Преглед изворни кода

Getting Hierarchy window to work

Marko Pintera пре 10 година
родитељ
комит
16abc5b4bf

+ 8 - 0
MBansheeEditor/GUI/GUISceneTreeView.cs

@@ -16,7 +16,15 @@ namespace BansheeEditor
             Internal_CreateInstance(this, "", options);
         }
 
+        public void Update()
+        {
+            Internal_Update(mCachedPtr);
+        }
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_CreateInstance(GUISceneTreeView instance, string style, GUIOption[] options);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_Update(IntPtr thisPtr);
     }
 }

+ 8 - 1
MBansheeEditor/HierarchyWindow.cs

@@ -4,6 +4,8 @@ namespace BansheeEditor
 {
     public class HierarchyWindow : EditorWindow
     {
+        private GUISceneTreeView treeView;
+
         [MenuItem("Windows/Hierarchy", ButtonModifier.CtrlAlt, ButtonCode.H)]
         private static void OpenHierarchyWindow()
         {
@@ -15,8 +17,13 @@ namespace BansheeEditor
             GUIScrollArea scrollArea = new GUIScrollArea();
             GUI.AddElement(scrollArea);
 
-            GUISceneTreeView treeView = new GUISceneTreeView();
+            treeView = new GUISceneTreeView();
             scrollArea.Layout.AddElement(treeView);
         }
+
+        private void OnEditorUpdate()
+        {
+            treeView.Update();
+        }
     }
 }

+ 1 - 0
SBansheeEditor/Include/BsScriptGUISceneTreeView.h

@@ -12,6 +12,7 @@ namespace BansheeEngine
 
 	private:
 		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
+		static void internal_update(ScriptGUISceneTreeView* thisPtr);
 
 		ScriptGUISceneTreeView(MonoObject* instance, GUISceneTreeView* treeView);
 	};

+ 10 - 0
SBansheeEditor/Source/BsScriptGUISceneTreeView.cpp

@@ -19,6 +19,7 @@ namespace BansheeEngine
 	void ScriptGUISceneTreeView::initRuntimeData()
 	{
 		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISceneTreeView::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_Update", &ScriptGUISceneTreeView::internal_update);
 	}
 
 	void ScriptGUISceneTreeView::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions)
@@ -34,4 +35,13 @@ namespace BansheeEngine
 		GUISceneTreeView* treeView = GUISceneTreeView::create(options);
 		ScriptGUISceneTreeView* nativeInstance = new (bs_alloc<ScriptGUISceneTreeView>()) ScriptGUISceneTreeView(instance, treeView);
 	}
+
+	void ScriptGUISceneTreeView::internal_update(ScriptGUISceneTreeView* thisPtr)
+	{
+		if (thisPtr->mIsDestroyed)
+			return;
+
+		GUISceneTreeView* treeView = static_cast<GUISceneTreeView*>(thisPtr->getGUIElement());
+		treeView->update();
+	}
 }

+ 0 - 1
TODO.txt

@@ -34,7 +34,6 @@ Attempting to dock a window that is not in focus will start drag instead (NC are
 Docking problem: When I dock three windows next to each other, e.g. Hierarchy|Scene|Inspector and then try to dock another
  so it splits space with Hierarchy vertically the dock area appears over both hierarchy and scene, and the when docked it looks wrong
 Decent looking default layout
-Fix shutdown
 Fix DX11 (and possibly DX9) rendering
 Missing Inspector values (name + transform fields)
 Fix handles