浏览代码

Added slider

marco.bellan 9 年之前
父节点
当前提交
161f1cbf48

+ 2 - 2
Source/MBansheeEditor/Windows/Inspector/GenericInspector.cs

@@ -29,10 +29,10 @@ namespace BansheeEditor
                 {
                     if (!field.Inspectable)
                         continue;
-
+                    
                     string path = field.Name;
                     InspectableField inspectableField = InspectableField.CreateInspectable(this, field.Name, path,
-                        currentIndex, 0, new InspectableFieldLayout(Layout), field.GetProperty());
+                        currentIndex, 0, new InspectableFieldLayout(Layout), field.GetProperty(), InspectableFieldStyle.Create(field));
 
                     inspectableFields.Add(inspectableField);
                     isEmpty = false;

+ 22 - 3
Source/MBansheeEditor/Windows/Inspector/InspectableField.cs

@@ -1,6 +1,7 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 using System;
+using System.Linq;
 using BansheeEngine;
  
 namespace BansheeEditor
@@ -129,10 +130,11 @@ namespace BansheeEditor
         ///                     contain other fields, in which case you should increase this value by one.</param>
         /// <param name="layout">Parent layout that all the field elements will be added to.</param>
         /// <param name="property">Serializable property referencing the array whose contents to display.</param>
+        /// <param name="style">Information related the field style</param>
         /// <returns>Inspectable field implementation that can be used for displaying the GUI for a serializable property
         ///          of the provided type.</returns>
         public static InspectableField CreateInspectable(Inspector parent, string title, string path, int layoutIndex, 
-            int depth, InspectableFieldLayout layout, SerializableProperty property)
+            int depth, InspectableFieldLayout layout, SerializableProperty property, InspectableFieldStyle[] style = null)
         {
             InspectableField field = null;
 
@@ -143,13 +145,30 @@ namespace BansheeEditor
             }
             else
             {
+                InspectableFieldRangeStyle rangeInfo = null;
+                if (style != null)
+                    rangeInfo = InspectableFieldStyle.FindStyle<InspectableFieldRangeStyle>(style);
                 switch (property.Type)
                 {
                     case SerializableProperty.FieldType.Int:
-                        field = new InspectableInt(parent, title, path, depth, layout, property);
+                        if (rangeInfo == null)
+                        {
+                            field = new InspectableInt(parent, title, path, depth, layout, property);
+                        }
+                        else
+                        {
+                            field = new InspectableRangedInt(parent, title, path, depth, layout, property, rangeInfo);
+                        }
                         break;
                     case SerializableProperty.FieldType.Float:
-                        field = new InspectableFloat(parent, title, path, depth, layout, property);
+                        if (rangeInfo == null)
+                        {
+                            field = new InspectableFloat(parent, title, path, depth, layout, property);
+                        }
+                        else
+                        {
+                            field = new InspectableRangedFloat(parent, title, path, depth, layout, property, rangeInfo);
+                        }
                         break;
                     case SerializableProperty.FieldType.Bool:
                         field = new InspectableBool(parent, title, path, depth, layout, property);

+ 25 - 0
Source/MBansheeEditor/Windows/Inspector/InspectableFieldRangeStyle.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Contains info about the range of values a field can store
+    /// </summary>
+    public class InspectableFieldRangeStyle : InspectableFieldStyle
+    {
+        public float Max { get; set; }
+        public float Min { get; set; }
+        public float Step { get; set; }
+
+        public InspectableFieldRangeStyle(float min, float max, float step = 0.0f)
+        {
+            this.Max = max;
+            this.Min = min;
+            this.Step = step;
+        }
+    }
+}

+ 34 - 0
Source/MBansheeEditor/Windows/Inspector/InspectableFieldStyle.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BansheeEditor;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Contains style information about inspectable items
+    /// </summary>
+    public class InspectableFieldStyle
+    {
+        public static InspectableFieldStyle[] Create(SerializableField field)
+        {
+            List<InspectableFieldStyle> styles = new List<InspectableFieldStyle>();
+            if (field.Range)
+                styles.Add(new InspectableFieldRangeStyle(field.RangeMinimum, field.RangeMaximum, field.RangeStep));
+            return styles.ToArray();
+        }
+
+        public static T FindStyle<T>(InspectableFieldStyle[] styleInfo) where T : InspectableFieldRangeStyle
+        {
+            for  (int i = 0; i < styleInfo.Length; i++)
+            {
+                if (styleInfo[i].GetType() == typeof(T))
+                    return (T)styleInfo[i];
+            }
+            return default(T);
+        }
+    }
+}

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

@@ -162,7 +162,7 @@ namespace BansheeEditor
                            string childPath = path + "/" + field.Name;
 
                            InspectableField inspectable = CreateInspectable(parent, field.Name, childPath,
-                               currentIndex, depth + 1, new InspectableFieldLayout(guiContentLayout), field.GetProperty());
+                               currentIndex, depth + 1, new InspectableFieldLayout(guiContentLayout), field.GetProperty(), InspectableFieldStyle.Create(field));
 
                            children.Add(inspectable);
                            currentIndex += inspectable.GetNumLayoutElements();

+ 41 - 0
Source/MBansheeEditor/Windows/Inspector/InspectableRangedField.cs

@@ -0,0 +1,41 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+using System;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /** @addtogroup Inspector
+     *  @{
+     */
+
+    /// <summary>
+    /// Inspectable field displays GUI elements for a single <see cref="SerializableProperty"/>. This is a base class that
+    /// should be specialized for all supported types contained by <see cref="SerializableProperty"/>. Inspectable fields
+    /// can and should be created recursively - normally complex types like objects and arrays will contain fields of their 
+    /// own, while primitive types like integer or boolean will consist of only a GUI element.
+    /// </summary>
+    public abstract class InspectableRangedField : InspectableField
+    {
+        protected InspectableFieldRangeStyle rangeStyle;
+        /// <summary>
+        /// Creates a new inspectable field GUI for the specified property.
+        /// </summary>
+        /// <param name="parent">Parent Inspector this field belongs to.</param>
+        /// <param name="title">Name of the property, or some other value to set as the title.</param>
+        /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
+        /// <param name="type">Type of property this field will be used for displaying.</param>
+        /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
+        ///                     contain other fields, in which case you should increase this value by one.</param>
+        /// <param name="layout">Parent layout that all the field elements will be added to.</param>
+        /// <param name="property">Serializable property referencing the array whose contents to display.</param>
+        /// <param name="rangeStyle">Information about the range of the field</param>
+        public InspectableRangedField(Inspector parent, string title, string path, SerializableProperty.FieldType type,
+            int depth, InspectableFieldLayout layout, SerializableProperty property, InspectableFieldRangeStyle rangeStyle) : base(parent, title, path, type, depth, layout, property)
+        {
+            this.rangeStyle = rangeStyle;
+        }
+    }
+
+    /** @} */
+}

+ 87 - 0
Source/MBansheeEditor/Windows/Inspector/InspectableRangedFloat.cs

@@ -0,0 +1,87 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /** @addtogroup Inspector
+     *  @{
+     */
+
+    /// <summary>
+    /// Displays GUI for a serializable property containing a floating point value.
+    /// </summary>
+    public class InspectableRangedFloat : InspectableRangedField
+    {
+        private GUISliderField guiFloatField;
+        private InspectableState state;
+
+        /// <summary>
+        /// Creates a new inspectable float GUI for the specified property with a range.
+        /// </summary>
+        /// <param name="parent">Parent Inspector this field belongs to.</param>
+        /// <param name="title">Name of the property, or some other value to set as the title.</param>
+        /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
+        /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
+        ///                     contain other fields, in which case you should increase this value by one.</param>
+        /// <param name="layout">Parent layout that all the field elements will be added to.</param>
+        /// <param name="property">Serializable property referencing the array whose contents to display.</param>
+        /// <param name="rangeStyle">Information about the range of the field</param>
+        public InspectableRangedFloat(Inspector parent, string title, string path, int depth, InspectableFieldLayout layout,
+            SerializableProperty property, InspectableFieldRangeStyle rangeStyle)
+            : base(parent, title, path, SerializableProperty.FieldType.Float, depth, layout, property, rangeStyle)
+        {
+
+        }
+
+        /// <inheritoc/>
+        protected internal override void Initialize(int layoutIndex)
+        {
+            if (property != null)
+            {
+                guiFloatField = new GUISliderField(rangeStyle.Min, rangeStyle.Max, new GUIContent(title));
+                if (rangeStyle.Step != 0)
+                    guiFloatField.Step = rangeStyle.Step;
+                guiFloatField.OnChanged += OnFieldValueChanged;
+                guiFloatField.OnFocusLost += OnFieldValueConfirm;
+
+                layout.AddElement(layoutIndex, guiFloatField);
+            }
+        }
+
+        /// <inheritdoc/>
+        public override InspectableState Refresh(int layoutIndex)
+        {
+            if (guiFloatField != null)
+            {
+                guiFloatField.Value = property.GetValue<float>();
+            }
+            InspectableState oldState = state;
+            if (state.HasFlag(InspectableState.Modified))
+                state = InspectableState.NotModified;
+
+            return oldState;
+        }
+
+        /// <summary>
+        /// Triggered when the user inputs a new floating point value.
+        /// </summary>
+        /// <param name="newValue">New value of the float field.</param>
+        private void OnFieldValueChanged(float newValue)
+        {
+            property.SetValue(newValue);
+            state |= InspectableState.ModifyInProgress;
+        }
+
+        /// <summary>
+        /// Triggered when the user confirms input in the float field.
+        /// </summary>
+        private void OnFieldValueConfirm()
+        {
+            if (state.HasFlag(InspectableState.ModifyInProgress))
+                state |= InspectableState.Modified;
+        }
+    }
+
+    /** @} */
+}

+ 86 - 0
Source/MBansheeEditor/Windows/Inspector/InspectableRangedInt.cs

@@ -0,0 +1,86 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /** @addtogroup Inspector
+     *  @{
+     */
+
+    /// <summary>
+    /// Displays GUI for a serializable property containing a floating point value.
+    /// </summary>
+    public class InspectableRangedInt : InspectableRangedField
+    {
+        private GUISliderField guiIntField;
+        private InspectableState state;
+
+        /// <summary>
+        /// Creates a new inspectable float GUI for the specified property with a range.
+        /// </summary>
+        /// <param name="parent">Parent Inspector this field belongs to.</param>
+        /// <param name="title">Name of the property, or some other value to set as the title.</param>
+        /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
+        /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
+        ///                     contain other fields, in which case you should increase this value by one.</param>
+        /// <param name="layout">Parent layout that all the field elements will be added to.</param>
+        /// <param name="property">Serializable property referencing the array whose contents to display.</param>
+        /// <param name="rangeStyle">Information about the range of the field</param>
+        public InspectableRangedInt(Inspector parent, string title, string path, int depth, InspectableFieldLayout layout,
+            SerializableProperty property, InspectableFieldRangeStyle rangeStyle)
+            : base(parent, title, path, SerializableProperty.FieldType.Float, depth, layout, property, rangeStyle)
+        {
+
+        }
+
+        /// <inheritoc/>
+        protected internal override void Initialize(int layoutIndex)
+        {
+            if (property != null)
+            {
+                guiIntField = new GUISliderField(rangeStyle.Min, rangeStyle.Max, new GUIContent(title));
+                if (rangeStyle.Step != 0)
+                    guiIntField.Step = rangeStyle.Step;
+                guiIntField.OnChanged += OnFieldValueChanged;
+                guiIntField.OnFocusLost += OnFieldValueConfirm;
+
+                layout.AddElement(layoutIndex, guiIntField);
+            }
+        }
+
+        /// <inheritdoc/>
+        public override InspectableState Refresh(int layoutIndex)
+        {
+            if (guiIntField != null)
+                guiIntField.Value = property.GetValue<float>();
+
+            InspectableState oldState = state;
+            if (state.HasFlag(InspectableState.Modified))
+                state = InspectableState.NotModified;
+
+            return oldState;
+        }
+
+        /// <summary>
+        /// Triggered when the user inputs a new floating point value.
+        /// </summary>
+        /// <param name="newValue">New value of the float field.</param>
+        private void OnFieldValueChanged(float newValue)
+        {
+            property.SetValue(newValue);
+            state |= InspectableState.ModifyInProgress;
+        }
+
+        /// <summary>
+        /// Triggered when the user confirms input in the float field.
+        /// </summary>
+        private void OnFieldValueConfirm()
+        {
+            if (state.HasFlag(InspectableState.ModifyInProgress))
+                state |= InspectableState.Modified;
+        }
+    }
+
+    /** @} */
+}

+ 5 - 1
Source/MBansheeEngine/Serialization/Range.cs

@@ -19,14 +19,18 @@ namespace BansheeEngine
         /// </summary>
         /// <param name="min">Minimum boundary of the range to clamp the field value to.</param>
         /// <param name="max">Maximum boundary of the range to clamp the field value to.</param>
-        public Range(float min, float max)
+        /// <param name="step">Minimum change of the field value every change should be multiple of.</param>
+        /// 
+        public Range(float min, float max, float step=0f)
         {
             this.min = min;
             this.max = max;
+            this.step = step;
         }
 
         private float min;
         private float max;
+        private float step;
     }
 
     /** @} */

+ 41 - 0
Source/MBansheeEngine/Serialization/SerializableField.cs

@@ -52,6 +52,38 @@ namespace BansheeEngine
             get { return name; }
         }
 
+        /// <summary>
+        /// Returns true if the field accepts a defined range.
+        /// </summary>
+        public bool Range
+        {
+            get { return (flags & 0x04) != 0; }
+        }
+
+        /// <summary>
+        /// Returns the upper bound of the range
+        /// </summary>
+        public float RangeMaximum
+        {
+            get { return Range? Internal_GetRangeMaximum(mCachedPtr) : 0; }
+        }
+
+        /// <summary>
+        /// Returns the lower bound of the range
+        /// </summary>
+        public float RangeMinimum
+        {
+            get { return Range? Internal_GetRangeMinimum(mCachedPtr) : 0; }
+        }
+
+        /// <summary>
+        /// Returns the step of the range
+        /// </summary>
+        public float RangeStep
+        {
+            get { return Range ? Internal_GetRangeStep(mCachedPtr) : 0; }
+        }
+
         /// <summary>
         /// Returns true if the field will be visible in the default inspector.
         /// </summary>
@@ -112,6 +144,15 @@ namespace BansheeEngine
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetValue(IntPtr nativeInstance, object instance, object value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetRangeMaximum(IntPtr field);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetRangeMinimum(IntPtr field);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetRangeStep(IntPtr field);
     }
 
     /** @} */

+ 11 - 1
Source/SBansheeEngine/Include/BsManagedSerializableObjectInfo.h

@@ -62,7 +62,8 @@ namespace BansheeEngine
 	enum class ScriptFieldFlags
 	{
 		Serializable = 0x01,
-		Inspectable = 0x02
+		Inspectable = 0x02,
+		Range = 0x04
 	};
 
 	/**	Contains information about a type of a managed serializable object. */
@@ -255,6 +256,15 @@ namespace BansheeEngine
 		/**	Determines should the field be serialized when serializing the parent object. */
 		bool isSerializable() const { return ((UINT32)mFlags & (UINT32)ScriptFieldFlags::Serializable) != 0; }
 
+		/** Returns the minimum value associated to a Range attribute */
+		float getRangeMinimum() const;
+
+		/** Returns the maximum value associated to a Range attribute */
+		float getRangeMaximum() const;
+
+		/** Returns the step value of a Range attribute */
+		float getRangeStep() const;
+
 		String mName;
 		UINT32 mFieldId;
 		UINT32 mParentTypeId;

+ 4 - 0
Source/SBansheeEngine/Include/BsScriptAssemblyManager.h

@@ -77,6 +77,9 @@ namespace BansheeEngine
 
 		/**	Gets the managed class for BansheeEngine.SceneObject type. */
 		MonoClass* getSceneObjectClass() const { return mSceneObjectClass; }
+
+		/** Gets the managed class for BansheeEngine.Range attribute */
+		MonoClass* getRangeAttribute() const { return mRangeAttribute; }
 	private:
 		/**	Deletes all stored managed serializable object infos for all assemblies. */
 		void clearScriptObjects();
@@ -103,6 +106,7 @@ namespace BansheeEngine
 		MonoClass* mDontSerializeFieldAttribute;
 		MonoClass* mSerializeFieldAttribute;
 		MonoClass* mHideInInspectorAttribute;
+		MonoClass* mRangeAttribute;
 	};
 
 	/** @} */

+ 3 - 1
Source/SBansheeEngine/Include/BsScriptSerializableField.h

@@ -25,7 +25,6 @@ namespace BansheeEngine
 		 *								provided parent object.
 		 */
 		static ScriptSerializableField* create(MonoObject* parentObject, const SPtr<ManagedSerializableFieldInfo>& fieldInfo);
-
 	private:
 		ScriptSerializableField(MonoObject* instance, const SPtr<ManagedSerializableFieldInfo>& fieldInfo);
 
@@ -37,6 +36,9 @@ namespace BansheeEngine
 		static MonoObject* internal_createProperty(ScriptSerializableField* nativeInstance);
 		static MonoObject* internal_getValue(ScriptSerializableField* nativeInstance, MonoObject* instance);
 		static void internal_setValue(ScriptSerializableField* nativeInstance, MonoObject* instance, MonoObject* value);
+		static float internal_getRangeMaximum(ScriptSerializableField* nativeInstance);
+		static float internal_getRangeMinimum(ScriptSerializableField* nativeInstance);
+		static float internal_getRangeStep(ScriptSerializableField* nativeInstance);
 	};
 
 	/** @} */

+ 49 - 0
Source/SBansheeEngine/Source/BsManagedSerializableObjectInfo.cpp

@@ -5,6 +5,7 @@
 #include "BsMonoUtil.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
+#include "BsMonoField.h"
 #include "BsScriptTexture2D.h"
 #include "BsScriptSpriteTexture.h"
 #include "BsScriptAssemblyManager.h"
@@ -94,6 +95,54 @@ namespace BansheeEngine
 
 	}
 
+	float ManagedSerializableFieldInfo::getRangeMinimum() const
+	{
+		if (((UINT32)mFlags & (UINT32)ScriptFieldFlags::Range) != 0)
+		{
+
+			MonoClass* range = ScriptAssemblyManager::instance().getRangeAttribute();
+			if (range != nullptr)
+			{
+				float min = 0;
+				range->getField("min")->getValue(mMonoField->getAttribute(range), &min);
+				return min;
+			}
+		}
+		return 0;
+	}
+
+	float ManagedSerializableFieldInfo::getRangeMaximum() const
+	{
+		if (((UINT32)mFlags & (UINT32)ScriptFieldFlags::Range) != 0)
+		{
+
+			MonoClass* range = ScriptAssemblyManager::instance().getRangeAttribute();
+			if (range != nullptr)
+			{
+				float max = 0;
+				range->getField("max")->getValue(mMonoField->getAttribute(range), &max);
+				return max;
+			}
+		}
+		return 0;
+	}
+
+	float ManagedSerializableFieldInfo::getRangeStep() const
+	{
+		if (((UINT32)mFlags & (UINT32)ScriptFieldFlags::Range) != 0)
+		{
+
+			MonoClass* range = ScriptAssemblyManager::instance().getRangeAttribute();
+			if (range != nullptr)
+			{
+				float step = 0;
+				range->getField("step")->getValue(mMonoField->getAttribute(range), &step);
+				return step;
+			}
+		}
+		return 0;
+	}
+
 	RTTITypeBase* ManagedSerializableFieldInfo::getRTTIStatic()
 	{
 		return ManagedSerializableFieldInfoRTTI::instance();

+ 8 - 1
Source/SBansheeEngine/Source/BsScriptAssemblyManager.cpp

@@ -33,7 +33,7 @@ namespace BansheeEngine
 		: mBaseTypesInitialized(false), mSystemArrayClass(nullptr), mSystemGenericListClass(nullptr)
 		, mSystemGenericDictionaryClass(nullptr), mSystemTypeClass(nullptr), mComponentClass(nullptr)
 		, mSceneObjectClass(nullptr), mMissingComponentClass(nullptr), mSerializeObjectAttribute(nullptr)
-		, mDontSerializeFieldAttribute(nullptr), mSerializeFieldAttribute(nullptr), mHideInInspectorAttribute(nullptr)
+		, mDontSerializeFieldAttribute(nullptr), mSerializeFieldAttribute(nullptr), mHideInInspectorAttribute(nullptr), mRangeAttribute(nullptr)
 	{
 
 	}
@@ -138,6 +138,8 @@ namespace BansheeEngine
 					if (field->hasAttribute(mSerializeFieldAttribute))
 						fieldInfo->mFlags = (ScriptFieldFlags)((UINT32)fieldInfo->mFlags | (UINT32)ScriptFieldFlags::Serializable);
 				}
+				if (field->hasAttribute(mRangeAttribute))
+					fieldInfo->mFlags = (ScriptFieldFlags)((UINT32)fieldInfo->mFlags | (UINT32)ScriptFieldFlags::Range);
 
 				objInfo->mFieldNameToId[fieldInfo->mName] = fieldInfo->mFieldId;
 				objInfo->mFields[fieldInfo->mFieldId] = fieldInfo;
@@ -433,6 +435,7 @@ namespace BansheeEngine
 
 		mSerializeFieldAttribute = nullptr;
 		mHideInInspectorAttribute = nullptr;
+		mRangeAttribute = nullptr;
 	}
 
 	void ScriptAssemblyManager::initializeBaseTypes()
@@ -470,6 +473,10 @@ namespace BansheeEngine
 		if(mDontSerializeFieldAttribute == nullptr)
 			BS_EXCEPT(InvalidStateException, "Cannot find DontSerializeField managed class.");
 
+		mRangeAttribute = bansheeEngineAssembly->getClass("BansheeEngine", "Range");
+		if (mRangeAttribute == nullptr)
+			BS_EXCEPT(InvalidStateException, "Cannot find Range managed class.");
+
 		mComponentClass = bansheeEngineAssembly->getClass("BansheeEngine", "Component");
 		if(mComponentClass == nullptr)
 			BS_EXCEPT(InvalidStateException, "Cannot find Component managed class.");

+ 7 - 0
Source/SBansheeEngine/Source/BsScriptSerializableField.cpp

@@ -11,6 +11,7 @@
 
 namespace BansheeEngine
 {
+
 	ScriptSerializableField::ScriptSerializableField(MonoObject* instance, const SPtr<ManagedSerializableFieldInfo>& fieldInfo)
 		:ScriptObject(instance), mFieldInfo(fieldInfo)
 	{
@@ -22,6 +23,9 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_CreateProperty", &ScriptSerializableField::internal_createProperty);
 		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptSerializableField::internal_getValue);
 		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptSerializableField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_GetRangeMaximum", &ScriptSerializableField::internal_getRangeMaximum);
+		metaData.scriptClass->addInternalCall("Internal_GetRangeMinimum", &ScriptSerializableField::internal_getRangeMinimum);
+		metaData.scriptClass->addInternalCall("Internal_GetRangeStep", &ScriptSerializableField::internal_getRangeStep);
 	}
 
 	ScriptSerializableField* ScriptSerializableField::create(MonoObject* parentObject, const SPtr<ManagedSerializableFieldInfo>& fieldInfo)
@@ -60,4 +64,7 @@ namespace BansheeEngine
 		else
 			nativeInstance->mFieldInfo->mMonoField->setValue(instance, value);
 	}
+	float ScriptSerializableField::internal_getRangeMaximum(ScriptSerializableField* nativeInstance) { return nativeInstance->mFieldInfo->getRangeMaximum(); }
+	float ScriptSerializableField::internal_getRangeMinimum(ScriptSerializableField* nativeInstance) { return nativeInstance->mFieldInfo->getRangeMinimum(); }
+	float ScriptSerializableField::internal_getRangeStep(ScriptSerializableField* nativeInstance) { return nativeInstance->mFieldInfo->getRangeStep(); }
 }