Browse Source

Feature: Float/color distribution fields now have a proper drop down arrow texture
- Also fixed positioning of distribution field context menu

BearishSun 7 years ago
parent
commit
2e83abba89

+ 1 - 1
CMakeLists.txt

@@ -28,7 +28,7 @@ add_subdirectory(${BSF_SOURCE_DIR})
 
 set (BS_PREBUILT_DEPENDENCIES_VERSION 24)
 set (BS_SRC_DEPENDENCIES_VERSION 15)
-set (BS_BUILTIN_ASSETS_VERSION 9)
+set (BS_BUILTIN_ASSETS_VERSION 10)
 
 # Options
 set(GENERATE_SCRIPT_BINDINGS OFF CACHE BOOL "If true, script binding files will be generated. Script bindings are required for the project to build properly, however they take a while to generate. If you are sure the script bindings are up to date, you can turn off their generation (temporarily) to speed up the build.")

+ 15 - 0
Data/Raw/DataList.json

@@ -1551,6 +1551,21 @@
             "Path": "ContainerBg.png",
             "SpriteUUID": "e15e000f-416e-b09e-2194-416eee62bfa9",
             "TextureUUID": "64b57435-4bd1-f789-93b1-4bd18dfbb67e"
+        },
+        {
+            "Path": "DropDownArrowActive.png",
+            "SpriteUUID": "b2bbfc8f-47a5-8558-c4a6-47a52bbfaf77",
+            "TextureUUID": "00dd0ec4-48a0-d823-8da3-48a0024be996"
+        },
+        {
+            "Path": "DropDownArrowHover.png",
+            "SpriteUUID": "8d66a71b-4cef-1b6a-16a6-4ceff8155c2a",
+            "TextureUUID": "f3dd16f7-4150-f9ba-3ea5-4150a00cb00c"
+        },
+        {
+            "Path": "DropDownArrowNormal.png",
+            "SpriteUUID": "ec9065e4-4faa-c25b-eaa0-4faa1715356f",
+            "TextureUUID": "3a3a6257-41e7-6879-6584-41e7155ed876"
         }
     ]
 }

+ 18 - 2
Data/Raw/GUISkin.json

@@ -3127,7 +3127,7 @@
             },
             {
                 "name": "DropDownButton",
-                "style": "Button"
+                "style": "DropDownArrowButton"
             },
             {
                 "name": "EditorFieldLabel",
@@ -3167,12 +3167,28 @@
             },
             {
                 "name": "DropDownButton",
-                "style": "Button"
+                "style": "DropDownArrowButton"
             },
             {
                 "name": "EditorFieldLabel",
                 "style": "EditorFieldLabel"
             }
         ]
+    },
+    {
+        "name": "DropDownArrowButton",
+		"fixedWidth": true,
+        "fixedHeight": true,
+		"width": 18,
+        "height": 21,
+        "normal": {
+            "texture": "DropDownArrowNormal.png"
+        },
+        "hover": {
+            "texture": "DropDownArrowHover.png"
+        },
+		"active": {
+            "texture": "DropDownArrowActive.png"
+        }
     }
 ]

+ 2 - 3
Source/EditorCore/GUI/BsGUIColorDistributionField.cpp

@@ -229,11 +229,10 @@ namespace bs
 			break;
 		}
 
-		mDropDownButton = GUIButton::create(HString::dummy(), GUIOptions(GUIOption::fixedWidth(50)), 
-			getSubStyleName(DROP_DOWN_FIELD_STYLE_TYPE));
+		mDropDownButton = GUIButton::create(HString::dummy(), getSubStyleName(DROP_DOWN_FIELD_STYLE_TYPE));
 		mDropDownButton->onClick.connect([this]()
 		{
-			const Rect2I bounds = getBounds();
+			const Rect2I bounds = mDropDownButton->getBounds(mParentWidget->getPanel());
 			const Vector2I center(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
 
 			mContextMenu->open(center, *mParentWidget);

+ 2 - 3
Source/EditorCore/GUI/BsGUIFloatDistributionField.cpp

@@ -260,11 +260,10 @@ namespace bs
 			break;
 		}
 
-		mDropDownButton = GUIButton::create(HString::dummy(), GUIOptions(GUIOption::fixedWidth(50)), 
-			getSubStyleName(DROP_DOWN_FIELD_STYLE_TYPE));
+		mDropDownButton = GUIButton::create(HString::dummy(), getSubStyleName(DROP_DOWN_FIELD_STYLE_TYPE));
 		mDropDownButton->onClick.connect([this]()
 		{
-			const Rect2I bounds = getBounds();
+			const Rect2I bounds = mDropDownButton->getBounds(mParentWidget->getPanel());
 			const Vector2I center(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
 
 			mContextMenu->open(center, *mParentWidget);