Просмотр исходного кода

Added dummy icons to inspector

BearishSun 10 лет назад
Родитель
Сommit
f284524576

+ 13 - 0
BansheeEditor/Include/BsBuiltinEditorResources.h

@@ -32,6 +32,14 @@ namespace BansheeEngine
 		View, Move, Rotate, Scale, Pivot, Center, Local, World, MoveSnap, RotateSnap
 	};
 
+	/**
+	 * @brief	Types of icons that may be displayed in the inspector window.
+	 */
+	enum class InspectorWindowIcon
+	{
+		Create, Clone, Clear, Resize, Delete, MoveUp, MoveDown
+	};
+
 	/**
 	* @brief	Types of icons that may be displayed in the library window.
 	*/
@@ -151,6 +159,11 @@ namespace BansheeEngine
 		 */
 		HSpriteTexture getLibraryWindowIcon(LibraryWindowIcon icon) const;
 
+		/**
+		 * @brief	Retrieves an icon that may be displayed on the inspector window.
+		 */
+		HSpriteTexture getInspectorWindowIcon(InspectorWindowIcon icon) const;
+
 		/**
 		 * @brief	Retrieves an icon that represents a specific generic editor icon.
 		 */

+ 23 - 0
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -1952,6 +1952,29 @@ namespace BansheeEngine
 		return HSpriteTexture();
 	}
 
+	HSpriteTexture BuiltinEditorResources::getInspectorWindowIcon(InspectorWindowIcon icon) const
+	{
+		switch (icon)
+		{
+		case InspectorWindowIcon::Create:
+			return getGUIIcon(L"InspectorCreateIcon.png");
+		case InspectorWindowIcon::Clone:
+			return getGUIIcon(L"InspectorCloneIcon.png");
+		case InspectorWindowIcon::Clear:
+			return getGUIIcon(L"InspectorClearIcon.png");
+		case InspectorWindowIcon::Resize:
+			return getGUIIcon(L"InspectorResizeIcon.png");
+		case InspectorWindowIcon::Delete:
+			return getGUIIcon(L"InspectorDeleteIcon.png");
+		case InspectorWindowIcon::MoveUp:
+			return getGUIIcon(L"InspectorMoveUpIcon.png");
+		case InspectorWindowIcon::MoveDown:
+			return getGUIIcon(L"InspectorMoveDownIcon.png");
+		}
+
+		return HSpriteTexture();
+	}
+
 	HSpriteTexture BuiltinEditorResources::getIcon(EditorIcon icon) const
 	{
 		switch (icon)

+ 24 - 2
MBansheeEditor/EditorBuiltin.cs

@@ -28,6 +28,14 @@ namespace BansheeEditor
 		Home, Up, Clear, Options
 	};
 
+    /// <summary>
+    /// Types of icons that may be displayed in the inspector window.
+    /// </summary>
+	public enum InspectorWindowIcon  // Note: Must match C++ enum InspectorWindowIcon
+	{
+		Create, Clone, Clear, Resize, Delete, MoveUp, MoveDown
+	};
+
     /// <summary>
     /// Contains various editor-specific resources that are always available.
     /// </summary>
@@ -91,9 +99,20 @@ namespace BansheeEditor
         /// <returns>Sprite texture of the icon.</returns>
         public static SpriteTexture GetLibraryWindowIcon(LibraryWindowIcon icon)
         {
-            return Internal_LibraryWindowIcon(icon);
+            return Internal_GetLibraryWindowIcon(icon);
         }
 
+        /// <summary>
+        /// Retrieves an icon that may be displayed on the inspector window.
+        /// </summary>
+        /// <param name="icon">Type of icon to retrieve.</param>
+        /// <returns>Sprite texture of the icon.</returns>
+        public static SpriteTexture GetInspectorWindowIcon(InspectorWindowIcon icon)
+        {
+            return Internal_GetInspectorWindowIcon(icon);
+        }
+
+
         /// <summary>
         /// Retrieves an icon that may be displayed on the scene window.
         /// </summary>
@@ -150,7 +169,10 @@ namespace BansheeEditor
         private static extern SpriteTexture Internal_GetToolbarIcon(ToolbarIcon icon);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern SpriteTexture Internal_LibraryWindowIcon(LibraryWindowIcon icon);
+        private static extern SpriteTexture Internal_GetLibraryWindowIcon(LibraryWindowIcon icon);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern SpriteTexture Internal_GetInspectorWindowIcon(InspectorWindowIcon icon);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern SpriteTexture Internal_GetSceneWindowIcon(SceneWindowIcon icon);

+ 17 - 7
MBansheeEditor/GUI/GUIArray.cs

@@ -52,7 +52,8 @@ namespace BansheeEditor
                 guiTitleLayout.AddElement(new GUILabel(title));
                 guiTitleLayout.AddElement(new GUILabel("Empty", GUIOption.FixedWidth(100)));
 
-                GUIButton createBtn = new GUIButton("Cr", GUIOption.FixedWidth(20));
+                GUIContent createIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Create));
+                GUIButton createBtn = new GUIButton(createIcon, GUIOption.FixedWidth(30));
                 createBtn.OnClick += OnCreateButtonClicked;
                 guiTitleLayout.AddElement(createBtn);
             }
@@ -63,9 +64,13 @@ namespace BansheeEditor
                 guiFoldout.OnToggled += OnFoldoutToggled;
                 guiSizeField = new GUIIntField("", GUIOption.FixedWidth(50));
                 guiSizeField.SetRange(0, int.MaxValue);
-                GUIButton guiResizeBtn = new GUIButton("R", GUIOption.FixedWidth(20));
+
+                GUIContent resizeIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Resize));
+                GUIButton guiResizeBtn = new GUIButton(resizeIcon, GUIOption.FixedWidth(30));
                 guiResizeBtn.OnClick += OnResizeButtonClicked;
-                GUIButton guiClearBtn = new GUIButton("Cl", GUIOption.FixedWidth(20));
+
+                GUIContent clearIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clear));
+                GUIButton guiClearBtn = new GUIButton(clearIcon, GUIOption.FixedWidth(30));
                 guiClearBtn.OnClick += OnClearButtonClicked;
 
                 guiTitleLayout = layout.AddLayoutX();
@@ -447,10 +452,15 @@ namespace BansheeEditor
                 buttonCenter.AddFlexibleSpace();
             }
 
-            GUIButton cloneBtn = new GUIButton("C", GUIOption.FixedWidth(20));
-            GUIButton deleteBtn = new GUIButton("X", GUIOption.FixedWidth(20));
-            GUIButton moveUpBtn = new GUIButton("U", GUIOption.FixedWidth(20));
-            GUIButton moveDownBtn = new GUIButton("D", GUIOption.FixedWidth(20));
+            GUIContent cloneIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clone));
+            GUIContent deleteIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Delete));
+            GUIContent moveUp = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveUp));
+            GUIContent moveDown = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveDown));
+
+            GUIButton cloneBtn = new GUIButton(cloneIcon, GUIOption.FixedWidth(30));
+            GUIButton deleteBtn = new GUIButton(deleteIcon, GUIOption.FixedWidth(30));
+            GUIButton moveUpBtn = new GUIButton(moveUp, GUIOption.FixedWidth(30));
+            GUIButton moveDownBtn = new GUIButton(moveDown, GUIOption.FixedWidth(30));
 
             cloneBtn.OnClick += () => parent.OnCloneButtonClicked(seqIndex);
             deleteBtn.OnClick += () => parent.OnDeleteButtonClicked(seqIndex);

+ 17 - 7
MBansheeEditor/Inspector/InspectableArray.cs

@@ -55,10 +55,15 @@ namespace BansheeEditor
                     ownsTitleLayout = true;
                 }
 
-                GUIButton cloneBtn = new GUIButton("C", GUIOption.FixedWidth(20));
-                GUIButton deleteBtn = new GUIButton("X", GUIOption.FixedWidth(20));
-                GUIButton moveUpBtn = new GUIButton("U", GUIOption.FixedWidth(20));
-                GUIButton moveDownBtn = new GUIButton("D", GUIOption.FixedWidth(20));
+                GUIContent cloneIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clone));
+                GUIContent deleteIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Delete));
+                GUIContent moveUp = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveUp));
+                GUIContent moveDown = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveDown));
+
+                GUIButton cloneBtn = new GUIButton(cloneIcon, GUIOption.FixedWidth(30));
+                GUIButton deleteBtn = new GUIButton(deleteIcon, GUIOption.FixedWidth(30));
+                GUIButton moveUpBtn = new GUIButton(moveUp, GUIOption.FixedWidth(30));
+                GUIButton moveDownBtn = new GUIButton(moveDown, GUIOption.FixedWidth(30));
 
                 cloneBtn.OnClick += () => parent.OnCloneButtonClicked(seqIndex);
                 deleteBtn.OnClick += () => parent.OnDeleteButtonClicked(seqIndex);
@@ -185,7 +190,8 @@ namespace BansheeEditor
 
                 if (!property.IsValueType)
                 {
-                    GUIButton createBtn = new GUIButton("Cr", GUIOption.FixedWidth(20));
+                    GUIContent createIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Create));
+                    GUIButton createBtn = new GUIButton(createIcon, GUIOption.FixedWidth(30));
                     createBtn.OnClick += OnCreateButtonClicked;
                     guiTitleLayout.AddElement(createBtn);
                 }
@@ -199,9 +205,13 @@ namespace BansheeEditor
                 guiFoldout.OnToggled += OnFoldoutToggled;
                 guiSizeField = new GUIIntField("", GUIOption.FixedWidth(50));
                 guiSizeField.SetRange(0, int.MaxValue);
-                GUIButton guiResizeBtn = new GUIButton("R", GUIOption.FixedWidth(20));
+
+                GUIContent resizeIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Resize));
+                GUIButton guiResizeBtn = new GUIButton(resizeIcon, GUIOption.FixedWidth(30));
                 guiResizeBtn.OnClick += OnResizeButtonClicked;
-                GUIButton guiClearBtn = new GUIButton("Cl", GUIOption.FixedWidth(20));
+
+                GUIContent clearIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clear));
+                GUIButton guiClearBtn = new GUIButton(clearIcon, GUIOption.FixedWidth(30));
                 guiClearBtn.OnClick += OnClearButtonClicked;
 
                 guiTitleLayout = layout.AddLayoutX(layoutIndex);

+ 17 - 7
MBansheeEditor/Inspector/InspectableList.cs

@@ -55,10 +55,15 @@ namespace BansheeEditor
                     ownsTitleLayout = true;
                 }
 
-                GUIButton cloneBtn = new GUIButton("C", GUIOption.FixedWidth(20));
-                GUIButton deleteBtn = new GUIButton("X", GUIOption.FixedWidth(20));
-                GUIButton moveUpBtn = new GUIButton("U", GUIOption.FixedWidth(20));
-                GUIButton moveDownBtn = new GUIButton("D", GUIOption.FixedWidth(20));
+                GUIContent cloneIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clone));
+                GUIContent deleteIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Delete));
+                GUIContent moveUp = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveUp));
+                GUIContent moveDown = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveDown));
+
+                GUIButton cloneBtn = new GUIButton(cloneIcon, GUIOption.FixedWidth(30));
+                GUIButton deleteBtn = new GUIButton(deleteIcon, GUIOption.FixedWidth(30));
+                GUIButton moveUpBtn = new GUIButton(moveUp, GUIOption.FixedWidth(30));
+                GUIButton moveDownBtn = new GUIButton(moveDown, GUIOption.FixedWidth(30));
 
                 cloneBtn.OnClick += () => parent.OnCloneButtonClicked(seqIndex);
                 deleteBtn.OnClick += () => parent.OnDeleteButtonClicked(seqIndex);
@@ -185,7 +190,8 @@ namespace BansheeEditor
 
                 if (!property.IsValueType)
                 {
-                    GUIButton createBtn = new GUIButton("Cr", GUIOption.FixedWidth(20));
+                    GUIContent createIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Create));
+                    GUIButton createBtn = new GUIButton(createIcon, GUIOption.FixedWidth(30));
                     createBtn.OnClick += OnCreateButtonClicked;
                     guiTitleLayout.AddElement(createBtn);
                 }
@@ -199,9 +205,13 @@ namespace BansheeEditor
                 guiFoldout.OnToggled += OnFoldoutToggled;
                 guiSizeField = new GUIIntField("", GUIOption.FixedWidth(50));
                 guiSizeField.SetRange(0, int.MaxValue);
-                GUIButton guiResizeBtn = new GUIButton("R", GUIOption.FixedWidth(20));
+
+                GUIContent resizeIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Resize));
+                GUIButton guiResizeBtn = new GUIButton(resizeIcon, GUIOption.FixedWidth(30));
                 guiResizeBtn.OnClick += OnResizeButtonClicked;
-                GUIButton guiClearBtn = new GUIButton("Cl", GUIOption.FixedWidth(20));
+
+                GUIContent clearIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clear));
+                GUIButton guiClearBtn = new GUIButton(clearIcon, GUIOption.FixedWidth(30));
                 guiClearBtn.OnClick += OnClearButtonClicked;
 
                 guiTitleLayout = layout.AddLayoutX(layoutIndex);

+ 4 - 2
MBansheeEditor/Inspector/InspectableObject.cs

@@ -81,7 +81,8 @@ namespace BansheeEditor
 
                 if (!property.IsValueType)
                 {
-                    GUIButton createBtn = new GUIButton("Cr", GUIOption.FixedWidth(20));
+                    GUIContent createIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Create));
+                    GUIButton createBtn = new GUIButton(createIcon, GUIOption.FixedWidth(30));
                     createBtn.OnClick += OnCreateButtonClicked;
                     guiTitleLayout.AddElement(createBtn);
                 }
@@ -95,7 +96,8 @@ namespace BansheeEditor
                 guiFoldout.OnToggled += OnFoldoutToggled;
                 guiTitleLayout.AddElement(guiFoldout);
 
-                GUIButton clearBtn = new GUIButton("Cl", GUIOption.FixedWidth(20));
+                GUIContent clearIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clear));
+                GUIButton clearBtn = new GUIButton(clearIcon, GUIOption.FixedWidth(20));
                 clearBtn.OnClick += OnClearButtonClicked;
                 guiTitleLayout.AddElement(clearBtn);
 

+ 2 - 1
SBansheeEditor/Include/BsScriptEditorBuiltin.h

@@ -37,7 +37,8 @@ namespace BansheeEngine
 		static MonoString* internal_GetEmptyCSScriptCode();
 
 		static MonoObject* internal_GetToolbarIcon(ToolbarIcon icon);
-		static MonoObject* internal_LibraryWindowIcon(LibraryWindowIcon icon);
+		static MonoObject* internal_GetLibraryWindowIcon(LibraryWindowIcon icon);
+		static MonoObject* internal_GetInspectorWindowIcon(InspectorWindowIcon icon);
 		static MonoObject* internal_GetSceneWindowIcon(SceneWindowIcon icon);
 	};
 }

+ 10 - 2
SBansheeEditor/Source/BsScriptEditorBuiltin.cpp

@@ -29,7 +29,8 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_GetEmptyShaderCode", &ScriptEditorBuiltin::internal_GetEmptyShaderCode);
 		metaData.scriptClass->addInternalCall("Internal_GetEmptyCSScriptCode", &ScriptEditorBuiltin::internal_GetEmptyCSScriptCode);
 		metaData.scriptClass->addInternalCall("Internal_GetToolbarIcon", &ScriptEditorBuiltin::internal_GetToolbarIcon);
-		metaData.scriptClass->addInternalCall("Internal_LibraryWindowIcon", &ScriptEditorBuiltin::internal_LibraryWindowIcon);
+		metaData.scriptClass->addInternalCall("Internal_GetLibraryWindowIcon", &ScriptEditorBuiltin::internal_GetLibraryWindowIcon);
+		metaData.scriptClass->addInternalCall("Internal_GetInspectorWindowIcon", &ScriptEditorBuiltin::internal_GetInspectorWindowIcon);
 		metaData.scriptClass->addInternalCall("Internal_GetSceneWindowIcon", &ScriptEditorBuiltin::internal_GetSceneWindowIcon);
 	}
 
@@ -138,13 +139,20 @@ namespace BansheeEngine
 		return ScriptSpriteTexture::toManaged(tex);
 	}
 
-	MonoObject* ScriptEditorBuiltin::internal_LibraryWindowIcon(LibraryWindowIcon icon)
+	MonoObject* ScriptEditorBuiltin::internal_GetLibraryWindowIcon(LibraryWindowIcon icon)
 	{
 		HSpriteTexture tex = BuiltinEditorResources::instance().getLibraryWindowIcon(icon);
 
 		return ScriptSpriteTexture::toManaged(tex);
 	}
 
+	MonoObject* ScriptEditorBuiltin::internal_GetInspectorWindowIcon(InspectorWindowIcon icon)
+	{
+		HSpriteTexture tex = BuiltinEditorResources::instance().getInspectorWindowIcon(icon);
+
+		return ScriptSpriteTexture::toManaged(tex);
+	}
+
 	MonoObject* ScriptEditorBuiltin::internal_GetSceneWindowIcon(SceneWindowIcon icon)
 	{
 		HSpriteTexture tex = BuiltinEditorResources::instance().getSceneWindowIcon(icon);

+ 1 - 3
TODO.txt

@@ -56,10 +56,8 @@ Ribek use:
  - Hook up color picker to guicolor field
  - When hiding a component in inspector, it doesn't immediately reposition the components below it
  - Having en empty component in inspector shows a small empty background, it shouldn't show anything
- - Component inspector for Renderable
- - Resource inspectors for: Shader, Sprite Texture, GUISkin, StringTable
+ - Resource inspectors for: Shader, GUISkin, StringTable
  - Test release mode
- - I'm missing array & object management icons (Create, Clone, Delete, Resize, Move up, Move down)
 
 Other polish:
  - Add menu items: