Browse Source

Added a title bar background to inspector

BearishSun 10 years ago
parent
commit
591cc93e81

+ 1 - 0
BansheeEditor/Include/BsBuiltinEditorResources.h

@@ -375,6 +375,7 @@ namespace BansheeEngine
 
 		static const WString StatusBarBgTex;
 		static const WString ScrollAreaBgTex;
+		static const WString InspectorTitleBgTex;
 
 		static const WString ShaderDockOverlayFile;
 		static const WString ShaderSceneGridFile;

+ 9 - 0
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -266,6 +266,7 @@ namespace BansheeEngine
 
 	const WString BuiltinEditorResources::StatusBarBgTex = L"StatusBarBackground.png";
 	const WString BuiltinEditorResources::ScrollAreaBgTex = L"ScrollAreaBg.png";
+	const WString BuiltinEditorResources::InspectorTitleBgTex = L"InspectorTitleBg.png";
 
 	/************************************************************************/
 	/* 									SHADERS                      		*/
@@ -1711,6 +1712,14 @@ namespace BansheeEngine
 		
 		skin->setStyle("ScrollAreaBg", scrollAreaBg);
 
+		// Inspector title area background
+		GUIElementStyle inspectorTitleBg;
+		inspectorTitleBg.normal.texture = getGUITexture(InspectorTitleBgTex);
+		inspectorTitleBg.minHeight = 4;
+		inspectorTitleBg.border.bottom = 2;
+
+		skin->setStyle("InspectorTitleBg", inspectorTitleBg);
+
 		return skin;
 	}
 

+ 1 - 0
MBansheeEditor/EditorStyles.cs

@@ -23,5 +23,6 @@ namespace BansheeEditor
         public const string SelectionArea = "SelectionArea";
         public const string SelectableLabel = "SelectableLabel";
         public const string ScrollAreaBg = "ScrollAreaBg";
+        public const string InspectorTitleBg = "InspectorTitleBg";
     }
 }

+ 25 - 1
MBansheeEditor/Inspector/InspectorWindow.cs

@@ -37,8 +37,10 @@ namespace BansheeEditor
         private InspectorResource inspectorResource;
         private GUIScrollArea inspectorScrollArea;
         private GUILayout inspectorLayout;
+        private GUILayoutY sceneObjectLayout;
         private GUIPanel highlightPanel;
         private GUITexture scrollAreaHighlight;
+        private GUITexture titleBg;
 
         private SceneObject activeSO;
         private GUITextBox soNameInput;
@@ -143,6 +145,8 @@ namespace BansheeEditor
 
             dropBounds = inspectorScrollArea.Bounds;
             scrollAreaHighlight.Bounds = dropBounds;
+
+            titleBg.Bounds = GetTitleBounds();
         }
 
         private void OnComponentFoldoutToggled(InspectorComponent inspectorData, bool expanded)
@@ -154,8 +158,13 @@ namespace BansheeEditor
         private void CreateSceneObjectFields()
         {
             GUIPanel sceneObjectPanel = inspectorLayout.AddPanel();
-            GUILayoutY sceneObjectLayout = sceneObjectPanel.AddLayoutY();
+            sceneObjectPanel.SetHeight(GetTitleBounds().height);
+
+            sceneObjectLayout = sceneObjectPanel.AddLayoutY();
+            sceneObjectLayout.SetPosition(5, 5);
 
+            GUIPanel sceneObjectBgPanel = sceneObjectPanel.AddPanel(1);
+            
             GUILayoutX nameLayout = sceneObjectLayout.AddLayoutX();
             GUILabel nameLbl = new GUILabel(new LocEdString("Name"), GUIOption.FixedWidth(50));
             soNameInput = new GUITextBox(false, GUIOption.FlexibleWidth(180));
@@ -228,7 +237,12 @@ namespace BansheeEditor
             scaleLayout.AddElement(soScaleZ);
             scaleLayout.AddFlexibleSpace();
 
+            sceneObjectLayout.AddFlexibleSpace();
+
             inspectorLayout.AddSpace(15);
+
+            titleBg = new GUITexture(null, EditorStyles.InspectorTitleBg);
+            sceneObjectBgPanel.AddElement(titleBg);
         }
 
         private void RefreshSceneObjectFields(bool forceUpdate)
@@ -517,11 +531,18 @@ namespace BansheeEditor
             soScaleY = null;
             soScaleZ = null;
             dropBounds = new Rect2I();
+            sceneObjectLayout = null;
+            titleBg = null;
 
             activeResource = null;
             currentType = InspectorType.None;
         }
 
+        private Rect2I GetTitleBounds()
+        {
+            return new Rect2I(0, 0, Width, 115);
+        }
+
         private void OnPositionChanged(int idx, float value)
         {
             if (activeSO == null)
@@ -579,6 +600,9 @@ namespace BansheeEditor
 
             if (scrollAreaHighlight != null)
                 scrollAreaHighlight.Bounds = dropBounds;
+
+            if(titleBg != null)
+                titleBg.Bounds = GetTitleBounds();
         }
 
         private Inspector GetInspector(Type type)

+ 2 - 2
MBansheeEditor/LibraryWindow.cs

@@ -19,7 +19,7 @@ namespace BansheeEditor
         private const int DRAG_SCROLL_HEIGHT = 20;
         private const int DRAG_SCROLL_AMOUNT_PER_SECOND = 100;
         private const int FOLDER_BUTTON_WIDTH = 20;
-        private const int FOLDER_SEPARATOR_WIDTH = 7;
+        private const int FOLDER_SEPARATOR_WIDTH = 10;
         private const int SELECTION_EXTRA_WIDTH = 3;
         private static readonly Color PING_COLOR = Color.BansheeOrange;
         private static readonly Color SELECTION_COLOR = Color.DarkCyan;
@@ -1152,7 +1152,7 @@ namespace BansheeEditor
                     folderButton.OnClick += () => OnFolderButtonClicked(fullPath);
                 }
 
-                GUILabel separator = new GUILabel("/", GUIOption.FixedWidth(FOLDER_SEPARATOR_WIDTH));
+                GUIButton separator = new GUIButton("/", GUIOption.FixedWidth(FOLDER_SEPARATOR_WIDTH));
 
                 folderListLayout.InsertElement(0, separator);
                 folderListLayout.InsertElement(0, folderButton);