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

Added sliders on ranged inspector fields with stepping functionality.
Label now accepts floats starting with '.' as .65

marco.bellan 9 лет назад
Родитель
Сommit
9b4afd8157

+ 16 - 3
Source/BansheeEditor/Include/BsGUISliderField.h

@@ -33,8 +33,11 @@ namespace BansheeEngine
 		/**	Returns the value of the input field/slider. */
 		float getValue() const;
 
+		/** Gets the minimum percentual variation of the handle position */
+		float getStep() const;
+
 		/**	Sets a new value in the input field/slider. */
-		void setValue(float value);
+		float setValue(float value);
 
 		/**
 		 * Sets a minimum and maximum allow values in the input field. Set to large negative/positive values if you don't
@@ -48,6 +51,9 @@ namespace BansheeEngine
 		 */
 		void setStep(float step);
 
+		/**	Checks is the input field currently active. */
+		bool hasInputFocus() const { return mHasInputFocus; }
+
 		/** @copydoc GUIElement::setTint */
 		void setTint(const Color& color) override;
 
@@ -70,17 +76,24 @@ namespace BansheeEngine
 		/** @copydoc GUIElementContainer::styleUpdated */
 		void styleUpdated() override;
 
-		/**	Triggered when the input box value changes. */
-		void valueChanged(const WString& newValue);
+		/**	Triggered when the input box value changes definitively. */
+		void inputBoxValueChanged(bool confirmed);
+
+		/**	Triggered when the input box value is changing. */
+		void inputBoxValueChanging(const WString&);
 
 		/**	Triggered when the slider is moved. */
 		void sliderChanged(float newValue);
 
+		/**	Triggers when the input box receives or loses keyboard focus. */
+		void inputBoxFocusChanged(bool focus);
+
 		/**	Callback that checks can the provided string be	converted to a floating point value. */
 		static bool floatFilter(const WString& str);
 
 		GUIInputBox* mInputBox;
 		GUISliderHorz* mSlider;
+		bool mHasInputFocus;
 	};
 
 	/** @} */

+ 54 - 13
Source/BansheeEditor/Source/BsGUISliderField.cpp

@@ -15,7 +15,7 @@ namespace BansheeEngine
 {
 	GUISliderField::GUISliderField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
 		const String& style, const GUIDimensions& dimensions, bool withLabel)
-		:TGUIField(dummy, labelContent, labelWidth, style, dimensions, withLabel), mInputBox(nullptr), mSlider(nullptr)
+		:TGUIField(dummy, labelContent, labelWidth, style, dimensions, withLabel), mInputBox(nullptr), mSlider(nullptr), mHasInputFocus(false)
 	{
 		mSlider = GUISliderHorz::create(GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(getSliderStyleType()));
 		mSlider->onChanged.connect(std::bind(&GUISliderField::sliderChanged, this, _1));
@@ -23,7 +23,9 @@ namespace BansheeEngine
 		mInputBox = GUIInputBox::create(false, GUIOptions(GUIOption::fixedWidth(75)), getSubStyleName(getInputStyleType()));
 		mInputBox->setFilter(&GUISliderField::floatFilter);
 
-		mInputBox->onValueChanged.connect(std::bind((void(GUISliderField::*)(const WString&))&GUISliderField::valueChanged, this, _1));
+		mInputBox->onValueChanged.connect(std::bind((void(GUISliderField::*)(const WString&))&GUISliderField::inputBoxValueChanging, this, _1));
+		mInputBox->onConfirm.connect(std::bind((void(GUISliderField::*)(void))&GUISliderField::inputBoxValueChanged, this));
+		mInputBox->onFocusChanged.connect(std::bind(&GUISliderField::inputBoxFocusChanged, this, _1));
 
 		mLayout->addElement(mSlider);
 		mLayout->addNewElement<GUIFixedSpace>(5);
@@ -43,7 +45,12 @@ namespace BansheeEngine
 		return mSlider->getValue();
 	}
 
-	void GUISliderField::setValue(float value)
+	float GUISliderField::getStep() const
+	{
+		return mSlider->getStep();
+	}
+
+	float GUISliderField::setValue(float value)
 	{
 		float origValue = mSlider->getValue();
 		if (origValue != value)
@@ -57,6 +64,7 @@ namespace BansheeEngine
 		float curValue = parseFloat(mInputBox->getText());
 		if (clampedValue != curValue)
 			mInputBox->setText(toWString(clampedValue));
+		return clampedValue;
 	}
 
 	void GUISliderField::setRange(float min, float max)
@@ -66,7 +74,7 @@ namespace BansheeEngine
 
 	void GUISliderField::setStep(float step)
 	{
-		mSlider->setStep(step);
+		mSlider->setStep(step / (mSlider->getRangeMaximum() - mSlider->getRangeMinimum()));
 	}
 
 	void GUISliderField::setTint(const Color& color)
@@ -79,10 +87,10 @@ namespace BansheeEngine
 
 	void GUISliderField::_setValue(float value, bool triggerEvent)
 	{
-		setValue(value);
+		float clamped = setValue(value);
 
 		if (triggerEvent)
-			onValueChanged(value);
+			onValueChanged(clamped);
 	}
 
 	const String& GUISliderField::getGUITypeName()
@@ -112,22 +120,55 @@ namespace BansheeEngine
 		mInputBox->setStyle(getSubStyleName(getInputStyleType()));
 	}
 
-	void GUISliderField::valueChanged(const WString& newValue)
+	void GUISliderField::inputBoxValueChanging(const WString& newValue) {
+		inputBoxValueChanged(false);
+	}
+
+	void GUISliderField::inputBoxValueChanged(bool confirmed = true)
 	{
-		float newFloatValue = parseFloat(newValue);
+		float newFloatValue = parseFloat(mInputBox->getText());
+		if (mSlider->getValue() != newFloatValue) {
+			if (confirmed) {
+				CmdInputFieldValueChange<GUISliderField, float>::execute(this, newFloatValue);
+			}
+			else
+			{
+				mSlider->setValue(newFloatValue);
+				onValueChanged(mSlider->getValue());
+			}
+		}
+		else if (mInputBox->getText() == L"" && confirmed) //Avoid leaving label blank
+		{
+			mInputBox->setText(L"0");
+		}
+	}
 
-		CmdInputFieldValueChange<GUISliderField, float>::execute(this, newFloatValue);
+	void GUISliderField::inputBoxFocusChanged(bool focus)
+	{
+		if (focus)
+		{
+			UndoRedo::instance().pushGroup("InputBox");
+			mHasInputFocus = true;
+		}
+		else
+		{
+			UndoRedo::instance().popGroup("InputBox");
+			inputBoxValueChanged();
+			mHasInputFocus = false;
+		}
 	}
 
 	void GUISliderField::sliderChanged(float newValue)
 	{
-		setValue(mSlider->getValue());
-
-		onValueChanged(newValue);
+		//float old = mSlider->getValue();
+		_setValue(newValue, true);
 	}
 
 	bool GUISliderField::floatFilter(const WString& str)
 	{
-		return std::regex_match(str, std::wregex(L"-?(\\d+(\\.\\d*)?)?"));
+		//-?(\\d+(\\.\\d*)?)?
+		//[-+]?[0-9]*\.?[0-9]*
+		bool result = std::regex_match(str, std::wregex(L"-?(\\d*(\\.\\d*)?)?"));
+		return result;
 	}
 }

+ 9 - 0
Source/BansheeEngine/Include/BsGUISlider.h

@@ -50,12 +50,21 @@ namespace BansheeEngine
 		 */
 		void setRange(float min, float max);
 
+		/** Returns the minimum value of the slider */
+		float getRangeMinimum() const;
+
+		/** Returns the maximum value of the slider */
+		float getRangeMaximum() const;
+
 		/**
 		 * Sets a step that defines the minimal increment the value can be increased/decreased by. Set to zero to have no
 		 * step.
 		 */
 		void setStep(float step);
 
+		/** Gets the minimum percentual variation of the handle position */
+		float getStep() const;
+
 		/** @copydoc GUIElement::setTint */
 		virtual void setTint(const Color& color) override;
 

+ 3 - 0
Source/BansheeEngine/Include/BsGUISliderHandle.h

@@ -56,6 +56,9 @@ namespace BansheeEngine
 		/**	Gets the current position of the handle, in percent ranging [0.0f, 1.0f]. */
 		float getHandlePos() const;
 
+		/** Gets the minimum percentual variation of the handle position */
+		float getStep() const;
+
 		/**	Returns the position of the slider handle, in pixels. Relative to this object. */
 		INT32 getHandlePosPx() const;
 

+ 15 - 0
Source/BansheeEngine/Source/BsGUISlider.cpp

@@ -169,11 +169,26 @@ namespace BansheeEngine
 		mMaxRange = max;
 	}
 
+	float GUISlider::getRangeMaximum() const
+	{
+		return mMaxRange;
+	}
+
+	float GUISlider::getRangeMinimum() const
+	{
+		return mMinRange;
+	}
+
 	void GUISlider::setStep(float step)
 	{
 		mSliderHandle->setStep(step);
 	}
 
+	float GUISlider::getStep() const 
+	{
+		return mSliderHandle->getStep();
+	}
+
 	void GUISlider::setTint(const Color& color)
 	{
 		mBackground->setTint(color);

+ 55 - 50
Source/BansheeEngine/Source/BsGUISliderHandle.cpp

@@ -1,5 +1,6 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "math.h"
 #include "BsGUISliderHandle.h"
 #include "BsImageSprite.h"
 #include "BsGUISkin.h"
@@ -48,8 +49,11 @@ namespace BansheeEngine
 	void GUISliderHandle::_setHandlePos(float pct)
 	{
 		float maxPct = 1.0f;
-		if (mStep > 0.0f)
+		if (mStep > 0.0f && pct < maxPct)
+		{
+			pct = (pct + mStep * 0.5f) - fmod(pct + mStep * 0.5f, mStep);
 			maxPct = Math::floor(1.0f / mStep) * mStep;
+		}
 
 		mPctHandlePos = Math::clamp(pct, 0.0f, maxPct);
 	}
@@ -59,6 +63,11 @@ namespace BansheeEngine
 		return mPctHandlePos;;
 	}
 
+	float GUISliderHandle::getStep() const
+	{
+		return mStep;
+	}
+
 	void GUISliderHandle::setStep(float step)
 	{
 		mStep = Math::clamp01(step);
@@ -159,13 +168,13 @@ namespace BansheeEngine
 
 	bool GUISliderHandle::_mouseEvent(const GUIMouseEvent& ev)
 	{
-		if(ev.getType() == GUIMouseEventType::MouseMove)
+		if(ev.getType() == GUIMouseEventType::MouseMove) //Mouse moves
 		{
 			if (!_isDisabled())
 			{
-				if (mMouseOverHandle)
+				if (mMouseOverHandle) //It was on the handle
 				{
-					if (!isOnHandle(ev.getPosition()))
+					if (!isOnHandle(ev.getPosition())) //It isn't anymore
 					{
 						mMouseOverHandle = false;
 
@@ -175,9 +184,9 @@ namespace BansheeEngine
 						return true;
 					}
 				}
-				else
+				else //It wasn't on the handle
 				{
-					if (isOnHandle(ev.getPosition()))
+					if (isOnHandle(ev.getPosition())) //It is now
 					{
 						mMouseOverHandle = true;
 
@@ -190,14 +199,14 @@ namespace BansheeEngine
 			}
 		}
 
-		if(ev.getType() == GUIMouseEventType::MouseDown && (mMouseOverHandle || mJumpOnClick))
+		if(ev.getType() == GUIMouseEventType::MouseDown && (mMouseOverHandle || mJumpOnClick)) //Mouse button is down, and the handle is being dragged or it is supposed to jump
 		{
 			if (!_isDisabled())
 			{
 				mState = State::Active;
 				_markLayoutAsDirty();
 
-				if (mJumpOnClick)
+				if (mJumpOnClick) //If it is supposed to jump
 				{
 					float handlePosPx = 0.0f;
 
@@ -207,6 +216,7 @@ namespace BansheeEngine
 						handlePosPx = (float)(ev.getPosition().y - (INT32)mLayoutData.area.y - mHandleSize * 0.5f);
 
 					setHandlePosPx((INT32)handlePosPx);
+					onHandleMoved(mPctHandlePos);
 				}
 
 				if (mHorizontal)
@@ -219,7 +229,7 @@ namespace BansheeEngine
 					INT32 top = (INT32)mLayoutData.area.y + getHandlePosPx();
 					mDragStartPos = ev.getPosition().y - top;
 				}
-
+				
 				mHandleDragged = true;
 			}
 
@@ -273,45 +283,45 @@ namespace BansheeEngine
 					mState = State::Hover;
 				else
 					mState = State::Normal;
-
-				// If we clicked above or below the scroll handle, scroll by one page
-				INT32 handlePosPx = getHandlePosPx();
-				if (!mJumpOnClick)
-				{
-					UINT32 stepSizePx = 0;
-					if (mStep > 0.0f)
-						stepSizePx = (UINT32)(mStep * getMaxSize());
-					else
-						stepSizePx = mHandleSize;
-
-					INT32 handleOffset = 0;
-					if (mHorizontal)
+				if (!mHandleDragged) {
+					// If we clicked above or below the scroll handle, scroll by one page
+					INT32 handlePosPx = getHandlePosPx();
+					if (!mJumpOnClick)
 					{
-						INT32 handleLeft = (INT32)mLayoutData.area.x + handlePosPx;
-						INT32 handleRight = handleLeft + mHandleSize;
-
-						if (ev.getPosition().x < handleLeft)
-							handleOffset -= stepSizePx;
-						else if (ev.getPosition().x > handleRight)
-							handleOffset += stepSizePx;
-					}
-					else
-					{
-						INT32 handleTop = (INT32)mLayoutData.area.y + handlePosPx;
-						INT32 handleBottom = handleTop + mHandleSize;
-
-						if (ev.getPosition().y < handleTop)
-							handleOffset -= stepSizePx;
-						else if (ev.getPosition().y > handleBottom)
-							handleOffset += stepSizePx;
+						UINT32 stepSizePx = 0;
+						if (mStep > 0.0f)
+							stepSizePx = (UINT32)(mStep * getMaxSize());
+						else
+							stepSizePx = mHandleSize;
+
+						INT32 handleOffset = 0;
+						if (mHorizontal)
+						{
+							INT32 handleLeft = (INT32)mLayoutData.area.x + handlePosPx;
+							INT32 handleRight = handleLeft + mHandleSize;
+
+							if (ev.getPosition().x < handleLeft)
+								handleOffset -= stepSizePx;
+							else if (ev.getPosition().x > handleRight)
+								handleOffset += stepSizePx;
+						}
+						else
+						{
+							INT32 handleTop = (INT32)mLayoutData.area.y + handlePosPx;
+							INT32 handleBottom = handleTop + mHandleSize;
+
+							if (ev.getPosition().y < handleTop)
+								handleOffset -= stepSizePx;
+							else if (ev.getPosition().y > handleBottom)
+								handleOffset += stepSizePx;
+						}
+
+						handlePosPx += handleOffset;
 					}
 
-					handlePosPx += handleOffset;
+					setHandlePosPx(handlePosPx);
+					onHandleMoved(mPctHandlePos);
 				}
-
-				setHandlePosPx(handlePosPx);
-				onHandleMoved(mPctHandlePos);
-
 				mHandleDragged = false;
 				_markLayoutAsDirty();
 			}
@@ -324,7 +334,6 @@ namespace BansheeEngine
 			if (!_isDisabled())
 			{
 				mHandleDragged = false;
-
 				if (mMouseOverHandle)
 					mState = State::Hover;
 				else
@@ -370,11 +379,7 @@ namespace BansheeEngine
 	void GUISliderHandle::setHandlePosPx(INT32 pos)
 	{
 		float maxScrollAmount = (float)getMaxSize() - mHandleSize;
-		float maxPct = 1.0f;
-		if (mStep > 0.0f)
-			maxPct = Math::floor(1.0f / mStep) * mStep;
-
-		mPctHandlePos = Math::clamp(pos / maxScrollAmount, 0.0f, maxPct);
+		_setHandlePos(pos / maxScrollAmount);
 	}
 
 	UINT32 GUISliderHandle::getMaxSize() const

+ 31 - 10
Source/MBansheeEditor/GUI/GUISliderField.cs

@@ -31,6 +31,16 @@ namespace BansheeEditor
             set { Internal_SetValue(mCachedPtr, value); }
         }
 
+        /// <summary>
+        /// A step value that determines the minimal increment the slider can be increased or decreased by.
+        /// </summary>
+        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
+        public float Step
+        {
+            get { return Internal_GetStep(mCachedPtr); }
+            set { Internal_SetStep(mCachedPtr, value); }
+        }
+
         /// <summary>
         /// Creates a new slider field element with a label.
         /// </summary>
@@ -64,6 +74,20 @@ namespace BansheeEditor
             Internal_CreateInstance(this, min, max, null, 0, style, options, false);
         }
 
+        /// <summary>
+        /// Checks does the element currently has input focus. Input focus means the element has an input caret displayed
+        /// and will accept input from the keyboard.
+        /// </summary>
+        public bool HasInputFocus
+        {
+            get
+            {
+                bool value;
+                Internal_HasInputFocus(mCachedPtr, out value);
+                return value;
+            }
+        }
+
         /// <summary>
         /// Colors the element with a specific tint.
         /// </summary>
@@ -84,15 +108,6 @@ namespace BansheeEditor
             Internal_SetRange(mCachedPtr, min, max);
         }
 
-        /// <summary>
-        /// Sets a step value that determines the minimal increment the slider can be increased or decreased by.
-        /// </summary>
-        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
-        public void SetStep(float step)
-        {
-            Internal_SetStep(mCachedPtr, step);
-        }
-
         /// <summary>
         /// Triggered by the runtime when the value of the float field changes.
         /// </summary>
@@ -111,7 +126,13 @@ namespace BansheeEditor
         private static extern float Internal_GetValue(IntPtr nativeInstance);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, float value);
+        private static extern float Internal_GetStep(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_SetValue(IntPtr nativeInstance, float value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool focus);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);

+ 5 - 0
Source/MBansheeEditor/MBansheeEditor.csproj

@@ -71,6 +71,11 @@
     <Compile Include="Inspectors\SliderJointInspector.cs" />
     <Compile Include="Inspectors\SphereColliderInspector.cs" />
     <Compile Include="Inspectors\SphericalJointInspector.cs" />
+    <Compile Include="Windows\Inspector\InspectableFieldRangeStyle.cs" />
+    <Compile Include="Windows\Inspector\InspectableFieldStyle.cs" />
+    <Compile Include="Windows\Inspector\InspectableRangedField.cs" />
+    <Compile Include="Windows\Inspector\InspectableRangedFloat.cs" />
+    <Compile Include="Windows\Inspector\InspectableRangedInt.cs" />
     <Compile Include="Windows\LogWindow.cs" />
     <Compile Include="Window\DefaultSize.cs" />
     <Compile Include="Windows\DialogBox.cs" />

+ 2 - 3
Source/MBansheeEditor/Windows/Inspector/InspectableRangedFloat.cs

@@ -52,10 +52,9 @@ namespace BansheeEditor
         /// <inheritdoc/>
         public override InspectableState Refresh(int layoutIndex)
         {
-            if (guiFloatField != null)
-            {
+            if (guiFloatField != null && !guiFloatField.HasInputFocus)
                 guiFloatField.Value = property.GetValue<float>();
-            }
+
             InspectableState oldState = state;
             if (state.HasFlag(InspectableState.Modified))
                 state = InspectableState.NotModified;

+ 1 - 1
Source/MBansheeEditor/Windows/Inspector/InspectableRangedInt.cs

@@ -52,7 +52,7 @@ namespace BansheeEditor
         /// <inheritdoc/>
         public override InspectableState Refresh(int layoutIndex)
         {
-            if (guiIntField != null)
+            if (guiIntField != null && !guiIntField.HasInputFocus)
                 guiIntField.Value = property.GetValue<float>();
 
             InspectableState oldState = state;

+ 62 - 8
Source/MBansheeEngine/GUI/GUISlider.cs

@@ -77,12 +77,30 @@ namespace BansheeEngine
         }
 
         /// <summary>
-        /// Sets a step value that determines the minimal increment the slider can be increased or decreased by.
+        /// The upper bound of the slider range
         /// </summary>
-        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
-        public void SetStep(float step)
+        /// <returns>The upper bound of the slider range</returns>
+        public float GetRangeMaximum()
         {
-            Internal_SetStep(mCachedPtr, step);
+            return Internal_GetRangeMaximum(mCachedPtr);
+        }
+
+        /// <summary>
+        /// The lower bound of the slider range
+        /// </summary>
+        /// <returns>The lower bound of the slider range</returns>
+        public float GetRangeMinimum()
+        {
+            return Internal_GetRangeMinimum(mCachedPtr);
+        }
+
+        /// <summary>
+        /// A step value that determines the minimal increment the slider can be increased or decreased by.
+        /// </summary>
+        public float Step
+        {
+            get { return Internal_GetStep(mCachedPtr); }
+            set { Internal_SetStep(mCachedPtr, value); }
         }
 
         /// <summary>
@@ -122,9 +140,18 @@ namespace BansheeEngine
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
 
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetRangeMaximum(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetRangeMinimum(IntPtr nativeInstance);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
 
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetStep(IntPtr nativeInstance);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }
@@ -197,12 +224,30 @@ namespace BansheeEngine
         }
 
         /// <summary>
-        /// Sets a step value that determines the minimal increment the slider can be increased or decreased by.
+        /// The upper bound of the slider range
         /// </summary>
-        /// <param name="step">Step value in percent if range is not defined, otherwise in same units as the range.</param>
-        public void SetStep(float step)
+        /// <returns>The upper bound of the slider range</returns>
+        public float GetRangeMaximum()
         {
-            Internal_SetStep(mCachedPtr, step);
+            return Internal_GetRangeMaximum(mCachedPtr);
+        }
+
+        /// <summary>
+        /// The lower bound of the slider range
+        /// </summary>
+        /// <returns>The lower bound of the slider range</returns>
+        public float GetRangeMinimum()
+        {
+            return Internal_GetRangeMinimum(mCachedPtr);
+        }
+
+        /// <summary>
+        /// A step value that determines the minimal increment the slider can be increased or decreased by.
+        /// </summary>
+        public float Step
+        {
+            get { return Internal_GetStep(mCachedPtr); }
+            set { Internal_SetStep(mCachedPtr, value); }
         }
 
         /// <summary>
@@ -242,9 +287,18 @@ namespace BansheeEngine
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
 
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetRangeMaximum(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetRangeMinimum(IntPtr nativeInstance);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
 
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetStep(IntPtr nativeInstance);
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
     }

+ 3 - 1
Source/SBansheeEditor/Include/BsScriptGUISliderField.h

@@ -35,7 +35,9 @@ namespace BansheeEngine
 			MonoString* style, MonoArray* guiOptions, bool withTitle);
 
 		static float internal_getValue(ScriptGUISliderField* nativeInstance);
-		static void internal_setValue(ScriptGUISliderField* nativeInstance, float value);
+		static float internal_getStep(ScriptGUISliderField* nativeInstance);
+		static float internal_setValue(ScriptGUISliderField* nativeInstance, float value);
+		static void internal_hasInputFocus(ScriptGUISliderField* nativeInstance, bool* output);
 		static void internal_setTint(ScriptGUISliderField* nativeInstance, Color* color);
 		static void internal_setRange(ScriptGUISliderField* nativeInstance, float min, float max);
 		static void internal_setStep(ScriptGUISliderField* nativeInstance, float step);

+ 15 - 1
Source/SBansheeEditor/Source/BsScriptGUISliderField.cpp

@@ -28,7 +28,9 @@ namespace BansheeEngine
 	{
 		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISliderField::internal_createInstance);
 		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_GetStep", &ScriptGUISliderField::internal_getStep);
 		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUISliderField::internal_hasInputFocus);
 		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUISliderField::internal_setTint);
 		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderField::internal_setRange);
 		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderField::internal_setStep);
@@ -71,12 +73,24 @@ namespace BansheeEngine
 		return sliderField->getValue();
 	}
 
-	void ScriptGUISliderField::internal_setValue(ScriptGUISliderField* nativeInstance, float value)
+	float ScriptGUISliderField::internal_getStep(ScriptGUISliderField* nativeInstance)
+	{
+		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
+		return sliderField->getStep();
+	}
+
+	float ScriptGUISliderField::internal_setValue(ScriptGUISliderField* nativeInstance, float value)
 	{
 		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
 		return sliderField->setValue(value);
 	}
 
+	void ScriptGUISliderField::internal_hasInputFocus(ScriptGUISliderField* nativeInstance, bool* output)
+	{
+		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
+		*output = sliderField->hasInputFocus();
+	}
+
 	void ScriptGUISliderField::internal_setTint(ScriptGUISliderField* nativeInstance, Color* color)
 	{
 		GUISliderField* sliderField = (GUISliderField*)nativeInstance->getGUIElement();

+ 6 - 0
Source/SBansheeEngine/Include/BsScriptGUISlider.h

@@ -32,7 +32,10 @@ namespace BansheeEngine
 		static float internal_getValue(ScriptGUISliderH* nativeInstance);
 		static void internal_setValue(ScriptGUISliderH* nativeInstance, float percent);
 		static void internal_setRange(ScriptGUISliderH* nativeInstance, float min, float max);
+		static float internal_getRangeMaximum(ScriptGUISliderH* nativeInstance);
+		static float internal_getRangeMinimum(ScriptGUISliderH* nativeInstance);
 		static void internal_setStep(ScriptGUISliderH* nativeInstance, float step);
+		static float internal_getStep(ScriptGUISliderH* nativeInstance);
 		static void internal_setTint(ScriptGUISliderH* nativeInstance, Color* color);
 
 		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
@@ -60,7 +63,10 @@ namespace BansheeEngine
 		static float internal_getValue(ScriptGUISliderV* nativeInstance);
 		static void internal_setValue(ScriptGUISliderV* nativeInstance, float percent);
 		static void internal_setRange(ScriptGUISliderV* nativeInstance, float min, float max);
+		static float internal_getRangeMaximum(ScriptGUISliderV* nativeInstance);
+		static float internal_getRangeMinimum(ScriptGUISliderV* nativeInstance);
 		static void internal_setStep(ScriptGUISliderV* nativeInstance, float step);
+		static float internal_getStep(ScriptGUISliderV* nativeInstance);
 		static void internal_setTint(ScriptGUISliderV* nativeInstance, Color* color);
 
 		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);

+ 42 - 0
Source/SBansheeEngine/Source/BsScriptGUISlider.cpp

@@ -37,7 +37,10 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderH::internal_getValue);
 		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderH::internal_setValue);
 		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderH::internal_setRange);
+		metaData.scriptClass->addInternalCall("Internal_GetRangeMaximum", &ScriptGUISliderH::internal_getRangeMaximum);
+		metaData.scriptClass->addInternalCall("Internal_GetRangeMinimum", &ScriptGUISliderH::internal_getRangeMinimum);
 		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderH::internal_setStep);
+		metaData.scriptClass->addInternalCall("Internal_GetStep", &ScriptGUISliderH::internal_getStep);
 
 		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
 	}
@@ -87,12 +90,30 @@ namespace BansheeEngine
 		return slider->setRange(min, max);
 	}
 
+	float ScriptGUISliderH::internal_getRangeMaximum(ScriptGUISliderH* nativeInstance)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->getRangeMaximum();
+	}
+
+	float ScriptGUISliderH::internal_getRangeMinimum(ScriptGUISliderH* nativeInstance)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->getRangeMinimum();
+	}
+
 	void ScriptGUISliderH::internal_setStep(ScriptGUISliderH* nativeInstance, float step)
 	{
 		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
 		return slider->setStep(step);
 	}
 
+	float ScriptGUISliderH::internal_getStep(ScriptGUISliderH* nativeInstance)
+	{
+		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
+		return slider->getStep();
+	}
+
 	void ScriptGUISliderH::internal_setTint(ScriptGUISliderH* nativeInstance, Color* color)
 	{
 		GUISliderHorz* slider = (GUISliderHorz*)nativeInstance->getGUIElement();
@@ -121,7 +142,10 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderV::internal_getValue);
 		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderV::internal_setValue);
 		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderV::internal_setRange);
+		metaData.scriptClass->addInternalCall("Internal_GetRangeMaximum", &ScriptGUISliderV::internal_getRangeMaximum);
+		metaData.scriptClass->addInternalCall("Internal_GetRangeMinimum", &ScriptGUISliderV::internal_getRangeMinimum);
 		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderV::internal_setStep);
+		metaData.scriptClass->addInternalCall("Internal_GetStep", &ScriptGUISliderV::internal_getStep);
 
 		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
 	}
@@ -171,12 +195,30 @@ namespace BansheeEngine
 		return slider->setRange(min, max);
 	}
 
+	float ScriptGUISliderV::internal_getRangeMaximum(ScriptGUISliderV* nativeInstance)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->getRangeMaximum();
+	}
+
+	float ScriptGUISliderV::internal_getRangeMinimum(ScriptGUISliderV* nativeInstance)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->getRangeMinimum();
+	}
+
 	void ScriptGUISliderV::internal_setStep(ScriptGUISliderV* nativeInstance, float step)
 	{
 		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
 		return slider->setStep(step);
 	}
 
+	float ScriptGUISliderV::internal_getStep(ScriptGUISliderV* nativeInstance)
+	{
+		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();
+		return slider->getStep();
+	}
+
 	void ScriptGUISliderV::internal_setTint(ScriptGUISliderV* nativeInstance, Color* color)
 	{
 		GUISliderVert* slider = (GUISliderVert*)nativeInstance->getGUIElement();