Răsfoiți Sursa

Fixed an issue with GUIManager where it would incorrectly overlap elements of the same depth
Fixed component foldout so it works with the new UI style
Minor modifications to inspector UI

BearishSun 10 ani în urmă
părinte
comite
3a9872b4b6

+ 0 - 5
BansheeEditor/Include/BsGUIComponentFoldout.h

@@ -96,11 +96,6 @@ namespace BansheeEngine
 		 */
 		void toggleTriggered(bool value);
 
-		/**
-		 * @brief	Triggered when the remove button is clicked.
-		 */
-		void removeTriggered();
-
 		/**
 		 * @copydoc	GUIElement::styleUpdated
 		 */

+ 5 - 5
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -1193,7 +1193,7 @@ namespace BansheeEngine
 
 		GUIElementStyle editorObjectFieldStyle;
 		editorObjectFieldStyle.fixedHeight = true;
-		editorObjectFieldStyle.height = 15;
+		editorObjectFieldStyle.height = 21;
 		editorObjectFieldStyle.minWidth = 30;
 		editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
 		editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
@@ -1237,7 +1237,7 @@ namespace BansheeEngine
 		textureDropStyle.border.left = 2;
 		textureDropStyle.border.right = 2;
 		textureDropStyle.border.top = 2;
-		textureDropStyle.border.bottom = 2;
+		textureDropStyle.border.bottom = 4;
 
 		skin->setStyle(TextureFieldDropStyleName, textureDropStyle);
 		
@@ -1358,13 +1358,13 @@ namespace BansheeEngine
 		cmpFoldoutBtnStyle.fixedHeight = true;
 		cmpFoldoutBtnStyle.fixedWidth = false;
 		cmpFoldoutBtnStyle.height = 10;
-		cmpFoldoutBtnStyle.minWidth = 10;
+		cmpFoldoutBtnStyle.minWidth = 14;
 		cmpFoldoutBtnStyle.font = font;
 		cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
 		cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
 		cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
-		cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
-		cmpFoldoutBtnStyle.border.left = 8;
+		cmpFoldoutBtnStyle.contentOffset = RectOffset(13, 0, 0, 0);
+		cmpFoldoutBtnStyle.border.left = 10;
 
 		skin->setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
 

+ 1 - 1
BansheeEditor/Source/BsGUIComponentFoldout.cpp

@@ -23,7 +23,7 @@ namespace BansheeEngine
 		_registerChildElement(mBackground);
 
 		mToggle->onToggled.connect(std::bind(&GUIComponentFoldout::toggleTriggered, this, _1));
-		mBackground->_setElementDepth(1);
+		mBackground->_setElementDepth(2);
 	}
 
 	GUIComponentFoldout::~GUIComponentFoldout()

+ 1 - 1
BansheeEditor/Source/BsGUIFoldout.cpp

@@ -97,7 +97,7 @@ namespace BansheeEngine
 
 			mToggle->_setLayoutData(childData);
 
-			toggleOffset = optimalSize.x;
+			toggleOffset = optimalSize.x + 3; // +3 = arbitrary spacing
 		}
 
 		{

+ 6 - 3
BansheeEngine/Source/BsGUIManager.cpp

@@ -58,6 +58,7 @@ namespace BansheeEngine
 		GUIMaterialInfo matInfo;
 		UINT32 numQuads;
 		UINT32 depth;
+		UINT32 minDepth;
 		Rect2I bounds;
 		Vector<GUIGroupElement> elements;
 	};
@@ -483,7 +484,7 @@ namespace BansheeEngine
 
 						GUIMaterialGroup& group = *groupIter;
 
-						if (group.depth == elemDepth || group.depth == (elemDepth - 1))
+						if (group.depth == elemDepth)
 						{
 							foundGroup = &group;
 							break;
@@ -504,7 +505,8 @@ namespace BansheeEngine
 									if (&matGroup == &group)
 										continue;
 
-									if (matGroup.depth > startDepth && matGroup.depth < endDepth)
+									if ((matGroup.minDepth >= startDepth && matGroup.minDepth <= endDepth)
+										|| (matGroup.depth >= startDepth && matGroup.depth <= endDepth))
 									{
 										if (matGroup.bounds.overlaps(potentialGroupBounds))
 										{
@@ -529,6 +531,7 @@ namespace BansheeEngine
 						foundGroup = &allGroups[allGroups.size() - 1];
 
 						foundGroup->depth = elemDepth;
+						foundGroup->minDepth = elemDepth;
 						foundGroup->bounds = tfrmedBounds;
 						foundGroup->elements.push_back(GUIGroupElement(guiElem, renderElemIdx));
 						foundGroup->matInfo = matInfo;
@@ -538,7 +541,7 @@ namespace BansheeEngine
 					{
 						foundGroup->bounds.encapsulate(tfrmedBounds);
 						foundGroup->elements.push_back(GUIGroupElement(guiElem, renderElemIdx));
-						foundGroup->depth = std::min(foundGroup->depth, elemDepth);
+						foundGroup->minDepth = std::min(foundGroup->minDepth, elemDepth);
 						foundGroup->numQuads += guiElem->_getNumQuads(renderElemIdx);
 					}
 				}

+ 1 - 0
MBansheeEditor/Inspector/InspectableArray.cs

@@ -190,6 +190,7 @@ namespace BansheeEditor
                     guiChildLayout.AddSpace(IndentAmount);
 
                     GUILayoutY guiContentLayout = guiChildLayout.AddLayoutY();
+                    guiChildLayout.AddSpace(IndentAmount);
 
                     for (int i = 0; i < numArrayElements; i++)
                     {

+ 1 - 0
MBansheeEditor/Inspector/InspectableList.cs

@@ -190,6 +190,7 @@ namespace BansheeEditor
                     guiChildLayout.AddSpace(IndentAmount);
 
                     GUILayoutY guiContentLayout = guiChildLayout.AddLayoutY();
+                    guiChildLayout.AddSpace(IndentAmount);
 
                     for (int i = 0; i < numArrayElements; i++)
                     {

+ 1 - 0
MBansheeEditor/Inspector/InspectableObject.cs

@@ -92,6 +92,7 @@ namespace BansheeEditor
                     guiChildLayout.AddSpace(IndentAmount);
 
                     GUILayoutY guiContentLayout = guiChildLayout.AddLayoutY();
+                    guiChildLayout.AddSpace(IndentAmount);
 
                     SerializableObject serializableObject = property.GetObject();
                     foreach (var field in serializableObject.Fields)

+ 11 - 7
MBansheeEditor/Inspector/InspectorWindow.cs

@@ -125,13 +125,17 @@ namespace BansheeEditor
                 data.instanceId = allComponents[i].InstanceId;
 
                 data.foldout = new GUIComponentFoldout(allComponents[i].GetType().Name);
-                data.removeBtn = new GUIButton(new GUIContent(EditorBuiltin.XBtnIcon));
+                data.removeBtn = new GUIButton(new GUIContent(EditorBuiltin.XBtnIcon), GUIOption.FixedWidth(30));
+
+                GUILayoutX titleLayout = inspectorLayout.AddLayoutX();
+                titleLayout.AddElement(data.foldout);
+                titleLayout.AddElement(data.removeBtn);
+
+                GUILayoutX contentLayout = inspectorLayout.AddLayoutX();
+                contentLayout.AddSpace(5);
+                data.panel = contentLayout.AddPanel();
+                contentLayout.AddSpace(5);
 
-                GUILayoutX horzLayout = inspectorLayout.AddLayoutX();
-                horzLayout.AddElement(data.foldout);
-                horzLayout.AddElement(data.removeBtn);
-                data.panel = inspectorLayout.AddPanel();
-                
                 data.inspector = InspectorUtility.GetInspector(allComponents[i].GetType());
                 data.inspector.Initialize(this, data.panel, allComponents[i]);
 
@@ -244,7 +248,7 @@ namespace BansheeEditor
 
             sceneObjectLayout.AddFlexibleSpace();
 
-            inspectorLayout.AddSpace(15);
+            inspectorLayout.AddSpace(5);
 
             titleBg = new GUITexture(null, EditorStyles.InspectorTitleBg);
             sceneObjectBgPanel.AddElement(titleBg);