Browse Source

Fixed an issue where GUI widget depth wasn't being used

Marko Pintera 10 years ago
parent
commit
53dc112890

+ 6 - 0
BansheeEditor/Source/BsEditorWidgetManager.cpp

@@ -52,6 +52,12 @@ namespace BansheeEngine
 			{
 			{
 				EditorWidgetBase* widget = widgetData.second;
 				EditorWidgetBase* widget = widgetData.second;
 				EditorWidgetContainer* parentContainer = widget->_getParent();
 				EditorWidgetContainer* parentContainer = widget->_getParent();
+				if (parentContainer == nullptr)
+				{
+					widget->_setHasFocus(false);
+					continue;
+				}
+
 				EditorWindowBase* parentWindow = parentContainer->getParentWindow();
 				EditorWindowBase* parentWindow = parentContainer->getParentWindow();
 				RenderWindowPtr parentRenderWindow = parentWindow->getRenderWindow();
 				RenderWindowPtr parentRenderWindow = parentWindow->getRenderWindow();
 				const RenderWindowProperties& props = parentRenderWindow->getProperties();
 				const RenderWindowProperties& props = parentRenderWindow->getProperties();

+ 2 - 2
BansheeEditor/Source/BsGUIMenuBar.cpp

@@ -22,11 +22,11 @@ namespace BansheeEngine
 		:mParentWidget(parent), mParentWindow(parentWindow), mMainPanel(nullptr), mMainLayout(nullptr),
 		:mParentWidget(parent), mParentWindow(parentWindow), mMainPanel(nullptr), mMainLayout(nullptr),
 		mBgTexture(nullptr), mLogoTexture(nullptr), mSubMenuOpen(false), mSubMenuButton(nullptr), mBgPanel(nullptr)
 		mBgTexture(nullptr), mLogoTexture(nullptr), mSubMenuOpen(false), mSubMenuButton(nullptr), mBgPanel(nullptr)
 	{
 	{
-		mMainPanel = parent->getPanel()->addNewElement<GUIPanel>(0);
+		mMainPanel = parent->getPanel()->addNewElement<GUIPanel>(std::numeric_limits<INT16>::min() + 10);
 		mMainPanel->setWidth(1);
 		mMainPanel->setWidth(1);
 		mMainPanel->setHeight(13);
 		mMainPanel->setHeight(13);
 
 
-		mBgPanel = parent->getPanel()->addNewElement<GUIPanel>(1);
+		mBgPanel = parent->getPanel()->addNewElement<GUIPanel>(std::numeric_limits<INT16>::min() + 11);
 		mBgPanel->setWidth(1);
 		mBgPanel->setWidth(1);
 		mBgPanel->setHeight(13);
 		mBgPanel->setHeight(13);
 
 

+ 1 - 15
BansheeEditor/Source/BsMainEditorWindow.cpp

@@ -2,24 +2,10 @@
 #include "BsEditorWindowManager.h"
 #include "BsEditorWindowManager.h"
 #include "BsDockManager.h"
 #include "BsDockManager.h"
 #include "BsGUIMenuBar.h"
 #include "BsGUIMenuBar.h"
-#include "BsCamera.h"
-#include "BsSceneObject.h"
-#include "BsRenderTexture.h"
-#include "BsApplication.h"
-#include "BsProfilingManager.h"
+#include "BsGUIWidget.h"
 #include "BsGUIPanel.h"
 #include "BsGUIPanel.h"
-#include "BsGUILayout.h"
 #include "BsEditorTestSuite.h"
 #include "BsEditorTestSuite.h"
 #include "BsTestOutput.h"
 #include "BsTestOutput.h"
-#include "BsVirtualInput.h"
-
-// DEBUG ONLY
-#include "BsTestTextSprite.h"
-#include "BsShapeMeshes2D.h"
-#include "BsShapeMeshes3D.h"
-#include "BsRect2.h"
-#include "BsProfilerOverlay.h"
-#include "BsPlatform.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {

+ 2 - 2
BansheeEngine/Include/BsGUIWidget.h

@@ -52,7 +52,7 @@ namespace BansheeEngine
 		 * @brief	Changes the depth to render the widget at. If two widgets overlap the
 		 * @brief	Changes the depth to render the widget at. If two widgets overlap the
 		 *			widget with the lower depth will be rendered in front.
 		 *			widget with the lower depth will be rendered in front.
 		 */
 		 */
-		void setDepth(UINT8 depth) { mDepth = depth; mWidgetIsDirty = true; }
+		void setDepth(UINT8 depth);
 
 
 		/**
 		/**
 		 * @brief	Checks are the specified coordinates within widget bounds. Coordinates should
 		 * @brief	Checks are the specified coordinates within widget bounds. Coordinates should
@@ -180,7 +180,7 @@ namespace BansheeEngine
 		/**
 		/**
 		 * @brief	Updates the size of the primary GUI panel based on the viewport.
 		 * @brief	Updates the size of the primary GUI panel based on the viewport.
 		 */
 		 */
-		void updatePanelSize();
+		void updateRootPanel();
 
 
 		Viewport* mTarget;
 		Viewport* mTarget;
 		Vector<GUIElement*> mElements;
 		Vector<GUIElement*> mElements;

+ 11 - 3
BansheeEngine/Source/BsGUIWidget.cpp

@@ -37,12 +37,20 @@ namespace BansheeEngine
 
 
 		mPanel = GUIPanel::create();
 		mPanel = GUIPanel::create();
 		mPanel->_changeParentWidget(this);
 		mPanel->_changeParentWidget(this);
-		updatePanelSize();
+		updateRootPanel();
 	}
 	}
 
 
 	GUIWidget::~GUIWidget()
 	GUIWidget::~GUIWidget()
 	{ }
 	{ }
 
 
+	void GUIWidget::setDepth(UINT8 depth)
+	{
+		mDepth = depth; 
+		mWidgetIsDirty = true;
+
+		updateRootPanel();
+	}
+
 	void GUIWidget::onDestroyed()
 	void GUIWidget::onDestroyed()
 	{
 	{
 		GUILayout::destroy(mPanel);
 		GUILayout::destroy(mPanel);
@@ -302,10 +310,10 @@ namespace BansheeEngine
 
 
 	void GUIWidget::ownerTargetResized()
 	void GUIWidget::ownerTargetResized()
 	{
 	{
-		updatePanelSize();
+		updateRootPanel();
 	}
 	}
 
 
-	void GUIWidget::updatePanelSize()
+	void GUIWidget::updateRootPanel()
 	{
 	{
 		UINT32 width = getTarget()->getWidth();
 		UINT32 width = getTarget()->getWidth();
 		UINT32 height = getTarget()->getHeight();
 		UINT32 height = getTarget()->getHeight();

+ 8 - 2
TODO.txt

@@ -66,7 +66,6 @@ When elements are docked in the main window the menu bar drop down appears behin
 Click on empty part of the menu bar doesn't close the menu bar (ignoring NC area clicks?)
 Click on empty part of the menu bar doesn't close the menu bar (ignoring NC area clicks?)
 Clicking on a parent of a menu item just reopens that item but I would expect it to close it
 Clicking on a parent of a menu item just reopens that item but I would expect it to close it
 Clicking on menu items doesn't seem to work
 Clicking on menu items doesn't seem to work
-Attempting to dock a window that is not in focus will start drag instead (NC area incorrectly set up?)
 Docking a window to another windows title bar doesn't seem to work
 Docking a window to another windows title bar doesn't seem to work
 Decent looking default layout
 Decent looking default layout
 Fix DX11 (and possibly DX9) rendering
 Fix DX11 (and possibly DX9) rendering
@@ -74,10 +73,17 @@ Missing Inspector values (name + transform fields)
 Fix handles
 Fix handles
  - Some handle functionality is unfinished
  - Some handle functionality is unfinished
  - Handles look too large when scene view is enlarged
  - Handles look too large when scene view is enlarged
-Moving the title bar tab and then dropping it closes the window (possibly only happens when there is just one tab)
 After undocking ProjectWindow the auto-scroll seems to be stuck in up position
 After undocking ProjectWindow the auto-scroll seems to be stuck in up position
 
 
 Need a way to add scene objects and components (and remove them)
 Need a way to add scene objects and components (and remove them)
+ - Components adding should be only done by drag and dropping scripts to inspector (undoable)
+ - COmponent removal should be done by context menu in inspector (undoable)
+ - Adding scene objects should be doable from context menu in Hierarchy, by dropping a Prefab or by main Menu (undoable)
+ - Deleting them should be doable by context menu in Hierarchy and Del keystroke (undoable)
+
+For later: I could record undo/redo per-property using the new diff system
+Remember: Record all portions where objects & components get modified so I can mark them dirty, will likely need
+ to use those some points for undo/redo
 
 
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 Project window
 Project window