Pārlūkot izejas kodu

Enabled scene and tree views for better GameObjectField testing

Marko Pintera 11 gadi atpakaļ
vecāks
revīzija
7c1348d402

+ 2 - 0
BansheeEditor/Include/BsDockManager.h

@@ -33,6 +33,8 @@ namespace BansheeEngine
 			void addWidget(EditorWidgetBase* widget);
 			void addWidget(EditorWidgetBase* widget);
 			void addWidget(const String& name);
 			void addWidget(const String& name);
 
 
+			void update();
+
 			DockContainer* find(EditorWidgetContainer* widgetContainer);
 			DockContainer* find(EditorWidgetContainer* widgetContainer);
 
 
 			/**
 			/**

+ 2 - 0
BansheeEditor/Include/BsEditorWidget.h

@@ -27,6 +27,8 @@ namespace BansheeEngine
 
 
 		void close();
 		void close();
 
 
+		virtual void _update() { }
+
 		Event<void(UINT32, UINT32)> onResized;
 		Event<void(UINT32, UINT32)> onResized;
 		Event<void(INT32, INT32)> onMoved;
 		Event<void(INT32, INT32)> onMoved;
 		Event<void(EditorWidgetContainer*)> onParentChanged;
 		Event<void(EditorWidgetContainer*)> onParentChanged;

+ 2 - 0
BansheeEditor/Include/BsEditorWidgetContainer.h

@@ -27,6 +27,8 @@ namespace BansheeEngine
 		RectI getContentBounds() const;
 		RectI getContentBounds() const;
 		Vector<RectI> getDraggableAreas() const;
 		Vector<RectI> getDraggableAreas() const;
 
 
+		void _update();
+
 		void _notifyWidgetDestroyed(EditorWidgetBase* widget);
 		void _notifyWidgetDestroyed(EditorWidgetBase* widget);
 
 
 		Event<void()> onWidgetClosed;
 		Event<void()> onWidgetClosed;

+ 2 - 0
BansheeEditor/Include/BsEditorWindow.h

@@ -12,6 +12,8 @@ namespace BansheeEngine
 
 
 		EditorWidgetContainer& widgets() const { return *mWidgets; }
 		EditorWidgetContainer& widgets() const { return *mWidgets; }
 
 
+		virtual void update();
+
 		static EditorWindow* create();
 		static EditorWindow* create();
 
 
 	protected:
 	protected:

+ 4 - 0
BansheeEditor/Include/DbgEditorWidget1.h

@@ -11,6 +11,8 @@ namespace BansheeEngine
 		DbgEditorWidget1(const ConstructPrivately& dummy, EditorWidgetContainer& parentContainer);
 		DbgEditorWidget1(const ConstructPrivately& dummy, EditorWidgetContainer& parentContainer);
 		virtual ~DbgEditorWidget1();
 		virtual ~DbgEditorWidget1();
 
 
+		virtual void _update();
+
 		static DbgEditorWidget1* instance();
 		static DbgEditorWidget1* instance();
 		static DbgEditorWidget1* open();
 		static DbgEditorWidget1* open();
 		static void close();
 		static void close();
@@ -18,5 +20,7 @@ namespace BansheeEngine
 
 
 	private:
 	private:
 		static DbgEditorWidget1* Instance;
 		static DbgEditorWidget1* Instance;
+		GUISceneTreeView* mSceneTreeView = nullptr;
+		GUIResourceTreeView* mResourceTreeView = nullptr;
 	};
 	};
 }
 }

+ 19 - 0
BansheeEditor/Source/BsDockManager.cpp

@@ -355,6 +355,23 @@ namespace BansheeEngine
 		return mWidgets->getContentBounds();
 		return mWidgets->getContentBounds();
 	}
 	}
 
 
+	void DockManager::DockContainer::update()
+	{
+		if (mIsLeaf)
+		{
+			if (mWidgets != nullptr)
+				mWidgets->_update();
+		}
+		else
+		{
+			if (mChildren[0] != nullptr)
+				mChildren[0]->update();
+
+			if (mChildren[1] != nullptr)
+				mChildren[1]->update();
+		}
+	}
+
 	DockManager::DockManager(RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions)
 	DockManager::DockManager(RenderWindow* parentWindow, const GUILayoutOptions& layoutOptions)
 		:GUIElementContainer(layoutOptions), mParentWindow(parentWindow), mMouseOverContainer(nullptr), mHighlightedDropLoc(DockLocation::None),
 		:GUIElementContainer(layoutOptions), mParentWindow(parentWindow), mMouseOverContainer(nullptr), mHighlightedDropLoc(DockLocation::None),
 		mShowOverlay(false), mAddedRenderCallback(false)
 		mShowOverlay(false), mAddedRenderCallback(false)
@@ -387,6 +404,8 @@ namespace BansheeEngine
 			mHighlightedDropLoc = DockLocation::None;
 			mHighlightedDropLoc = DockLocation::None;
 			mShowOverlay = false;
 			mShowOverlay = false;
 		}
 		}
+
+		mRootContainer.update();
 	}
 	}
 
 
 	void DockManager::render(const Viewport* viewport, DrawList& drawList)
 	void DockManager::render(const Viewport* viewport, DrawList& drawList)

+ 8 - 0
BansheeEditor/Source/BsEditorWidgetContainer.cpp

@@ -42,6 +42,14 @@ namespace BansheeEngine
 		GUIElement::destroy(mTitleBar);
 		GUIElement::destroy(mTitleBar);
 	}
 	}
 
 
+	void EditorWidgetContainer::_update()
+	{
+		for (auto& widget : mWidgets)
+		{
+			widget.second->_update();
+		}
+	}
+
 	void EditorWidgetContainer::add(EditorWidgetBase& widget)
 	void EditorWidgetContainer::add(EditorWidgetBase& widget)
 	{
 	{
 		insert((UINT32)mWidgets.size(), widget);
 		insert((UINT32)mWidgets.size(), widget);

+ 5 - 0
BansheeEditor/Source/BsEditorWindow.cpp

@@ -18,6 +18,11 @@ namespace BansheeEngine
 		bs_delete(mWidgets);
 		bs_delete(mWidgets);
 	}
 	}
 
 
+	void EditorWindow::update()
+	{
+		mWidgets->_update();
+	}
+
 	void EditorWindow::resized()
 	void EditorWindow::resized()
 	{
 	{
 		EditorWindowBase::resized();
 		EditorWindowBase::resized();

+ 17 - 4
BansheeEditor/Source/DbgEditorWidget1.cpp

@@ -7,6 +7,8 @@
 #include "BsGUIArea.h"
 #include "BsGUIArea.h"
 #include "BsGUILayout.h"
 #include "BsGUILayout.h"
 #include "BsEditorWidgetManager.h"
 #include "BsEditorWidgetManager.h"
+#include "BsGUISceneTreeView.h"
+#include "BsGUIResourceTreeView.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -26,7 +28,7 @@ namespace BansheeEngine
 		GUIScrollArea* scrollArea = GUIScrollArea::create();
 		GUIScrollArea* scrollArea = GUIScrollArea::create();
 		layout.addElement(scrollArea);
 		layout.addElement(scrollArea);
 
 
-		GUILayout& scrollLayout = scrollArea->getLayout().addLayoutX();
+		GUILayout& treeViewLayout = scrollArea->getLayout().addLayoutY();
 
 
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test A"));
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test A"));
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test B"));
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test B"));
@@ -41,9 +43,14 @@ namespace BansheeEngine
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test K"));
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test K"));
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test L"));
 		//scrollLayout.addElement(GUIButton::create(*mGUI, L"Test L"));
 
 
-		scrollLayout.addElement(GUIInputBox::create(true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
-		scrollLayout.addElement(GUIInputBox::create(true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
-		scrollLayout.addElement(GUIInputBox::create(true, GUIOptions(GUIOption::fixedWidth(100), GUIOption::fixedHeight(100))));
+		mSceneTreeView = GUISceneTreeView::create(GUIOptions(GUIOption::flexibleWidth(), GUIOption::flexibleHeight()));
+		mResourceTreeView = GUIResourceTreeView::create(GUIOptions(GUIOption::flexibleWidth(), GUIOption::flexibleHeight()));
+
+		treeViewLayout.addElement(GUILabel::create(HString(L"<<<<<<<<<<<<<<SCENE VIEW>>>>>>>>>>>>>>")));
+		treeViewLayout.addElement(mSceneTreeView);
+
+		treeViewLayout.addElement(GUILabel::create(HString(L"<<<<<<<<<<<<<<RESOURCE VIEW>>>>>>>>>>>>>>")));
+		treeViewLayout.addElement(mResourceTreeView);
 
 
 		//GUIFlexibleSpace& space4 = otherLayout.addFlexibleSpace();
 		//GUIFlexibleSpace& space4 = otherLayout.addFlexibleSpace();
 		//otherLayout.addElement(mDbgLabel);
 		//otherLayout.addElement(mDbgLabel);
@@ -75,6 +82,12 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
+	void DbgEditorWidget1::_update()
+	{
+		mSceneTreeView->update();
+		mResourceTreeView->update();
+	}
+
 	DbgEditorWidget1* DbgEditorWidget1::instance()
 	DbgEditorWidget1* DbgEditorWidget1::instance()
 	{
 	{
 		return Instance;
 		return Instance;