update
This commit is contained in:
5778
.idea/.idea.BABA_YAGA/.idea/workspace.xml
generated
5778
.idea/.idea.BABA_YAGA/.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -137,7 +137,7 @@ namespace VTabs
|
|||||||
if (dockArea.GetType() != t_DockArea) return; // happens on 2021.1.28
|
if (dockArea.GetType() != t_DockArea) return; // happens on 2021.1.28
|
||||||
|
|
||||||
|
|
||||||
var curScroll = dockArea.GetFieldValue<float>("m_ScrollOffset");
|
var curScroll = dockArea.GetFieldValue<float>("m_ScrollOffset", false);
|
||||||
|
|
||||||
if (!curScroll.Approx(0))
|
if (!curScroll.Approx(0))
|
||||||
curScroll -= nonZeroTabScrollOffset;
|
curScroll -= nonZeroTabScrollOffset;
|
||||||
@@ -174,7 +174,7 @@ namespace VTabs
|
|||||||
if (!newScroll.Approx(0))
|
if (!newScroll.Approx(0))
|
||||||
newScroll += nonZeroTabScrollOffset;
|
newScroll += nonZeroTabScrollOffset;
|
||||||
|
|
||||||
dockArea.SetFieldValue("m_ScrollOffset", newScroll);
|
dockArea.SetFieldValue("m_ScrollOffset", newScroll, false);
|
||||||
|
|
||||||
EditorWindow.focusedWindow.Repaint();
|
EditorWindow.focusedWindow.Repaint();
|
||||||
|
|
||||||
@@ -1122,30 +1122,16 @@ namespace VTabs
|
|||||||
{
|
{
|
||||||
if (!isOneColumn) return;
|
if (!isOneColumn) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!browser.InvokeMethod<bool>("Initialized"))
|
if (!browser.InvokeMethod<bool>("Initialized"))
|
||||||
browser.InvokeMethod("Init");
|
browser.InvokeMethod("Init");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var m_TreeViewKeyboardControlID = GUIUtility.GetControlID(FocusType.Keyboard);
|
var m_TreeViewKeyboardControlID = GUIUtility.GetControlID(FocusType.Keyboard);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
browser.InvokeMethod("OnEvent");
|
browser.InvokeMethod("OnEvent");
|
||||||
|
|
||||||
if (curEvent.isMouseDown && browser.position.SetPos(0, 0).IsHovered())
|
if (curEvent.isMouseDown && browser.position.SetPos(0, 0).IsHovered())
|
||||||
t_ProjectBrowser.SetFieldValue("s_LastInteractedProjectBrowser", browser);
|
t_ProjectBrowser.SetFieldValue("s_LastInteractedProjectBrowser", browser);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// header
|
// header
|
||||||
browser.SetFieldValue("m_ListHeaderRect", breadcrumbsRect);
|
browser.SetFieldValue("m_ListHeaderRect", breadcrumbsRect);
|
||||||
|
|
||||||
@@ -1155,34 +1141,15 @@ namespace VTabs
|
|||||||
breadcrumbsRect.Draw(breadcrumbsTint);
|
breadcrumbsRect.Draw(breadcrumbsTint);
|
||||||
topGapRect.Draw(topGapColor);
|
topGapRect.Draw(topGapColor);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// footer
|
// footer
|
||||||
browser.SetFieldValue("m_BottomBarRect", footerRect);
|
browser.SetFieldValue("m_BottomBarRect", footerRect);
|
||||||
browser.InvokeMethod("BottomBar");
|
browser.InvokeMethod("BottomBar");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// tree
|
// tree
|
||||||
browser.GetMemberValue("m_AssetTree")?.InvokeMethod("OnGUI", listAreaRect, m_TreeViewKeyboardControlID);
|
browser.GetMemberValue("m_AssetTree")?.InvokeMethod("OnGUI", listAreaRect, m_TreeViewKeyboardControlID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
browser.InvokeMethod("HandleCommandEvents");
|
browser.InvokeMethod("HandleCommandEvents");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void twoColumns()
|
void twoColumns()
|
||||||
{
|
{
|
||||||
@@ -1365,7 +1332,7 @@ namespace VTabs
|
|||||||
if (!pos.Approx(0))
|
if (!pos.Approx(0))
|
||||||
pos += nonZeroTabScrollOffset;
|
pos += nonZeroTabScrollOffset;
|
||||||
|
|
||||||
GetDockArea(window).SetFieldValue("m_ScrollOffset", pos);
|
GetDockArea(window)?.SetFieldValue("m_ScrollOffset", pos, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
static void EnsureActiveTabsVisibleOnScroller() => allEditorWindows.Where(r => r.hasFocus && !r.maximized && r.docked).ForEach(r => EnsureTabVisibleOnScroller(r));
|
static void EnsureActiveTabsVisibleOnScroller() => allEditorWindows.Where(r => r.hasFocus && !r.maximized && r.docked).ForEach(r => EnsureTabVisibleOnScroller(r));
|
||||||
@@ -1373,8 +1340,11 @@ namespace VTabs
|
|||||||
static float GetOptimalTabScrollerPosition(EditorWindow activeTab)
|
static float GetOptimalTabScrollerPosition(EditorWindow activeTab)
|
||||||
{
|
{
|
||||||
|
|
||||||
var dockArea = activeTab.GetMemberValue("m_Parent");
|
var dockArea = activeTab.GetMemberValue("m_Parent", false);
|
||||||
var tabAreaWidth = dockArea.GetFieldValue<Rect>("m_TabAreaRect").width;
|
if (dockArea == null) return 0;
|
||||||
|
|
||||||
|
var tabAreaRect = dockArea.GetFieldValue<Rect>("m_TabAreaRect", false);
|
||||||
|
var tabAreaWidth = tabAreaRect.width;
|
||||||
|
|
||||||
if (tabAreaWidth == 0)
|
if (tabAreaWidth == 0)
|
||||||
tabAreaWidth = activeTab.position.width - 38;
|
tabAreaWidth = activeTab.position.width - 38;
|
||||||
@@ -1396,7 +1366,7 @@ namespace VTabs
|
|||||||
|
|
||||||
foreach (var tab in GetTabList(activeTab))
|
foreach (var tab in GetTabList(activeTab))
|
||||||
{
|
{
|
||||||
var tabWidth = dockArea.InvokeMethod<float>("GetTabWidth", tabStyle, tab);
|
var tabWidth = dockArea.InvokeMethod<float>("GetTabWidth", false, tabStyle, tab);
|
||||||
|
|
||||||
tabWidthSum += tabWidth;
|
tabWidthSum += tabWidth;
|
||||||
|
|
||||||
@@ -1731,9 +1701,9 @@ namespace VTabs
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static object GetDockArea(EditorWindow window) => window.GetFieldValue("m_Parent");
|
static object GetDockArea(EditorWindow window) => window.GetFieldValue("m_Parent", false);
|
||||||
|
|
||||||
static List<EditorWindow> GetTabList(EditorWindow window) => GetDockArea(window).GetFieldValue<List<EditorWindow>>("m_Panes");
|
static List<EditorWindow> GetTabList(EditorWindow window) => GetDockArea(window)?.GetFieldValue<List<EditorWindow>>("m_Panes", false) ?? new List<EditorWindow>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ namespace VTabs.Libs
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static object InvokeMethod(this object o, string methodName, params object[] parameters) // todo handle null params (can't get their type)
|
public static object InvokeMethod(this object o, string methodName, bool exceptionIfNotFound, params object[] parameters) // todo handle null params (can't get their type)
|
||||||
{
|
{
|
||||||
var type = (o as Type) ?? o.GetType();
|
var type = (o as Type) ?? o.GetType();
|
||||||
var target = o is Type ? null : o;
|
var target = o is Type ? null : o;
|
||||||
@@ -231,11 +231,21 @@ namespace VTabs.Libs
|
|||||||
return methodInfo.Invoke(target, parameters);
|
return methodInfo.Invoke(target, parameters);
|
||||||
|
|
||||||
|
|
||||||
throw new System.Exception($"Method '{methodName}' not found in type '{type.Name}', its parent types and interfaces");
|
if (exceptionIfNotFound)
|
||||||
|
throw new System.Exception($"Method '{methodName}' not found in type '{type.Name}', its parent types and interfaces");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static object InvokeMethod(this object o, string methodName, params object[] parameters) => o.InvokeMethod(methodName, true, parameters);
|
||||||
|
|
||||||
|
public static T InvokeMethod<T>(this object o, string methodName, bool exceptionIfNotFound, params object[] parameters)
|
||||||
|
{
|
||||||
|
var res = o.InvokeMethod(methodName, exceptionIfNotFound, parameters);
|
||||||
|
if (res == null) return default;
|
||||||
|
return (T)res;
|
||||||
|
}
|
||||||
|
public static T InvokeMethod<T>(this object o, string methodName, params object[] parameters) => o.InvokeMethod<T>(methodName, true, parameters);
|
||||||
|
|
||||||
static FieldInfo GetFieldInfo(this Type type, string fieldName)
|
static FieldInfo GetFieldInfo(this Type type, string fieldName)
|
||||||
{
|
{
|
||||||
@@ -344,13 +354,6 @@ namespace VTabs.Libs
|
|||||||
}
|
}
|
||||||
return (T)val;
|
return (T)val;
|
||||||
}
|
}
|
||||||
public static T InvokeMethod<T>(this object o, string methodName, params object[] parameters) => (T)o.InvokeMethod(methodName, parameters);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static List<Type> GetSubclasses(this Type t) => t.Assembly.GetTypes().Where(type => type.IsSubclassOf(t)).ToList();
|
public static List<Type> GetSubclasses(this Type t) => t.Assembly.GetTypes().Where(type => type.IsSubclassOf(t)).ToList();
|
||||||
|
|
||||||
public static object GetDefaultValue(this FieldInfo f, params object[] constructorVars) => f.GetValue(System.Activator.CreateInstance(((MemberInfo)f).ReflectedType, constructorVars));
|
public static object GetDefaultValue(this FieldInfo f, params object[] constructorVars) => f.GetValue(System.Activator.CreateInstance(((MemberInfo)f).ReflectedType, constructorVars));
|
||||||
|
|||||||
@@ -1,11 +1,2 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 91d4456e469254096af9035b29263ca5
|
guid: 91d4456e469254096af9035b29263ca5
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Reference in New Issue
Block a user