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

Feature: Improved distribution inspectors

BearishSun 7 лет назад
Родитель
Сommit
e8f7d823d8

+ 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 13)
+set (BS_BUILTIN_ASSETS_VERSION 14)
 
 # 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.")

+ 1 - 1
Data/.reqversion

@@ -1 +1 @@
-3
+4

+ 5 - 0
Data/Raw/DataList.json

@@ -958,6 +958,11 @@
             "Path": "CurveBg.png",
             "SpriteUUID": "fd9eebd6-48d6-13d8-a2ae-48d6080e2142",
             "TextureUUID": "a00466ae-43c2-5460-b49d-43c2f66fe13a"
+        },
+        {
+            "Path": "HeaderLightBg.png",
+            "SpriteUUID": "cc246361-4f95-e188-77bf-4f953134f4cd",
+            "TextureUUID": "12d8705e-4da4-0197-d3a4-4da4eb961b30"
         }
     ],
     "SplashScreen": {

+ 134 - 22
Data/Raw/GUISkin.json

@@ -620,7 +620,7 @@
             "bottom": 4,
             "left": 4,
             "right": 4,
-            "top": 4
+            "top": 5
         },
         "fixedHeight": true,
         "focused": {
@@ -633,7 +633,7 @@
             "texture": "InputBoxActive.png"
         },
         "font": "arial.ttf",
-        "height": 19,
+        "height": 21,
         "hover": {
             "textColor": {
                 "a": 1.0,
@@ -3217,7 +3217,7 @@
             },
             {
                 "name": "CurvesField",
-                "style": "GUICurves"
+                "style": "GUICurvesField"
             },
             {
                 "name": "DropDownButton",
@@ -3240,8 +3240,12 @@
                 "style": "GUIVector2Field"
             },
             {
-                "name": "CurvesField",
-                "style": "GUICurves"
+                "name": "CurvesFieldX",
+                "style": "GUICurvesFieldX"
+            },
+            {
+                "name": "CurvesFieldY",
+                "style": "GUICurvesFieldY"
             },
             {
                 "name": "DropDownButton",
@@ -3264,8 +3268,16 @@
                 "style": "GUIVector3Field"
             },
             {
-                "name": "CurvesField",
-                "style": "GUICurves"
+                "name": "CurvesFieldX",
+                "style": "GUICurvesFieldX"
+            },
+            {
+                "name": "CurvesFieldY",
+                "style": "GUICurvesFieldY"
+            },
+            {
+                "name": "CurvesFieldZ",
+                "style": "GUICurvesFieldZ"
             },
             {
                 "name": "DropDownButton",
@@ -3295,8 +3307,7 @@
     },
     {
         "name": "GUIColorDistributionField",
-        "fixedHeight": true,
-        "height": 21,
+        "minHeight": 21,
         "minWidth": 30,
         "subStyles": [
             {
@@ -3334,8 +3345,8 @@
         }
     },
     {
-        "fixedHeight": true,
-        "height": 19,
+        "name": "ButtonAddOnBlue",
+        "minHeight": 6,
 		"fixedWidth": true,
 		"width": 15,
         "border": {
@@ -3359,15 +3370,14 @@
             },
             "texture": "ButtonAddOnBlue.png"
         },
-        "name": "ButtonAddOnBlue",
         "textHorzAlign": 1,
         "textVertAlign": 1,
         "font": "arialBold.ttf",
         "fontSize": 8
     },
     {
-        "fixedHeight": true,
-        "height": 19,
+        "name": "ButtonAddOnGreen",
+        "minHeight": 6,
 		"fixedWidth": true,
 		"width": 15,
         "border": {
@@ -3391,15 +3401,14 @@
             },
             "texture": "ButtonAddOnGreen.png"
         },
-        "name": "ButtonAddOnGreen",
         "textHorzAlign": 1,
         "textVertAlign": 1,
         "font": "arialBold.ttf",
         "fontSize": 8
     },
     {
-        "fixedHeight": true,
-        "height": 19,
+        "name": "ButtonAddOnRed",
+        "minHeight": 6,
 		"fixedWidth": true,
 		"width": 15,
         "border": {
@@ -3423,15 +3432,14 @@
             },
             "texture": "ButtonAddOnRed.png"
         },
-        "name": "ButtonAddOnRed",
         "textHorzAlign": 1,
         "textVertAlign": 1,
         "font": "arialBold.ttf",
         "fontSize": 8
     },
     {
-        "fixedHeight": true,
-        "height": 19,
+        "name": "ButtonAddOnGray",
+        "minHeight": 6,
 		"fixedWidth": true,
 		"width": 15,
         "border": {
@@ -3455,13 +3463,13 @@
             },
             "texture": "ButtonAddOnGray.png"
         },
-        "name": "ButtonAddOnGray",
         "textHorzAlign": 1,
         "textVertAlign": 1,
         "font": "arialBold.ttf",
         "fontSize": 8
     },
     {
+	    "name": "CurveBg",
         "minHeight": 4,
 		"minWidth": 4,
         "border": {
@@ -3472,7 +3480,111 @@
         },
         "normal": {
             "texture": "CurveBg.png"
+        }
+    },
+	{
+        "name": "GUICurvesField",
+        "minHeight": 40,
+        "minWidth": 30,
+        "subStyles": [
+            {
+                "name": "EditorFieldLabel",
+                "style": "EditorFieldLabel"
+            },
+            {
+                "name": "EditorFieldCurves",
+                "style": "GUICurves"
+            }
+        ]
+    },
+	{
+        "name": "GUICurvesFieldX",
+        "minHeight": 40,
+        "minWidth": 30,
+        "subStyles": [
+            {
+                "name": "EditorFieldLabel",
+                "style": "ButtonAddOnRed"
+            },
+            {
+                "name": "EditorFieldCurves",
+                "style": "GUICurves"
+            }
+        ]
+    },
+	{
+        "name": "GUICurvesFieldY",
+        "minHeight": 40,
+        "minWidth": 30,
+        "subStyles": [
+            {
+                "name": "EditorFieldLabel",
+                "style": "ButtonAddOnGreen"
+            },
+            {
+                "name": "EditorFieldCurves",
+                "style": "GUICurves"
+            }
+        ]
+    },
+	{
+        "name": "GUICurvesFieldZ",
+        "minHeight": 40,
+        "minWidth": 30,
+        "subStyles": [
+            {
+                "name": "EditorFieldLabel",
+                "style": "ButtonAddOnBlue"
+            },
+            {
+                "name": "EditorFieldCurves",
+                "style": "GUICurves"
+            }
+        ]
+    },
+	{
+        "name": "GUICurvesFieldGray",
+        "minHeight": 40,
+        "minWidth": 30,
+        "subStyles": [
+            {
+                "name": "EditorFieldLabel",
+                "style": "ButtonAddOnGray"
+            },
+            {
+                "name": "EditorFieldCurves",
+                "style": "GUICurves"
+            }
+        ]
+    },
+    {
+        "name": "HeaderLight",
+		"fixedHeight": true,
+        "height": 12,
+        "border": {
+            "bottom": 1,
+            "left": 1,
+            "right": 1,
+            "top": 4
         },
-        "name": "CurveBg"
+        "margins": {
+            "bottom": 2,
+            "left": 2,
+            "right": 2,
+            "top": 2
+        },
+        "normal": {
+            "textColor": {
+                "a": 1.0,
+                "b": 0.7,
+                "g": 0.7,
+                "r": 0.7
+            },
+            "texture": "HeaderLightBg.png"
+        },
+        "textHorzAlign": 1,
+        "textVertAlign": 1,
+        "font": "arialBold.ttf",
+        "fontSize": 8
     }
 ]

+ 83 - 30
Source/EditorCore/GUI/BsGUIColorDistributionField.cpp

@@ -1,7 +1,7 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2018 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "GUI/BsGUIColorDistributionField.h"
-#include "GUI/BsGUILayout.h"
+#include "GUI/BsGUILayoutY.h"
 #include "GUI/BsGUILabel.h"
 #include "GUI/BsGUIColorField.h"
 #include "GUI/BsGUIColorGradientField.h"
@@ -14,6 +14,18 @@ using namespace std::placeholders;
 
 namespace bs
 {
+	/** Style type name for the internal color fields. */
+	static constexpr const char* COLOR_FIELD_STYLE_TYPE = "ColorField";
+
+	/** Style type name for the internal color gradient field. */
+	static constexpr const char* COLOR_GRADIENT_FIELD_STYLE_TYPE = "GradientField";
+
+	/** Style type name for the internal drop down button. */
+	static constexpr const char* DROP_DOWN_FIELD_STYLE_TYPE = "DropDownButton";
+
+	/** Spacing between two internal elements, in pixels. */
+	static constexpr UINT32 ELEM_SPACING = 5;
+
 	GUIColorDistributionField::GUIColorDistributionField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
 		UINT32 labelWidth, const String& style, const GUIDimensions& dimensions, bool withLabel)
 		: TGUIField(dummy, labelContent, labelWidth, style, dimensions, withLabel)
@@ -113,40 +125,75 @@ namespace bs
 
 		if(mMaxGradientField)
 			mMaxGradientField->setTint(color);
+
+		for(auto& entry : mLabels)
+		{
+			if(entry)
+				entry->setTint(color);
+		}
 	}
 
 	Vector2I GUIColorDistributionField::_getOptimalSize() const
 	{
-		Vector2I optimalsize = mDropDownButton->_getOptimalSize();
-
-		if(mLabel)
-		{
-			optimalsize.x += mLabel->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mLabel->_getOptimalSize().y);
-		}
+		Vector2I optimalsize = Vector2I::ZERO;
 
 		if(mMinColorField)
 		{
-			optimalsize.x += mMinColorField->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mMinColorField->_getOptimalSize().y);
+			Vector2I elemOptimal = mMinColorField->_calculateLayoutSizeRange().optimal;
+
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
 		}
 
 		if(mMaxColorField)
 		{
-			optimalsize.x += mMaxColorField->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mMaxColorField->_getOptimalSize().y);
+			Vector2I elemOptimal = mMaxColorField->_calculateLayoutSizeRange().optimal;
+
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
+
+			optimalsize.y += ELEM_SPACING;
 		}
 
 		if(mMinGradientField)
 		{
-			optimalsize.x += mMinGradientField->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mMinGradientField->_getOptimalSize().y);
+			Vector2I elemOptimal = mMinGradientField->_calculateLayoutSizeRange().optimal;
+
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
 		}
 
 		if(mMaxGradientField)
 		{
-			optimalsize.x += mMaxGradientField->_getOptimalSize().x;
-			optimalsize.y = std::max(optimalsize.y, mMaxGradientField->_getOptimalSize().y);
+			Vector2I elemOptimal = mMaxGradientField->_calculateLayoutSizeRange().optimal;
+
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
+
+			optimalsize.y += ELEM_SPACING;
+		}
+
+		for (auto& entry : mLabels)
+		{
+			if (!entry)
+				continue;
+
+			Vector2I elemOptimal = entry->_calculateLayoutSizeRange().optimal;
+
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
+		}
+
+		Vector2I dropDownSize = mDropDownButton->_calculateLayoutSizeRange().optimal;
+		optimalsize.x += dropDownSize.x;
+		optimalsize.y = std::max(optimalsize.y, dropDownSize.y);
+
+		if (mLabel)
+		{
+			Vector2I elemOptimal = mLabel->_calculateLayoutSizeRange().optimal;
+
+			optimalsize.x += elemOptimal.x;
+			optimalsize.y = std::max(optimalsize.y, elemOptimal.y);
 		}
 
 		return optimalsize;
@@ -180,6 +227,7 @@ namespace bs
 		mLayout->clear();
 		mLayout->addElement(mLabel);
 
+		GUILayout* valueLayout = mLayout->addNewElement<GUILayoutY>();
 		switch (mPropertyType)
 		{
 		default:
@@ -188,15 +236,16 @@ namespace bs
 			mMaxColorField = nullptr;
 			mMinGradientField = nullptr;
 			mMaxGradientField = nullptr;
+			mLabels = { nullptr, nullptr };
 
 			mMinColorField->setValue(mMinConstant);
 			mMinColorField->onClicked.connect([this]() { onMinClicked(); });
 
-			mLayout->addElement(mMinColorField);
+			valueLayout->addElement(mMinColorField);
 			break;
 		case PDT_RandomRange: 
-			mMinColorField = GUIColorField::create(HString("Min."), 40, GUIOptions(), getSubStyleName(COLOR_FIELD_STYLE_TYPE));
-			mMaxColorField = GUIColorField::create(HString("Max."), 40, GUIOptions(), getSubStyleName(COLOR_FIELD_STYLE_TYPE));
+			mMinColorField = GUIColorField::create(GUIOptions(), getSubStyleName(COLOR_FIELD_STYLE_TYPE));
+			mMaxColorField = GUIColorField::create(GUIOptions(), getSubStyleName(COLOR_FIELD_STYLE_TYPE));
 			mMinGradientField = nullptr;
 			mMaxGradientField = nullptr;
 
@@ -206,38 +255,42 @@ namespace bs
 			mMaxColorField->setValue(mMaxConstant);
 			mMaxColorField->onClicked.connect([this]() { onMaxClicked(); });
 
-			mLayout->addElement(mMinColorField);
-			mLayout->addElement(mMaxColorField);
+			mLabels[0] = valueLayout->addNewElement<GUILabel>(HString("Min."), "HeaderLight");
+			valueLayout->addElement(mMinColorField);
+			valueLayout->addNewElement<GUIFixedSpace>(ELEM_SPACING);
+			mLabels[1] = valueLayout->addNewElement<GUILabel>(HString("Max."), "HeaderLight");
+			valueLayout->addElement(mMaxColorField);
 			break;
 		case PDT_Curve: 
 			mMinColorField = nullptr;
 			mMaxColorField = nullptr;
-			mMinGradientField = GUIColorGradientField::create(HString("Gradient"), 
-				getSubStyleName(COLOR_GRADIENT_FIELD_STYLE_TYPE));
+			mMinGradientField = GUIColorGradientField::create(getSubStyleName(COLOR_GRADIENT_FIELD_STYLE_TYPE));
 			mMaxGradientField = nullptr;
+			mLabels = { nullptr, nullptr };
 
 			mMinGradientField->setValue(mMinGradient);
 			mMinGradientField->onClicked.connect([this](){ onMinClicked(); });
 
-			mLayout->addElement(mMinGradientField);
+			valueLayout->addElement(mMinGradientField);
 			break;
 		case PDT_RandomCurveRange: 
 			mMinColorField = nullptr;
 			mMaxColorField = nullptr;
-			mMinGradientField = GUIColorGradientField::create(HString("Min. "),
-				getSubStyleName(COLOR_GRADIENT_FIELD_STYLE_TYPE));
+			mMinGradientField = GUIColorGradientField::create(getSubStyleName(COLOR_GRADIENT_FIELD_STYLE_TYPE));
 
 			mMinGradientField->setValue(mMinGradient);
 			mMinGradientField->onClicked.connect([this](){ onMinClicked(); });
 
-			mMaxGradientField = GUIColorGradientField::create(HString("Max. "),
-				getSubStyleName(COLOR_GRADIENT_FIELD_STYLE_TYPE));
+			mMaxGradientField = GUIColorGradientField::create(getSubStyleName(COLOR_GRADIENT_FIELD_STYLE_TYPE));
 
 			mMaxGradientField->setValue(mMaxGradient);
 			mMaxGradientField->onClicked.connect([this](){ onMaxClicked(); });
 
-			mLayout->addElement(mMinGradientField);
-			mLayout->addElement(mMaxGradientField);
+			mLabels[0] = valueLayout->addNewElement<GUILabel>(HString("Min."), "HeaderLight");
+			valueLayout->addElement(mMinGradientField);
+			valueLayout->addNewElement<GUIFixedSpace>(ELEM_SPACING);
+			mLabels[1] = valueLayout->addNewElement<GUILabel>(HString("Max."), "HeaderLight");
+			valueLayout->addElement(mMaxGradientField);
 			break;
 		}
 

+ 1 - 9
Source/EditorCore/GUI/BsGUIColorDistributionField.h

@@ -23,15 +23,6 @@ namespace bs
 	GUIColorDistributionField final : public TGUIField<GUIColorDistributionField>
 	{
 	public:
-		/** Style type name for the internal color fields. */
-		static constexpr const char* COLOR_FIELD_STYLE_TYPE = "ColorField";
-
-		/** Style type name for the internal color gradient field. */
-		static constexpr const char* COLOR_GRADIENT_FIELD_STYLE_TYPE = "GradientField";
-
-		/** Style type name for the internal drop down button. */
-		static constexpr const char* DROP_DOWN_FIELD_STYLE_TYPE = "DropDownButton";
-
 		/** Returns type name of the GUI element used for finding GUI element styles. */
 		static const String& getGUITypeName();
 
@@ -83,6 +74,7 @@ namespace bs
 		GUIColorField* mMaxColorField = nullptr;
 		GUIColorGradientField* mMinGradientField = nullptr;
 		GUIColorGradientField* mMaxGradientField = nullptr;
+		std::array<GUILabel*, 2> mLabels = { nullptr, nullptr };
 		PropertyDistributionType mPropertyType = PDT_Constant;
 
 		Color mMinConstant = Color::White;

+ 0 - 6
Source/EditorCore/GUI/BsGUIColorField.cpp

@@ -20,12 +20,6 @@ namespace bs
 		mLayout->addElement(mColor);
 	}
 
-
-	GUIColorField::~GUIColorField()
-	{
-
-	}
-
 	void GUIColorField::setValue(const Color& color)
 	{
 		mValue = color;

+ 1 - 1
Source/EditorCore/GUI/BsGUIColorField.h

@@ -49,7 +49,7 @@ namespace bs
 		/** @} */
 
 	protected:
-		virtual ~GUIColorField();
+		virtual ~GUIColorField() = default;
 
 		/** @copydoc GUIElement::styleUpdated */
 		void styleUpdated() override;

+ 30 - 7
Source/EditorCore/GUI/BsGUICurves.cpp

@@ -8,6 +8,7 @@
 #include "GUI/BsGUICanvas.h"
 #include "Math/BsLine2.h"
 #include "GUI/BsGUIWidget.h"
+#include "Image/BsPixelUtil.h"
 
 namespace bs
 {
@@ -22,7 +23,7 @@ namespace bs
 
 	const String& GUICurves::getGUITypeName()
 	{
-		static String name = "Curves";
+		static String name = "GUICurves";
 		return name;
 	}
 
@@ -746,19 +747,41 @@ namespace bs
 			mTickHandler.setRange(mOffset, mOffset + getRangeWithPadding(), getDrawableWidth() + mPadding);
 
 			// Draw vertical frame markers
+			struct TickLevel
+			{
+				float t;
+				float strength;
+			};
+
+			struct TickComparator
+			{
+				bool operator()(const TickLevel& a, const TickLevel& b)
+				{
+					if (fabs(a.t - b.t) > 0.001f)
+						return a.t < b.t;
+
+					return false;
+				}
+			};
+
+			Set<TickLevel, TickComparator> uniqueTicks;
+
 			const INT32 numTickLevels = (INT32)mTickHandler.getNumLevels();
-			for (INT32 i = numTickLevels - 1; i >= 0; i--)
+			for (INT32 i = 0; i < numTickLevels; i++)
 			{
 				Vector<float> ticks = mTickHandler.getTicks(i);
 				const float strength = mTickHandler.getLevelStrength(i);
 
 				for (UINT32 j = 0; j < (UINT32)ticks.size(); j++)
-				{
-					Color color = COLOR_DARK_GRAY;
-					color.a *= strength;
+					uniqueTicks.insert({ticks[j], strength });
+			}
 
-					drawFrameMarker(ticks[j], color, false);
-				}
+			for(auto& entry : uniqueTicks)
+			{
+				Color color = PixelUtil::linearToSRGB(COLOR_DARK_GRAY);
+				color *= entry.strength;
+
+				drawFrameMarker(entry.t, color, false);
 			}
 
 			// Draw center line

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

@@ -12,10 +12,10 @@ namespace bs
 	static const TAnimationCurve<float> EMPTY_CURVE;
 
 	GUICurvesField::GUICurvesField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-		const String& style, const GUIDimensions& dimensions, bool withLabel)
+		const String& style, const GUIDimensions& dimensions, bool withLabel, CurveDrawOptions drawOptions)
 		: TGUIField(dummy, labelContent, labelWidth, style, dimensions, withLabel)
 	{
-		mCurves = GUICurves::create(getSubStyleName(getCurveStyleType()));
+		mCurves = GUICurves::create(drawOptions, getSubStyleName(getCurveStyleType()));
 		mCurves->onClicked.connect(std::bind(&GUICurvesField::clicked, this));
 
 		mLayout->addElement(mCurves);
@@ -31,7 +31,6 @@ namespace bs
 		mCurves->setCurves(drawInfos);
 	}
 
-
 	void GUICurvesField::setCurveRange(const TAnimationCurve<float>& curveA, const TAnimationCurve<float>& curveB)
 	{
 		const Vector<CurveDrawInfo> drawInfos =

+ 82 - 4
Source/EditorCore/GUI/BsGUICurvesField.h

@@ -4,6 +4,7 @@
 
 #include "BsEditorPrerequisites.h"
 #include "GUI/BsGUIFieldBase.h"
+#include "GUI/BsGUICurves.h"
 #include "Animation/BsAnimationCurve.h"
 
 namespace bs
@@ -28,7 +29,8 @@ namespace bs
 		static const String& getCurveStyleType();
 
 		GUICurvesField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& style, const GUIDimensions& dimensions, bool withLabel);
+			const String& style, const GUIDimensions& dimensions, bool withLabel, 
+			CurveDrawOptions drawOptions = CurveDrawOptions());
 
 		/** Sets an animation curve to display on the field. */
 		BS_SCRIPT_EXPORT() 
@@ -59,12 +61,90 @@ namespace bs
 		BS_SCRIPT_EXPORT(pr:getter,n:MaxCurve)
 		const TAnimationCurve<float>& getMaxCurve() const;
 
+		/** @copydoc GUICurves::setRange */
+		BS_SCRIPT_EXPORT()
+		void setRange(float xRange, float yRange) { mCurves->setRange(xRange, yRange); }
+
+		/** @copydoc GUICurves::setOffset */
+		BS_SCRIPT_EXPORT()
+		void setOffset(const Vector2& offset) { mCurves->setOffset(offset); }
+
+		/** @copydoc GUICurves::centerAndZoom */
+		BS_SCRIPT_EXPORT()
+		void centerAndZoom() { mCurves->centerAndZoom(); }
+
+		/** @copydoc GUICurves::setPadding */
+		BS_SCRIPT_EXPORT(pr:setter,n:Padding)
+		void setPadding(UINT32 padding) { mCurves->setPadding(padding); }
+
 		/** @copydoc GUIElement::setTint */
 		void setTint(const Color& color) override;
 
 		BS_SCRIPT_EXPORT(in:true) 
 		Event<void()> onClicked; /**< Triggered when the user clicks on the GUI element. */
 
+		using TGUIField::create;
+
+		/**
+		 * Creates a new GUI editor field with a label.
+		 *
+		 * @param[in]	drawOptions		Options that control which additional curve elements to draw.
+		 * @param[in]	labelContent	Content to display in the editor field label.
+		 * @param[in]	labelWidth		Width of the label in pixels.
+		 * @param[in]	style			Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		BS_SCRIPT_EXPORT(ec:GUICurvesField)
+		static GUICurvesField* create(CurveDrawOptions drawOptions, const GUIContent& labelContent, UINT32 labelWidth,
+			 const String& style = StringUtil::BLANK)
+		{
+			const String* curStyle = &style;
+			if (*curStyle == StringUtil::BLANK)
+				curStyle = &GUICurvesField::getGUITypeName();
+
+			return bs_new<GUICurvesField>(PrivatelyConstruct(), labelContent, labelWidth, *curStyle, 
+				GUIDimensions::create(), true, drawOptions);
+		}
+
+		/**
+		 * Creates a new GUI editor field with a label.
+		 *
+		 * @param[in]	drawOptions		Options that control which additional curve elements to draw.
+		 * @param[in]	labelText		String to display in the editor field label.
+		 * @param[in]	labelWidth		Width of the label in pixels.
+		 * @param[in]	style			Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		BS_SCRIPT_EXPORT(ec:GUICurvesField)
+		static GUICurvesField* create(CurveDrawOptions drawOptions, const HString& labelText, UINT32 labelWidth,
+			const String& style = StringUtil::BLANK)
+		{
+			const String* curStyle = &style;
+			if (*curStyle == StringUtil::BLANK)
+				curStyle = &GUICurvesField::getGUITypeName();
+
+			return bs_new<GUICurvesField>(PrivatelyConstruct(), GUIContent(labelText), labelWidth, *curStyle,
+				GUIDimensions::create(), true, drawOptions);
+		}
+
+		/**
+		 * Creates a new GUI editor field without a label.
+		 *
+		 * @param[in]	drawOptions		Options that control which additional curve elements to draw.
+		 * @param[in]	style			Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		BS_SCRIPT_EXPORT(ec:GUICurvesField)
+		static GUICurvesField* create(CurveDrawOptions drawOptions, const String& style = StringUtil::BLANK)
+		{
+			const String* curStyle = &style;
+			if (*curStyle == StringUtil::BLANK)
+				curStyle = &GUICurvesField::getGUITypeName();
+
+			return bs_new<GUICurvesField>(PrivatelyConstruct(), GUIContent(), 0, *curStyle, 
+				GUIDimensions::create(), false, drawOptions);
+		}
+
 		/** @name Internal 
 		 *  @{
 		 */
@@ -81,10 +161,8 @@ namespace bs
 		/**	Triggered when the child color input field is clicked on. */
 		void clicked();
 
-		UINT32 mLabelWidth = 100;
-		GUILabel* mLabel = nullptr;
 		GUICurves* mCurves = nullptr;
 	};
 
 	/** @} */
-}
+}

+ 92 - 79
Source/EditorCore/GUI/BsGUIFloatDistributionField.cpp

@@ -8,7 +8,7 @@
 #include "GUI/BsGUIFloatField.h"
 #include "GUI/BsGUIVector2Field.h"
 #include "GUI/BsGUIVector3Field.h"
-#include "GUI/BsGUICurves.h"
+#include "GUI/BsGUICurvesField.h"
 #include "GUI/BsGUIButton.h"
 #include "GUI/BsGUIContextMenu.h"
 #include "GUI/BsGUISpace.h"
@@ -17,14 +17,18 @@ using namespace std::placeholders;
 
 namespace bs
 {
-	namespace impl
-	{
-		template<class T>
-		bool isVertical() { return true; }
+	/** Style type name for the internal float fields. */
+	static constexpr const char* FLOAT_FIELD_STYLE_TYPE = "FloatField";
 
-		template<>
-		bool isVertical<float>() { return false; }
-	}
+	/** Style type name for the internal curve display fields. */
+	static constexpr const char* CURVES_FIELD_STYLE_TYPES[4] = 
+		{ "CurvesFieldX", "CurvesFieldY", "CurvesFieldZ", "CurvesFieldW" };
+
+	/** Style type name for the internal drop down button. */
+	static constexpr const char* DROP_DOWN_FIELD_STYLE_TYPE = "DropDownButton";
+
+	/** Spacing between two internal elements, in pixels. */
+	static constexpr UINT32 ELEM_SPACING = 5;
 
 	template<class T, class SELF>
 	TGUIDistributionField<T, SELF>::TGUIDistributionField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
@@ -127,7 +131,7 @@ namespace bs
 				TCurveProperties<T>::setComponent(mMinConstant, i, mMinCurve[i].evaluate(0.0f));
 				TCurveProperties<T>::setComponent(mMaxConstant, i, mMaxCurve[i].evaluate(0.0f));
 
-				mCurveDisplay[i]->setCurves({ CurveDrawInfo(mMinCurve[i], Color::BansheeOrange) });
+				mCurveDisplay[i]->setCurve(mMinCurve[i]);
 			}
 
 			break;
@@ -140,11 +144,7 @@ namespace bs
 				TCurveProperties<T>::setComponent(mMinConstant, i, mMinCurve[i].evaluate(0.0f));
 				TCurveProperties<T>::setComponent(mMaxConstant, i, mMaxCurve[i].evaluate(0.0f));
 
-				mCurveDisplay[i]->setCurves(
-					{
-						CurveDrawInfo(mMinCurve[i], Color::BansheeOrange),
-						CurveDrawInfo(mMaxCurve[i], Color::Red)
-					});	
+				mCurveDisplay[i]->setCurveRange(mMinCurve[i], mMaxCurve[i]);
 			}
 
 			break;
@@ -177,6 +177,12 @@ namespace bs
 		if(mMaxInput)
 			mMaxInput->setTint(color);
 
+		for(auto& entry : mLabels)
+		{
+			if(entry)
+				entry->setTint(color);
+		}
+
 		for(int i = 0; i < NumComponents; i++)
 		{
 			if(mCurveDisplay[i])
@@ -189,62 +195,46 @@ namespace bs
 	{
 		Vector2I optimalsize = Vector2I::ZERO;
 
-		if(impl::isVertical<T>())
+		if (mMinInput)
 		{
-			if (mMinInput)
-			{
-				Vector2I elemOptimal = mMinInput->_calculateLayoutSizeRange().optimal;
+			Vector2I elemOptimal = mMinInput->_calculateLayoutSizeRange().optimal;
 
-				optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
-				optimalsize.y += elemOptimal.y;
-			}
-
-			if (mMaxInput)
-			{
-				Vector2I elemOptimal = mMaxInput->_calculateLayoutSizeRange().optimal;
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
+		}
 
-				optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
-				optimalsize.y += elemOptimal.y;
-			}
+		if (mMaxInput)
+		{
+			Vector2I elemOptimal = mMaxInput->_calculateLayoutSizeRange().optimal;
 
-			for(UINT32 i = 0; i < NumComponents; i++)
-			{
-				if (mCurveDisplay[i])
-				{
-					Vector2I elemOptimal = mCurveDisplay[i]->_calculateLayoutSizeRange().optimal;
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
 
-					optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
-					optimalsize.y += elemOptimal.y;
-				}
-			}
+			optimalsize.y += ELEM_SPACING;
 		}
-		else
-		{
-			if (mMinInput)
-			{
-				Vector2I elemOptimal = mMinInput->_calculateLayoutSizeRange().optimal;
 
-				optimalsize.x += elemOptimal.x;
-				optimalsize.y = std::max(optimalsize.y, elemOptimal.y);
-			}
+		for (auto& entry : mLabels)
+		{
+			if (!entry)
+				continue;
 
-			if (mMaxInput)
-			{
-				Vector2I elemOptimal = mMaxInput->_calculateLayoutSizeRange().optimal;
+			Vector2I elemOptimal = entry->_calculateLayoutSizeRange().optimal;
 
-				optimalsize.x += elemOptimal.x;
-				optimalsize.y = std::max(optimalsize.y, elemOptimal.y);
-			}
+			optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+			optimalsize.y += elemOptimal.y;
+		}
 
-			for(UINT32 i = 0; i < NumComponents; i++)
+		for (UINT32 i = 0; i < NumComponents; i++)
+		{
+			if (mCurveDisplay[i])
 			{
-				if (mCurveDisplay[i])
-				{
-					Vector2I elemOptimal = mCurveDisplay[i]->_calculateLayoutSizeRange().optimal;
+				Vector2I elemOptimal = mCurveDisplay[i]->_calculateLayoutSizeRange().optimal;
 
-					optimalsize.x += elemOptimal.x;
-					optimalsize.y = std::max(optimalsize.y, elemOptimal.y);
-				}
+				optimalsize.x = std::max(optimalsize.x, elemOptimal.x);
+				optimalsize.y += elemOptimal.y;
+
+				if (i != 0)
+					optimalsize.y += ELEM_SPACING;
 			}
 		}
 		
@@ -277,35 +267,33 @@ namespace bs
 		if (mMaxInput)
 			mMaxInput->setStyle(getSubStyleName(FLOAT_FIELD_STYLE_TYPE));
 
-		for(int i = 0; i < NumComponents; i++)
+		for (int i = 0; i < NumComponents; i++)
 		{
 			if (mCurveDisplay[i])
-				mCurveDisplay[i]->setStyle(getSubStyleName(CURVES_FIELD_STYLE_TYPE));
+				mCurveDisplay[i]->setStyle(getSubStyleName(CURVES_FIELD_STYLE_TYPES[i]));
 		}
 	}
 
 	template<class T, class SELF>
 	void TGUIDistributionField<T, SELF>::rebuild()
 	{
+		constexpr const char* COMP_NAMES[] = { "X", "Y", "Z", "W" };
+		constexpr UINT32 ELEMENT_LABEL_WIDTH = 15;
+
 		if(mLabel)
 			mLayout->removeElement(mLabel);
 
 		mLayout->clear();
 		mLayout->addElement(mLabel);
 
-		GUILayout* valueLayout;
-		
-		if(impl::isVertical<T>())
-			valueLayout = mLayout->addNewElement<GUILayoutY>();
-		else
-			valueLayout = mLayout;
-
+		GUILayout* valueLayout = mLayout->addNewElement<GUILayoutY>();
 		switch (mValue.getType())
 		{
 		default:
 		case PDT_Constant:
 			mMinInput = GUIConstantType::create(GUIOptions(), getSubStyleName(FLOAT_FIELD_STYLE_TYPE));
 			mMaxInput = nullptr;
+			mLabels = { nullptr, nullptr };
 
 			for(int i = 0; i < NumComponents; i++)
 				mCurveDisplay[i] = nullptr;
@@ -323,8 +311,8 @@ namespace bs
 			valueLayout->addElement(mMinInput);
 			break;
 		case PDT_RandomRange: 
-			mMinInput = GUIConstantType::create(HString("Min."), 40, GUIOptions(), getSubStyleName(FLOAT_FIELD_STYLE_TYPE));
-			mMaxInput = GUIConstantType::create(HString("Max."), 40, GUIOptions(), getSubStyleName(FLOAT_FIELD_STYLE_TYPE));
+			mMinInput = GUIConstantType::create(GUIOptions(), getSubStyleName(FLOAT_FIELD_STYLE_TYPE));
+			mMaxInput = GUIConstantType::create(GUIOptions(), getSubStyleName(FLOAT_FIELD_STYLE_TYPE));
 
 			for(int i = 0; i < NumComponents; i++)
 				mCurveDisplay[i] = nullptr;
@@ -349,45 +337,70 @@ namespace bs
 			});
 			mMaxInput->onConfirm.connect([this]() { onConstantConfirmed(); });
 
+			mLabels[0] = valueLayout->addNewElement<GUILabel>(HString("Min."), "HeaderLight");
 			valueLayout->addElement(mMinInput);
+			valueLayout->addNewElement<GUIFixedSpace>(ELEM_SPACING);
+			mLabels[1] = valueLayout->addNewElement<GUILabel>(HString("Max."), "HeaderLight");
 			valueLayout->addElement(mMaxInput);
 			break;
 		case PDT_Curve: 
 			mMinInput = nullptr;
 			mMaxInput = nullptr;
+			mLabels = { nullptr, nullptr };
 
 			for(int i = 0; i < NumComponents; i++)
 			{
-				mCurveDisplay[i] = GUICurves::create(CurveDrawOption::DrawMarkers, getSubStyleName(CURVES_FIELD_STYLE_TYPE));
-				mCurveDisplay[i]->setCurves({ CurveDrawInfo(mMinCurve[i], Color::BansheeOrange) });
+				if(NumComponents > 1)
+				{
+					mCurveDisplay[i] = GUICurvesField::create(CurveDrawOption::DrawMarkers, HString(COMP_NAMES[i]),
+						ELEMENT_LABEL_WIDTH, getSubStyleName(CURVES_FIELD_STYLE_TYPES[i]));
+				}
+				else
+				{
+					mCurveDisplay[i] = GUICurvesField::create(CurveDrawOption::DrawMarkers, 
+						getSubStyleName(CURVES_FIELD_STYLE_TYPES[i]));
+				}
+
+				mCurveDisplay[i]->setCurve(mMinCurve[i]);
 
 				mCurveDisplay[i]->setPadding(3);
 				mCurveDisplay[i]->centerAndZoom();
 				mCurveDisplay[i]->onClicked.connect([this,i]() { onClicked(i); });
 
+				if(i != 0)
+					valueLayout->addNewElement<GUIFixedSpace>(ELEM_SPACING);
+
 				valueLayout->addElement(mCurveDisplay[i]);
+
 			}
 
 			break;
 		case PDT_RandomCurveRange: 
 			mMinInput = nullptr;
 			mMaxInput = nullptr;
+			mLabels = { nullptr, nullptr };
 
 			for(int i = 0; i < NumComponents; i++)
 			{
-				mCurveDisplay[i] = GUICurves::create(CurveDrawOption::DrawMarkers | CurveDrawOption::DrawRange,
-					getSubStyleName(CURVES_FIELD_STYLE_TYPE));
-
-				mCurveDisplay[i]->setCurves(
-					{
-						CurveDrawInfo(mMinCurve[i], Color::BansheeOrange),
-						CurveDrawInfo(mMaxCurve[i], Color::Red)
-					});
+				if(NumComponents > 1)
+				{
+					mCurveDisplay[i] = GUICurvesField::create(CurveDrawOption::DrawMarkers, HString(COMP_NAMES[i]),
+						ELEMENT_LABEL_WIDTH, getSubStyleName(CURVES_FIELD_STYLE_TYPES[i]));
+				}
+				else
+				{
+					mCurveDisplay[i] = GUICurvesField::create(CurveDrawOption::DrawMarkers, 
+						getSubStyleName(CURVES_FIELD_STYLE_TYPES[i]));
+				}
 
+				mCurveDisplay[i]->setCurveRange(mMinCurve[i], mMaxCurve[i]);
 				mCurveDisplay[i]->setPadding(3);
 				mCurveDisplay[i]->centerAndZoom();
 				mCurveDisplay[i]->onClicked.connect([this,i]() { onClicked(i); });
 
+				if(i != 0)
+					valueLayout->addNewElement<GUIFixedSpace>(ELEM_SPACING);
+
 				valueLayout->addElement(mCurveDisplay[i]);
 			}
 

+ 3 - 11
Source/EditorCore/GUI/BsGUIFloatDistributionField.h

@@ -9,7 +9,7 @@
 
 namespace bs
 {
-	class GUICurves;
+	class GUICurvesField;
 
 	/** @addtogroup GUI-Editor-Internal
 	 *  @{
@@ -47,15 +47,6 @@ namespace bs
 		enum { NumComponents = TCurveProperties<T>::NumComponents };
 
 	public:
-		/** Style type name for the internal float fields. */
-		static constexpr const char* FLOAT_FIELD_STYLE_TYPE = "FloatField";
-
-		/** Style type name for the internal curve display field. */
-		static constexpr const char* CURVES_FIELD_STYLE_TYPE = "CurvesField";
-
-		/** Style type name for the internal drop down button. */
-		static constexpr const char* DROP_DOWN_FIELD_STYLE_TYPE = "DropDownButton";
-
 		TGUIDistributionField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
 			const String& style, const GUIDimensions& dimensions, bool withLabel);
 
@@ -119,7 +110,8 @@ namespace bs
 		GUIButton* mDropDownButton = nullptr;
 		GUIConstantType* mMinInput = nullptr;
 		GUIConstantType* mMaxInput = nullptr;
-		GUICurves* mCurveDisplay[NumComponents] = { };
+		std::array<GUILabel*, 2> mLabels = { nullptr, nullptr };
+		GUICurvesField* mCurveDisplay[NumComponents] = { };
 		PropertyDistributionType mPropertyType = PDT_Constant;
 
 		T mMinConstant = TCurveProperties<T>::getZero();

+ 77 - 10
Source/Scripting/MBansheeEditor/Generated/GUICurvesField.generated.cs

@@ -19,6 +19,32 @@ namespace BansheeEditor
 		private GUICurvesField(bool __dummy0) { }
 		protected GUICurvesField() { }
 
+		/// <summary>Creates a new GUI editor field with a label.</summary>
+		/// <param name="drawOptions">Options that control which additional curve elements to draw.</param>
+		/// <param name="labelContent">Content to display in the editor field label.</param>
+		/// <param name="labelWidth">Width of the label in pixels.</param>
+		/// <param name="style">
+		/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on. 
+		/// If not specified default style is used.
+		/// </param>
+		public GUICurvesField(CurveDrawOptions drawOptions, GUIContent labelContent, uint labelWidth, string style = "")
+		{
+			Internal_create(this, drawOptions, ref labelContent, labelWidth, style);
+		}
+
+		/// <summary>Creates a new GUI editor field with a label.</summary>
+		/// <param name="drawOptions">Options that control which additional curve elements to draw.</param>
+		/// <param name="labelText">String to display in the editor field label.</param>
+		/// <param name="labelWidth">Width of the label in pixels.</param>
+		/// <param name="style">
+		/// Optional style to use for the element. Style will be retrieved from GUISkin of the GUIWidget the element is used on. 
+		/// If not specified default style is used.
+		/// </param>
+		public GUICurvesField(CurveDrawOptions drawOptions, LocString labelText, uint labelWidth, string style = "")
+		{
+			Internal_create0(this, drawOptions, labelText, labelWidth, style);
+		}
+
 		/// <summary>Creates a new GUI editor field with a label.</summary>
 		/// <param name="labelContent">Content to display in the editor field label.</param>
 		/// <param name="labelWidth">Width of the label in pixels.</param>
@@ -28,7 +54,7 @@ namespace BansheeEditor
 		/// </param>
 		public GUICurvesField(GUIContent labelContent, uint labelWidth, string style = "")
 		{
-			Internal_create(this, ref labelContent, labelWidth, style);
+			Internal_create1(this, ref labelContent, labelWidth, style);
 		}
 
 		/// <summary>Creates a new GUI editor field with a label.</summary>
@@ -39,7 +65,7 @@ namespace BansheeEditor
 		/// </param>
 		public GUICurvesField(GUIContent labelContent, string style = "")
 		{
-			Internal_create0(this, ref labelContent, style);
+			Internal_create2(this, ref labelContent, style);
 		}
 
 		/// <summary>Creates a new GUI editor field with a label.</summary>
@@ -51,7 +77,7 @@ namespace BansheeEditor
 		/// </param>
 		public GUICurvesField(LocString labelText, uint labelWidth, string style = "")
 		{
-			Internal_create1(this, labelText, labelWidth, style);
+			Internal_create3(this, labelText, labelWidth, style);
 		}
 
 		/// <summary>Creates a new GUI editor field with a label.</summary>
@@ -62,7 +88,7 @@ namespace BansheeEditor
 		/// </param>
 		public GUICurvesField(LocString labelText, string style = "")
 		{
-			Internal_create2(this, labelText, style);
+			Internal_create4(this, labelText, style);
 		}
 
 		/// <summary>Creates a new GUI editor field without a label.</summary>
@@ -72,7 +98,7 @@ namespace BansheeEditor
 		/// </param>
 		public GUICurvesField(string style = "")
 		{
-			Internal_create3(this, style);
+			Internal_create5(this, style);
 		}
 
 		/// <summary>
@@ -114,6 +140,14 @@ namespace BansheeEditor
 			get { return Internal_getMaxCurve(mCachedPtr); }
 		}
 
+		/// <summary>Sets the size of padding to apply to the left and right sides of the curve drawing, in pixels.</summary>
+		[ShowInInspector]
+		[NativeWrapper]
+		public uint Padding
+		{
+			set { Internal_setPadding(mCachedPtr, value); }
+		}
+
 		/// <summary>Triggered when the user clicks on the GUI element.</summary>
 		partial void OnClicked();
 
@@ -129,6 +163,27 @@ namespace BansheeEditor
 			Internal_setCurveRange(mCachedPtr, curveA, curveB);
 		}
 
+		/// <summary>Changes the visible range that the GUI element displays.</summary>
+		/// <param name="xRange">Range of the horizontal area. Displayed area will range from [0, xRange].</param>
+		/// <param name="yRange">Range of the vertical area. Displayed area will range from [-yRange * 0.5, yRange * 0.5]</param>
+		public void SetRange(float xRange, float yRange)
+		{
+			Internal_setRange(mCachedPtr, xRange, yRange);
+		}
+
+		/// <summary>Returns the offset at which the displayed timeline values start at.</summary>
+		/// <param name="offset">Value to start the timeline values at, where x = time, y = value.</param>
+		public void SetOffset(Vector2 offset)
+		{
+			Internal_setOffset(mCachedPtr, ref offset);
+		}
+
+		/// <summary>Centers and zooms the view to fully display the provided set of curves.</summary>
+		public void CenterAndZoom()
+		{
+			Internal_centerAndZoom(mCachedPtr);
+		}
+
 		[MethodImpl(MethodImplOptions.InternalCall)]
 		private static extern void Internal_setCurve(IntPtr thisPtr, AnimationCurve curve);
 		[MethodImpl(MethodImplOptions.InternalCall)]
@@ -140,15 +195,27 @@ namespace BansheeEditor
 		[MethodImpl(MethodImplOptions.InternalCall)]
 		private static extern AnimationCurve Internal_getMaxCurve(IntPtr thisPtr);
 		[MethodImpl(MethodImplOptions.InternalCall)]
-		private static extern void Internal_create(GUICurvesField managedInstance, ref GUIContent labelContent, uint labelWidth, string style);
+		private static extern void Internal_setRange(IntPtr thisPtr, float xRange, float yRange);
+		[MethodImpl(MethodImplOptions.InternalCall)]
+		private static extern void Internal_setOffset(IntPtr thisPtr, ref Vector2 offset);
+		[MethodImpl(MethodImplOptions.InternalCall)]
+		private static extern void Internal_centerAndZoom(IntPtr thisPtr);
+		[MethodImpl(MethodImplOptions.InternalCall)]
+		private static extern void Internal_setPadding(IntPtr thisPtr, uint padding);
+		[MethodImpl(MethodImplOptions.InternalCall)]
+		private static extern void Internal_create(GUICurvesField managedInstance, CurveDrawOptions drawOptions, ref GUIContent labelContent, uint labelWidth, string style);
+		[MethodImpl(MethodImplOptions.InternalCall)]
+		private static extern void Internal_create0(GUICurvesField managedInstance, CurveDrawOptions drawOptions, LocString labelText, uint labelWidth, string style);
+		[MethodImpl(MethodImplOptions.InternalCall)]
+		private static extern void Internal_create1(GUICurvesField managedInstance, ref GUIContent labelContent, uint labelWidth, string style);
 		[MethodImpl(MethodImplOptions.InternalCall)]
-		private static extern void Internal_create0(GUICurvesField managedInstance, ref GUIContent labelContent, string style);
+		private static extern void Internal_create2(GUICurvesField managedInstance, ref GUIContent labelContent, string style);
 		[MethodImpl(MethodImplOptions.InternalCall)]
-		private static extern void Internal_create1(GUICurvesField managedInstance, LocString labelText, uint labelWidth, string style);
+		private static extern void Internal_create3(GUICurvesField managedInstance, LocString labelText, uint labelWidth, string style);
 		[MethodImpl(MethodImplOptions.InternalCall)]
-		private static extern void Internal_create2(GUICurvesField managedInstance, LocString labelText, string style);
+		private static extern void Internal_create4(GUICurvesField managedInstance, LocString labelText, string style);
 		[MethodImpl(MethodImplOptions.InternalCall)]
-		private static extern void Internal_create3(GUICurvesField managedInstance, string style);
+		private static extern void Internal_create5(GUICurvesField managedInstance, string style);
 		private void Internal_onClicked()
 		{
 			OnClicked();

+ 55 - 5
Source/Scripting/SBansheeEditor/Generated/BsScriptGUICurvesField.generated.cpp

@@ -5,6 +5,7 @@
 #include "../../../EditorCore/GUI/BsGUICurvesField.h"
 #include "BsScriptHString.generated.h"
 #include "BsScriptTAnimationCurve.generated.h"
+#include "Wrappers/BsScriptVector.h"
 #include "BsScriptGUIContent.generated.h"
 #include "../../../EditorCore/GUI/BsGUICurvesField.h"
 
@@ -25,11 +26,17 @@ namespace bs
 		metaData.scriptClass->addInternalCall("Internal_getCurve", (void*)&ScriptGUICurvesField::Internal_getCurve);
 		metaData.scriptClass->addInternalCall("Internal_getMinCurve", (void*)&ScriptGUICurvesField::Internal_getMinCurve);
 		metaData.scriptClass->addInternalCall("Internal_getMaxCurve", (void*)&ScriptGUICurvesField::Internal_getMaxCurve);
+		metaData.scriptClass->addInternalCall("Internal_setRange", (void*)&ScriptGUICurvesField::Internal_setRange);
+		metaData.scriptClass->addInternalCall("Internal_setOffset", (void*)&ScriptGUICurvesField::Internal_setOffset);
+		metaData.scriptClass->addInternalCall("Internal_centerAndZoom", (void*)&ScriptGUICurvesField::Internal_centerAndZoom);
+		metaData.scriptClass->addInternalCall("Internal_setPadding", (void*)&ScriptGUICurvesField::Internal_setPadding);
 		metaData.scriptClass->addInternalCall("Internal_create", (void*)&ScriptGUICurvesField::Internal_create);
 		metaData.scriptClass->addInternalCall("Internal_create0", (void*)&ScriptGUICurvesField::Internal_create0);
 		metaData.scriptClass->addInternalCall("Internal_create1", (void*)&ScriptGUICurvesField::Internal_create1);
 		metaData.scriptClass->addInternalCall("Internal_create2", (void*)&ScriptGUICurvesField::Internal_create2);
 		metaData.scriptClass->addInternalCall("Internal_create3", (void*)&ScriptGUICurvesField::Internal_create3);
+		metaData.scriptClass->addInternalCall("Internal_create4", (void*)&ScriptGUICurvesField::Internal_create4);
+		metaData.scriptClass->addInternalCall("Internal_create5", (void*)&ScriptGUICurvesField::Internal_create5);
 
 		onClickedThunk = (onClickedThunkDef)metaData.scriptClass->getMethodExact("Internal_onClicked", "")->getThunk();
 	}
@@ -96,7 +103,50 @@ namespace bs
 		return __output;
 	}
 
-	void ScriptGUICurvesField::Internal_create(MonoObject* managedInstance, __GUIContentInterop* labelContent, uint32_t labelWidth, MonoString* style)
+	void ScriptGUICurvesField::Internal_setRange(ScriptGUICurvesField* thisPtr, float xRange, float yRange)
+	{
+		static_cast<GUICurvesField*>(thisPtr->getGUIElement())->setRange(xRange, yRange);
+	}
+
+	void ScriptGUICurvesField::Internal_setOffset(ScriptGUICurvesField* thisPtr, Vector2* offset)
+	{
+		static_cast<GUICurvesField*>(thisPtr->getGUIElement())->setOffset(*offset);
+	}
+
+	void ScriptGUICurvesField::Internal_centerAndZoom(ScriptGUICurvesField* thisPtr)
+	{
+		static_cast<GUICurvesField*>(thisPtr->getGUIElement())->centerAndZoom();
+	}
+
+	void ScriptGUICurvesField::Internal_setPadding(ScriptGUICurvesField* thisPtr, uint32_t padding)
+	{
+		static_cast<GUICurvesField*>(thisPtr->getGUIElement())->setPadding(padding);
+	}
+
+	void ScriptGUICurvesField::Internal_create(MonoObject* managedInstance, CurveDrawOption drawOptions, __GUIContentInterop* labelContent, uint32_t labelWidth, MonoString* style)
+	{
+		GUIContent tmplabelContent;
+		tmplabelContent = ScriptGUIContent::fromInterop(*labelContent);
+		String tmpstyle;
+		tmpstyle = MonoUtil::monoToString(style);
+		GUICurvesField* instance = GUICurvesField::create(drawOptions, tmplabelContent, labelWidth, tmpstyle);
+		new (bs_alloc<ScriptGUICurvesField>())ScriptGUICurvesField(managedInstance, instance);
+	}
+
+	void ScriptGUICurvesField::Internal_create0(MonoObject* managedInstance, CurveDrawOption drawOptions, MonoObject* labelText, uint32_t labelWidth, MonoString* style)
+	{
+		SPtr<HString> tmplabelText;
+		ScriptHString* scriptlabelText;
+		scriptlabelText = ScriptHString::toNative(labelText);
+		if(scriptlabelText != nullptr)
+			tmplabelText = scriptlabelText->getInternal();
+		String tmpstyle;
+		tmpstyle = MonoUtil::monoToString(style);
+		GUICurvesField* instance = GUICurvesField::create(drawOptions, *tmplabelText, labelWidth, tmpstyle);
+		new (bs_alloc<ScriptGUICurvesField>())ScriptGUICurvesField(managedInstance, instance);
+	}
+
+	void ScriptGUICurvesField::Internal_create1(MonoObject* managedInstance, __GUIContentInterop* labelContent, uint32_t labelWidth, MonoString* style)
 	{
 		GUIContent tmplabelContent;
 		tmplabelContent = ScriptGUIContent::fromInterop(*labelContent);
@@ -106,7 +156,7 @@ namespace bs
 		new (bs_alloc<ScriptGUICurvesField>())ScriptGUICurvesField(managedInstance, instance);
 	}
 
-	void ScriptGUICurvesField::Internal_create0(MonoObject* managedInstance, __GUIContentInterop* labelContent, MonoString* style)
+	void ScriptGUICurvesField::Internal_create2(MonoObject* managedInstance, __GUIContentInterop* labelContent, MonoString* style)
 	{
 		GUIContent tmplabelContent;
 		tmplabelContent = ScriptGUIContent::fromInterop(*labelContent);
@@ -116,7 +166,7 @@ namespace bs
 		new (bs_alloc<ScriptGUICurvesField>())ScriptGUICurvesField(managedInstance, instance);
 	}
 
-	void ScriptGUICurvesField::Internal_create1(MonoObject* managedInstance, MonoObject* labelText, uint32_t labelWidth, MonoString* style)
+	void ScriptGUICurvesField::Internal_create3(MonoObject* managedInstance, MonoObject* labelText, uint32_t labelWidth, MonoString* style)
 	{
 		SPtr<HString> tmplabelText;
 		ScriptHString* scriptlabelText;
@@ -129,7 +179,7 @@ namespace bs
 		new (bs_alloc<ScriptGUICurvesField>())ScriptGUICurvesField(managedInstance, instance);
 	}
 
-	void ScriptGUICurvesField::Internal_create2(MonoObject* managedInstance, MonoObject* labelText, MonoString* style)
+	void ScriptGUICurvesField::Internal_create4(MonoObject* managedInstance, MonoObject* labelText, MonoString* style)
 	{
 		SPtr<HString> tmplabelText;
 		ScriptHString* scriptlabelText;
@@ -142,7 +192,7 @@ namespace bs
 		new (bs_alloc<ScriptGUICurvesField>())ScriptGUICurvesField(managedInstance, instance);
 	}
 
-	void ScriptGUICurvesField::Internal_create3(MonoObject* managedInstance, MonoString* style)
+	void ScriptGUICurvesField::Internal_create5(MonoObject* managedInstance, MonoString* style)
 	{
 		String tmpstyle;
 		tmpstyle = MonoUtil::monoToString(style);

+ 13 - 5
Source/Scripting/SBansheeEditor/Generated/BsScriptGUICurvesField.generated.h

@@ -4,6 +4,8 @@
 #include "Wrappers/GUI/BsScriptGUIElement.h"
 #include "../../../bsf/Source/Foundation/bsfCore/Localization/BsHString.h"
 #include "../../../bsf/Source/Foundation/bsfCore/Animation/BsAnimationCurve.h"
+#include "Math/BsVector2.h"
+#include "../../../EditorCore/GUI/BsGUICurves.h"
 
 namespace bs
 {
@@ -28,10 +30,16 @@ namespace bs
 		static MonoObject* Internal_getCurve(ScriptGUICurvesField* thisPtr);
 		static MonoObject* Internal_getMinCurve(ScriptGUICurvesField* thisPtr);
 		static MonoObject* Internal_getMaxCurve(ScriptGUICurvesField* thisPtr);
-		static void Internal_create(MonoObject* managedInstance, __GUIContentInterop* labelContent, uint32_t labelWidth, MonoString* style);
-		static void Internal_create0(MonoObject* managedInstance, __GUIContentInterop* labelContent, MonoString* style);
-		static void Internal_create1(MonoObject* managedInstance, MonoObject* labelText, uint32_t labelWidth, MonoString* style);
-		static void Internal_create2(MonoObject* managedInstance, MonoObject* labelText, MonoString* style);
-		static void Internal_create3(MonoObject* managedInstance, MonoString* style);
+		static void Internal_setRange(ScriptGUICurvesField* thisPtr, float xRange, float yRange);
+		static void Internal_setOffset(ScriptGUICurvesField* thisPtr, Vector2* offset);
+		static void Internal_centerAndZoom(ScriptGUICurvesField* thisPtr);
+		static void Internal_setPadding(ScriptGUICurvesField* thisPtr, uint32_t padding);
+		static void Internal_create(MonoObject* managedInstance, CurveDrawOption drawOptions, __GUIContentInterop* labelContent, uint32_t labelWidth, MonoString* style);
+		static void Internal_create0(MonoObject* managedInstance, CurveDrawOption drawOptions, MonoObject* labelText, uint32_t labelWidth, MonoString* style);
+		static void Internal_create1(MonoObject* managedInstance, __GUIContentInterop* labelContent, uint32_t labelWidth, MonoString* style);
+		static void Internal_create2(MonoObject* managedInstance, __GUIContentInterop* labelContent, MonoString* style);
+		static void Internal_create3(MonoObject* managedInstance, MonoObject* labelText, uint32_t labelWidth, MonoString* style);
+		static void Internal_create4(MonoObject* managedInstance, MonoObject* labelText, MonoString* style);
+		static void Internal_create5(MonoObject* managedInstance, MonoString* style);
 	};
 }