Explorar o código

Making all interop structs be passed by referenced in editor script objects

BearishSun %!s(int64=10) %!d(string=hai) anos
pai
achega
e4b531cc0e
Modificáronse 75 ficheiros con 7455 adicións e 7451 borrados
  1. 129 129
      MBansheeEditor/DropDownWindow.cs
  2. 4 4
      MBansheeEditor/EditorWindow.cs
  3. 112 112
      MBansheeEditor/GUI/GUIColorField.cs
  4. 197 197
      MBansheeEditor/GUI/GUIEnumField.cs
  5. 137 137
      MBansheeEditor/GUI/GUIFloatField.cs
  6. 97 97
      MBansheeEditor/GUI/GUIGameObjectField.cs
  7. 137 137
      MBansheeEditor/GUI/GUIIntField.cs
  8. 339 339
      MBansheeEditor/GUI/GUIListBoxField.cs
  9. 119 119
      MBansheeEditor/GUI/GUIResourceField.cs
  10. 119 119
      MBansheeEditor/GUI/GUISliderField.cs
  11. 125 125
      MBansheeEditor/GUI/GUITextField.cs
  12. 118 118
      MBansheeEditor/GUI/GUITextureField.cs
  13. 94 94
      MBansheeEditor/GUI/GUIToggleField.cs
  14. 123 123
      MBansheeEditor/GUI/GUIVector2Field.cs
  15. 123 123
      MBansheeEditor/GUI/GUIVector3Field.cs
  16. 123 123
      MBansheeEditor/GUI/GUIVector4Field.cs
  17. 129 129
      MBansheeEditor/ModalWindow.cs
  18. 124 124
      MBansheeEditor/OSDropTarget.cs
  19. 155 155
      MBansheeEditor/Scene/Gizmos.cs
  20. 212 208
      MBansheeEditor/Scene/HandleDrawing.cs
  21. 136 136
      MBansheeEditor/Scene/HandleSlider.cs
  22. 77 77
      MBansheeEditor/Scene/HandleSliderDisc.cs
  23. 47 47
      MBansheeEditor/Scene/HandleSliderLine.cs
  24. 51 51
      MBansheeEditor/Scene/HandleSliderPlane.cs
  25. 112 112
      MBansheeEditor/Scene/SceneViewHandler.cs
  26. 120 120
      SBansheeEditor/Include/BsScriptDropDownWindow.h
  27. 2 2
      SBansheeEditor/Include/BsScriptEditorWindow.h
  28. 40 40
      SBansheeEditor/Include/BsScriptGUIColorField.h
  29. 48 48
      SBansheeEditor/Include/BsScriptGUIEnumField.h
  30. 51 51
      SBansheeEditor/Include/BsScriptGUIFloatField.h
  31. 47 47
      SBansheeEditor/Include/BsScriptGUIGameObjectField.h
  32. 51 51
      SBansheeEditor/Include/BsScriptGUIIntField.h
  33. 45 45
      SBansheeEditor/Include/BsScriptGUIListBoxField.h
  34. 48 48
      SBansheeEditor/Include/BsScriptGUIResourceField.h
  35. 42 42
      SBansheeEditor/Include/BsScriptGUISliderField.h
  36. 50 50
      SBansheeEditor/Include/BsScriptGUITextField.h
  37. 49 49
      SBansheeEditor/Include/BsScriptGUITextureField.h
  38. 40 40
      SBansheeEditor/Include/BsScriptGUIToggleField.h
  39. 50 50
      SBansheeEditor/Include/BsScriptGUIVector2Field.h
  40. 50 50
      SBansheeEditor/Include/BsScriptGUIVector3Field.h
  41. 50 50
      SBansheeEditor/Include/BsScriptGUIVector4Field.h
  42. 34 34
      SBansheeEditor/Include/BsScriptGizmos.h
  43. 38 38
      SBansheeEditor/Include/BsScriptHandleDrawing.h
  44. 63 63
      SBansheeEditor/Include/BsScriptHandleSlider.h
  45. 43 43
      SBansheeEditor/Include/BsScriptHandleSliderDisc.h
  46. 41 41
      SBansheeEditor/Include/BsScriptHandleSliderLine.h
  47. 41 41
      SBansheeEditor/Include/BsScriptHandleSliderPlane.h
  48. 156 156
      SBansheeEditor/Include/BsScriptModalWindow.h
  49. 144 144
      SBansheeEditor/Include/BsScriptOSDropTarget.h
  50. 33 33
      SBansheeEditor/Include/BsScriptSceneViewHandler.h
  51. 213 213
      SBansheeEditor/Source/BsScriptDropDownWindow.cpp
  52. 6 6
      SBansheeEditor/Source/BsScriptEditorWindow.cpp
  53. 88 88
      SBansheeEditor/Source/BsScriptGUIColorField.cpp
  54. 210 210
      SBansheeEditor/Source/BsScriptGUIEnumField.cpp
  55. 110 110
      SBansheeEditor/Source/BsScriptGUIFloatField.cpp
  56. 124 124
      SBansheeEditor/Source/BsScriptGUIGameObjectField.cpp
  57. 110 110
      SBansheeEditor/Source/BsScriptGUIIntField.cpp
  58. 189 189
      SBansheeEditor/Source/BsScriptGUIListBoxField.cpp
  59. 152 152
      SBansheeEditor/Source/BsScriptGUIResourceField.cpp
  60. 98 98
      SBansheeEditor/Source/BsScriptGUISliderField.cpp
  61. 116 116
      SBansheeEditor/Source/BsScriptGUITextField.cpp
  62. 137 137
      SBansheeEditor/Source/BsScriptGUITextureField.cpp
  63. 88 88
      SBansheeEditor/Source/BsScriptGUIToggleField.cpp
  64. 103 103
      SBansheeEditor/Source/BsScriptGUIVector2Field.cpp
  65. 103 103
      SBansheeEditor/Source/BsScriptGUIVector3Field.cpp
  66. 103 103
      SBansheeEditor/Source/BsScriptGUIVector4Field.cpp
  67. 82 82
      SBansheeEditor/Source/BsScriptGizmos.cpp
  68. 95 95
      SBansheeEditor/Source/BsScriptHandleDrawing.cpp
  69. 82 82
      SBansheeEditor/Source/BsScriptHandleSlider.cpp
  70. 56 56
      SBansheeEditor/Source/BsScriptHandleSliderDisc.cpp
  71. 44 44
      SBansheeEditor/Source/BsScriptHandleSliderLine.cpp
  72. 44 44
      SBansheeEditor/Source/BsScriptHandleSliderPlane.cpp
  73. 271 271
      SBansheeEditor/Source/BsScriptModalWindow.cpp
  74. 237 237
      SBansheeEditor/Source/BsScriptOSDropTarget.cpp
  75. 79 79
      SBansheeEditor/Source/BsScriptSceneViewHandler.cpp

+ 129 - 129
MBansheeEditor/DropDownWindow.cs

@@ -1,129 +1,129 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Base class for all drop down window implementations. Drop down windows are temporary windows that open above all
-    /// other GUI, and close as soon user clicks outside of them.
-    /// </summary>
-    public class DropDownWindow : ScriptObject
-    {
-        private int width;
-        private int height;
-
-        /// <summary>
-        /// Width of the window in pixels.
-        /// </summary>
-        public int Width
-        {
-            get { return width; }
-            set { Internal_SetWidth(mCachedPtr, value); width = value; }
-        }
-
-        /// <summary>
-        /// Height of the window in pixels.
-        /// </summary>
-        public int Height
-        {
-            get { return height; }
-            set { Internal_SetHeight(mCachedPtr, value); height = value; }
-        }
-
-        protected GUIPanel GUI;
-
-        /// <summary>
-        /// Opens a new drop down window at the specified location.
-        /// </summary>
-        /// <typeparam name="T">Type of the drop down window to open.</typeparam>
-        /// <param name="parent">Parent editor window to open the drop down window in.</param>
-        /// <param name="position">Position relative to the parent editor window at which to open the drop down window.
-        ///                        </param>
-        /// <returns>Instance of the opened drop down window.</returns>
-        public static T Open<T>(EditorWindow parent, Vector2I position) where T : DropDownWindow, new()
-        {
-            T window = new T();
-            window.Initialize(parent, position);
-
-            return window;
-        }
-
-        /// <summary>
-        /// Constructs a new drop down window.
-        /// </summary>
-        /// <param name="width">Width of the window in pixels.</param>
-        /// <param name="height">Height of the window in pixels.</param>
-        protected DropDownWindow(int width = 200, int height = 200)
-        {
-            this.width = width;
-            this.height = height;
-        }
-
-        /// <summary>
-        /// Initializes the drop down window after construction. Must be called before use.
-        /// </summary>
-        /// <param name="parent">Parent editor window to open the drop down window in.</param>
-        /// <param name="position">Position relative to the parent editor window at which to open the drop down window.
-        ///                        </param>
-        private void Initialize(EditorWindow parent, Vector2I position)
-        {
-            IntPtr parentPtr = IntPtr.Zero;
-            if (parent != null)
-                parentPtr = parent.GetCachedPtr();
-
-            Internal_CreateInstance(this, parentPtr, position, width, height);
-        }
-
-        /// <summary>
-        /// Converts coordinates in screen space to coordinates relative to the drop down window.
-        /// </summary>
-        /// <param name="screenPos">Coordinates in screen space.</param>
-        /// <returns>Coordinates relative to the drop down window.</returns>
-        protected Vector2I ScreenToWindowPos(Vector2I screenPos)
-        {
-            Vector2I windowPos;
-            Internal_ScreenToWindowPos(mCachedPtr, screenPos, out windowPos);
-            return windowPos;
-        }
-
-        /// <summary>
-        /// Converts coordinates relative to the drop down window to screen space to coordinates.
-        /// </summary>
-        /// <param name="windowPos">Coordinates relative to the drop down window.</param>
-        /// <returns>Coordinates in screen space.</returns>
-        protected Vector2I WindowToScreenPos(Vector2I windowPos)
-        {
-            Vector2I screenPos;
-            Internal_WindowToScreenPos(mCachedPtr, windowPos, out screenPos);
-            return screenPos;
-        }
-
-        /// <summary>
-        /// Closes the drop down window.
-        /// </summary>
-        protected void Close()
-        {
-            Internal_Close(mCachedPtr);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(DropDownWindow instance, IntPtr parentWindow, Vector2I position, int width, int height);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Close(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetWidth(IntPtr nativeInstance, int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetHeight(IntPtr nativeInstance, int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ScreenToWindowPos(IntPtr nativeInstance, Vector2I position, out Vector2I windowPos);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_WindowToScreenPos(IntPtr nativeInstance, Vector2I position, out Vector2I screenPos);
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Base class for all drop down window implementations. Drop down windows are temporary windows that open above all
+    /// other GUI, and close as soon user clicks outside of them.
+    /// </summary>
+    public class DropDownWindow : ScriptObject
+    {
+        private int width;
+        private int height;
+
+        /// <summary>
+        /// Width of the window in pixels.
+        /// </summary>
+        public int Width
+        {
+            get { return width; }
+            set { Internal_SetWidth(mCachedPtr, value); width = value; }
+        }
+
+        /// <summary>
+        /// Height of the window in pixels.
+        /// </summary>
+        public int Height
+        {
+            get { return height; }
+            set { Internal_SetHeight(mCachedPtr, value); height = value; }
+        }
+
+        protected GUIPanel GUI;
+
+        /// <summary>
+        /// Opens a new drop down window at the specified location.
+        /// </summary>
+        /// <typeparam name="T">Type of the drop down window to open.</typeparam>
+        /// <param name="parent">Parent editor window to open the drop down window in.</param>
+        /// <param name="position">Position relative to the parent editor window at which to open the drop down window.
+        ///                        </param>
+        /// <returns>Instance of the opened drop down window.</returns>
+        public static T Open<T>(EditorWindow parent, Vector2I position) where T : DropDownWindow, new()
+        {
+            T window = new T();
+            window.Initialize(parent, position);
+
+            return window;
+        }
+
+        /// <summary>
+        /// Constructs a new drop down window.
+        /// </summary>
+        /// <param name="width">Width of the window in pixels.</param>
+        /// <param name="height">Height of the window in pixels.</param>
+        protected DropDownWindow(int width = 200, int height = 200)
+        {
+            this.width = width;
+            this.height = height;
+        }
+
+        /// <summary>
+        /// Initializes the drop down window after construction. Must be called before use.
+        /// </summary>
+        /// <param name="parent">Parent editor window to open the drop down window in.</param>
+        /// <param name="position">Position relative to the parent editor window at which to open the drop down window.
+        ///                        </param>
+        private void Initialize(EditorWindow parent, Vector2I position)
+        {
+            IntPtr parentPtr = IntPtr.Zero;
+            if (parent != null)
+                parentPtr = parent.GetCachedPtr();
+
+            Internal_CreateInstance(this, parentPtr, ref position, width, height);
+        }
+
+        /// <summary>
+        /// Converts coordinates in screen space to coordinates relative to the drop down window.
+        /// </summary>
+        /// <param name="screenPos">Coordinates in screen space.</param>
+        /// <returns>Coordinates relative to the drop down window.</returns>
+        protected Vector2I ScreenToWindowPos(Vector2I screenPos)
+        {
+            Vector2I windowPos;
+            Internal_ScreenToWindowPos(mCachedPtr, ref screenPos, out windowPos);
+            return windowPos;
+        }
+
+        /// <summary>
+        /// Converts coordinates relative to the drop down window to screen space to coordinates.
+        /// </summary>
+        /// <param name="windowPos">Coordinates relative to the drop down window.</param>
+        /// <returns>Coordinates in screen space.</returns>
+        protected Vector2I WindowToScreenPos(Vector2I windowPos)
+        {
+            Vector2I screenPos;
+            Internal_WindowToScreenPos(mCachedPtr, ref windowPos, out screenPos);
+            return screenPos;
+        }
+
+        /// <summary>
+        /// Closes the drop down window.
+        /// </summary>
+        protected void Close()
+        {
+            Internal_Close(mCachedPtr);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(DropDownWindow instance, IntPtr parentWindow, ref Vector2I position, int width, int height);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_Close(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetWidth(IntPtr nativeInstance, int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetHeight(IntPtr nativeInstance, int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_ScreenToWindowPos(IntPtr nativeInstance, ref Vector2I position, out Vector2I windowPos);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_WindowToScreenPos(IntPtr nativeInstance, ref Vector2I position, out Vector2I screenPos);
+    }
+}

+ 4 - 4
MBansheeEditor/EditorWindow.cs

@@ -62,7 +62,7 @@ namespace BansheeEditor
         public Vector2I ScreenToWindowPos(Vector2I screenPos)
         public Vector2I ScreenToWindowPos(Vector2I screenPos)
         {
         {
             Vector2I windowPos;
             Vector2I windowPos;
-            Internal_ScreenToWindowPos(mCachedPtr, screenPos, out windowPos);
+            Internal_ScreenToWindowPos(mCachedPtr, ref screenPos, out windowPos);
             return windowPos;
             return windowPos;
         }
         }
 
 
@@ -74,7 +74,7 @@ namespace BansheeEditor
         public Vector2I WindowToScreenPos(Vector2I windowPos)
         public Vector2I WindowToScreenPos(Vector2I windowPos)
         {
         {
             Vector2I screenPos;
             Vector2I screenPos;
-            Internal_WindowToScreenPos(mCachedPtr, windowPos, out screenPos);
+            Internal_WindowToScreenPos(mCachedPtr, ref windowPos, out screenPos);
             return screenPos;
             return screenPos;
         }
         }
 
 
@@ -122,9 +122,9 @@ namespace BansheeEditor
         private static extern bool Internal_HasFocus(IntPtr nativeInstance);
         private static extern bool Internal_HasFocus(IntPtr nativeInstance);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ScreenToWindowPos(IntPtr nativeInstance, Vector2I position, out Vector2I windowPos);
+        private static extern void Internal_ScreenToWindowPos(IntPtr nativeInstance, ref Vector2I position, out Vector2I windowPos);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_WindowToScreenPos(IntPtr nativeInstance, Vector2I position, out Vector2I screenPos);
+        private static extern void Internal_WindowToScreenPos(IntPtr nativeInstance, ref Vector2I position, out Vector2I screenPos);
     }
     }
 }
 }

+ 112 - 112
MBansheeEditor/GUI/GUIColorField.cs

@@ -1,112 +1,112 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a color and an optional label. Allows the user to select a color using the color 
-    /// picker.
-    /// </summary>
-    public sealed class GUIColorField : GUIElement
-    {
-        public delegate void OnChangedDelegate(Color newValue);
-
-        /// <summary>
-        /// Triggered when the color in the field changes.
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// Color displayed by the field.
-        /// </summary>
-        public Color Value
-        {
-            get
-            {
-                Color value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new color field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIColorField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new color field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIColorField(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered when the user closes the color picker window.
-        /// </summary>
-        /// <param name="selected">True if the user confirms color selection, false if he cancels.</param>
-        /// <param name="color">Newly selected color.</param>
-        private void ColorPickerClosed(bool selected, Color color)
-        {
-            if (!selected)
-                return;
-
-            if (Value != color)
-            {
-                Value = color;
-
-                if(OnChanged != null)
-                    OnChanged(color);
-            }
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the user clicks on the color field.
-        /// </summary>
-        private void Internal_DoOnClicked()
-        {
-            ColorPicker.Show(Value, ColorPickerClosed);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIColorField instance, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out Color value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, Color value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a color and an optional label. Allows the user to select a color using the color 
+    /// picker.
+    /// </summary>
+    public sealed class GUIColorField : GUIElement
+    {
+        public delegate void OnChangedDelegate(Color newValue);
+
+        /// <summary>
+        /// Triggered when the color in the field changes.
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// Color displayed by the field.
+        /// </summary>
+        public Color Value
+        {
+            get
+            {
+                Color value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, ref value); }
+        }
+
+        /// <summary>
+        /// Creates a new color field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIColorField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new color field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIColorField(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered when the user closes the color picker window.
+        /// </summary>
+        /// <param name="selected">True if the user confirms color selection, false if he cancels.</param>
+        /// <param name="color">Newly selected color.</param>
+        private void ColorPickerClosed(bool selected, Color color)
+        {
+            if (!selected)
+                return;
+
+            if (Value != color)
+            {
+                Value = color;
+
+                if(OnChanged != null)
+                    OnChanged(color);
+            }
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the user clicks on the color field.
+        /// </summary>
+        private void Internal_DoOnClicked()
+        {
+            ColorPicker.Show(Value, ColorPickerClosed);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIColorField instance, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out Color value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, ref Color value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 197 - 197
MBansheeEditor/GUI/GUIEnumField.cs

@@ -1,197 +1,197 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a list box with elements of an enumeration and an optional label.
-    /// </summary>
-    public sealed class GUIEnumField : GUIElement
-    {
-        public delegate void OnSelectionChangedDelegate(UInt64 value);
-
-        /// <summary>
-        /// Triggered whenever user selects a new element in the list box. Returns the value of the enumeration entry that 
-        /// was selected.
-        /// </summary>
-        public event OnSelectionChangedDelegate OnSelectionChanged;
-
-        /// <summary>
-        /// Value of the enumeration entry currently selected. This is a combination of all selected values in case a
-        /// multiselect list is used.
-        /// </summary>
-        public UInt64 Value
-        {
-            get { return Internal_GetValue(mCachedPtr); }
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// States of all element in the list box (enabled or disabled).
-        /// </summary>
-        public bool[] States
-        {
-            get { return Internal_GetElementStates(mCachedPtr); }
-            set { Internal_SetElementStates(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new list box with enumeration entries as its elements and a label.
-        /// </summary>
-        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIEnumField(Type enumType, bool multiselect, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect,
-                title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new list box with enumeration entries as its elements and a label.
-        /// </summary>
-        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIEnumField(Type enumType, bool multiselect, GUIContent title, int titleWidth, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect,
-                title, titleWidth, "", options, true);
-        }
-
-        /// <summary>
-        /// Creates a new single selection list box with enumeration entries as its elements and a label.
-        /// </summary>
-        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIEnumField(Type enumType, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), false,
-                title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new single selection list box with enumeration entries as its elements and a label.
-        /// </summary>
-        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIEnumField(Type enumType, GUIContent title, int titleWidth, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), false, 
-                title, titleWidth, "", options, true);
-        }
-
-        /// <summary>
-        /// Creates a new list box with enumeration entries as its elements and no label.
-        /// </summary>
-        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIEnumField(Type enumType, bool multiselect, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect, 
-                null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Creates a new list box with enumeration entries as its elements and no label.
-        /// </summary>
-        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIEnumField(Type enumType, bool multiselect = false, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect, 
-                null, 0, "", options, false);
-        }
-
-        /// <summary>
-        /// Makes the element with the specified index selected.
-        /// </summary>
-        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
-        public void SelectElement(int idx)
-        {
-            Internal_SelectElement(mCachedPtr, idx);
-        }
-
-        /// <summary>
-        /// Deselect element the element with the specified index. Only relevant for multi-select list boxes.
-        /// </summary>
-        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
-        public void DeselectElement(int idx)
-        {
-            Internal_DeselectElement(mCachedPtr, idx);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when a user selects an object in the list.
-        /// </summary>
-        private void DoOnSelectionChanged(UInt64 index)
-        {
-            if (OnSelectionChanged != null)
-                OnSelectionChanged(index);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIEnumField instance, string[] names, Array values, 
-            bool multiselect, GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern UInt64 Internal_GetValue(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, UInt64 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool[] Internal_GetElementStates(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetElementStates(IntPtr nativeInstance, bool[] states);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SelectElement(IntPtr nativeInstance, int idx);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DeselectElement(IntPtr nativeInstance, int idx);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a list box with elements of an enumeration and an optional label.
+    /// </summary>
+    public sealed class GUIEnumField : GUIElement
+    {
+        public delegate void OnSelectionChangedDelegate(UInt64 value);
+
+        /// <summary>
+        /// Triggered whenever user selects a new element in the list box. Returns the value of the enumeration entry that 
+        /// was selected.
+        /// </summary>
+        public event OnSelectionChangedDelegate OnSelectionChanged;
+
+        /// <summary>
+        /// Value of the enumeration entry currently selected. This is a combination of all selected values in case a
+        /// multiselect list is used.
+        /// </summary>
+        public UInt64 Value
+        {
+            get { return Internal_GetValue(mCachedPtr); }
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// States of all element in the list box (enabled or disabled).
+        /// </summary>
+        public bool[] States
+        {
+            get { return Internal_GetElementStates(mCachedPtr); }
+            set { Internal_SetElementStates(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new list box with enumeration entries as its elements and a label.
+        /// </summary>
+        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIEnumField(Type enumType, bool multiselect, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect,
+                title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new list box with enumeration entries as its elements and a label.
+        /// </summary>
+        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIEnumField(Type enumType, bool multiselect, GUIContent title, int titleWidth, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect,
+                title, titleWidth, "", options, true);
+        }
+
+        /// <summary>
+        /// Creates a new single selection list box with enumeration entries as its elements and a label.
+        /// </summary>
+        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIEnumField(Type enumType, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), false,
+                title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new single selection list box with enumeration entries as its elements and a label.
+        /// </summary>
+        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIEnumField(Type enumType, GUIContent title, int titleWidth, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), false, 
+                title, titleWidth, "", options, true);
+        }
+
+        /// <summary>
+        /// Creates a new list box with enumeration entries as its elements and no label.
+        /// </summary>
+        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIEnumField(Type enumType, bool multiselect, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect, 
+                null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Creates a new list box with enumeration entries as its elements and no label.
+        /// </summary>
+        /// <param name="enumType">Type of enum of whose entries to display in the list box.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIEnumField(Type enumType, bool multiselect = false, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect, 
+                null, 0, "", options, false);
+        }
+
+        /// <summary>
+        /// Makes the element with the specified index selected.
+        /// </summary>
+        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
+        public void SelectElement(int idx)
+        {
+            Internal_SelectElement(mCachedPtr, idx);
+        }
+
+        /// <summary>
+        /// Deselect element the element with the specified index. Only relevant for multi-select list boxes.
+        /// </summary>
+        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
+        public void DeselectElement(int idx)
+        {
+            Internal_DeselectElement(mCachedPtr, idx);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when a user selects an object in the list.
+        /// </summary>
+        private void DoOnSelectionChanged(UInt64 index)
+        {
+            if (OnSelectionChanged != null)
+                OnSelectionChanged(index);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIEnumField instance, string[] names, Array values, 
+            bool multiselect, GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern UInt64 Internal_GetValue(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, UInt64 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern bool[] Internal_GetElementStates(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetElementStates(IntPtr nativeInstance, bool[] states);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SelectElement(IntPtr nativeInstance, int idx);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DeselectElement(IntPtr nativeInstance, int idx);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 137 - 137
MBansheeEditor/GUI/GUIFloatField.cs

@@ -1,137 +1,137 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a floating point input field and an optional label.
-    /// </summary>
-    public sealed class GUIFloatField : GUIElement
-    {
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event Action<float> OnChanged;
-
-        /// <summary>
-        /// Triggered whenever user confirms input.
-        /// </summary>
-        public event Action OnConfirmed;
-
-        /// <summary>
-        /// Value displayed by the field input box.
-        /// </summary>
-        public float Value
-        {
-            get
-            {
-                float value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <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>
-        /// Creates a new float field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIFloatField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new float field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIFloatField(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
-        /// is not required.
-        /// </summary>
-        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
-        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
-        public void SetRange(float min, float max)
-        {
-            Internal_SetRange(mCachedPtr, min, max);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the float field changes.
-        /// </summary>
-        /// <param name="newValue">New value of the float field.</param>
-        private void Internal_DoOnChanged(float newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the user confirms the input.
-        /// </summary>
-        private void Internal_DoOnConfirmed()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIFloatField instance, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a floating point input field and an optional label.
+    /// </summary>
+    public sealed class GUIFloatField : GUIElement
+    {
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event Action<float> OnChanged;
+
+        /// <summary>
+        /// Triggered whenever user confirms input.
+        /// </summary>
+        public event Action OnConfirmed;
+
+        /// <summary>
+        /// Value displayed by the field input box.
+        /// </summary>
+        public float Value
+        {
+            get
+            {
+                float value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <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>
+        /// Creates a new float field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIFloatField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new float field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIFloatField(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
+        /// is not required.
+        /// </summary>
+        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
+        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
+        public void SetRange(float min, float max)
+        {
+            Internal_SetRange(mCachedPtr, min, max);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the float field changes.
+        /// </summary>
+        /// <param name="newValue">New value of the float field.</param>
+        private void Internal_DoOnChanged(float newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the user confirms the input.
+        /// </summary>
+        private void Internal_DoOnConfirmed()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIFloatField instance, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out float value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, float value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
+    }
+}

+ 97 - 97
MBansheeEditor/GUI/GUIGameObjectField.cs

@@ -1,97 +1,97 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a reference to a <see cref="GameObject"/> and an optional label. Game objects can
-    /// be dragged and dropped onto the field to update the reference.
-    /// </summary>
-    public sealed class GUIGameObjectField : GUIElement
-    {
-        public delegate void OnChangedDelegate(GameObject newValue);
-
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// <see cref="GameObject"/> referenced by the field.
-        /// </summary>
-        public GameObject Value
-        {
-            get
-            {
-                GameObject value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new game object field element with a label.
-        /// </summary>
-        /// <param name="type">Specific type of <see cref="GameObject"/> this field accepts.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIGameObjectField(Type type, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, type, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new game object field element without a label.
-        /// </summary>
-        /// <param name="type">Specific type of <see cref="GameObject"/> this field accepts.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIGameObjectField(Type type, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, type, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the field changes.
-        /// </summary>
-        /// <param name="newValue">New game object referenced by the field.</param>
-        private void DoOnChanged(GameObject newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIGameObjectField instance, Type type, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out GameObject value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, GameObject value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a reference to a <see cref="GameObject"/> and an optional label. Game objects can
+    /// be dragged and dropped onto the field to update the reference.
+    /// </summary>
+    public sealed class GUIGameObjectField : GUIElement
+    {
+        public delegate void OnChangedDelegate(GameObject newValue);
+
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// <see cref="GameObject"/> referenced by the field.
+        /// </summary>
+        public GameObject Value
+        {
+            get
+            {
+                GameObject value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new game object field element with a label.
+        /// </summary>
+        /// <param name="type">Specific type of <see cref="GameObject"/> this field accepts.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIGameObjectField(Type type, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, type, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new game object field element without a label.
+        /// </summary>
+        /// <param name="type">Specific type of <see cref="GameObject"/> this field accepts.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIGameObjectField(Type type, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, type, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the field changes.
+        /// </summary>
+        /// <param name="newValue">New game object referenced by the field.</param>
+        private void DoOnChanged(GameObject newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIGameObjectField instance, Type type, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out GameObject value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, GameObject value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 137 - 137
MBansheeEditor/GUI/GUIIntField.cs

@@ -1,137 +1,137 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a integer input field and an optional label.
-    /// </summary>
-    public sealed class GUIIntField : GUIElement
-    {
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event Action<int> OnChanged;
-
-        /// <summary>
-        /// Triggered whenever user confirms input.
-        /// </summary>
-        public event Action OnConfirmed;
-
-        /// <summary>
-        /// Value displayed by the field input box.
-        /// </summary>
-        public int Value
-        {
-            get
-            {
-                int value; 
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <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>
-        /// Creates a new integer field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIIntField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new integer field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIIntField(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
-        /// is not required.
-        /// </summary>
-        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
-        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
-        public void SetRange(int min, int max)
-        {
-            Internal_SetRange(mCachedPtr, min, max);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the float field changes.
-        /// </summary>
-        /// <param name="newValue">New value of the float field.</param>
-        private void Internal_DoOnChanged(int newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the user confirms the input.
-        /// </summary>
-        private void Internal_DoOnConfirmed()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIIntField instance, GUIContent title, int titleWidth, 
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRange(IntPtr nativeInstance, int min, int max);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a integer input field and an optional label.
+    /// </summary>
+    public sealed class GUIIntField : GUIElement
+    {
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event Action<int> OnChanged;
+
+        /// <summary>
+        /// Triggered whenever user confirms input.
+        /// </summary>
+        public event Action OnConfirmed;
+
+        /// <summary>
+        /// Value displayed by the field input box.
+        /// </summary>
+        public int Value
+        {
+            get
+            {
+                int value; 
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <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>
+        /// Creates a new integer field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIIntField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new integer field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIIntField(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
+        /// is not required.
+        /// </summary>
+        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
+        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
+        public void SetRange(int min, int max)
+        {
+            Internal_SetRange(mCachedPtr, min, max);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the float field changes.
+        /// </summary>
+        /// <param name="newValue">New value of the float field.</param>
+        private void Internal_DoOnChanged(int newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the user confirms the input.
+        /// </summary>
+        private void Internal_DoOnConfirmed()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIIntField instance, GUIContent title, int titleWidth, 
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetRange(IntPtr nativeInstance, int min, int max);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 339 - 339
MBansheeEditor/GUI/GUIListBoxField.cs

@@ -1,339 +1,339 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a list box with user-specified elements and an optional label. List box can be
-    /// a standard list-box that allows a single element to be selected, or a multi-select list box where any number of
-    /// elements can be selected at the same time.
-    /// </summary>
-    public sealed class GUIListBoxField : GUIElement
-    {
-        public delegate void OnSelectionChangedDelegate(int index);
-
-        /// <summary>
-        /// Triggered whenever user selects a new element in the list box. Returned index maps to the element in the
-        /// elements array that the list box was initialized with.
-        /// </summary>
-        public event OnSelectionChangedDelegate OnSelectionChanged;
-
-        /// <summary>
-        /// Index of the list box entry currently selected.
-        /// </summary>
-        public int Index
-        {
-            get { return Internal_GetValue(mCachedPtr); }
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// States of all element in the list box (enabled or disabled).
-        /// </summary>
-        public bool[] States
-        {
-            get { return Internal_GetElementStates(mCachedPtr); }
-            set { Internal_SetElementStates(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(LocString[] elements, bool multiselect, GUIContent title, int titleWidth, string style = "",
-            params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, elements, multiselect, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(LocString[] elements, bool multiselect, GUIContent title, int titleWidth = 100, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, elements, multiselect, title, titleWidth, "", options, true);
-        }
-
-        /// <summary>
-        /// Creates a new single-selection list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(LocString[] elements, GUIContent title, int titleWidth, string style = "", 
-            params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, elements, false, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new single-selection list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(LocString[] elements, GUIContent title, int titleWidth = 100, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, elements, false, title, titleWidth, "", options, true);
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and no label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(LocString[] elements, bool multiselect = false, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, elements, multiselect, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and no label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(LocString[] elements, bool multiselect = false, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, elements, multiselect, null, 0, "", options, false);
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(string[] elements, bool multiselect, GUIContent title, int titleWidth, string style = "",
-            params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(string[] elements, bool multiselect, GUIContent title, int titleWidth = 100, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, title, titleWidth, "", options, true);
-        }
-
-        /// <summary>
-        /// Creates a new single-selection list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(string[] elements, GUIContent title, int titleWidth, string style = "",
-            params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), false, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new single-selection list box with the specified elements and a label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(string[] elements, GUIContent title, int titleWidth = 100, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), false, title, titleWidth, "", options, true);
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and no label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(string[] elements, bool multiselect = false, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Creates a new list box with the specified elements and no label.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
-        ///                           </param>
-        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIListBoxField(string[] elements, bool multiselect = false, params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, null, 0, "", options, false);
-        }
-
-        /// <summary>
-        /// Updates the list box with a new set of elements.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        public void SetElements(LocString[] elements)
-        {
-            Internal_SetElements(mCachedPtr, elements);
-        }
-
-        /// <summary>
-        /// Updates the list box with a new set of elements.
-        /// </summary>
-        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
-        ///                        order as in the array.</param>
-        public void SetElements(string[] elements)
-        {
-            Internal_SetElements(mCachedPtr, ToLocalizedElements(elements));
-        }
-
-        /// <summary>
-        /// Makes the element with the specified index selected.
-        /// </summary>
-        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
-        public void SelectElement(int idx)
-        {
-            Internal_SelectElement(mCachedPtr, idx);
-        }
-
-        /// <summary>
-        /// Deselect element the element with the specified index. Only relevant for multi-select list boxes.
-        /// </summary>
-        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
-        public void DeselectElement(int idx)
-        {
-            Internal_DeselectElement(mCachedPtr, idx);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Converts a set of normal strings to a set of localized strings.
-        /// </summary>
-        /// <param name="elements">Strings to convert.</param>
-        /// <returns>Localized strings created from input strings.</returns>
-        private LocString[] ToLocalizedElements(string[] elements)
-        {
-            if (elements == null)
-                return null;
-
-            LocString[] locElements = new LocString[elements.Length];
-            for (int i = 0; i < locElements.Length; i++)
-                locElements[i] = elements[i];
-
-            return locElements;
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when a user selects an object in the list.
-        /// </summary>
-        private void DoOnSelectionChanged(int index)
-        {
-            if (OnSelectionChanged != null)
-                OnSelectionChanged(index);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIListBoxField instance, LocString[] entries, bool multiselect,
-            GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetElements(IntPtr nativeInstance, LocString[] elements);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetValue(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool[] Internal_GetElementStates(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetElementStates(IntPtr nativeInstance, bool[] states);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SelectElement(IntPtr nativeInstance, int idx);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DeselectElement(IntPtr nativeInstance, int idx);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a list box with user-specified elements and an optional label. List box can be
+    /// a standard list-box that allows a single element to be selected, or a multi-select list box where any number of
+    /// elements can be selected at the same time.
+    /// </summary>
+    public sealed class GUIListBoxField : GUIElement
+    {
+        public delegate void OnSelectionChangedDelegate(int index);
+
+        /// <summary>
+        /// Triggered whenever user selects a new element in the list box. Returned index maps to the element in the
+        /// elements array that the list box was initialized with.
+        /// </summary>
+        public event OnSelectionChangedDelegate OnSelectionChanged;
+
+        /// <summary>
+        /// Index of the list box entry currently selected.
+        /// </summary>
+        public int Index
+        {
+            get { return Internal_GetValue(mCachedPtr); }
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// States of all element in the list box (enabled or disabled).
+        /// </summary>
+        public bool[] States
+        {
+            get { return Internal_GetElementStates(mCachedPtr); }
+            set { Internal_SetElementStates(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(LocString[] elements, bool multiselect, GUIContent title, int titleWidth, string style = "",
+            params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, elements, multiselect, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(LocString[] elements, bool multiselect, GUIContent title, int titleWidth = 100, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, elements, multiselect, title, titleWidth, "", options, true);
+        }
+
+        /// <summary>
+        /// Creates a new single-selection list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(LocString[] elements, GUIContent title, int titleWidth, string style = "", 
+            params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, elements, false, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new single-selection list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(LocString[] elements, GUIContent title, int titleWidth = 100, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, elements, false, title, titleWidth, "", options, true);
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and no label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(LocString[] elements, bool multiselect = false, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, elements, multiselect, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and no label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(LocString[] elements, bool multiselect = false, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, elements, multiselect, null, 0, "", options, false);
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(string[] elements, bool multiselect, GUIContent title, int titleWidth, string style = "",
+            params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(string[] elements, bool multiselect, GUIContent title, int titleWidth = 100, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, title, titleWidth, "", options, true);
+        }
+
+        /// <summary>
+        /// Creates a new single-selection list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(string[] elements, GUIContent title, int titleWidth, string style = "",
+            params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, ToLocalizedElements(elements), false, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new single-selection list box with the specified elements and a label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(string[] elements, GUIContent title, int titleWidth = 100, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, ToLocalizedElements(elements), false, title, titleWidth, "", options, true);
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and no label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(string[] elements, bool multiselect = false, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Creates a new list box with the specified elements and no label.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        /// <param name="multiselect">Determines should the listbox allow multiple elements to be selected or just one.
+        ///                           </param>
+        /// <param name="options">Options that allow you to control how is the element positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIListBoxField(string[] elements, bool multiselect = false, params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, null, 0, "", options, false);
+        }
+
+        /// <summary>
+        /// Updates the list box with a new set of elements.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        public void SetElements(LocString[] elements)
+        {
+            Internal_SetElements(mCachedPtr, elements);
+        }
+
+        /// <summary>
+        /// Updates the list box with a new set of elements.
+        /// </summary>
+        /// <param name="elements">Array of elements to display in the list box. Elements will be displayed in the same 
+        ///                        order as in the array.</param>
+        public void SetElements(string[] elements)
+        {
+            Internal_SetElements(mCachedPtr, ToLocalizedElements(elements));
+        }
+
+        /// <summary>
+        /// Makes the element with the specified index selected.
+        /// </summary>
+        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
+        public void SelectElement(int idx)
+        {
+            Internal_SelectElement(mCachedPtr, idx);
+        }
+
+        /// <summary>
+        /// Deselect element the element with the specified index. Only relevant for multi-select list boxes.
+        /// </summary>
+        /// <param name="idx">Sequential index in the elements array provided on construction.</param>
+        public void DeselectElement(int idx)
+        {
+            Internal_DeselectElement(mCachedPtr, idx);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Converts a set of normal strings to a set of localized strings.
+        /// </summary>
+        /// <param name="elements">Strings to convert.</param>
+        /// <returns>Localized strings created from input strings.</returns>
+        private LocString[] ToLocalizedElements(string[] elements)
+        {
+            if (elements == null)
+                return null;
+
+            LocString[] locElements = new LocString[elements.Length];
+            for (int i = 0; i < locElements.Length; i++)
+                locElements[i] = elements[i];
+
+            return locElements;
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when a user selects an object in the list.
+        /// </summary>
+        private void DoOnSelectionChanged(int index)
+        {
+            if (OnSelectionChanged != null)
+                OnSelectionChanged(index);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIListBoxField instance, LocString[] entries, bool multiselect,
+            GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetElements(IntPtr nativeInstance, LocString[] elements);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern int Internal_GetValue(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern bool[] Internal_GetElementStates(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetElementStates(IntPtr nativeInstance, bool[] states);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SelectElement(IntPtr nativeInstance, int idx);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DeselectElement(IntPtr nativeInstance, int idx);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 119 - 119
MBansheeEditor/GUI/GUIResourceField.cs

@@ -1,119 +1,119 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a reference to a <see cref="Resource"/> and an optional label. Resources can
-    /// be dragged and dropped onto the field to update the reference.
-    /// </summary>
-    public sealed class GUIResourceField : GUIElement
-    {
-        public delegate void OnChangedDelegate(ResourceRef newValue);
-
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// <see cref="Resource"/> referenced by the field. This will load the resource if it is not already loaded. Use
-        /// <see cref="ValueRef"/> if you don't require a loaded resource.
-        /// </summary>
-        public Resource Value
-        {
-            get
-            {
-                Resource value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Reference to the <see cref="Resource"/> referenced by the field.
-        /// </summary>
-        public ResourceRef ValueRef
-        {
-            get
-            {
-                ResourceRef value;
-                Internal_GetValueRef(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValueRef(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new resource field element with a label.
-        /// </summary>
-        /// <param name="type">Specific type of <see cref="Resource"/> this field accepts.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIResourceField(Type type, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, type, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new resource field element without a label.
-        /// </summary>
-        /// <param name="type">Specific type of <see cref="Resource"/> this field accepts.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIResourceField(Type type, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, type, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the field changes.
-        /// </summary>
-        /// <param name="newValue">New resource referenced by the field.</param>
-        private void DoOnChanged(ResourceRef newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIResourceField instance, Type type, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out Resource value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, Resource value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValueRef(IntPtr nativeInstance, out ResourceRef value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValueRef(IntPtr nativeInstance, ResourceRef value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a reference to a <see cref="Resource"/> and an optional label. Resources can
+    /// be dragged and dropped onto the field to update the reference.
+    /// </summary>
+    public sealed class GUIResourceField : GUIElement
+    {
+        public delegate void OnChangedDelegate(ResourceRef newValue);
+
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// <see cref="Resource"/> referenced by the field. This will load the resource if it is not already loaded. Use
+        /// <see cref="ValueRef"/> if you don't require a loaded resource.
+        /// </summary>
+        public Resource Value
+        {
+            get
+            {
+                Resource value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Reference to the <see cref="Resource"/> referenced by the field.
+        /// </summary>
+        public ResourceRef ValueRef
+        {
+            get
+            {
+                ResourceRef value;
+                Internal_GetValueRef(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValueRef(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new resource field element with a label.
+        /// </summary>
+        /// <param name="type">Specific type of <see cref="Resource"/> this field accepts.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIResourceField(Type type, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, type, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new resource field element without a label.
+        /// </summary>
+        /// <param name="type">Specific type of <see cref="Resource"/> this field accepts.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIResourceField(Type type, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, type, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the field changes.
+        /// </summary>
+        /// <param name="newValue">New resource referenced by the field.</param>
+        private void DoOnChanged(ResourceRef newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIResourceField instance, Type type, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out Resource value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, Resource value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValueRef(IntPtr nativeInstance, out ResourceRef value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValueRef(IntPtr nativeInstance, ResourceRef value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 119 - 119
MBansheeEditor/GUI/GUISliderField.cs

@@ -1,119 +1,119 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a slider with floating point input field and an optional label.
-    /// </summary>
-    public sealed class GUISliderField : GUIElement
-    {
-        public delegate void OnChangedDelegate(float newValue);
-
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// Value displayed by the field input box.
-        /// </summary>
-        public float Value
-        {
-            get { return Internal_GetValue(mCachedPtr); }
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new slider field element with a label.
-        /// </summary>
-        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
-        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUISliderField(float min, float max, GUIContent title, int titleWidth = 100, 
-            string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, min, max, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new slider field element without a label.
-        /// </summary>
-        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
-        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUISliderField(float min, float max, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, min, max, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
-        /// is not required.
-        /// </summary>
-        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
-        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
-        public void SetRange(float min, float max)
-        {
-            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>
-        /// <param name="newValue">New value of the float field.</param>
-        private void DoOnChanged(float newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUISliderField instance, float min, float max, 
-            GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern float Internal_GetValue(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a slider with floating point input field and an optional label.
+    /// </summary>
+    public sealed class GUISliderField : GUIElement
+    {
+        public delegate void OnChangedDelegate(float newValue);
+
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// Value displayed by the field input box.
+        /// </summary>
+        public float Value
+        {
+            get { return Internal_GetValue(mCachedPtr); }
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new slider field element with a label.
+        /// </summary>
+        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
+        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUISliderField(float min, float max, GUIContent title, int titleWidth = 100, 
+            string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, min, max, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new slider field element without a label.
+        /// </summary>
+        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
+        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUISliderField(float min, float max, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, min, max, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Sets a range that will input field values will be clamped to. Set to large negative/positive values if clamping
+        /// is not required.
+        /// </summary>
+        /// <param name="min">Minimum boundary of the range to clamp values to.</param>
+        /// <param name="max">Maximum boundary of the range to clamp values to.</param>
+        public void SetRange(float min, float max)
+        {
+            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>
+        /// <param name="newValue">New value of the float field.</param>
+        private void DoOnChanged(float newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUISliderField instance, float min, float max, 
+            GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern float Internal_GetValue(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, float value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetRange(IntPtr nativeInstance, float min, float max);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetStep(IntPtr nativeInstance, float step);
+    }
+}

+ 125 - 125
MBansheeEditor/GUI/GUITextField.cs

@@ -1,125 +1,125 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a textual input field and an optional label.
-    /// </summary>
-    public sealed class GUITextField : GUIElement
-    {
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event Action<string> OnChanged;
-
-        /// <summary>
-        /// Triggered whenever user confirms input.
-        /// </summary>
-        public event Action OnConfirmed;
-
-        /// <summary>
-        /// Value displayed by the field input box.
-        /// </summary>
-        public string Value
-        {
-            get
-            {
-                String value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <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>
-        /// Creates a new text field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="multiline">Determines should the input field accept multiple lines of text.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUITextField(GUIContent title, int titleWidth = 100, bool multiline = false, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, multiline, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new text field element without a label.
-        /// </summary>
-        /// <param name="multiline">Determines should the input field accept multiple lines of text.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUITextField(bool multiline = false, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, multiline, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the text field changes.
-        /// </summary>
-        /// <param name="newValue">New value of the text field.</param>
-        private void Internal_DoOnChanged(String newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the user confirms the input.
-        /// </summary>
-        private void Internal_DoOnConfirmed()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUITextField instance, bool multiline, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out String value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, String value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a textual input field and an optional label.
+    /// </summary>
+    public sealed class GUITextField : GUIElement
+    {
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event Action<string> OnChanged;
+
+        /// <summary>
+        /// Triggered whenever user confirms input.
+        /// </summary>
+        public event Action OnConfirmed;
+
+        /// <summary>
+        /// Value displayed by the field input box.
+        /// </summary>
+        public string Value
+        {
+            get
+            {
+                String value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <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>
+        /// Creates a new text field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="multiline">Determines should the input field accept multiple lines of text.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUITextField(GUIContent title, int titleWidth = 100, bool multiline = false, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, multiline, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new text field element without a label.
+        /// </summary>
+        /// <param name="multiline">Determines should the input field accept multiple lines of text.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUITextField(bool multiline = false, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, multiline, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the text field changes.
+        /// </summary>
+        /// <param name="newValue">New value of the text field.</param>
+        private void Internal_DoOnChanged(String newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the user confirms the input.
+        /// </summary>
+        private void Internal_DoOnConfirmed()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUITextField instance, bool multiline, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out String value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, String value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 118 - 118
MBansheeEditor/GUI/GUITextureField.cs

@@ -1,118 +1,118 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a reference to a <see cref="Texture"/> and an optional label. Textures can
-    /// be dragged and dropped onto the field to update the reference. This is similar to <see cref="GUIResourceField"/>
-    /// but the will display the texture contents and not only the name.
-    /// </summary>
-    public sealed class GUITextureField : GUIElement
-    {
-        public delegate void OnChangedDelegate(ResourceRef newValue);
-
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// <see cref="Texture"/> referenced by the field. This will load the texture if it is not already loaded. Use
-        /// <see cref="ValueRef"/> if you don't require a loaded resource.
-        /// </summary>
-        public Texture Value
-        {
-            get
-            {
-                Texture value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Reference to the <see cref="Texture"/> referenced by the field.
-        /// </summary>
-        public ResourceRef ValueRef
-        {
-            get
-            {
-                ResourceRef value;
-                Internal_GetValueRef(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValueRef(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new texture field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUITextureField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new texture field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUITextureField(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the field changes.
-        /// </summary>
-        /// <param name="newValue">New resource referenced by the field.</param>
-        private void Internal_DoOnChanged(ResourceRef newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUITextureField instance, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out Texture value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, Texture value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValueRef(IntPtr nativeInstance, out ResourceRef value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValueRef(IntPtr nativeInstance, ResourceRef value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a reference to a <see cref="Texture"/> and an optional label. Textures can
+    /// be dragged and dropped onto the field to update the reference. This is similar to <see cref="GUIResourceField"/>
+    /// but the will display the texture contents and not only the name.
+    /// </summary>
+    public sealed class GUITextureField : GUIElement
+    {
+        public delegate void OnChangedDelegate(ResourceRef newValue);
+
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// <see cref="Texture"/> referenced by the field. This will load the texture if it is not already loaded. Use
+        /// <see cref="ValueRef"/> if you don't require a loaded resource.
+        /// </summary>
+        public Texture Value
+        {
+            get
+            {
+                Texture value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Reference to the <see cref="Texture"/> referenced by the field.
+        /// </summary>
+        public ResourceRef ValueRef
+        {
+            get
+            {
+                ResourceRef value;
+                Internal_GetValueRef(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValueRef(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new texture field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUITextureField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new texture field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUITextureField(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the field changes.
+        /// </summary>
+        /// <param name="newValue">New resource referenced by the field.</param>
+        private void Internal_DoOnChanged(ResourceRef newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUITextureField instance, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out Texture value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, Texture value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValueRef(IntPtr nativeInstance, out ResourceRef value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValueRef(IntPtr nativeInstance, ResourceRef value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 94 - 94
MBansheeEditor/GUI/GUIToggleField.cs

@@ -1,94 +1,94 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a toggle button and an optional label.
-    /// </summary>
-    public sealed class GUIToggleField : GUIElement
-    {
-        public delegate void OnChangedDelegate(bool newValue);
-
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event OnChangedDelegate OnChanged;
-
-        /// <summary>
-        /// Current state of the toggle button.
-        /// </summary>
-        public bool Value
-        {
-            get
-            {
-                bool value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Creates a new toggle field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIToggleField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new toggle field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIToggleField(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the toggle button is toggled.
-        /// </summary>
-        /// <param name="newValue">New value of the toggle button.</param>
-        private void DoOnChanged(bool newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIToggleField instance, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a toggle button and an optional label.
+    /// </summary>
+    public sealed class GUIToggleField : GUIElement
+    {
+        public delegate void OnChangedDelegate(bool newValue);
+
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event OnChangedDelegate OnChanged;
+
+        /// <summary>
+        /// Current state of the toggle button.
+        /// </summary>
+        public bool Value
+        {
+            get
+            {
+                bool value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Creates a new toggle field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIToggleField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new toggle field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIToggleField(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the toggle button is toggled.
+        /// </summary>
+        /// <param name="newValue">New value of the toggle button.</param>
+        private void DoOnChanged(bool newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIToggleField instance, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 123 - 123
MBansheeEditor/GUI/GUIVector2Field.cs

@@ -1,123 +1,123 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a 2D vector input field and an optional label.
-    /// </summary>
-    public sealed class GUIVector2Field : GUIElement
-    {
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event Action<Vector2> OnChanged;
-
-        /// <summary>
-        /// Triggered whenever user confirms input.
-        /// </summary>
-        public event Action OnConfirmed;
-
-        /// <summary>
-        /// Value displayed by the field input box.
-        /// </summary>
-        public Vector2 Value
-        {
-            get
-            {
-                Vector2 value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <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>
-        /// Creates a new 2D vector field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIVector2Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new 2D vector field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIVector2Field(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the field changes.
-        /// </summary>
-        /// <param name="newValue">New value of the field.</param>
-        private void Internal_DoOnChanged(Vector2 newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the user confirms the input.
-        /// </summary>
-        private void Internal_DoOnConfirmed()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIVector2Field instance, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out Vector2 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, Vector2 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a 2D vector input field and an optional label.
+    /// </summary>
+    public sealed class GUIVector2Field : GUIElement
+    {
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event Action<Vector2> OnChanged;
+
+        /// <summary>
+        /// Triggered whenever user confirms input.
+        /// </summary>
+        public event Action OnConfirmed;
+
+        /// <summary>
+        /// Value displayed by the field input box.
+        /// </summary>
+        public Vector2 Value
+        {
+            get
+            {
+                Vector2 value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, ref value); }
+        }
+
+        /// <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>
+        /// Creates a new 2D vector field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIVector2Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new 2D vector field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIVector2Field(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the field changes.
+        /// </summary>
+        /// <param name="newValue">New value of the field.</param>
+        private void Internal_DoOnChanged(Vector2 newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the user confirms the input.
+        /// </summary>
+        private void Internal_DoOnConfirmed()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIVector2Field instance, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out Vector2 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, ref Vector2 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 123 - 123
MBansheeEditor/GUI/GUIVector3Field.cs

@@ -1,123 +1,123 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a 3D vector input field and an optional label.
-    /// </summary>
-    public sealed class GUIVector3Field : GUIElement
-    {
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event Action<Vector3> OnChanged;
-
-        /// <summary>
-        /// Triggered whenever user confirms input.
-        /// </summary>
-        public event Action OnConfirmed;
-
-        /// <summary>
-        /// Value displayed by the field input box.
-        /// </summary>
-        public Vector3 Value
-        {
-            get
-            {
-                Vector3 value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <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>
-        /// Creates a new 3D vector field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIVector3Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new 3D vector field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIVector3Field(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the field changes.
-        /// </summary>
-        /// <param name="newValue">New value of the field.</param>
-        private void Internal_DoOnChanged(Vector3 newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the user confirms the input.
-        /// </summary>
-        private void Internal_DoOnConfirmed()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIVector3Field instance, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out Vector3 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, Vector3 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a 3D vector input field and an optional label.
+    /// </summary>
+    public sealed class GUIVector3Field : GUIElement
+    {
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event Action<Vector3> OnChanged;
+
+        /// <summary>
+        /// Triggered whenever user confirms input.
+        /// </summary>
+        public event Action OnConfirmed;
+
+        /// <summary>
+        /// Value displayed by the field input box.
+        /// </summary>
+        public Vector3 Value
+        {
+            get
+            {
+                Vector3 value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, ref value); }
+        }
+
+        /// <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>
+        /// Creates a new 3D vector field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIVector3Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new 3D vector field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIVector3Field(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the field changes.
+        /// </summary>
+        /// <param name="newValue">New value of the field.</param>
+        private void Internal_DoOnChanged(Vector3 newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the user confirms the input.
+        /// </summary>
+        private void Internal_DoOnConfirmed()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIVector3Field instance, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out Vector3 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, ref Vector3 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 123 - 123
MBansheeEditor/GUI/GUIVector4Field.cs

@@ -1,123 +1,123 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Editor GUI element that displays a 4D vector input field and an optional label.
-    /// </summary>
-    public sealed class GUIVector4Field : GUIElement
-    {
-        /// <summary>
-        /// Triggered when the value in the field changes.
-        /// </summary>
-        public event Action<Vector4> OnChanged;
-
-        /// <summary>
-        /// Triggered whenever user confirms input.
-        /// </summary>
-        public event Action OnConfirmed;
-
-        /// <summary>
-        /// Value displayed by the field input box.
-        /// </summary>
-        public Vector4 Value
-        {
-            get
-            {
-                Vector4 value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
-
-            set { Internal_SetValue(mCachedPtr, value); }
-        }
-
-        /// <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>
-        /// Creates a new 4D vector field element with a label.
-        /// </summary>
-        /// <param name="title">Content to display on the label.</param>
-        /// <param name="titleWidth">Width of the title label in pixels.</param>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIVector4Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
-        }
-
-        /// <summary>
-        /// Creates a new 4D vector field element without a label.
-        /// </summary>
-        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
-        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
-        ///                     default element style is used.</param>
-        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
-        ///                       override any similar options set by style.</param>
-        public GUIVector4Field(string style = "", params GUIOption[] options)
-        {
-            Internal_CreateInstance(this, null, 0, style, options, false);
-        }
-
-        /// <summary>
-        /// Colors the element with a specific tint.
-        /// </summary>
-        /// <param name="color">Tint to apply to the element.</param>
-        public void SetTint(Color color)
-        {
-            Internal_SetTint(mCachedPtr, color);
-        }
-
-        /// <summary>
-        /// Triggered by the runtime when the value of the field changes.
-        /// </summary>
-        /// <param name="newValue">New value of the field.</param>
-        private void Internal_DoOnChanged(Vector4 newValue)
-        {
-            if (OnChanged != null)
-                OnChanged(newValue);
-        }
-
-        /// <summary>
-        /// Triggered by the native interop object when the user confirms the input.
-        /// </summary>
-        private void Internal_DoOnConfirmed()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIVector4Field instance, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out Vector4 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, Vector4 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTint(IntPtr nativeInstance, Color color);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Editor GUI element that displays a 4D vector input field and an optional label.
+    /// </summary>
+    public sealed class GUIVector4Field : GUIElement
+    {
+        /// <summary>
+        /// Triggered when the value in the field changes.
+        /// </summary>
+        public event Action<Vector4> OnChanged;
+
+        /// <summary>
+        /// Triggered whenever user confirms input.
+        /// </summary>
+        public event Action OnConfirmed;
+
+        /// <summary>
+        /// Value displayed by the field input box.
+        /// </summary>
+        public Vector4 Value
+        {
+            get
+            {
+                Vector4 value;
+                Internal_GetValue(mCachedPtr, out value);
+                return value;
+            }
+
+            set { Internal_SetValue(mCachedPtr, ref value); }
+        }
+
+        /// <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>
+        /// Creates a new 4D vector field element with a label.
+        /// </summary>
+        /// <param name="title">Content to display on the label.</param>
+        /// <param name="titleWidth">Width of the title label in pixels.</param>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIVector4Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+        }
+
+        /// <summary>
+        /// Creates a new 4D vector field element without a label.
+        /// </summary>
+        /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as 
+        ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified 
+        ///                     default element style is used.</param>
+        /// <param name="options">Options that allow you to control how is the element  positioned and sized. This will 
+        ///                       override any similar options set by style.</param>
+        public GUIVector4Field(string style = "", params GUIOption[] options)
+        {
+            Internal_CreateInstance(this, null, 0, style, options, false);
+        }
+
+        /// <summary>
+        /// Colors the element with a specific tint.
+        /// </summary>
+        /// <param name="color">Tint to apply to the element.</param>
+        public void SetTint(Color color)
+        {
+            Internal_SetTint(mCachedPtr, ref color);
+        }
+
+        /// <summary>
+        /// Triggered by the runtime when the value of the field changes.
+        /// </summary>
+        /// <param name="newValue">New value of the field.</param>
+        private void Internal_DoOnChanged(Vector4 newValue)
+        {
+            if (OnChanged != null)
+                OnChanged(newValue);
+        }
+
+        /// <summary>
+        /// Triggered by the native interop object when the user confirms the input.
+        /// </summary>
+        private void Internal_DoOnConfirmed()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(GUIVector4Field instance, GUIContent title, int titleWidth,
+            string style, GUIOption[] options, bool withTitle);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetValue(IntPtr nativeInstance, out Vector4 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetValue(IntPtr nativeInstance, ref Vector4 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);
+    }
+}

+ 129 - 129
MBansheeEditor/ModalWindow.cs

@@ -1,129 +1,129 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Base implementation of a window that when open doesn't allow you to interact with other windows. Modal windows 
-    /// are similar to editor windows but cannot be docked, and are meant to be used for temporary operations like dialog 
-    /// boxes and progress bars.
-    /// </summary>
-    public class ModalWindow : ScriptObject
-    {
-        /// <summary>
-        /// Width of the window in pixels.
-        /// </summary>
-        public int Width
-        {
-            get { return Internal_GetWidth(mCachedPtr); }
-            set { Internal_SetWidth(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Height of the window in pixels.
-        /// </summary>
-        public int Height
-        {
-            get { return Internal_GetHeight(mCachedPtr); }
-            set { Internal_SetHeight(mCachedPtr, value); }
-        }
-
-        protected GUIPanel GUI;
-
-        /// <summary>
-        /// Constructor for internal use by the runtime.
-        /// </summary>
-        protected ModalWindow()
-        {
-            Internal_CreateInstance(this, false);
-        }
-
-        /// <summary>
-        /// Creates a new modal window.
-        /// </summary>
-        /// <param name="allowCloseButton">Should the close button be displayed.</param>
-        protected ModalWindow(bool allowCloseButton)
-        {
-            Internal_CreateInstance(this, allowCloseButton);
-        }
-
-        /// <summary>
-        /// Converts coordinates in screen space to coordinates relative to the window.
-        /// </summary>
-        /// <param name="screenPos">Coordinates in screen space.</param>
-        /// <returns>Coordinates relative to the window.</returns>
-        protected Vector2I ScreenToWindowPos(Vector2I screenPos)
-        {
-            Vector2I windowPos;
-            Internal_ScreenToWindowPos(mCachedPtr, screenPos, out windowPos);
-            return windowPos;
-        }
-
-        /// <summary>
-        /// Converts coordinates relative to the window to screen space to coordinates.
-        /// </summary>
-        /// <param name="windowPos">Coordinates relative to the window.</param>
-        /// <returns>Coordinates in screen space.</returns>
-        protected Vector2I WindowToScreenPos(Vector2I windowPos)
-        {
-            Vector2I screenPos;
-            Internal_WindowToScreenPos(mCachedPtr, windowPos, out screenPos);
-            return screenPos;
-        }
-
-        /// <summary>
-        /// Triggered whenever the window size ranges.
-        /// </summary>
-        /// <param name="width">New width of the window in pixels.</param>
-        /// <param name="height">New height of the window in pixels.</param>
-        protected virtual void OnWindowResized(int width, int height)
-        {
-
-        }
-
-        /// <summary>
-        /// Closes the modal window.
-        /// </summary>
-        protected void Close()
-        {
-            Internal_Close(mCachedPtr);
-        }
-
-        /// <summary>
-        /// Allows you to set the mame of the window to display in the title bar.
-        /// </summary>
-        public LocString Title
-        {
-            set { Internal_SetTitle(mCachedPtr, value); }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(ModalWindow instance, bool allowCloseButton);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Close(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTitle(IntPtr nativeInstance, LocString title);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetWidth(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_SetWidth(IntPtr nativeInstance, int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_GetHeight(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern int Internal_SetHeight(IntPtr nativeInstance, int value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ScreenToWindowPos(IntPtr nativeInstance, Vector2I position, out Vector2I windowPos);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_WindowToScreenPos(IntPtr nativeInstance, Vector2I position, out Vector2I screenPos);
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Base implementation of a window that when open doesn't allow you to interact with other windows. Modal windows 
+    /// are similar to editor windows but cannot be docked, and are meant to be used for temporary operations like dialog 
+    /// boxes and progress bars.
+    /// </summary>
+    public class ModalWindow : ScriptObject
+    {
+        /// <summary>
+        /// Width of the window in pixels.
+        /// </summary>
+        public int Width
+        {
+            get { return Internal_GetWidth(mCachedPtr); }
+            set { Internal_SetWidth(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Height of the window in pixels.
+        /// </summary>
+        public int Height
+        {
+            get { return Internal_GetHeight(mCachedPtr); }
+            set { Internal_SetHeight(mCachedPtr, value); }
+        }
+
+        protected GUIPanel GUI;
+
+        /// <summary>
+        /// Constructor for internal use by the runtime.
+        /// </summary>
+        protected ModalWindow()
+        {
+            Internal_CreateInstance(this, false);
+        }
+
+        /// <summary>
+        /// Creates a new modal window.
+        /// </summary>
+        /// <param name="allowCloseButton">Should the close button be displayed.</param>
+        protected ModalWindow(bool allowCloseButton)
+        {
+            Internal_CreateInstance(this, allowCloseButton);
+        }
+
+        /// <summary>
+        /// Converts coordinates in screen space to coordinates relative to the window.
+        /// </summary>
+        /// <param name="screenPos">Coordinates in screen space.</param>
+        /// <returns>Coordinates relative to the window.</returns>
+        protected Vector2I ScreenToWindowPos(Vector2I screenPos)
+        {
+            Vector2I windowPos;
+            Internal_ScreenToWindowPos(mCachedPtr, ref screenPos, out windowPos);
+            return windowPos;
+        }
+
+        /// <summary>
+        /// Converts coordinates relative to the window to screen space to coordinates.
+        /// </summary>
+        /// <param name="windowPos">Coordinates relative to the window.</param>
+        /// <returns>Coordinates in screen space.</returns>
+        protected Vector2I WindowToScreenPos(Vector2I windowPos)
+        {
+            Vector2I screenPos;
+            Internal_WindowToScreenPos(mCachedPtr, ref windowPos, out screenPos);
+            return screenPos;
+        }
+
+        /// <summary>
+        /// Triggered whenever the window size ranges.
+        /// </summary>
+        /// <param name="width">New width of the window in pixels.</param>
+        /// <param name="height">New height of the window in pixels.</param>
+        protected virtual void OnWindowResized(int width, int height)
+        {
+
+        }
+
+        /// <summary>
+        /// Closes the modal window.
+        /// </summary>
+        protected void Close()
+        {
+            Internal_Close(mCachedPtr);
+        }
+
+        /// <summary>
+        /// Allows you to set the mame of the window to display in the title bar.
+        /// </summary>
+        public LocString Title
+        {
+            set { Internal_SetTitle(mCachedPtr, value); }
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(ModalWindow instance, bool allowCloseButton);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_Close(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTitle(IntPtr nativeInstance, LocString title);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern int Internal_GetWidth(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern int Internal_SetWidth(IntPtr nativeInstance, int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern int Internal_GetHeight(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern int Internal_SetHeight(IntPtr nativeInstance, int value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_ScreenToWindowPos(IntPtr nativeInstance, ref Vector2I position, out Vector2I windowPos);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_WindowToScreenPos(IntPtr nativeInstance, ref Vector2I position, out Vector2I screenPos);
+    }
+}

+ 124 - 124
MBansheeEditor/OSDropTarget.cs

@@ -1,124 +1,124 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Drop targets allow you to register a certain portion of a window as a drop target that accepts file drops from the
-    /// OS (platform) specific drag and drop system. You will receive events with the specified drop area as long as it is 
-    /// active.
-    /// </summary>
-    public class OSDropTarget : ScriptObject
-    {
-        /// <summary>
-        /// Triggered when the user completes a drop while pointer is over the drop area. Provides window coordinates of 
-        /// the pointer position.
-        /// </summary>
-        public Action<int, int> OnDrop;
-
-        /// <summary>
-        /// Triggered when a pointer enters the drop area. Provides window coordinates of the pointer position.
-        /// </summary>
-        public Action<int, int> OnEnter;
-
-        /// <summary>
-        /// Triggered when a pointer leaves the drop area.
-        /// </summary>
-        public Action OnLeave;
-
-        /// <summary>
-        /// Triggered when a pointer is being dragged over the drop area. Provides window coordinates of the pointer 
-        /// position.
-        /// </summary>
-        public Action<int, int> OnDrag;
-
-        /// <summary>
-        /// Creates a new OS drop target.
-        /// </summary>
-        /// <param name="window">Window on which the drop target is on.</param>
-        public OSDropTarget(EditorWindow window)
-        {
-            IntPtr nativeWindow = window.GetCachedPtr();;
-            Internal_CreateInstance(this, nativeWindow);
-        }
-
-        /// <summary>
-        /// Destroys the drop target, stopping any further events.
-        /// </summary>
-        public void Destroy()
-        {
-            Internal_Destroy(mCachedPtr);
-        }
-
-        /// <summary>
-        /// Allows you to set the drop target bounds, relative to the parent window.
-        /// </summary>
-        public Rect2I Bounds
-        {
-            set { Internal_SetBounds(mCachedPtr, value); }
-        }
-
-        /// <summary>
-        /// Returns a list of files received by the drop target. Only valid after a drop has been triggered.
-        /// </summary>
-        public string[] FilePaths
-        {
-            get { return Internal_GetFilePaths(mCachedPtr); }
-        }
-
-        /// <summary>
-        /// Triggered internally by the runtime when a pointer enters the drop area.
-        /// </summary>
-        /// <param name="x">X coordinate of the pointer position, relative to the parent window.</param>
-        /// <param name="y">Y coordinate of the pointer position, relative to the parent window.</param>
-        private void InternalDoOnEnter(int x, int y)
-        {
-            if (OnEnter != null)
-                OnEnter(x, y);
-        }
-
-        /// <summary>
-        /// Triggered internally by the runtime when a pointer leaves the drop area.
-        /// </summary>
-        private void InternalDoOnLeave()
-        {
-            if (OnLeave != null)
-                OnLeave();
-        }
-
-        /// <summary>
-        /// Triggered internally by the runtime when a pointer is being dragged over the drop area.
-        /// </summary>
-        /// <param name="x">X coordinate of the pointer position, relative to the parent window.</param>
-        /// <param name="y">Y coordinate of the pointer position, relative to the parent window.</param>
-        private void InternalDoOnDrag(int x, int y)
-        {
-            if (OnDrag != null)
-                OnDrag(x, y);
-        }
-
-        /// <summary>
-        /// Triggered internally by the runtime when the user completes a drop while pointer is over the drop area.
-        /// </summary>
-        /// <param name="x">X coordinate of the pointer position, relative to the parent window.</param>
-        /// <param name="y">Y coordinate of the pointer position, relative to the parent window.</param>
-        private void InternalDoOnDrop(int x, int y)
-        {
-            if (OnDrop != null)
-                OnDrop(x, y);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(OSDropTarget instance, IntPtr editorWindow);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Destroy(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetBounds(IntPtr nativeInstance, Rect2I bounds);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern string[] Internal_GetFilePaths(IntPtr nativeInstance);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Drop targets allow you to register a certain portion of a window as a drop target that accepts file drops from the
+    /// OS (platform) specific drag and drop system. You will receive events with the specified drop area as long as it is 
+    /// active.
+    /// </summary>
+    public class OSDropTarget : ScriptObject
+    {
+        /// <summary>
+        /// Triggered when the user completes a drop while pointer is over the drop area. Provides window coordinates of 
+        /// the pointer position.
+        /// </summary>
+        public Action<int, int> OnDrop;
+
+        /// <summary>
+        /// Triggered when a pointer enters the drop area. Provides window coordinates of the pointer position.
+        /// </summary>
+        public Action<int, int> OnEnter;
+
+        /// <summary>
+        /// Triggered when a pointer leaves the drop area.
+        /// </summary>
+        public Action OnLeave;
+
+        /// <summary>
+        /// Triggered when a pointer is being dragged over the drop area. Provides window coordinates of the pointer 
+        /// position.
+        /// </summary>
+        public Action<int, int> OnDrag;
+
+        /// <summary>
+        /// Creates a new OS drop target.
+        /// </summary>
+        /// <param name="window">Window on which the drop target is on.</param>
+        public OSDropTarget(EditorWindow window)
+        {
+            IntPtr nativeWindow = window.GetCachedPtr();;
+            Internal_CreateInstance(this, nativeWindow);
+        }
+
+        /// <summary>
+        /// Destroys the drop target, stopping any further events.
+        /// </summary>
+        public void Destroy()
+        {
+            Internal_Destroy(mCachedPtr);
+        }
+
+        /// <summary>
+        /// Allows you to set the drop target bounds, relative to the parent window.
+        /// </summary>
+        public Rect2I Bounds
+        {
+            set { Internal_SetBounds(mCachedPtr, ref value); }
+        }
+
+        /// <summary>
+        /// Returns a list of files received by the drop target. Only valid after a drop has been triggered.
+        /// </summary>
+        public string[] FilePaths
+        {
+            get { return Internal_GetFilePaths(mCachedPtr); }
+        }
+
+        /// <summary>
+        /// Triggered internally by the runtime when a pointer enters the drop area.
+        /// </summary>
+        /// <param name="x">X coordinate of the pointer position, relative to the parent window.</param>
+        /// <param name="y">Y coordinate of the pointer position, relative to the parent window.</param>
+        private void InternalDoOnEnter(int x, int y)
+        {
+            if (OnEnter != null)
+                OnEnter(x, y);
+        }
+
+        /// <summary>
+        /// Triggered internally by the runtime when a pointer leaves the drop area.
+        /// </summary>
+        private void InternalDoOnLeave()
+        {
+            if (OnLeave != null)
+                OnLeave();
+        }
+
+        /// <summary>
+        /// Triggered internally by the runtime when a pointer is being dragged over the drop area.
+        /// </summary>
+        /// <param name="x">X coordinate of the pointer position, relative to the parent window.</param>
+        /// <param name="y">Y coordinate of the pointer position, relative to the parent window.</param>
+        private void InternalDoOnDrag(int x, int y)
+        {
+            if (OnDrag != null)
+                OnDrag(x, y);
+        }
+
+        /// <summary>
+        /// Triggered internally by the runtime when the user completes a drop while pointer is over the drop area.
+        /// </summary>
+        /// <param name="x">X coordinate of the pointer position, relative to the parent window.</param>
+        /// <param name="y">Y coordinate of the pointer position, relative to the parent window.</param>
+        private void InternalDoOnDrop(int x, int y)
+        {
+            if (OnDrop != null)
+                OnDrop(x, y);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(OSDropTarget instance, IntPtr editorWindow);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_Destroy(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetBounds(IntPtr nativeInstance, ref Rect2I bounds);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern string[] Internal_GetFilePaths(IntPtr nativeInstance);
+    }
+}

+ 155 - 155
MBansheeEditor/Scene/Gizmos.cs

@@ -1,156 +1,156 @@
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Provides functionality for drawing gizmos. This class should only be used in methods defined with 
-    /// <see cref="DrawGizmo"/> attribute.
-    /// </summary>
-    public class Gizmos
-    {
-        /// <summary>
-        /// Determines the color that will be used on any following draw method.
-        /// </summary>
-        public static Color Color
-        {
-            get
-            {
-                Color value;
-                Internal_GetColor(out value); 
-                return value; 
-            }
-
-            set
-            {
-                Internal_SetColor(value);
-            }
-        }
-
-        /// <summary>
-        /// Determines the world transform that will be applied to any following draw method.
-        /// </summary>
-        public static Matrix4 Transform
-        {
-            get
-            {
-                Matrix4 value;
-                Internal_GetTransform(out value);
-                return value; 
-            }
-
-            set
-            {
-                Internal_SetTransform(value);
-            }
-        }
-
-        /// <summary>
-        /// Draws an axis aligned solid cube.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the cube.</param>
-        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
-        public static void DrawCube(Vector3 position, Vector3 extents)
-        {
-            Internal_DrawCube(position, extents);
-        }
-
-        /// <summary>
-        /// Draws a solid sphere.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the sphere.</param>
-        /// <param name="radius">Sphere radius.</param>
-        public static void DrawSphere(Vector3 position, float radius)
-        {
-            Internal_DrawSphere(position, radius);
-        }
-
-        /// <summary>
-        /// Draws an axis aligned wireframe cube.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the cube.</param>
-        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
-        public static void DrawWireCube(Vector3 position, Vector3 extents)
-        {
-            Internal_DrawWireCube(position, extents);
-        }
-
-        /// <summary>
-        /// Draws a wireframe sphere.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the sphere.</param>
-        /// <param name="radius">Sphere radius.</param>
-        public static void DrawWireSphere(Vector3 position, float radius)
-        {
-            Internal_DrawWireSphere(position, radius);
-        }
-
-        /// <summary>
-        /// Draws a 3D line.
-        /// </summary>
-        /// <param name="start">Starting point for the line.</param>
-        /// <param name="end">Ending point for the line.</param>
-        public static void DrawLine(Vector3 start, Vector3 end)
-        {
-            Internal_DrawLine(start, end);
-        }
-
-        /// <summary>
-        /// Draws a wireframe camera frustum.
-        /// </summary>
-        /// <param name="position">Origin of the frustum (place where the camera origin would normally be).</param>
-        /// <param name="aspect">Aspect radio (width/height).</param>
-        /// <param name="FOV">Horizontal field of view.</param>
-        /// <param name="near">Distance from the origin to the near plane.</param>
-        /// <param name="far">Distance from the origin to the far plane.</param>
-        public static void DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far)
-        {
-            Internal_DrawFrustum(position, aspect, FOV, near, far);
-        }
-
-        /// <summary>
-        /// Draws a texture as a camera-facing quad at a specific position.
-        /// </summary>
-        /// <param name="position">World position of the center of the quad the texture will be drawn on.</param>
-        /// <param name="image">Texture to draw.</param>
-        /// <param name="fixedScale">If true the icon will remain consistent size regardless of distance from camera. 
-        ///                          If false normal perspective foreshortening effect will occurr.</param>
-        public static void DrawIcon(Vector3 position, SpriteTexture image, bool fixedScale)
-        {
-            Internal_DrawIcon(position, image, fixedScale);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetColor(Color color);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetColor(out Color color);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTransform(Matrix4 transform);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetTransform(out Matrix4 transform);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawCube(Vector3 position, Vector3 extents);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawSphere(Vector3 position, float radius);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireCube(Vector3 position, Vector3 extents);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireSphere(Vector3 position, float radius);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawLine(Vector3 start, Vector3 end);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawIcon(Vector3 position, SpriteTexture image, bool fixedScale);
-    }
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Provides functionality for drawing gizmos. This class should only be used in methods defined with 
+    /// <see cref="DrawGizmo"/> attribute.
+    /// </summary>
+    public class Gizmos
+    {
+        /// <summary>
+        /// Determines the color that will be used on any following draw method.
+        /// </summary>
+        public static Color Color
+        {
+            get
+            {
+                Color value;
+                Internal_GetColor(out value); 
+                return value; 
+            }
+
+            set
+            {
+                Internal_SetColor(ref value);
+            }
+        }
+
+        /// <summary>
+        /// Determines the world transform that will be applied to any following draw method.
+        /// </summary>
+        public static Matrix4 Transform
+        {
+            get
+            {
+                Matrix4 value;
+                Internal_GetTransform(out value);
+                return value; 
+            }
+
+            set
+            {
+                Internal_SetTransform(ref value);
+            }
+        }
+
+        /// <summary>
+        /// Draws an axis aligned solid cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
+        public static void DrawCube(Vector3 position, Vector3 extents)
+        {
+            Internal_DrawCube(ref position, ref extents);
+        }
+
+        /// <summary>
+        /// Draws a solid sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
+        public static void DrawSphere(Vector3 position, float radius)
+        {
+            Internal_DrawSphere(ref position, radius);
+        }
+
+        /// <summary>
+        /// Draws an axis aligned wireframe cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
+        public static void DrawWireCube(Vector3 position, Vector3 extents)
+        {
+            Internal_DrawWireCube(ref position, ref extents);
+        }
+
+        /// <summary>
+        /// Draws a wireframe sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
+        public static void DrawWireSphere(Vector3 position, float radius)
+        {
+            Internal_DrawWireSphere(ref position, radius);
+        }
+
+        /// <summary>
+        /// Draws a 3D line.
+        /// </summary>
+        /// <param name="start">Starting point for the line.</param>
+        /// <param name="end">Ending point for the line.</param>
+        public static void DrawLine(Vector3 start, Vector3 end)
+        {
+            Internal_DrawLine(ref start, ref end);
+        }
+
+        /// <summary>
+        /// Draws a wireframe camera frustum.
+        /// </summary>
+        /// <param name="position">Origin of the frustum (place where the camera origin would normally be).</param>
+        /// <param name="aspect">Aspect radio (width/height).</param>
+        /// <param name="FOV">Horizontal field of view.</param>
+        /// <param name="near">Distance from the origin to the near plane.</param>
+        /// <param name="far">Distance from the origin to the far plane.</param>
+        public static void DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far)
+        {
+            Internal_DrawFrustum(ref position, aspect, ref FOV, near, far);
+        }
+
+        /// <summary>
+        /// Draws a texture as a camera-facing quad at a specific position.
+        /// </summary>
+        /// <param name="position">World position of the center of the quad the texture will be drawn on.</param>
+        /// <param name="image">Texture to draw.</param>
+        /// <param name="fixedScale">If true the icon will remain consistent size regardless of distance from camera. 
+        ///                          If false normal perspective foreshortening effect will occurr.</param>
+        public static void DrawIcon(Vector3 position, SpriteTexture image, bool fixedScale)
+        {
+            Internal_DrawIcon(ref position, image, fixedScale);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetColor(ref Color color);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetColor(out Color color);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTransform(ref Matrix4 transform);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetTransform(out Matrix4 transform);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawCube(ref Vector3 position, ref Vector3 extents);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawSphere(ref Vector3 position, float radius);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawWireCube(ref Vector3 position, ref Vector3 extents);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawWireSphere(ref Vector3 position, float radius);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawLine(ref Vector3 start, ref Vector3 end);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawFrustum(ref Vector3 position, float aspect, ref Degree FOV, float near, float far);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawIcon(ref Vector3 position, SpriteTexture image, bool fixedScale);
+    }
 }
 }

+ 212 - 208
MBansheeEditor/Scene/HandleDrawing.cs

@@ -1,208 +1,212 @@
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Contains various method that can be used for drawing handles. These methods should only be called from 
-    /// <see cref="Handle.Draw"/> method or its overrides.
-    /// </summary>
-    public sealed class HandleDrawing
-    {
-        /// <summary>
-        /// Determines the color that will be used on any following draw method.
-        /// </summary>
-        public static Color Color
-        {
-            set { Internal_SetColor(value); }
-        }
-
-        /// <summary>
-        /// Determines the world transform that will be applied to any following draw method.
-        /// </summary>
-        public static Matrix4 Transform
-        {
-            set { Internal_SetTransform(value); }
-        }
-
-        /// <summary>
-        /// Draws an axis aligned solid cube.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the cube.</param>
-        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining 
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawCube(Vector3 position, Vector3 extents, float size = 1.0f)
-        {
-            Internal_DrawCube(position, extents, size);
-        }
-
-        /// <summary>
-        /// Draws a solid sphere.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the sphere.</param>
-        /// <param name="radius">Sphere radius.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawSphere(Vector3 position, float radius, float size = 1.0f)
-        {
-            Internal_DrawSphere(position, radius, size);
-        }
-
-        /// <summary>
-        /// Draws an axis aligned wireframe cube.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the cube.</param>
-        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawWireCube(Vector3 position, Vector3 extents, float size = 1.0f)
-        {
-            Internal_DrawWireCube(position, extents, size);
-        }
-
-        /// <summary>
-        /// Draws a wireframe sphere.
-        /// </summary>
-        /// <param name="position">World coordinates of the center of the sphere.</param>
-        /// <param name="radius">Sphere radius.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawWireSphere(Vector3 position, float radius, float size = 1.0f)
-        {
-            Internal_DrawWireSphere(position, radius, size);
-        }
-
-        /// <summary>
-        /// Draws a solid cone.
-        /// </summary>
-        /// <param name="coneBase">Location of the cone base (center of the cone disc).</param>
-        /// <param name="normal">Normal pointing from the base to the cone point.</param>
-        /// <param name="height">Distance from the origin to the cone point.</param>
-        /// <param name="radius">Radius of the cone disc.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size = 1.0f)
-        {
-            Internal_DrawCone(coneBase, normal, height, radius, size);
-        }
-
-        /// <summary>
-        /// Draws a 3D line.
-        /// </summary>
-        /// <param name="start">Starting point for the line.</param>
-        /// <param name="end">Ending point for the line.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawLine(Vector3 start, Vector3 end, float size = 1.0f)
-        {
-            Internal_DrawLine(start, end, size);
-        }
-
-        /// <summary>
-        /// Draws a solid double-sided disc.
-        /// </summary>
-        /// <param name="position">Center of the disc.</param>
-        /// <param name="normal">Normal towards which to orient the disc.</param>
-        /// <param name="radius">Radius of the disc.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
-        {
-            Internal_DrawDisc(position, normal, radius, size);
-        }
-
-        /// <summary>
-        /// Draws a wireframe disc.
-        /// </summary>
-        /// <param name="position">Center of the disc.</param>
-        /// <param name="normal">Normal towards which to orient the disc.</param>
-        /// <param name="radius">Radius of the disc.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
-        {
-            Internal_DrawWireDisc(position, normal, radius, size);
-        }
-
-        /// <summary>
-        /// Draws a solid double-sided arc.
-        /// </summary>
-        /// <param name="position">Center of the disc out of which the arc is cut out of.</param>
-        /// <param name="normal">Normal towards which to orient the arc.</param>
-        /// <param name="radius">Radius of the  disc out of which the arc is cut out of.</param>
-        /// <param name="startAngle">Angle at which the arc starts.</param>
-        /// <param name="amountAngle">Length of the arc.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
-        {
-            Internal_DrawArc(position, normal, radius, startAngle, amountAngle, size);
-        }
-
-        /// <summary>
-        /// Draws a wireframe arc.
-        /// </summary>
-        /// <param name="position">Center of the disc out of which the arc is cut out of.</param>
-        /// <param name="normal">Normal towards which to orient the arc.</param>
-        /// <param name="radius">Radius of the  disc out of which the arc is cut out of.</param>
-        /// <param name="startAngle">Angle at which the arc starts.</param>
-        /// <param name="amountAngle">Length of the arc.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
-        {
-            Internal_DrawWireArc(position, normal, radius, startAngle, amountAngle, size);
-        }
-
-        /// <summary>
-        /// Draws a single-sided rectangle in 3D.
-        /// </summary>
-        /// <param name="area">Determines the position, orientation and size of the rectangle.</param>
-        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
-        ///                    handle size regardless of distance from camera.</param>
-        public static void DrawRect(Rect3 area, float size = 1.0f)
-        {
-            Internal_DrawRect(area.Center, area.AxisHorz, area.AxisVert, area.ExtentHorz, area.ExtentVert, size);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetColor(Color color);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetTransform(Matrix4 transform);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawCube(Vector3 position, Vector3 extents, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawSphere(Vector3 position, float radius, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireCube(Vector3 position, Vector3 extents, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireSphere(Vector3 position, float radius, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawLine(Vector3 start, Vector3 end, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawDisc(Vector3 position, Vector3 normal, float radius, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawRect(Vector3 center, Vector3 axisH, Vector3 axisV, float extentH, float extentV, float size);
-    }
-}
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Contains various method that can be used for drawing handles. These methods should only be called from 
+    /// <see cref="Handle.Draw"/> method or its overrides.
+    /// </summary>
+    public sealed class HandleDrawing
+    {
+        /// <summary>
+        /// Determines the color that will be used on any following draw method.
+        /// </summary>
+        public static Color Color
+        {
+            set { Internal_SetColor(value); }
+        }
+
+        /// <summary>
+        /// Determines the world transform that will be applied to any following draw method.
+        /// </summary>
+        public static Matrix4 Transform
+        {
+            set { Internal_SetTransform(ref value); }
+        }
+
+        /// <summary>
+        /// Draws an axis aligned solid cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining 
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawCube(Vector3 position, Vector3 extents, float size = 1.0f)
+        {
+            Internal_DrawCube(ref position, ref extents, size);
+        }
+
+        /// <summary>
+        /// Draws a solid sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawSphere(Vector3 position, float radius, float size = 1.0f)
+        {
+            Internal_DrawSphere(ref position, radius, size);
+        }
+
+        /// <summary>
+        /// Draws an axis aligned wireframe cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawWireCube(Vector3 position, Vector3 extents, float size = 1.0f)
+        {
+            Internal_DrawWireCube(ref position, ref extents, size);
+        }
+
+        /// <summary>
+        /// Draws a wireframe sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawWireSphere(Vector3 position, float radius, float size = 1.0f)
+        {
+            Internal_DrawWireSphere(ref position, radius, size);
+        }
+
+        /// <summary>
+        /// Draws a solid cone.
+        /// </summary>
+        /// <param name="coneBase">Location of the cone base (center of the cone disc).</param>
+        /// <param name="normal">Normal pointing from the base to the cone point.</param>
+        /// <param name="height">Distance from the origin to the cone point.</param>
+        /// <param name="radius">Radius of the cone disc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size = 1.0f)
+        {
+            Internal_DrawCone(ref coneBase, ref normal, height, radius, size);
+        }
+
+        /// <summary>
+        /// Draws a 3D line.
+        /// </summary>
+        /// <param name="start">Starting point for the line.</param>
+        /// <param name="end">Ending point for the line.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawLine(Vector3 start, Vector3 end, float size = 1.0f)
+        {
+            Internal_DrawLine(ref start, ref end, size);
+        }
+
+        /// <summary>
+        /// Draws a solid double-sided disc.
+        /// </summary>
+        /// <param name="position">Center of the disc.</param>
+        /// <param name="normal">Normal towards which to orient the disc.</param>
+        /// <param name="radius">Radius of the disc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
+        {
+            Internal_DrawDisc(ref position, ref normal, radius, size);
+        }
+
+        /// <summary>
+        /// Draws a wireframe disc.
+        /// </summary>
+        /// <param name="position">Center of the disc.</param>
+        /// <param name="normal">Normal towards which to orient the disc.</param>
+        /// <param name="radius">Radius of the disc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
+        {
+            Internal_DrawWireDisc(ref position, ref normal, radius, size);
+        }
+
+        /// <summary>
+        /// Draws a solid double-sided arc.
+        /// </summary>
+        /// <param name="position">Center of the disc out of which the arc is cut out of.</param>
+        /// <param name="normal">Normal towards which to orient the arc.</param>
+        /// <param name="radius">Radius of the  disc out of which the arc is cut out of.</param>
+        /// <param name="startAngle">Angle at which the arc starts.</param>
+        /// <param name="amountAngle">Length of the arc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
+        {
+            Internal_DrawArc(ref position, ref normal, radius, ref startAngle, ref amountAngle, size);
+        }
+
+        /// <summary>
+        /// Draws a wireframe arc.
+        /// </summary>
+        /// <param name="position">Center of the disc out of which the arc is cut out of.</param>
+        /// <param name="normal">Normal towards which to orient the arc.</param>
+        /// <param name="radius">Radius of the  disc out of which the arc is cut out of.</param>
+        /// <param name="startAngle">Angle at which the arc starts.</param>
+        /// <param name="amountAngle">Length of the arc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
+        {
+            Internal_DrawWireArc(ref position, ref normal, radius, ref startAngle, ref amountAngle, size);
+        }
+
+        /// <summary>
+        /// Draws a single-sided rectangle in 3D.
+        /// </summary>
+        /// <param name="area">Determines the position, orientation and size of the rectangle.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
+        public static void DrawRect(Rect3 area, float size = 1.0f)
+        {
+            Vector3 center = area.Center;
+            Vector3 axisHorz = area.AxisHorz;
+            Vector3 axisVert = area.AxisVert;
+
+            Internal_DrawRect(ref center, ref axisHorz, ref axisVert, area.ExtentHorz, area.ExtentVert, size);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetColor(ref Color color);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetTransform(ref Matrix4 transform);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawCube(ref Vector3 position, ref Vector3 extents, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawSphere(ref Vector3 position, float radius, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawWireCube(ref Vector3 position, ref Vector3 extents, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawWireSphere(ref Vector3 position, float radius, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawCone(ref Vector3 coneBase, ref Vector3 normal, float height, float radius, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawLine(ref Vector3 start, ref Vector3 end, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawDisc(ref Vector3 position, ref Vector3 normal, float radius, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawWireDisc(ref Vector3 position, ref Vector3 normal, float radius, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawArc(ref Vector3 position, ref Vector3 normal, float radius, ref Degree startAngle, ref Degree amountAngle, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawWireArc(ref Vector3 position, ref Vector3 normal, float radius, ref Degree startAngle, ref Degree amountAngle, float size);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_DrawRect(ref Vector3 center, ref Vector3 axisH, ref Vector3 axisV, float extentH, float extentV, float size);
+    }
+}

+ 136 - 136
MBansheeEditor/Scene/HandleSlider.cs

@@ -1,136 +1,136 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Base class for all handle sliders. A handle slider is geometry that the user can interact with by selecting or 
-    /// dragging (i.e. sliding) it while in scene view. Sliders generally output a one- or multi-dimensional delta value 
-    /// that signals the drag amount (and/or direction). Handle sliders are one of the building blocks for 
-    /// <see cref="Handle"/> implementations.
-    /// </summary>
-    public class HandleSlider : ScriptObject
-    {
-        /// <summary>
-        /// Possible states the slider can be in.
-        /// </summary>
-        public enum StateType
-        {
-            /// <summary>Slider is not being interacted with.</summary>
-	        Inactive,
-            /// <summary>Slider is clicked on and being dragged.</summary>
-	        Active,
-            /// <summary>Slider is being hovered over but isn't clicked on.</summary>
-	        Hover
-        };
-
-        /// <summary>
-        /// Creates a new handle slider.
-        /// </summary>
-        /// <param name="parentHandle">Handle that the slider belongs to.</param>
-        public HandleSlider(Handle parentHandle)
-        {
-            parentHandle.RegisterSlider(this);
-        }
-
-        /// <summary>
-        /// World position of the slider.
-        /// </summary>
-        public Vector3 Position
-        {
-            get
-            {
-                Vector3 value;
-                Internal_GetPosition(mCachedPtr, out value);
-                return value;
-            }
-
-            set
-            {
-                Internal_SetPosition(mCachedPtr, value);
-            }
-        }
-
-        /// <summary>
-        /// World rotation of the slider.
-        /// </summary>
-        public Quaternion Rotation
-        {
-            get
-            {
-                Quaternion value;
-                Internal_GetRotation(mCachedPtr, out value);
-                return value;
-            }
-
-            set
-            {
-                Internal_SetRotation(mCachedPtr, value);
-            }
-        }
-
-        /// <summary>
-        /// Scale of the slider.
-        /// </summary>
-        public Vector3 Scale
-        {
-            get
-            {
-                Vector3 value;
-                Internal_GetScale(mCachedPtr, out value);
-                return value;
-            }
-
-            set
-            {
-                Internal_SetScale(mCachedPtr, value);
-            }
-        }
-
-        /// <summary>
-        /// State the slider is currently in.
-        /// </summary>
-        public StateType State
-        {
-            get
-            {
-                StateType value;
-                Internal_GetState(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        /// <summary>
-        /// Destroys the slider, removing it from the scene.
-        /// </summary>
-        internal void Destroy()
-        {
-            Internal_Destroy(mCachedPtr);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Destroy(IntPtr nativeInstance);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetPosition(IntPtr nativeInstance, out Vector3 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetPosition(IntPtr nativeInstance, Vector3 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetRotation(IntPtr nativeInstance, out Quaternion value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetRotation(IntPtr nativeInstance, Quaternion value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetScale(IntPtr nativeInstance, out Vector3 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetScale(IntPtr nativeInstance, Vector3 value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetState(IntPtr nativeInstance, out StateType value);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Base class for all handle sliders. A handle slider is geometry that the user can interact with by selecting or 
+    /// dragging (i.e. sliding) it while in scene view. Sliders generally output a one- or multi-dimensional delta value 
+    /// that signals the drag amount (and/or direction). Handle sliders are one of the building blocks for 
+    /// <see cref="Handle"/> implementations.
+    /// </summary>
+    public class HandleSlider : ScriptObject
+    {
+        /// <summary>
+        /// Possible states the slider can be in.
+        /// </summary>
+        public enum StateType
+        {
+            /// <summary>Slider is not being interacted with.</summary>
+	        Inactive,
+            /// <summary>Slider is clicked on and being dragged.</summary>
+	        Active,
+            /// <summary>Slider is being hovered over but isn't clicked on.</summary>
+	        Hover
+        };
+
+        /// <summary>
+        /// Creates a new handle slider.
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
+        public HandleSlider(Handle parentHandle)
+        {
+            parentHandle.RegisterSlider(this);
+        }
+
+        /// <summary>
+        /// World position of the slider.
+        /// </summary>
+        public Vector3 Position
+        {
+            get
+            {
+                Vector3 value;
+                Internal_GetPosition(mCachedPtr, out value);
+                return value;
+            }
+
+            set
+            {
+                Internal_SetPosition(mCachedPtr, ref value);
+            }
+        }
+
+        /// <summary>
+        /// World rotation of the slider.
+        /// </summary>
+        public Quaternion Rotation
+        {
+            get
+            {
+                Quaternion value;
+                Internal_GetRotation(mCachedPtr, out value);
+                return value;
+            }
+
+            set
+            {
+                Internal_SetRotation(mCachedPtr, ref value);
+            }
+        }
+
+        /// <summary>
+        /// Scale of the slider.
+        /// </summary>
+        public Vector3 Scale
+        {
+            get
+            {
+                Vector3 value;
+                Internal_GetScale(mCachedPtr, out value);
+                return value;
+            }
+
+            set
+            {
+                Internal_SetScale(mCachedPtr, ref value);
+            }
+        }
+
+        /// <summary>
+        /// State the slider is currently in.
+        /// </summary>
+        public StateType State
+        {
+            get
+            {
+                StateType value;
+                Internal_GetState(mCachedPtr, out value);
+                return value;
+            }
+        }
+
+        /// <summary>
+        /// Destroys the slider, removing it from the scene.
+        /// </summary>
+        internal void Destroy()
+        {
+            Internal_Destroy(mCachedPtr);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_Destroy(IntPtr nativeInstance);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetPosition(IntPtr nativeInstance, out Vector3 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetPosition(IntPtr nativeInstance, ref Vector3 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetRotation(IntPtr nativeInstance, out Quaternion value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetRotation(IntPtr nativeInstance, ref Quaternion value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetScale(IntPtr nativeInstance, out Vector3 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetScale(IntPtr nativeInstance, ref Vector3 value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetState(IntPtr nativeInstance, out StateType value);
+    }
+}

+ 77 - 77
MBansheeEditor/Scene/HandleSliderDisc.cs

@@ -1,77 +1,77 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Handle slider that returns a delta value as you drag the pointer along a disc. For intersection purposes the disc 
-    /// is internally represented by a torus.
-    /// </summary>
-    public sealed class HandleSliderDisc : HandleSlider
-    {
-        /// <summary>
-        /// Creates a new disc handle slider.
-        /// </summary>
-        /// <param name="parentHandle">Handle that the slider belongs to.</param>
-        /// <param name="normal">Normal that determines the orientation of the disc.</param>
-        /// <param name="radius">Radius of the disc.</param>
-        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the 
-        ///                          viewport regardless of distance from camera.</param>
-        public HandleSliderDisc(Handle parentHandle, Vector3 normal, float radius, bool fixedScale = true)
-            :base(parentHandle)
-        {
-            Internal_CreateInstance(this, normal, radius, fixedScale);
-        }
-
-        /// <summary>
-        /// Returns a delta value that is the result of dragging/sliding the pointer along the disc. This changes every 
-        /// frame and will be zero unless the slider is active.
-        /// </summary>
-        public Degree Delta
-        {
-            get
-            {
-                float value;
-                Internal_GetDelta(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        /// <summary>
-        /// Gets the initial angle at which the drag/slide operation started. This is only valid when the slider is active.
-        /// </summary>
-        public Degree StartAngle
-        {
-            get
-            {
-                float value;
-                Internal_GetStartAngle(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        /// <summary>
-        /// Enables or disables a cut-off plane that can allow the disc to be intersected with only in a 180 degree arc.
-        /// </summary>
-        /// <param name="angle">Angle at which to start the cut-off. Points on the dist at the specified angle and the next
-        ///                     180 degrees won't be interactable.</param>
-        /// <param name="enabled">Should the cutoff plane be enabled or disabled.</param>
-        public void SetCutoffPlane(Degree angle, bool enabled)
-        {
-            Internal_SetCutoffPlane(mCachedPtr, angle.Degrees, enabled);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(HandleSliderDisc instance, Vector3 normal, float radius, bool fixedScale);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetStartAngle(IntPtr nativeInstance, out float value);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetCutoffPlane(IntPtr nativeInstance, float angle, bool enabled);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Handle slider that returns a delta value as you drag the pointer along a disc. For intersection purposes the disc 
+    /// is internally represented by a torus.
+    /// </summary>
+    public sealed class HandleSliderDisc : HandleSlider
+    {
+        /// <summary>
+        /// Creates a new disc handle slider.
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
+        /// <param name="normal">Normal that determines the orientation of the disc.</param>
+        /// <param name="radius">Radius of the disc.</param>
+        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the 
+        ///                          viewport regardless of distance from camera.</param>
+        public HandleSliderDisc(Handle parentHandle, Vector3 normal, float radius, bool fixedScale = true)
+            :base(parentHandle)
+        {
+            Internal_CreateInstance(this, ref normal, radius, fixedScale);
+        }
+
+        /// <summary>
+        /// Returns a delta value that is the result of dragging/sliding the pointer along the disc. This changes every 
+        /// frame and will be zero unless the slider is active.
+        /// </summary>
+        public Degree Delta
+        {
+            get
+            {
+                float value;
+                Internal_GetDelta(mCachedPtr, out value);
+                return value;
+            }
+        }
+
+        /// <summary>
+        /// Gets the initial angle at which the drag/slide operation started. This is only valid when the slider is active.
+        /// </summary>
+        public Degree StartAngle
+        {
+            get
+            {
+                float value;
+                Internal_GetStartAngle(mCachedPtr, out value);
+                return value;
+            }
+        }
+
+        /// <summary>
+        /// Enables or disables a cut-off plane that can allow the disc to be intersected with only in a 180 degree arc.
+        /// </summary>
+        /// <param name="angle">Angle at which to start the cut-off. Points on the dist at the specified angle and the next
+        ///                     180 degrees won't be interactable.</param>
+        /// <param name="enabled">Should the cutoff plane be enabled or disabled.</param>
+        public void SetCutoffPlane(Degree angle, bool enabled)
+        {
+            Internal_SetCutoffPlane(mCachedPtr, angle.Degrees, enabled);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(HandleSliderDisc instance, ref Vector3 normal, float radius, bool fixedScale);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetStartAngle(IntPtr nativeInstance, out float value);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetCutoffPlane(IntPtr nativeInstance, float angle, bool enabled);
+    }
+}

+ 47 - 47
MBansheeEditor/Scene/HandleSliderLine.cs

@@ -1,47 +1,47 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Handle slider that returns a delta value as you drag the pointer along a line. For intersection purposes the line 
-    /// is internally by a capsule and a sphere at its cap (assuming this will be used for arrow-like handles).
-    /// </summary>
-    public sealed class HandleSliderLine : HandleSlider
-    {
-        /// <summary>
-        /// Creates a new line handle slider. 
-        /// </summary>
-        /// <param name="parentHandle">Handle that the slider belongs to.</param>
-        /// <param name="direction">Normalized direction towards which the line is pointing.</param>
-        /// <param name="length">Length of the line.</param>
-        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the
-        ///                          viewport regardless of distance from camera.</param>
-        public HandleSliderLine(Handle parentHandle, Vector3 direction, float length, bool fixedScale = true)
-            :base(parentHandle)
-        {
-            Internal_CreateInstance(this, direction, length, fixedScale);
-        }
-
-        /// <summary>
-        /// Returns a delta value that is the result of dragging/sliding the pointer along the line. This changes every 
-        /// frame and will be zero unless the slider is active.
-        /// </summary>
-        public float Delta
-        {
-            get
-            {
-                float value;
-                Internal_GetDelta(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(HandleSliderLine instance, Vector3 direction, float length, bool fixedScale);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Handle slider that returns a delta value as you drag the pointer along a line. For intersection purposes the line 
+    /// is internally by a capsule and a sphere at its cap (assuming this will be used for arrow-like handles).
+    /// </summary>
+    public sealed class HandleSliderLine : HandleSlider
+    {
+        /// <summary>
+        /// Creates a new line handle slider. 
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
+        /// <param name="direction">Normalized direction towards which the line is pointing.</param>
+        /// <param name="length">Length of the line.</param>
+        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the
+        ///                          viewport regardless of distance from camera.</param>
+        public HandleSliderLine(Handle parentHandle, Vector3 direction, float length, bool fixedScale = true)
+            :base(parentHandle)
+        {
+            Internal_CreateInstance(this, ref direction, length, fixedScale);
+        }
+
+        /// <summary>
+        /// Returns a delta value that is the result of dragging/sliding the pointer along the line. This changes every 
+        /// frame and will be zero unless the slider is active.
+        /// </summary>
+        public float Delta
+        {
+            get
+            {
+                float value;
+                Internal_GetDelta(mCachedPtr, out value);
+                return value;
+            }
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(HandleSliderLine instance, ref Vector3 direction, float length, bool fixedScale);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);
+    }
+}

+ 51 - 51
MBansheeEditor/Scene/HandleSliderPlane.cs

@@ -1,51 +1,51 @@
-using System;
-using System.Runtime.CompilerServices;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Handle slider that returns a delta value as you drag the pointer along a plane. For intersection purposes the line 
-    /// is internally by a quadrilateral (a bounded plane).
-    /// </summary>
-    public sealed class HandleSliderPlane : HandleSlider
-    {        
-        /// <summary>
-        /// Creates a new plane handle slider. 
-        /// </summary>
-        /// <param name="parentHandle">Handle that the slider belongs to.</param>
-        /// <param name="dir1">First direction of the plane. The x component of returned delta value will be in this 
-        ///                    direction. Should be perpendicular to <see cref="dir2"/>.</param>
-        /// <param name="dir2">Second direction of the plane. The y component of returned delta value will be in this
-        ///                    direction. Should be perpendicular to <see cref="dir1"/>.</param>
-        /// <param name="length">Length of the quadrilateral in both directions.</param>
-        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the
-        ///                          viewport regardless of distance from camera.</param>
-        public HandleSliderPlane(Handle parentHandle, Vector3 dir1, Vector3 dir2, float length, bool fixedScale = true)
-            :base(parentHandle)
-        {
-            Internal_CreateInstance(this, dir1, dir2, length, fixedScale);
-        }
-
-        /// <summary>
-        /// Returns a delta value that is the result of dragging/sliding the pointer along the plane. Returned movement is 
-        /// in terms of the two directions originally provided when constructing the slider. This changes every frame and 
-        /// will be zero unless the slider is active.
-        /// </summary>
-        public Vector2 Delta
-        {
-            get
-            {
-                Vector2 value;
-                Internal_GetDelta(mCachedPtr, out value);
-                return value;
-            }
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(HandleSliderPlane instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetDelta(IntPtr nativeInstance, out Vector2 value);
-    }
-}
+using System;
+using System.Runtime.CompilerServices;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Handle slider that returns a delta value as you drag the pointer along a plane. For intersection purposes the line 
+    /// is internally by a quadrilateral (a bounded plane).
+    /// </summary>
+    public sealed class HandleSliderPlane : HandleSlider
+    {        
+        /// <summary>
+        /// Creates a new plane handle slider. 
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
+        /// <param name="dir1">First direction of the plane. The x component of returned delta value will be in this 
+        ///                    direction. Should be perpendicular to <see cref="dir2"/>.</param>
+        /// <param name="dir2">Second direction of the plane. The y component of returned delta value will be in this
+        ///                    direction. Should be perpendicular to <see cref="dir1"/>.</param>
+        /// <param name="length">Length of the quadrilateral in both directions.</param>
+        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the
+        ///                          viewport regardless of distance from camera.</param>
+        public HandleSliderPlane(Handle parentHandle, Vector3 dir1, Vector3 dir2, float length, bool fixedScale = true)
+            :base(parentHandle)
+        {
+            Internal_CreateInstance(this, ref dir1, ref dir2, length, fixedScale);
+        }
+
+        /// <summary>
+        /// Returns a delta value that is the result of dragging/sliding the pointer along the plane. Returned movement is 
+        /// in terms of the two directions originally provided when constructing the slider. This changes every frame and 
+        /// will be zero unless the slider is active.
+        /// </summary>
+        public Vector2 Delta
+        {
+            get
+            {
+                Vector2 value;
+                Internal_GetDelta(mCachedPtr, out value);
+                return value;
+            }
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_CreateInstance(HandleSliderPlane instance, ref Vector3 dir1, ref Vector3 dir2, float length, bool fixedScale);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetDelta(IntPtr nativeInstance, out Vector2 value);
+    }
+}

+ 112 - 112
MBansheeEditor/Scene/SceneViewHandler.cs

@@ -1,112 +1,112 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Handles scene view handle interactions, object picking and gizmos.
-    /// </summary>
-    internal sealed class SceneViewHandler : ScriptObject
-    {
-        /// <summary>
-        /// Creates a new scene view handler.
-        /// </summary>
-        /// <param name="parent">Editor window in which the scene view is displayed.</param>
-        /// <param name="sceneCamera">Camera through which the scene view is displayed.</param>
-        internal SceneViewHandler(EditorWindow parent, Camera sceneCamera)
-        {
-            Internal_Create(this, parent.GetCachedPtr(), sceneCamera.Native.GetCachedPtr());
-        }
-
-        /// <summary>
-        /// Called every frame. Updates gizmos and scene grid.
-        /// </summary>
-        internal void Update()
-        {
-            Internal_Update(mCachedPtr);
-        }
-
-        /// <summary>
-        /// Updates currently active handles.
-        /// </summary>
-        /// <param name="pointerPos">Position of the pointer relative to the scene camera viewport.</param>
-        /// <param name="inputDelta">Movement of the pointer since last frame.</param>
-        internal void UpdateHandle(Vector2I pointerPos, Vector2I inputDelta)
-        {
-            Internal_UpdateHandle(mCachedPtr, pointerPos, inputDelta);
-        }
-
-        /// <summary>
-        /// Updates the selection overlay for currently selected object(s).
-        /// </summary>
-        internal void UpdateSelection()
-        {
-            Internal_UpdateSelection(mCachedPtr);
-        }
-
-        /// <summary>
-        /// Selects a handle under the pointer position.
-        /// </summary>
-        /// <param name="pointerPos">Position of the pointer relative to the scene camera viewport.</param>
-        internal void TrySelectHandle(Vector2I pointerPos)
-        {
-            Internal_TrySelectHandle(mCachedPtr, pointerPos);
-        }
-
-        /// <summary>
-        /// Checks is any handle currently active.
-        /// </summary>
-        /// <returns>True if a handle is active.</returns>
-        internal bool IsHandleActive()
-        {
-            return Internal_IsHandleActive(mCachedPtr);
-        }
-
-        /// <summary>
-        /// Deselects any currently active handles.
-        /// </summary>
-        internal void ClearHandleSelection()
-        {
-            Internal_ClearHandleSelection(mCachedPtr);
-        }
-
-        /// <summary>
-        /// Attempts to select a scene object under the pointer position.
-        /// </summary>
-        /// <param name="pointerPos">Position of the pointer relative to the scene camera viewport.</param>
-        /// <param name="controlHeld">Should this selection add to the existing selection, or replace it.</param>
-        internal void PickObject(Vector2I pointerPos, bool controlHeld)
-        {
-            Internal_PickObject(mCachedPtr, pointerPos, controlHeld);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Create(SceneViewHandler managedInstance, IntPtr parentWindow, IntPtr camera);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_Update(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_UpdateHandle(IntPtr thisPtr, Vector2I pointerPos, Vector2I inputDelta);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_UpdateSelection(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_TrySelectHandle(IntPtr thisPtr, Vector2I pointerPos);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern bool Internal_IsHandleActive(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_ClearHandleSelection(IntPtr thisPtr);
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_PickObject(IntPtr thisPtr, Vector2I pointerPos, bool controlHeld);
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Handles scene view handle interactions, object picking and gizmos.
+    /// </summary>
+    internal sealed class SceneViewHandler : ScriptObject
+    {
+        /// <summary>
+        /// Creates a new scene view handler.
+        /// </summary>
+        /// <param name="parent">Editor window in which the scene view is displayed.</param>
+        /// <param name="sceneCamera">Camera through which the scene view is displayed.</param>
+        internal SceneViewHandler(EditorWindow parent, Camera sceneCamera)
+        {
+            Internal_Create(this, parent.GetCachedPtr(), sceneCamera.Native.GetCachedPtr());
+        }
+
+        /// <summary>
+        /// Called every frame. Updates gizmos and scene grid.
+        /// </summary>
+        internal void Update()
+        {
+            Internal_Update(mCachedPtr);
+        }
+
+        /// <summary>
+        /// Updates currently active handles.
+        /// </summary>
+        /// <param name="pointerPos">Position of the pointer relative to the scene camera viewport.</param>
+        /// <param name="inputDelta">Movement of the pointer since last frame.</param>
+        internal void UpdateHandle(Vector2I pointerPos, Vector2I inputDelta)
+        {
+            Internal_UpdateHandle(mCachedPtr, ref pointerPos, ref inputDelta);
+        }
+
+        /// <summary>
+        /// Updates the selection overlay for currently selected object(s).
+        /// </summary>
+        internal void UpdateSelection()
+        {
+            Internal_UpdateSelection(mCachedPtr);
+        }
+
+        /// <summary>
+        /// Selects a handle under the pointer position.
+        /// </summary>
+        /// <param name="pointerPos">Position of the pointer relative to the scene camera viewport.</param>
+        internal void TrySelectHandle(Vector2I pointerPos)
+        {
+            Internal_TrySelectHandle(mCachedPtr, ref pointerPos);
+        }
+
+        /// <summary>
+        /// Checks is any handle currently active.
+        /// </summary>
+        /// <returns>True if a handle is active.</returns>
+        internal bool IsHandleActive()
+        {
+            return Internal_IsHandleActive(mCachedPtr);
+        }
+
+        /// <summary>
+        /// Deselects any currently active handles.
+        /// </summary>
+        internal void ClearHandleSelection()
+        {
+            Internal_ClearHandleSelection(mCachedPtr);
+        }
+
+        /// <summary>
+        /// Attempts to select a scene object under the pointer position.
+        /// </summary>
+        /// <param name="pointerPos">Position of the pointer relative to the scene camera viewport.</param>
+        /// <param name="controlHeld">Should this selection add to the existing selection, or replace it.</param>
+        internal void PickObject(Vector2I pointerPos, bool controlHeld)
+        {
+            Internal_PickObject(mCachedPtr, ref pointerPos, controlHeld);
+        }
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_Create(SceneViewHandler managedInstance, IntPtr parentWindow, IntPtr camera);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_Update(IntPtr thisPtr);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_UpdateHandle(IntPtr thisPtr, ref Vector2I pointerPos, ref Vector2I inputDelta);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_UpdateSelection(IntPtr thisPtr);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_TrySelectHandle(IntPtr thisPtr, ref Vector2I pointerPos);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern bool Internal_IsHandleActive(IntPtr thisPtr);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_ClearHandleSelection(IntPtr thisPtr);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_PickObject(IntPtr thisPtr, ref Vector2I pointerPos, bool controlHeld);
+    }
+}

+ 120 - 120
SBansheeEditor/Include/BsScriptDropDownWindow.h

@@ -1,121 +1,121 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsDropDownWindow.h"
-#include "BsVector2I.h"
-
-namespace BansheeEngine
-{
-	class ManagedDropDownWindow;
-
-	/**
-	 * @brief	Interop class between C++ & CLR for types deriving from DropDownWindow.
-	 */
-	class BS_SCR_BED_EXPORT ScriptDropDownWindow : public ScriptObject <ScriptDropDownWindow>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "DropDownWindow")
-
-		~ScriptDropDownWindow();
-
-	private:
-		friend class ManagedDropDownWindow;
-
-		ScriptDropDownWindow(ManagedDropDownWindow* window);
-
-		/**
-		 * @brief	Triggered when the assembly refresh starts.
-		 */
-		void onAssemblyRefreshStarted();
-
-		/**
-		 * @brief	Triggered when the native DropDownWindow wrapped by this object
-		 *			gets closed.
-		 */
-		void notifyWindowClosed();
-
-		ManagedDropDownWindow* mDropDownWindow;
-		HEvent mOnAssemblyRefreshStartedConn;
-
-		static MonoField* guiPanelField;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* parentWindow, Vector2I position, int width, int height);
-		static void internal_Close(ScriptDropDownWindow* nativeInstance);
-		static void internal_SetWidth(ScriptDropDownWindow* nativeInstance, UINT32 value);
-		static void internal_SetHeight(ScriptDropDownWindow* nativeInstance, UINT32 value);
-		static void internal_ScreenToWindowPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* windowPos);
-		static void internal_WindowToScreenPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* screenPos);
-	};
-
-	/**
-	 * @brief	Managed implementation of a DropDownWindow. All managed drop down windows
-	 *			are implemented using this class, and the managed instance contains the
-	 *			specifics of each implementation.
-	 */
-	class BS_SCR_BED_EXPORT ManagedDropDownWindow : public DropDownWindow
-	{
-	public:
-		ManagedDropDownWindow(const RenderWindowPtr& parent, const CameraPtr& camera,
-			const Vector2I& position, MonoObject* managedInstance, UINT32 width, UINT32 height);
-		~ManagedDropDownWindow();
-
-		/**
-		 * @brief	Initializes the drop down window with the interop object that owns 
-		 *			the managed instance of this window
-		 */
-		void initialize(ScriptDropDownWindow* parent);
-
-		/**
-		 * @brief	Called every frame. Triggers OnEditorUpdate method on the managed object.
-		 */
-		void update() override;
-
-		/**
-		 * @brief	Trigger the OnInitialize method on the managed object.
-		 */
-		void triggerOnInitialize();
-
-		/**
-		 * @brief	Trigger the OnDestroy method on the managed object.
-		 */
-		void triggerOnDestroy();
-
-		/**
-		 * @brief	Returns the managed instance of the drop down window implementation.
-		 */
-		MonoObject* getManagedInstance() const { return mManagedInstance; }
-
-		/**
-		 * @brief	Reloads all the managed types and methods. Usually called right after
-		 *			construction or after assembly reload.
-		 *
-		 * @param	windowClass	Managed class of the drop down window to retrieve the data for.
-		 */
-		void reloadMonoTypes(MonoClass* windowClass);
-
-	private:
-		friend class ScriptModalWindow;
-
-		typedef void(__stdcall *OnInitializeThunkDef) (MonoObject*, MonoException**);
-		typedef void(__stdcall *OnDestroyThunkDef) (MonoObject*, MonoException**);
-		typedef void(__stdcall *UpdateThunkDef) (MonoObject*, MonoException**);
-
-		String mNamespace;
-		String mTypename;
-
-		OnInitializeThunkDef mOnInitializeThunk;
-		OnDestroyThunkDef mOnDestroyThunk;
-		UpdateThunkDef mUpdateThunk;
-
-		bool mIsInitialized;
-		MonoObject* mManagedInstance;
-		uint32_t mGCHandle;
-
-		ScriptDropDownWindow* mScriptParent;
-		ScriptGUILayout* mContentsPanel;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsDropDownWindow.h"
+#include "BsVector2I.h"
+
+namespace BansheeEngine
+{
+	class ManagedDropDownWindow;
+
+	/**
+	 * @brief	Interop class between C++ & CLR for types deriving from DropDownWindow.
+	 */
+	class BS_SCR_BED_EXPORT ScriptDropDownWindow : public ScriptObject <ScriptDropDownWindow>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "DropDownWindow")
+
+		~ScriptDropDownWindow();
+
+	private:
+		friend class ManagedDropDownWindow;
+
+		ScriptDropDownWindow(ManagedDropDownWindow* window);
+
+		/**
+		 * @brief	Triggered when the assembly refresh starts.
+		 */
+		void onAssemblyRefreshStarted();
+
+		/**
+		 * @brief	Triggered when the native DropDownWindow wrapped by this object
+		 *			gets closed.
+		 */
+		void notifyWindowClosed();
+
+		ManagedDropDownWindow* mDropDownWindow;
+		HEvent mOnAssemblyRefreshStartedConn;
+
+		static MonoField* guiPanelField;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* parentWindow, Vector2I* position, int width, int height);
+		static void internal_Close(ScriptDropDownWindow* nativeInstance);
+		static void internal_SetWidth(ScriptDropDownWindow* nativeInstance, UINT32 value);
+		static void internal_SetHeight(ScriptDropDownWindow* nativeInstance, UINT32 value);
+		static void internal_ScreenToWindowPos(ScriptDropDownWindow* nativeInstance, Vector2I* position, Vector2I* windowPos);
+		static void internal_WindowToScreenPos(ScriptDropDownWindow* nativeInstance, Vector2I* position, Vector2I* screenPos);
+	};
+
+	/**
+	 * @brief	Managed implementation of a DropDownWindow. All managed drop down windows
+	 *			are implemented using this class, and the managed instance contains the
+	 *			specifics of each implementation.
+	 */
+	class BS_SCR_BED_EXPORT ManagedDropDownWindow : public DropDownWindow
+	{
+	public:
+		ManagedDropDownWindow(const RenderWindowPtr& parent, const CameraPtr& camera,
+			const Vector2I& position, MonoObject* managedInstance, UINT32 width, UINT32 height);
+		~ManagedDropDownWindow();
+
+		/**
+		 * @brief	Initializes the drop down window with the interop object that owns 
+		 *			the managed instance of this window
+		 */
+		void initialize(ScriptDropDownWindow* parent);
+
+		/**
+		 * @brief	Called every frame. Triggers OnEditorUpdate method on the managed object.
+		 */
+		void update() override;
+
+		/**
+		 * @brief	Trigger the OnInitialize method on the managed object.
+		 */
+		void triggerOnInitialize();
+
+		/**
+		 * @brief	Trigger the OnDestroy method on the managed object.
+		 */
+		void triggerOnDestroy();
+
+		/**
+		 * @brief	Returns the managed instance of the drop down window implementation.
+		 */
+		MonoObject* getManagedInstance() const { return mManagedInstance; }
+
+		/**
+		 * @brief	Reloads all the managed types and methods. Usually called right after
+		 *			construction or after assembly reload.
+		 *
+		 * @param	windowClass	Managed class of the drop down window to retrieve the data for.
+		 */
+		void reloadMonoTypes(MonoClass* windowClass);
+
+	private:
+		friend class ScriptModalWindow;
+
+		typedef void(__stdcall *OnInitializeThunkDef) (MonoObject*, MonoException**);
+		typedef void(__stdcall *OnDestroyThunkDef) (MonoObject*, MonoException**);
+		typedef void(__stdcall *UpdateThunkDef) (MonoObject*, MonoException**);
+
+		String mNamespace;
+		String mTypename;
+
+		OnInitializeThunkDef mOnInitializeThunk;
+		OnDestroyThunkDef mOnDestroyThunk;
+		UpdateThunkDef mUpdateThunk;
+
+		bool mIsInitialized;
+		MonoObject* mManagedInstance;
+		uint32_t mGCHandle;
+
+		ScriptDropDownWindow* mScriptParent;
+		ScriptGUILayout* mContentsPanel;
+	};
 }
 }

+ 2 - 2
SBansheeEditor/Include/BsScriptEditorWindow.h

@@ -132,8 +132,8 @@ namespace BansheeEngine
 		static MonoObject* internal_getInstance(MonoString* ns, MonoString* typeName);
 		static MonoObject* internal_getInstance(MonoString* ns, MonoString* typeName);
 
 
 		static bool internal_hasFocus(ScriptEditorWindow* thisPtr);
 		static bool internal_hasFocus(ScriptEditorWindow* thisPtr);
-		static void internal_screenToWindowPos(ScriptEditorWindow* thisPtr, Vector2I screenPos, Vector2I* windowPos);
-		static void internal_windowToScreenPos(ScriptEditorWindow* thisPtr, Vector2I windowPos, Vector2I* screenPos);
+		static void internal_screenToWindowPos(ScriptEditorWindow* thisPtr, Vector2I* screenPos, Vector2I* windowPos);
+		static void internal_windowToScreenPos(ScriptEditorWindow* thisPtr, Vector2I* windowPos, Vector2I* screenPos);
 		static UINT32 internal_getWidth(ScriptEditorWindow* thisPtr);
 		static UINT32 internal_getWidth(ScriptEditorWindow* thisPtr);
 		static UINT32 internal_getHeight(ScriptEditorWindow* thisPtr);
 		static UINT32 internal_getHeight(ScriptEditorWindow* thisPtr);
 	};
 	};

+ 40 - 40
SBansheeEditor/Include/BsScriptGUIColorField.h

@@ -1,41 +1,41 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-#include "BsColor.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIColorField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIColorField : public TScriptGUIElement<ScriptGUIColorField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIColorField")
-
-	private:
-		ScriptGUIColorField(MonoObject* instance, GUIColorField* colorField);
-
-		/**
-		 * @brief	Triggered when the user clicks on the native color field.
-		 *
-		 * @param	instance	Managed GUIColorField instance.
-		 */
-		static void onClicked(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIColorField* nativeInstance, Color* output);
-		static void internal_setValue(ScriptGUIColorField* nativeInstance, Color value);
-		static void internal_setTint(ScriptGUIColorField* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnClickedThunkDef) (MonoObject*, MonoException**);
-
-		static OnClickedThunkDef onClickedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+#include "BsColor.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIColorField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIColorField : public TScriptGUIElement<ScriptGUIColorField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIColorField")
+
+	private:
+		ScriptGUIColorField(MonoObject* instance, GUIColorField* colorField);
+
+		/**
+		 * @brief	Triggered when the user clicks on the native color field.
+		 *
+		 * @param	instance	Managed GUIColorField instance.
+		 */
+		static void onClicked(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIColorField* nativeInstance, Color* output);
+		static void internal_setValue(ScriptGUIColorField* nativeInstance, Color* value);
+		static void internal_setTint(ScriptGUIColorField* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnClickedThunkDef) (MonoObject*, MonoException**);
+
+		static OnClickedThunkDef onClickedThunk;
+	};
 }
 }

+ 48 - 48
SBansheeEditor/Include/BsScriptGUIEnumField.h

@@ -1,49 +1,49 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIListBoxField, with some specific functionality
-	 *			meant for displaying managed enumeration values.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIEnumField : public TScriptGUIElement<ScriptGUIEnumField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIEnumField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native list box selection changes.
-		 *
-		 * @param	instance	Managed GUIEnumField instance.
-		 * @param	newIndex	Index of the selected element.
-		 * @param	enabled		Determines whether the element at the selection index was enabled or disabled.
-		 */
-		static void onSelectionChanged(MonoObject* instance, UINT64 newIndex, bool enabled);
-
-		ScriptGUIEnumField(MonoObject* instance, GUIListBoxField* listBoxField, const Vector<UINT64>& values);
-
-		Vector<UINT64> mValues;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoArray* names, MonoArray* values, bool multiselect,
-			MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static UINT64 internal_getValue(ScriptGUIEnumField* nativeInstance);
-		static void internal_setValue(ScriptGUIEnumField* nativeInstance, UINT64 value);
-		static void internal_setTint(ScriptGUIEnumField* nativeInstance, Color color);
-		static void internal_selectElement(ScriptGUIEnumField* nativeInstance, int idx);
-		static void internal_deselectElement(ScriptGUIEnumField* nativeInstance, int idx);
-		static MonoArray* internal_getElementStates(ScriptGUIEnumField* nativeInstance);
-		static void internal_setElementStates(ScriptGUIEnumField* nativeInstance, MonoArray* states);
-
-		typedef void(__stdcall *OnSelectionChangedThunkDef) (MonoObject*, UINT64, MonoException**);
-
-		static OnSelectionChangedThunkDef onSelectionChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIListBoxField, with some specific functionality
+	 *			meant for displaying managed enumeration values.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIEnumField : public TScriptGUIElement<ScriptGUIEnumField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIEnumField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native list box selection changes.
+		 *
+		 * @param	instance	Managed GUIEnumField instance.
+		 * @param	newIndex	Index of the selected element.
+		 * @param	enabled		Determines whether the element at the selection index was enabled or disabled.
+		 */
+		static void onSelectionChanged(MonoObject* instance, UINT64 newIndex, bool enabled);
+
+		ScriptGUIEnumField(MonoObject* instance, GUIListBoxField* listBoxField, const Vector<UINT64>& values);
+
+		Vector<UINT64> mValues;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoArray* names, MonoArray* values, bool multiselect,
+			MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static UINT64 internal_getValue(ScriptGUIEnumField* nativeInstance);
+		static void internal_setValue(ScriptGUIEnumField* nativeInstance, UINT64 value);
+		static void internal_setTint(ScriptGUIEnumField* nativeInstance, Color* color);
+		static void internal_selectElement(ScriptGUIEnumField* nativeInstance, int idx);
+		static void internal_deselectElement(ScriptGUIEnumField* nativeInstance, int idx);
+		static MonoArray* internal_getElementStates(ScriptGUIEnumField* nativeInstance);
+		static void internal_setElementStates(ScriptGUIEnumField* nativeInstance, MonoArray* states);
+
+		typedef void(__stdcall *OnSelectionChangedThunkDef) (MonoObject*, UINT64, MonoException**);
+
+		static OnSelectionChangedThunkDef onSelectionChangedThunk;
+	};
 }
 }

+ 51 - 51
SBansheeEditor/Include/BsScriptGUIFloatField.h

@@ -1,52 +1,52 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIFloatField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIFloatField : public TScriptGUIElement<ScriptGUIFloatField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIFloatField")
-
-	private:
-		ScriptGUIFloatField(MonoObject* instance, GUIFloatField* floatField);
-
-		/**
-		 * @brief	Triggered when the value in the native float field changes.
-		 *
-		 * @param	instance	Managed GUIFloatField instance.
-		 * @param	newValue	New field value.
-		 */
-		static void onChanged(MonoObject* instance, float newValue);
-
-		/**
-		 * @brief	Triggered when the user confirms input in the native float field.
-		 *
-		 * @param	instance	Managed GUIFloatField instance.
-		 */
-		static void onConfirmed(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIFloatField* nativeInstance, float* output);
-		static void internal_setValue(ScriptGUIFloatField* nativeInstance, float value);
-		static void internal_hasInputFocus(ScriptGUIFloatField* nativeInstance, bool* output);
-		static void internal_setTint(ScriptGUIFloatField* nativeInstance, Color color);
-		static void internal_setRange(ScriptGUIFloatField* nativeInstance, float min, float max);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
-		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-		static OnConfirmedThunkDef onConfirmedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIFloatField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIFloatField : public TScriptGUIElement<ScriptGUIFloatField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIFloatField")
+
+	private:
+		ScriptGUIFloatField(MonoObject* instance, GUIFloatField* floatField);
+
+		/**
+		 * @brief	Triggered when the value in the native float field changes.
+		 *
+		 * @param	instance	Managed GUIFloatField instance.
+		 * @param	newValue	New field value.
+		 */
+		static void onChanged(MonoObject* instance, float newValue);
+
+		/**
+		 * @brief	Triggered when the user confirms input in the native float field.
+		 *
+		 * @param	instance	Managed GUIFloatField instance.
+		 */
+		static void onConfirmed(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIFloatField* nativeInstance, float* output);
+		static void internal_setValue(ScriptGUIFloatField* nativeInstance, float value);
+		static void internal_hasInputFocus(ScriptGUIFloatField* nativeInstance, bool* output);
+		static void internal_setTint(ScriptGUIFloatField* nativeInstance, Color* color);
+		static void internal_setRange(ScriptGUIFloatField* nativeInstance, float min, float max);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
+		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+		static OnConfirmedThunkDef onConfirmedThunk;
+	};
 }
 }

+ 47 - 47
SBansheeEditor/Include/BsScriptGUIGameObjectField.h

@@ -1,48 +1,48 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIGameObjectField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIGameObjectField : public TScriptGUIElement<ScriptGUIGameObjectField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIGameObjectField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native game object field changes.
-		 *
-		 * @param	instance	Managed GUIGameObjectField instance.
-		 * @param	newValue	New field value.
-		 */
-		static void onChanged(MonoObject* instance, const HGameObject& newValue);
-
-		/**
-		 * @brief	Retrieves a managed instance of the specified native game object.
-		 *			Will return null if one doesn't exist.
-		 */
-		static MonoObject* nativeToManagedGO(const HGameObject& instance);
-
-		ScriptGUIGameObjectField(MonoObject* instance, GUIGameObjectField* GOField);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIGameObjectField* nativeInstance, MonoObject** output);
-		static void internal_setValue(ScriptGUIGameObjectField* nativeInstance, MonoObject* value);
-		static void internal_setTint(ScriptGUIGameObjectField* nativeInstance, Color color);
-
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIGameObjectField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIGameObjectField : public TScriptGUIElement<ScriptGUIGameObjectField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIGameObjectField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native game object field changes.
+		 *
+		 * @param	instance	Managed GUIGameObjectField instance.
+		 * @param	newValue	New field value.
+		 */
+		static void onChanged(MonoObject* instance, const HGameObject& newValue);
+
+		/**
+		 * @brief	Retrieves a managed instance of the specified native game object.
+		 *			Will return null if one doesn't exist.
+		 */
+		static MonoObject* nativeToManagedGO(const HGameObject& instance);
+
+		ScriptGUIGameObjectField(MonoObject* instance, GUIGameObjectField* GOField);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIGameObjectField* nativeInstance, MonoObject** output);
+		static void internal_setValue(ScriptGUIGameObjectField* nativeInstance, MonoObject* value);
+		static void internal_setTint(ScriptGUIGameObjectField* nativeInstance, Color* color);
+
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+	};
 }
 }

+ 51 - 51
SBansheeEditor/Include/BsScriptGUIIntField.h

@@ -1,52 +1,52 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIIntField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIIntField : public TScriptGUIElement<ScriptGUIIntField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIIntField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native int field changes.
-		 *
-		 * @param	instance	Managed GUIIntField instance.
-		 * @param	newValue	New field value.
-		 */
-		static void onChanged(MonoObject* instance, INT32 newValue);
-
-		/**
-		 * @brief	Triggered when the user confirms input in the native int field.
-		 *
-		 * @param	instance	Managed GUIIntField instance.
-		 */
-		static void onConfirmed(MonoObject* instance);
-
-		ScriptGUIIntField(MonoObject* instance, GUIIntField* intField);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIIntField* nativeInstance, INT32* output);
-		static void internal_setValue(ScriptGUIIntField* nativeInstance, INT32 value);
-		static void internal_hasInputFocus(ScriptGUIIntField* nativeInstance, bool* output);
-		static void internal_setRange(ScriptGUIIntField* nativeInstance, INT32 min, INT32 max);
-		static void internal_setTint(ScriptGUIIntField* nativeInstance, Color color);
-
-		typedef void (__stdcall *OnChangedThunkDef) (MonoObject*, INT32, MonoException**);
-		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-		static OnConfirmedThunkDef onConfirmedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIIntField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIIntField : public TScriptGUIElement<ScriptGUIIntField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIIntField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native int field changes.
+		 *
+		 * @param	instance	Managed GUIIntField instance.
+		 * @param	newValue	New field value.
+		 */
+		static void onChanged(MonoObject* instance, INT32 newValue);
+
+		/**
+		 * @brief	Triggered when the user confirms input in the native int field.
+		 *
+		 * @param	instance	Managed GUIIntField instance.
+		 */
+		static void onConfirmed(MonoObject* instance);
+
+		ScriptGUIIntField(MonoObject* instance, GUIIntField* intField);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIIntField* nativeInstance, INT32* output);
+		static void internal_setValue(ScriptGUIIntField* nativeInstance, INT32 value);
+		static void internal_hasInputFocus(ScriptGUIIntField* nativeInstance, bool* output);
+		static void internal_setRange(ScriptGUIIntField* nativeInstance, INT32 min, INT32 max);
+		static void internal_setTint(ScriptGUIIntField* nativeInstance, Color* color);
+
+		typedef void (__stdcall *OnChangedThunkDef) (MonoObject*, INT32, MonoException**);
+		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+		static OnConfirmedThunkDef onConfirmedThunk;
+	};
 }
 }

+ 45 - 45
SBansheeEditor/Include/BsScriptGUIListBoxField.h

@@ -1,46 +1,46 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIListBoxField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIListBoxField : public TScriptGUIElement<ScriptGUIListBoxField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIListBoxField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native list box selection changes.
-		 *
-		 * @param	instance	Managed GUIListBoxField instance.
-		 * @param	newIndex	New selection index.
-		 */
-		static void onSelectionChanged(MonoObject* instance, UINT32 newIndex);
-
-		ScriptGUIListBoxField(MonoObject* instance, GUIListBoxField* listBoxField);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoArray* elements, bool multiselect, 
-			MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_setElements(ScriptGUIListBoxField* nativeInstance, MonoArray* elements);
-		static UINT32 internal_getValue(ScriptGUIListBoxField* nativeInstance);
-		static void internal_setValue(ScriptGUIListBoxField* nativeInstance, UINT32 value);
-		static void internal_selectElement(ScriptGUIListBoxField* nativeInstance, int idx);
-		static void internal_deselectElement(ScriptGUIListBoxField* nativeInstance, int idx);
-		static MonoArray* internal_getElementStates(ScriptGUIListBoxField* nativeInstance);
-		static void internal_setElementStates(ScriptGUIListBoxField* nativeInstance, MonoArray* states);
-		static void internal_setTint(ScriptGUIListBoxField* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnSelectionChangedThunkDef) (MonoObject*, UINT32, MonoException**);
-
-		static OnSelectionChangedThunkDef onSelectionChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIListBoxField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIListBoxField : public TScriptGUIElement<ScriptGUIListBoxField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIListBoxField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native list box selection changes.
+		 *
+		 * @param	instance	Managed GUIListBoxField instance.
+		 * @param	newIndex	New selection index.
+		 */
+		static void onSelectionChanged(MonoObject* instance, UINT32 newIndex);
+
+		ScriptGUIListBoxField(MonoObject* instance, GUIListBoxField* listBoxField);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoArray* elements, bool multiselect, 
+			MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_setElements(ScriptGUIListBoxField* nativeInstance, MonoArray* elements);
+		static UINT32 internal_getValue(ScriptGUIListBoxField* nativeInstance);
+		static void internal_setValue(ScriptGUIListBoxField* nativeInstance, UINT32 value);
+		static void internal_selectElement(ScriptGUIListBoxField* nativeInstance, int idx);
+		static void internal_deselectElement(ScriptGUIListBoxField* nativeInstance, int idx);
+		static MonoArray* internal_getElementStates(ScriptGUIListBoxField* nativeInstance);
+		static void internal_setElementStates(ScriptGUIListBoxField* nativeInstance, MonoArray* states);
+		static void internal_setTint(ScriptGUIListBoxField* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnSelectionChangedThunkDef) (MonoObject*, UINT32, MonoException**);
+
+		static OnSelectionChangedThunkDef onSelectionChangedThunk;
+	};
 }
 }

+ 48 - 48
SBansheeEditor/Include/BsScriptGUIResourceField.h

@@ -1,49 +1,49 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIResourceField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIResourceField : public TScriptGUIElement<ScriptGUIResourceField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIResourceField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native resource field changes.
-		 *
-		 * @param	instance	Managed GUIResourceField instance.
-		 * @param	newHandle	Weak handle of the newly selected resource.
-		 */
-		static void onChanged(MonoObject* instance, const WeakResourceHandle<Resource>& newHandle);
-
-		/**
-		 * @brief	Retrieves a managed instance of the specified native resource.
-		 *			Will return null if one doesn't exist.
-		 */
-		static MonoObject* nativeToManagedResource(const HResource& instance);
-
-		ScriptGUIResourceField(MonoObject* instance, GUIResourceField* resourceField);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIResourceField* nativeInstance, MonoObject** output);
-		static void internal_setValue(ScriptGUIResourceField* nativeInstance, MonoObject* value);
-		static void internal_getValueRef(ScriptGUIResourceField* nativeInstance, MonoObject** output);
-		static void internal_setValueRef(ScriptGUIResourceField* nativeInstance, MonoObject* value);
-		static void internal_setTint(ScriptGUIResourceField* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIResourceField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIResourceField : public TScriptGUIElement<ScriptGUIResourceField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIResourceField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native resource field changes.
+		 *
+		 * @param	instance	Managed GUIResourceField instance.
+		 * @param	newHandle	Weak handle of the newly selected resource.
+		 */
+		static void onChanged(MonoObject* instance, const WeakResourceHandle<Resource>& newHandle);
+
+		/**
+		 * @brief	Retrieves a managed instance of the specified native resource.
+		 *			Will return null if one doesn't exist.
+		 */
+		static MonoObject* nativeToManagedResource(const HResource& instance);
+
+		ScriptGUIResourceField(MonoObject* instance, GUIResourceField* resourceField);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIResourceField* nativeInstance, MonoObject** output);
+		static void internal_setValue(ScriptGUIResourceField* nativeInstance, MonoObject* value);
+		static void internal_getValueRef(ScriptGUIResourceField* nativeInstance, MonoObject** output);
+		static void internal_setValueRef(ScriptGUIResourceField* nativeInstance, MonoObject* value);
+		static void internal_setTint(ScriptGUIResourceField* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+	};
 }
 }

+ 42 - 42
SBansheeEditor/Include/BsScriptGUISliderField.h

@@ -1,43 +1,43 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUISliderField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUISliderField : public TScriptGUIElement<ScriptGUISliderField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUISliderField")
-
-	private:
-		ScriptGUISliderField(MonoObject* instance, GUISliderField* sliderField);
-
-		/**
-		 * @brief	Triggered when the value in the native slider field changes.
-		 *
-		 * @param	instance	Managed GUISliderField instance.
-		 * @param	newValue	New field value.
-		 */
-		static void onChanged(MonoObject* instance, float newValue);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, float min, float max, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static float internal_getValue(ScriptGUISliderField* nativeInstance);
-		static void internal_setValue(ScriptGUISliderField* nativeInstance, float value);
-		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);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUISliderField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUISliderField : public TScriptGUIElement<ScriptGUISliderField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUISliderField")
+
+	private:
+		ScriptGUISliderField(MonoObject* instance, GUISliderField* sliderField);
+
+		/**
+		 * @brief	Triggered when the value in the native slider field changes.
+		 *
+		 * @param	instance	Managed GUISliderField instance.
+		 * @param	newValue	New field value.
+		 */
+		static void onChanged(MonoObject* instance, float newValue);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, float min, float max, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static float internal_getValue(ScriptGUISliderField* nativeInstance);
+		static void internal_setValue(ScriptGUISliderField* nativeInstance, float value);
+		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);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+	};
 }
 }

+ 50 - 50
SBansheeEditor/Include/BsScriptGUITextField.h

@@ -1,51 +1,51 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUITextField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUITextField : public TScriptGUIElement<ScriptGUITextField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUITextField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native text field changes.
-		 *
-		 * @param	instance	Managed GUITextField instance.
-		 * @param	newValue	New string value.
-		 */
-		static void onChanged(MonoObject* instance, const WString& newValue);
-
-		/**
-		 * @brief	Triggered when the user confirms input in the native text field.
-		 *
-		 * @param	instance	Managed GUITextField instance.
-		 */
-		static void onConfirmed(MonoObject* instance);
-
-		ScriptGUITextField(MonoObject* instance, GUITextField* textField);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, bool multiline, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUITextField* nativeInstance, MonoString** output);
-		static void internal_setValue(ScriptGUITextField* nativeInstance, MonoString* value);
-		static void internal_hasInputFocus(ScriptGUITextField* nativeInstance, bool* output);
-		static void internal_setTint(ScriptGUITextField* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoString*, MonoException**);
-		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-		static OnConfirmedThunkDef onConfirmedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUITextField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUITextField : public TScriptGUIElement<ScriptGUITextField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUITextField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native text field changes.
+		 *
+		 * @param	instance	Managed GUITextField instance.
+		 * @param	newValue	New string value.
+		 */
+		static void onChanged(MonoObject* instance, const WString& newValue);
+
+		/**
+		 * @brief	Triggered when the user confirms input in the native text field.
+		 *
+		 * @param	instance	Managed GUITextField instance.
+		 */
+		static void onConfirmed(MonoObject* instance);
+
+		ScriptGUITextField(MonoObject* instance, GUITextField* textField);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, bool multiline, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUITextField* nativeInstance, MonoString** output);
+		static void internal_setValue(ScriptGUITextField* nativeInstance, MonoString* value);
+		static void internal_hasInputFocus(ScriptGUITextField* nativeInstance, bool* output);
+		static void internal_setTint(ScriptGUITextField* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoString*, MonoException**);
+		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+		static OnConfirmedThunkDef onConfirmedThunk;
+	};
 }
 }

+ 49 - 49
SBansheeEditor/Include/BsScriptGUITextureField.h

@@ -1,50 +1,50 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUITextureField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUITextureField : public TScriptGUIElement <ScriptGUITextureField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUITextureField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native texture field changes.
-		 *
-		 * @param	instance	Managed GUITextureField instance.
-		 * @param	newHandle	Handle of the new texture.
-		 */
-		static void onChanged(MonoObject* instance, const WeakResourceHandle<Texture>& newHandle);
-
-		/**
-		 * @brief	Retrieves a managed instance of the specified native texture.
-		 *			Will return null if one doesn't exist.
-		 */
-		static MonoObject* nativeToManagedResource(const HTexture& instance);
-
-		ScriptGUITextureField(MonoObject* instance, GUITextureField* textureField);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUITextureField* nativeInstance, MonoObject** output);
-		static void internal_setValue(ScriptGUITextureField* nativeInstance, MonoObject* value);
-		static void internal_getValueRef(ScriptGUITextureField* nativeInstance, MonoObject** output);
-		static void internal_setValueRef(ScriptGUITextureField* nativeInstance, MonoObject* value);
-		static void internal_setTint(ScriptGUITextureField* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUITextureField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUITextureField : public TScriptGUIElement <ScriptGUITextureField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUITextureField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native texture field changes.
+		 *
+		 * @param	instance	Managed GUITextureField instance.
+		 * @param	newHandle	Handle of the new texture.
+		 */
+		static void onChanged(MonoObject* instance, const WeakResourceHandle<Texture>& newHandle);
+
+		/**
+		 * @brief	Retrieves a managed instance of the specified native texture.
+		 *			Will return null if one doesn't exist.
+		 */
+		static MonoObject* nativeToManagedResource(const HTexture& instance);
+
+		ScriptGUITextureField(MonoObject* instance, GUITextureField* textureField);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUITextureField* nativeInstance, MonoObject** output);
+		static void internal_setValue(ScriptGUITextureField* nativeInstance, MonoObject* value);
+		static void internal_getValueRef(ScriptGUITextureField* nativeInstance, MonoObject** output);
+		static void internal_setValueRef(ScriptGUITextureField* nativeInstance, MonoObject* value);
+		static void internal_setTint(ScriptGUITextureField* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+	};
 }
 }

+ 40 - 40
SBansheeEditor/Include/BsScriptGUIToggleField.h

@@ -1,41 +1,41 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIToggleField.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIToggleField : public TScriptGUIElement<ScriptGUIToggleField>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIToggleField")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native toggle field changes.
-		 *
-		 * @param	instance	Managed GUIToggleField instance.
-		 * @param	newValue	Is the toggle active.
-		 */
-		static void onChanged(MonoObject* instance, bool newValue);
-
-		ScriptGUIToggleField(MonoObject* instance, GUIToggleField* toggleField);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIToggleField* nativeInstance, bool* output);
-		static void internal_setValue(ScriptGUIToggleField* nativeInstance, bool value);
-		static void internal_setTint(ScriptGUIToggleField* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, bool, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIToggleField.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIToggleField : public TScriptGUIElement<ScriptGUIToggleField>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIToggleField")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native toggle field changes.
+		 *
+		 * @param	instance	Managed GUIToggleField instance.
+		 * @param	newValue	Is the toggle active.
+		 */
+		static void onChanged(MonoObject* instance, bool newValue);
+
+		ScriptGUIToggleField(MonoObject* instance, GUIToggleField* toggleField);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIToggleField* nativeInstance, bool* output);
+		static void internal_setValue(ScriptGUIToggleField* nativeInstance, bool value);
+		static void internal_setTint(ScriptGUIToggleField* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, bool, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+	};
 }
 }

+ 50 - 50
SBansheeEditor/Include/BsScriptGUIVector2Field.h

@@ -1,51 +1,51 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIVector2Field.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIVector2Field : public TScriptGUIElement<ScriptGUIVector2Field>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIVector2Field")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native vector field changes.
-		 *
-		 * @param	instance	Managed GUIVector2Field instance.
-		 * @param	newValue	New vector value.
-		 */
-		static void onChanged(MonoObject* instance, Vector2 newValue);
-
-		/**
-		 * @brief	Triggered when the user confirms input in the native vector field.
-		 *
-		 * @param	instance	Managed GUIVector2Field instance.
-		 */
-		static void onConfirmed(MonoObject* instance);
-
-		ScriptGUIVector2Field(MonoObject* instance, GUIVector2Field* vector2Field);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIVector2Field* nativeInstance, Vector2* output);
-		static void internal_setValue(ScriptGUIVector2Field* nativeInstance, Vector2 value);
-		static void internal_hasInputFocus(ScriptGUIVector2Field* nativeInstance, bool* output);
-		static void internal_setTint(ScriptGUIVector2Field* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, Vector2, MonoException**);
-		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-		static OnConfirmedThunkDef onConfirmedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIVector2Field.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIVector2Field : public TScriptGUIElement<ScriptGUIVector2Field>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIVector2Field")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native vector field changes.
+		 *
+		 * @param	instance	Managed GUIVector2Field instance.
+		 * @param	newValue	New vector value.
+		 */
+		static void onChanged(MonoObject* instance, Vector2 newValue);
+
+		/**
+		 * @brief	Triggered when the user confirms input in the native vector field.
+		 *
+		 * @param	instance	Managed GUIVector2Field instance.
+		 */
+		static void onConfirmed(MonoObject* instance);
+
+		ScriptGUIVector2Field(MonoObject* instance, GUIVector2Field* vector2Field);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIVector2Field* nativeInstance, Vector2* output);
+		static void internal_setValue(ScriptGUIVector2Field* nativeInstance, Vector2* value);
+		static void internal_hasInputFocus(ScriptGUIVector2Field* nativeInstance, bool* output);
+		static void internal_setTint(ScriptGUIVector2Field* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, Vector2, MonoException**);
+		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+		static OnConfirmedThunkDef onConfirmedThunk;
+	};
 }
 }

+ 50 - 50
SBansheeEditor/Include/BsScriptGUIVector3Field.h

@@ -1,51 +1,51 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIVector3Field.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIVector3Field : public TScriptGUIElement<ScriptGUIVector3Field>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIVector3Field")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native vector field changes.
-		 *
-		 * @param	instance	Managed GUIVector3Field instance.
-		 * @param	newValue	New vector value.
-		 */
-		static void onChanged(MonoObject* instance, Vector3 newValue);
-
-		/**
-		 * @brief	Triggered when the user confirms input in the native vector field.
-		 *
-		 * @param	instance	Managed GUIVector3Field instance.
-		 */
-		static void onConfirmed(MonoObject* instance);
-
-		ScriptGUIVector3Field(MonoObject* instance, GUIVector3Field* vector3Field);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIVector3Field* nativeInstance, Vector3* output);
-		static void internal_setValue(ScriptGUIVector3Field* nativeInstance, Vector3 value);
-		static void internal_hasInputFocus(ScriptGUIVector3Field* nativeInstance, bool* output);
-		static void internal_setTint(ScriptGUIVector3Field* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, Vector3, MonoException**);
-		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-		static OnConfirmedThunkDef onConfirmedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIVector3Field.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIVector3Field : public TScriptGUIElement<ScriptGUIVector3Field>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIVector3Field")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native vector field changes.
+		 *
+		 * @param	instance	Managed GUIVector3Field instance.
+		 * @param	newValue	New vector value.
+		 */
+		static void onChanged(MonoObject* instance, Vector3 newValue);
+
+		/**
+		 * @brief	Triggered when the user confirms input in the native vector field.
+		 *
+		 * @param	instance	Managed GUIVector3Field instance.
+		 */
+		static void onConfirmed(MonoObject* instance);
+
+		ScriptGUIVector3Field(MonoObject* instance, GUIVector3Field* vector3Field);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIVector3Field* nativeInstance, Vector3* output);
+		static void internal_setValue(ScriptGUIVector3Field* nativeInstance, Vector3* value);
+		static void internal_hasInputFocus(ScriptGUIVector3Field* nativeInstance, bool* output);
+		static void internal_setTint(ScriptGUIVector3Field* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, Vector3, MonoException**);
+		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+		static OnConfirmedThunkDef onConfirmedThunk;
+	};
 }
 }

+ 50 - 50
SBansheeEditor/Include/BsScriptGUIVector4Field.h

@@ -1,51 +1,51 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIVector4Field.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGUIVector4Field : public TScriptGUIElement<ScriptGUIVector4Field>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIVector4Field")
-
-	private:
-		/**
-		 * @brief	Triggered when the value in the native vector field changes.
-		 *
-		 * @param	instance	Managed GUIVector4Field instance.
-		 * @param	newValue	New vector value.
-		 */
-		static void onChanged(MonoObject* instance, Vector4 newValue);
-
-		/**
-		 * @brief	Triggered when the user confirms input in the native vector field.
-		 *
-		 * @param	instance	Managed GUIVector4Field instance.
-		 */
-		static void onConfirmed(MonoObject* instance);
-
-		ScriptGUIVector4Field(MonoObject* instance, GUIVector4Field* vector4Field);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-			MonoString* style, MonoArray* guiOptions, bool withTitle);
-
-		static void internal_getValue(ScriptGUIVector4Field* nativeInstance, Vector4* output);
-		static void internal_setValue(ScriptGUIVector4Field* nativeInstance, Vector4 value);
-		static void internal_hasInputFocus(ScriptGUIVector4Field* nativeInstance, bool* output);
-		static void internal_setTint(ScriptGUIVector4Field* nativeInstance, Color color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, Vector4, MonoException**);
-		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-		static OnConfirmedThunkDef onConfirmedThunk;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GUIVector4Field.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGUIVector4Field : public TScriptGUIElement<ScriptGUIVector4Field>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "GUIVector4Field")
+
+	private:
+		/**
+		 * @brief	Triggered when the value in the native vector field changes.
+		 *
+		 * @param	instance	Managed GUIVector4Field instance.
+		 * @param	newValue	New vector value.
+		 */
+		static void onChanged(MonoObject* instance, Vector4 newValue);
+
+		/**
+		 * @brief	Triggered when the user confirms input in the native vector field.
+		 *
+		 * @param	instance	Managed GUIVector4Field instance.
+		 */
+		static void onConfirmed(MonoObject* instance);
+
+		ScriptGUIVector4Field(MonoObject* instance, GUIVector4Field* vector4Field);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+			MonoString* style, MonoArray* guiOptions, bool withTitle);
+
+		static void internal_getValue(ScriptGUIVector4Field* nativeInstance, Vector4* output);
+		static void internal_setValue(ScriptGUIVector4Field* nativeInstance, Vector4* value);
+		static void internal_hasInputFocus(ScriptGUIVector4Field* nativeInstance, bool* output);
+		static void internal_setTint(ScriptGUIVector4Field* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, Vector4, MonoException**);
+		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+		static OnConfirmedThunkDef onConfirmedThunk;
+	};
 }
 }

+ 34 - 34
SBansheeEditor/Include/BsScriptGizmos.h

@@ -1,35 +1,35 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsVector3.h"
-#include "BsMatrix4.h"
-#include "BsColor.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GizmoManager.
-	 */
-	class BS_SCR_BED_EXPORT ScriptGizmos : public ScriptObject<ScriptGizmos>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "Gizmos")
-
-	private:
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_SetColor(Color color);
-		static void internal_GetColor(Color* color);
-		static void internal_SetTransform(Matrix4 transform);
-		static void internal_GetTransform(Matrix4* transform);
-		static void internal_DrawCube(Vector3 position, Vector3 extents);
-		static void internal_DrawSphere(Vector3 position, float radius);
-		static void internal_DrawWireCube(Vector3 position, Vector3 extents);
-		static void internal_DrawWireSphere(Vector3 position, float radius);
-		static void internal_DrawLine(Vector3 start, Vector3 end);
-		static void internal_DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far);
-		static void internal_DrawIcon(Vector3 position, MonoObject* image, bool fixedScale);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsVector3.h"
+#include "BsMatrix4.h"
+#include "BsColor.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for GizmoManager.
+	 */
+	class BS_SCR_BED_EXPORT ScriptGizmos : public ScriptObject<ScriptGizmos>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "Gizmos")
+
+	private:
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_SetColor(Color* color);
+		static void internal_GetColor(Color* color);
+		static void internal_SetTransform(Matrix4* transform);
+		static void internal_GetTransform(Matrix4* transform);
+		static void internal_DrawCube(Vector3* position, Vector3* extents);
+		static void internal_DrawSphere(Vector3* position, float radius);
+		static void internal_DrawWireCube(Vector3* position, Vector3* extents);
+		static void internal_DrawWireSphere(Vector3* position, float radius);
+		static void internal_DrawLine(Vector3* start, Vector3* end);
+		static void internal_DrawFrustum(Vector3* position, float aspect, Degree* FOV, float near, float far);
+		static void internal_DrawIcon(Vector3* position, MonoObject* image, bool fixedScale);
+	};
 }
 }

+ 38 - 38
SBansheeEditor/Include/BsScriptHandleDrawing.h

@@ -1,39 +1,39 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsVector3.h"
-#include "BsMatrix4.h"
-#include "BsRect3.h"
-#include "BsColor.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for HandleDrawManager.
-	 */
-	class BS_SCR_BED_EXPORT ScriptHandleDrawing : public ScriptObject <ScriptHandleDrawing>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleDrawing")
-
-	private:
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_SetColor(Color color);
-		static void internal_SetTransform(Matrix4 transform);
-
-		static void internal_DrawCube(Vector3 position, Vector3 extents, float size);
-		static void internal_DrawSphere(Vector3 position, float radius, float size);
-		static void internal_DrawWireCube(Vector3 position, Vector3 extents, float size);
-		static void internal_DrawWireSphere(Vector3 position, float radius, float size);
-		static void internal_DrawLine(Vector3 start, Vector3 end, float size);
-		static void internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size);
-		static void internal_DrawDisc(Vector3 position, Vector3 normal, float radius, float size);
-		static void internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size);
-		static void internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
-		static void internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
-		static void internal_DrawRect(Vector3 center, Vector3 horzAxis, Vector3 vertAxis, float extentH, float extentV, float size);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsVector3.h"
+#include "BsMatrix4.h"
+#include "BsRect3.h"
+#include "BsColor.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleDrawManager.
+	 */
+	class BS_SCR_BED_EXPORT ScriptHandleDrawing : public ScriptObject <ScriptHandleDrawing>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleDrawing")
+
+	private:
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_SetColor(Color* color);
+		static void internal_SetTransform(Matrix4* transform);
+
+		static void internal_DrawCube(Vector3* position, Vector3* extents, float size);
+		static void internal_DrawSphere(Vector3* position, float radius, float size);
+		static void internal_DrawWireCube(Vector3* position, Vector3* extents, float size);
+		static void internal_DrawWireSphere(Vector3* position, float radius, float size);
+		static void internal_DrawLine(Vector3* start, Vector3* end, float size);
+		static void internal_DrawCone(Vector3* coneBase, Vector3* normal, float height, float radius, float size);
+		static void internal_DrawDisc(Vector3* position, Vector3* normal, float radius, float size);
+		static void internal_DrawWireDisc(Vector3* position, Vector3* normal, float radius, float size);
+		static void internal_DrawArc(Vector3* position, Vector3* normal, float radius, Degree* startAngle, Degree* amountAngle, float size);
+		static void internal_DrawWireArc(Vector3* position, Vector3* normal, float radius, Degree* startAngle, Degree* amountAngle, float size);
+		static void internal_DrawRect(Vector3* center, Vector3* horzAxis, Vector3* vertAxis, float extentH, float extentV, float size);
+	};
 }
 }

+ 63 - 63
SBansheeEditor/Include/BsScriptHandleSlider.h

@@ -1,64 +1,64 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsHandleSlider.h"
-#include "BsQuaternion.h"
-#include "BsVector3.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Base class for all C++/CLR interop objects that deal with handle sliders.
-	 */
-	class BS_SCR_BED_EXPORT ScriptHandleSliderBase : public ScriptObjectBase
-	{
-	public:
-		ScriptHandleSliderBase(MonoObject* managedInstance);
-		virtual ~ScriptHandleSliderBase();
-
-		/**
-		 * @brief	Returns the internal native handle slider.
-		 */
-		virtual HandleSlider* getSlider() const = 0;
-
-	protected:
-		friend class ScriptHandleSlider;
-		friend class ScriptHandleSliderManager;
-
-		/**
-		 * @brief	Destroys the internal native handle slider and unregisters it with
-		 *			with handle manager.
-		 */
-		void destroy();
-
-		/**
-		 * @brief	Destroys the internal native handle slider.
-		 */
-		virtual void destroyInternal() = 0;
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for HandleSlider.
-	 */
-	class BS_SCR_BED_EXPORT ScriptHandleSlider : public ScriptObject <ScriptHandleSlider>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSlider")
-
-	private:
-		ScriptHandleSlider(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_Destroy(ScriptHandleSliderBase* nativeInstance);
-		static void internal_GetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value);
-		static void internal_SetPosition(ScriptHandleSliderBase* nativeInstance, Vector3 value);
-		static void internal_GetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion* value);
-		static void internal_SetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion value);
-		static void internal_GetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value);
-		static void internal_SetScale(ScriptHandleSliderBase* nativeInstance, Vector3 value);
-		static void internal_GetState(ScriptHandleSliderBase* nativeInstance, HandleSlider::State* value);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsHandleSlider.h"
+#include "BsQuaternion.h"
+#include "BsVector3.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Base class for all C++/CLR interop objects that deal with handle sliders.
+	 */
+	class BS_SCR_BED_EXPORT ScriptHandleSliderBase : public ScriptObjectBase
+	{
+	public:
+		ScriptHandleSliderBase(MonoObject* managedInstance);
+		virtual ~ScriptHandleSliderBase();
+
+		/**
+		 * @brief	Returns the internal native handle slider.
+		 */
+		virtual HandleSlider* getSlider() const = 0;
+
+	protected:
+		friend class ScriptHandleSlider;
+		friend class ScriptHandleSliderManager;
+
+		/**
+		 * @brief	Destroys the internal native handle slider and unregisters it with
+		 *			with handle manager.
+		 */
+		void destroy();
+
+		/**
+		 * @brief	Destroys the internal native handle slider.
+		 */
+		virtual void destroyInternal() = 0;
+	};
+
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleSlider.
+	 */
+	class BS_SCR_BED_EXPORT ScriptHandleSlider : public ScriptObject <ScriptHandleSlider>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSlider")
+
+	private:
+		ScriptHandleSlider(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_Destroy(ScriptHandleSliderBase* nativeInstance);
+		static void internal_GetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value);
+		static void internal_SetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value);
+		static void internal_GetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion* value);
+		static void internal_SetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion* value);
+		static void internal_GetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value);
+		static void internal_SetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value);
+		static void internal_GetState(ScriptHandleSliderBase* nativeInstance, HandleSlider::State* value);
+	};
 }
 }

+ 43 - 43
SBansheeEditor/Include/BsScriptHandleSliderDisc.h

@@ -1,44 +1,44 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsScriptHandleSlider.h"
-#include "BsHandleSliderDisc.h"
-#include "BsVector3.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for HandleSliderDisc.
-	 */
-	class BS_SCR_BED_EXPORT ScriptHandleSliderDisc : public ScriptObject <ScriptHandleSliderDisc, ScriptHandleSliderBase>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderDisc")
-
-	protected:
-		/**
-		 * @copydoc	ScriptHandleSliderBase::getSlider
-		 */
-		virtual HandleSlider* getSlider() const override { return mSlider; }
-
-		/**
-		 * @copydoc	ScriptHandleSliderBase::destroyInternal
-		 */
-		virtual void destroyInternal() override;
-
-	private:
-		ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale);
-		~ScriptHandleSliderDisc();
-
-		HandleSliderDisc* mSlider;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale);
-		static void internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value);
-		static void internal_GetStartAngle(ScriptHandleSliderDisc* nativeInstance, float* value);
-		static void internal_SetCutoffPlane(ScriptHandleSliderDisc* nativeInstance, float value, bool enabled);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsScriptHandleSlider.h"
+#include "BsHandleSliderDisc.h"
+#include "BsVector3.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleSliderDisc.
+	 */
+	class BS_SCR_BED_EXPORT ScriptHandleSliderDisc : public ScriptObject <ScriptHandleSliderDisc, ScriptHandleSliderBase>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderDisc")
+
+	protected:
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual HandleSlider* getSlider() const override { return mSlider; }
+
+		/**
+		 * @copydoc	ScriptHandleSliderBase::destroyInternal
+		 */
+		virtual void destroyInternal() override;
+
+	private:
+		ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale);
+		~ScriptHandleSliderDisc();
+
+		HandleSliderDisc* mSlider;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, Vector3* normal, float radius, bool fixedScale);
+		static void internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value);
+		static void internal_GetStartAngle(ScriptHandleSliderDisc* nativeInstance, float* value);
+		static void internal_SetCutoffPlane(ScriptHandleSliderDisc* nativeInstance, float value, bool enabled);
+	};
 }
 }

+ 41 - 41
SBansheeEditor/Include/BsScriptHandleSliderLine.h

@@ -1,42 +1,42 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsScriptHandleSlider.h"
-#include "BsHandleSliderLine.h"
-#include "BsVector3.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for HandleSliderLine.
-	 */
-	class BS_SCR_BED_EXPORT ScriptHandleSliderLine : public ScriptObject <ScriptHandleSliderLine, ScriptHandleSliderBase>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderLine")
-
-	protected:
-		/**
-		 * @copydoc	ScriptHandleSliderBase::getSlider
-		 */
-		virtual HandleSlider* getSlider() const override { return mSlider; }
-
-		/**
-		 * @copydoc	ScriptHandleSliderBase::getSlider
-		 */
-		virtual void destroyInternal() override;
-
-	private:
-		ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale);
-		~ScriptHandleSliderLine();
-
-		HandleSliderLine* mSlider;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale);
-		static void internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsScriptHandleSlider.h"
+#include "BsHandleSliderLine.h"
+#include "BsVector3.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleSliderLine.
+	 */
+	class BS_SCR_BED_EXPORT ScriptHandleSliderLine : public ScriptObject <ScriptHandleSliderLine, ScriptHandleSliderBase>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderLine")
+
+	protected:
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual HandleSlider* getSlider() const override { return mSlider; }
+
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual void destroyInternal() override;
+
+	private:
+		ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale);
+		~ScriptHandleSliderLine();
+
+		HandleSliderLine* mSlider;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, Vector3* direction, float length, bool fixedScale);
+		static void internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value);
+	};
 }
 }

+ 41 - 41
SBansheeEditor/Include/BsScriptHandleSliderPlane.h

@@ -1,42 +1,42 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsScriptHandleSlider.h"
-#include "BsHandleSliderPlane.h"
-#include "BsVector3.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for HandleSliderPlane.
-	 */
-	class BS_SCR_BED_EXPORT ScriptHandleSliderPlane : public ScriptObject <ScriptHandleSliderPlane, ScriptHandleSliderBase>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderPlane")
-
-	protected:
-		/**
-		 * @copydoc	ScriptHandleSliderBase::getSlider
-		 */
-		virtual HandleSlider* getSlider() const override { return mSlider; }
-
-		/**
-		 * @copydoc	ScriptHandleSliderBase::getSlider
-		 */
-		virtual void destroyInternal() override;
-
-	private:
-		ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale);
-		~ScriptHandleSliderPlane();
-
-		HandleSliderPlane* mSlider;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale);
-		static void internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, Vector2* value);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsScriptHandleSlider.h"
+#include "BsHandleSliderPlane.h"
+#include "BsVector3.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleSliderPlane.
+	 */
+	class BS_SCR_BED_EXPORT ScriptHandleSliderPlane : public ScriptObject <ScriptHandleSliderPlane, ScriptHandleSliderBase>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderPlane")
+
+	protected:
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual HandleSlider* getSlider() const override { return mSlider; }
+
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual void destroyInternal() override;
+
+	private:
+		ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale);
+		~ScriptHandleSliderPlane();
+
+		HandleSliderPlane* mSlider;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, Vector3* dir1, Vector3* dir2, float length, bool fixedScale);
+		static void internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, Vector2* value);
+	};
 }
 }

+ 156 - 156
SBansheeEditor/Include/BsScriptModalWindow.h

@@ -1,157 +1,157 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsModalWindow.h"
-#include "BsVector2I.h"
-
-namespace BansheeEngine
-{
-	class ManagedModalWindow;
-
-	/**
-	 * @brief	Interop class between C++ & CLR for ManagedModalWindow.
-	 */
-	class BS_SCR_BED_EXPORT ScriptModalWindow : public ScriptObject <ScriptModalWindow>
-	{
-		/**
-		 * @brief	Contains data about the managed handle to a modal window.
-		 */
-		struct ModalWindowHandle
-		{
-			uint32_t gcHandle;
-			ManagedModalWindow* nativeObj;
-		};
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "ModalWindow")
-
-		~ScriptModalWindow();
-
-	private:
-		friend class ManagedModalWindow;
-
-		ScriptModalWindow(ManagedModalWindow* editorWidget);
-
-		/**
-		 * @brief	Triggered when assembly refresh has started.
-		 */
-		void onAssemblyRefreshStarted();
-
-		/**
-		 * @brief	Triggered when the native modal window is closed.
-		 */
-		void notifyWindowDestroyed();
-
-		ManagedModalWindow* mModalWindow;
-		HEvent mOnAssemblyRefreshStartedConn;
-
-		static MonoField* guiPanelField;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, bool allowCloseButton);
-		static void internal_close(ScriptModalWindow* thisPtr);
-		static UINT32 internal_getWidth(ScriptModalWindow* thisPtr);
-		static UINT32 internal_getHeight(ScriptModalWindow* thisPtr);
-		static void internal_setWidth(ScriptModalWindow* thisPtr, UINT32 value);
-		static void internal_setHeight(ScriptModalWindow* thisPtr, UINT32 value);
-		static void internal_setTitle(ScriptModalWindow* thisPtr, MonoObject* title);
-		static void internal_screenToWindowPos(ScriptModalWindow* thisPtr, Vector2I screenPos, Vector2I* windowPos);
-		static void internal_windowToScreenPos(ScriptModalWindow* thisPtr, Vector2I windowPos, Vector2I* screenPos);
-	};
-
-	/**
-	 * @brief	Modal window implementation that handles managed modal window implementations.
-	 *			Each implementation is wrapped in this object and then managed by its parent interop
-	 *			object of ScriptModalWindow type.
-	 */
-	class BS_SCR_BED_EXPORT ManagedModalWindow : public ModalWindow
-	{
-	public:
-		ManagedModalWindow(bool allowCloseButton, MonoObject* managedInstance);
-		~ManagedModalWindow();
-
-		/**
-		 * @brief	Attempts to create a managed instance for the modal window described by the
-		 *			type provided upon construction.
-		 *
-		 * @return	True if the managed instance was created.
-		 */
-		bool createManagedInstance();
-
-		/**
-		 * @brief	Releases the internally held handle to the managed instance. This will cause
-		 *			managed instance to be destroyed if no other references are being held.
-		 */
-		void releaseManagedInstance();
-
-		/**
-		 * @brief	Sets the parent interop object that handles part of the communication
-		 *			between this object and the managed instance.
-		 */
-		void setParent(ScriptModalWindow* parent);
-
-		/**
-		 * @copydoc	ModalWindow::update 
-		 */
-		void update() override;
-		
-		/**
-		 * @brief	Loads all required mono methods, fields and types required
-		 *			for operation of this object. Must be called after construction
-		 *			and after assembly refresh.
-		 *
-		 * @param	windowClass	Mono class to load the types from.
-		 */
-		void reloadMonoTypes(MonoClass* windowClass);
-
-		/**
-		 * @brief	Triggers OnInitialize callbacks on the managed instance.
-		 */
-		void triggerOnInitialize();
-
-		/**
-		 * @brief	Triggers OnDestroy callbacks on the managed instance.
-		 */
-		void triggerOnDestroy();
-
-		/**
-		 * @brief	Returns the managed instance for the modal window
-		 *			represented by this object.
-		 */
-		MonoObject* getManagedInstance() const { return mManagedInstance; }
-	protected:
-		/**
-		 * @copydoc	ModalWindow::resized
-		 */
-		virtual void resized() override;
-
-		/**
-		 * @copydoc	ModalWindow::close
-		 */
-		virtual void close() override;
-
-	private:
-		friend class ScriptModalWindow;
-
-		typedef void(__stdcall *OnInitializeThunkDef) (MonoObject*, MonoException**);
-		typedef void(__stdcall *OnDestroyThunkDef) (MonoObject*, MonoException**);
-		typedef void(__stdcall *UpdateThunkDef) (MonoObject*, MonoException**);
-
-		String mNamespace;
-		String mTypename;
-
-		OnInitializeThunkDef mOnInitializeThunk;
-		OnDestroyThunkDef mOnDestroyThunk;
-		UpdateThunkDef mUpdateThunk;
-		MonoMethod* mOnWindowResizedMethod;
-
-		bool mIsInitialized;
-		MonoObject* mManagedInstance;
-		uint32_t mGCHandle;
-
-		ScriptModalWindow* mScriptParent;
-		ScriptGUILayout* mContentsPanel;
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsModalWindow.h"
+#include "BsVector2I.h"
+
+namespace BansheeEngine
+{
+	class ManagedModalWindow;
+
+	/**
+	 * @brief	Interop class between C++ & CLR for ManagedModalWindow.
+	 */
+	class BS_SCR_BED_EXPORT ScriptModalWindow : public ScriptObject <ScriptModalWindow>
+	{
+		/**
+		 * @brief	Contains data about the managed handle to a modal window.
+		 */
+		struct ModalWindowHandle
+		{
+			uint32_t gcHandle;
+			ManagedModalWindow* nativeObj;
+		};
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "ModalWindow")
+
+		~ScriptModalWindow();
+
+	private:
+		friend class ManagedModalWindow;
+
+		ScriptModalWindow(ManagedModalWindow* editorWidget);
+
+		/**
+		 * @brief	Triggered when assembly refresh has started.
+		 */
+		void onAssemblyRefreshStarted();
+
+		/**
+		 * @brief	Triggered when the native modal window is closed.
+		 */
+		void notifyWindowDestroyed();
+
+		ManagedModalWindow* mModalWindow;
+		HEvent mOnAssemblyRefreshStartedConn;
+
+		static MonoField* guiPanelField;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, bool allowCloseButton);
+		static void internal_close(ScriptModalWindow* thisPtr);
+		static UINT32 internal_getWidth(ScriptModalWindow* thisPtr);
+		static UINT32 internal_getHeight(ScriptModalWindow* thisPtr);
+		static void internal_setWidth(ScriptModalWindow* thisPtr, UINT32 value);
+		static void internal_setHeight(ScriptModalWindow* thisPtr, UINT32 value);
+		static void internal_setTitle(ScriptModalWindow* thisPtr, MonoObject* title);
+		static void internal_screenToWindowPos(ScriptModalWindow* thisPtr, Vector2I* screenPos, Vector2I* windowPos);
+		static void internal_windowToScreenPos(ScriptModalWindow* thisPtr, Vector2I* windowPos, Vector2I* screenPos);
+	};
+
+	/**
+	 * @brief	Modal window implementation that handles managed modal window implementations.
+	 *			Each implementation is wrapped in this object and then managed by its parent interop
+	 *			object of ScriptModalWindow type.
+	 */
+	class BS_SCR_BED_EXPORT ManagedModalWindow : public ModalWindow
+	{
+	public:
+		ManagedModalWindow(bool allowCloseButton, MonoObject* managedInstance);
+		~ManagedModalWindow();
+
+		/**
+		 * @brief	Attempts to create a managed instance for the modal window described by the
+		 *			type provided upon construction.
+		 *
+		 * @return	True if the managed instance was created.
+		 */
+		bool createManagedInstance();
+
+		/**
+		 * @brief	Releases the internally held handle to the managed instance. This will cause
+		 *			managed instance to be destroyed if no other references are being held.
+		 */
+		void releaseManagedInstance();
+
+		/**
+		 * @brief	Sets the parent interop object that handles part of the communication
+		 *			between this object and the managed instance.
+		 */
+		void setParent(ScriptModalWindow* parent);
+
+		/**
+		 * @copydoc	ModalWindow::update 
+		 */
+		void update() override;
+		
+		/**
+		 * @brief	Loads all required mono methods, fields and types required
+		 *			for operation of this object. Must be called after construction
+		 *			and after assembly refresh.
+		 *
+		 * @param	windowClass	Mono class to load the types from.
+		 */
+		void reloadMonoTypes(MonoClass* windowClass);
+
+		/**
+		 * @brief	Triggers OnInitialize callbacks on the managed instance.
+		 */
+		void triggerOnInitialize();
+
+		/**
+		 * @brief	Triggers OnDestroy callbacks on the managed instance.
+		 */
+		void triggerOnDestroy();
+
+		/**
+		 * @brief	Returns the managed instance for the modal window
+		 *			represented by this object.
+		 */
+		MonoObject* getManagedInstance() const { return mManagedInstance; }
+	protected:
+		/**
+		 * @copydoc	ModalWindow::resized
+		 */
+		virtual void resized() override;
+
+		/**
+		 * @copydoc	ModalWindow::close
+		 */
+		virtual void close() override;
+
+	private:
+		friend class ScriptModalWindow;
+
+		typedef void(__stdcall *OnInitializeThunkDef) (MonoObject*, MonoException**);
+		typedef void(__stdcall *OnDestroyThunkDef) (MonoObject*, MonoException**);
+		typedef void(__stdcall *UpdateThunkDef) (MonoObject*, MonoException**);
+
+		String mNamespace;
+		String mTypename;
+
+		OnInitializeThunkDef mOnInitializeThunk;
+		OnDestroyThunkDef mOnDestroyThunk;
+		UpdateThunkDef mUpdateThunk;
+		MonoMethod* mOnWindowResizedMethod;
+
+		bool mIsInitialized;
+		MonoObject* mManagedInstance;
+		uint32_t mGCHandle;
+
+		ScriptModalWindow* mScriptParent;
+		ScriptGUILayout* mContentsPanel;
+	};
 }
 }

+ 144 - 144
SBansheeEditor/Include/BsScriptOSDropTarget.h

@@ -1,145 +1,145 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsRect2I.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for OSDropTarget. Managed drop target
-	 *			is always associated with a managed EditorWindow.
-	 */
-	class BS_SCR_BED_EXPORT ScriptOSDropTarget : public ScriptObject <ScriptOSDropTarget>
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "OSDropTarget")
-
-	private:
-		ScriptOSDropTarget(MonoObject* instance, ScriptEditorWindow* parent);
-		~ScriptOSDropTarget();
-
-		/**
-		 * @brief	Destroys the internal native drop target.
-		 */
-		void destroy();
-
-		/**
-		 * @brief	Creates an internal native drop target over the specified window. Any previous
-		 *			drop target is overwritten.
-		 * 
-		 * @param	parentWindow	Window the drop target is located on.
-		 * @param	x				X position of the drop target, relative to window, in pixels.
-		 * @param	y				Y position of the drop target, relative to window, in pixels.
-		 * @param	width			Width of the drop target in pixels.
-		 * @param	height			Height of the drop target in pixels.
-		 */
-		void setDropTarget(const RenderWindowPtr& parentWindow, INT32 x, INT32 y, UINT32 width, UINT32 height);
-
-		/**
-		 * @brief	Updates bounds of an existing drop target.
-		 *
-		 * @param	bounds	Area of the drop target relative to 
-		 *			the editor widget (EditorWindow in managed terms).
-		 */
-		void setBounds(const Rect2I& bounds);
-
-		/**
-		 * @brief	Triggered when editor widget (EditorWindow in managed terms) parent
-		 *			changes. This might mean we need to re-create the drop target
-		 *			as the parent render window might have changed.
-		 */
-		void widgetParentChanged(EditorWidgetContainer* parent);
-
-		/**
-		 * @brief	Triggered when the parent editor widget (EditorWindow in managed terms) is resized.
-		 */
-		void widgetResized(UINT32 width, UINT32 height);
-
-		/**
-		 * @brief	Triggered when the parent editor widget (EditorWindow in managed terms) is moved.
-		 */
-		void widgetMoved(INT32 x, INT32 y);
-
-		/**
-		 * @brief	Returns the editor widget (EditorWindow in managed terms) this drop target belongs to.
-		 */
-		EditorWidgetBase* getParentWidget() const;
-
-		/**
-		 * @brief	Returns the bounds of the drop target, relative to the parent window. This depends
-		 *			of set bounds using ::setBounds and the current position and size of the editor widget.
-		 */
-		Rect2I getDropTargetArea() const;
-
-		/**
-		 * @brief	Triggered when the drag and drop operation has entered the area over an OS drop target.
-		 *
-		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
-		 *						that triggered the event.
-		 * @param	x			X coordinate of the pointer, relative to parent window, in pixels.
-		 * @param	y			Y coordinate of the pointer, relative to parent window, in pixels.
-		 */
-		static void dropTargetDragEnter(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
-
-		/**
-		 * @brief	Triggered every frame that pointer moves while over the area over an OS drop target.
-		 *
-		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
-		 *						that triggered the event.
-		 * @param	x			X coordinate of the pointer, relative to parent window, in pixels.
-		 * @param	y			Y coordinate of the pointer, relative to parent window, in pixels.
-		 */
-		static void dropTargetDragMove(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
-
-		/**
-		 * @brief	Triggered when the drag and drop operation has left the area over an OS drop target.
-		 *
-		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
-		 *						that triggered the event.
-		 */
-		static void dropTargetDragLeave(ScriptOSDropTarget* thisPtr);
-
-		/**
-		 * @brief	Triggered when the drag and drop operation has finished over an OS drop target.
-		 *
-		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
-		 *						that triggered the event.
-		 * @param	x			X coordinate of the pointer, relative to parent window, in pixels.
-		 * @param	y			Y coordinate of the pointer, relative to parent window, in pixels.
-		 */
-		static void dropTargetDragDropped(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
-
-		ScriptEditorWindow* mParent;
-		OSDropTarget* mDropTarget;
-		Rect2I mParentArea;
-		Rect2I mArea;
-		bool mIsDestroyed;
-
-		HEvent mDropTargetEnterConn;
-		HEvent mDropTargetMoveConn;
-		HEvent mDropTargetLeaveConn;
-		HEvent mDropTargetDroppedConn;
-		HEvent mWidgetParentChangedConn;
-		HEvent mWidgetMovedConn;
-		HEvent mWidgetResizedConn;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		typedef void(__stdcall *OnEnterThunkDef) (MonoObject*, INT32, INT32, MonoException**);
-		typedef void(__stdcall *OnMoveDef) (MonoObject*, INT32, INT32, MonoException**);
-		typedef void(__stdcall *OnLeaveDef) (MonoObject*, MonoException**);
-		typedef void(__stdcall *OnDropThunkDef) (MonoObject*, INT32, INT32, MonoException**);
-
-		static OnEnterThunkDef onEnterThunk;
-		static OnMoveDef onMoveThunk;
-		static OnLeaveDef onLeaveThunk;
-		static OnDropThunkDef onDropThunk;
-
-		static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* editorWindow);
-		static void internal_Destroy(ScriptOSDropTarget* nativeInstance);
-		static void internal_SetBounds(ScriptOSDropTarget* nativeInstance, Rect2I bounds);
-		static MonoArray* internal_GetFilePaths(ScriptOSDropTarget* nativeInstance);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsRect2I.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for OSDropTarget. Managed drop target
+	 *			is always associated with a managed EditorWindow.
+	 */
+	class BS_SCR_BED_EXPORT ScriptOSDropTarget : public ScriptObject <ScriptOSDropTarget>
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "OSDropTarget")
+
+	private:
+		ScriptOSDropTarget(MonoObject* instance, ScriptEditorWindow* parent);
+		~ScriptOSDropTarget();
+
+		/**
+		 * @brief	Destroys the internal native drop target.
+		 */
+		void destroy();
+
+		/**
+		 * @brief	Creates an internal native drop target over the specified window. Any previous
+		 *			drop target is overwritten.
+		 * 
+		 * @param	parentWindow	Window the drop target is located on.
+		 * @param	x				X position of the drop target, relative to window, in pixels.
+		 * @param	y				Y position of the drop target, relative to window, in pixels.
+		 * @param	width			Width of the drop target in pixels.
+		 * @param	height			Height of the drop target in pixels.
+		 */
+		void setDropTarget(const RenderWindowPtr& parentWindow, INT32 x, INT32 y, UINT32 width, UINT32 height);
+
+		/**
+		 * @brief	Updates bounds of an existing drop target.
+		 *
+		 * @param	bounds	Area of the drop target relative to 
+		 *			the editor widget (EditorWindow in managed terms).
+		 */
+		void setBounds(const Rect2I& bounds);
+
+		/**
+		 * @brief	Triggered when editor widget (EditorWindow in managed terms) parent
+		 *			changes. This might mean we need to re-create the drop target
+		 *			as the parent render window might have changed.
+		 */
+		void widgetParentChanged(EditorWidgetContainer* parent);
+
+		/**
+		 * @brief	Triggered when the parent editor widget (EditorWindow in managed terms) is resized.
+		 */
+		void widgetResized(UINT32 width, UINT32 height);
+
+		/**
+		 * @brief	Triggered when the parent editor widget (EditorWindow in managed terms) is moved.
+		 */
+		void widgetMoved(INT32 x, INT32 y);
+
+		/**
+		 * @brief	Returns the editor widget (EditorWindow in managed terms) this drop target belongs to.
+		 */
+		EditorWidgetBase* getParentWidget() const;
+
+		/**
+		 * @brief	Returns the bounds of the drop target, relative to the parent window. This depends
+		 *			of set bounds using ::setBounds and the current position and size of the editor widget.
+		 */
+		Rect2I getDropTargetArea() const;
+
+		/**
+		 * @brief	Triggered when the drag and drop operation has entered the area over an OS drop target.
+		 *
+		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
+		 *						that triggered the event.
+		 * @param	x			X coordinate of the pointer, relative to parent window, in pixels.
+		 * @param	y			Y coordinate of the pointer, relative to parent window, in pixels.
+		 */
+		static void dropTargetDragEnter(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
+
+		/**
+		 * @brief	Triggered every frame that pointer moves while over the area over an OS drop target.
+		 *
+		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
+		 *						that triggered the event.
+		 * @param	x			X coordinate of the pointer, relative to parent window, in pixels.
+		 * @param	y			Y coordinate of the pointer, relative to parent window, in pixels.
+		 */
+		static void dropTargetDragMove(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
+
+		/**
+		 * @brief	Triggered when the drag and drop operation has left the area over an OS drop target.
+		 *
+		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
+		 *						that triggered the event.
+		 */
+		static void dropTargetDragLeave(ScriptOSDropTarget* thisPtr);
+
+		/**
+		 * @brief	Triggered when the drag and drop operation has finished over an OS drop target.
+		 *
+		 * @param	thisPtr		C++/CLR interop object that contains the native OSDropTarget
+		 *						that triggered the event.
+		 * @param	x			X coordinate of the pointer, relative to parent window, in pixels.
+		 * @param	y			Y coordinate of the pointer, relative to parent window, in pixels.
+		 */
+		static void dropTargetDragDropped(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y);
+
+		ScriptEditorWindow* mParent;
+		OSDropTarget* mDropTarget;
+		Rect2I mParentArea;
+		Rect2I mArea;
+		bool mIsDestroyed;
+
+		HEvent mDropTargetEnterConn;
+		HEvent mDropTargetMoveConn;
+		HEvent mDropTargetLeaveConn;
+		HEvent mDropTargetDroppedConn;
+		HEvent mWidgetParentChangedConn;
+		HEvent mWidgetMovedConn;
+		HEvent mWidgetResizedConn;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		typedef void(__stdcall *OnEnterThunkDef) (MonoObject*, INT32, INT32, MonoException**);
+		typedef void(__stdcall *OnMoveDef) (MonoObject*, INT32, INT32, MonoException**);
+		typedef void(__stdcall *OnLeaveDef) (MonoObject*, MonoException**);
+		typedef void(__stdcall *OnDropThunkDef) (MonoObject*, INT32, INT32, MonoException**);
+
+		static OnEnterThunkDef onEnterThunk;
+		static OnMoveDef onMoveThunk;
+		static OnLeaveDef onLeaveThunk;
+		static OnDropThunkDef onDropThunk;
+
+		static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* editorWindow);
+		static void internal_Destroy(ScriptOSDropTarget* nativeInstance);
+		static void internal_SetBounds(ScriptOSDropTarget* nativeInstance, Rect2I* bounds);
+		static MonoArray* internal_GetFilePaths(ScriptOSDropTarget* nativeInstance);
+	};
 }
 }

+ 33 - 33
SBansheeEditor/Include/BsScriptSceneViewHandler.h

@@ -1,34 +1,34 @@
-#pragma once
-
-#include "BsScriptEditorPrerequisites.h"
-#include "BsScriptObject.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for SceneViewHandler.
-	 */
-	class BS_SCR_BED_EXPORT ScriptSceneViewHandler : public ScriptObject < ScriptSceneViewHandler >
-	{
-	public:
-		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "SceneViewHandler")
-
-	private:
-		ScriptSceneViewHandler(MonoObject* object, EditorWidgetBase* parentWidget, const SPtr<Camera>& camera);
-		~ScriptSceneViewHandler();
-
-		SceneViewHandler* mHandler;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCamera* camera);
-		static void internal_Update(ScriptSceneViewHandler* thisPtr);
-		static void internal_UpdateHandle(ScriptSceneViewHandler* thisPtr, Vector2I inputPos, Vector2I inputDelta);
-		static void internal_UpdateSelection(ScriptSceneViewHandler* thisPtr);
-		static void internal_TrySelectHandle(ScriptSceneViewHandler* thisPtr, Vector2I inputPos);
-		static bool internal_IsHandleActive(ScriptSceneViewHandler* thisPtr, Vector2I inputPos);
-		static void internal_ClearHandleSelection(ScriptSceneViewHandler* thisPtr, Vector2I inputPos);
-		static void internal_PickObject(ScriptSceneViewHandler* thisPtr, Vector2I inputPos, bool additive);
-	};
+#pragma once
+
+#include "BsScriptEditorPrerequisites.h"
+#include "BsScriptObject.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Interop class between C++ & CLR for SceneViewHandler.
+	 */
+	class BS_SCR_BED_EXPORT ScriptSceneViewHandler : public ScriptObject < ScriptSceneViewHandler >
+	{
+	public:
+		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "SceneViewHandler")
+
+	private:
+		ScriptSceneViewHandler(MonoObject* object, EditorWidgetBase* parentWidget, const SPtr<Camera>& camera);
+		~ScriptSceneViewHandler();
+
+		SceneViewHandler* mHandler;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCamera* camera);
+		static void internal_Update(ScriptSceneViewHandler* thisPtr);
+		static void internal_UpdateHandle(ScriptSceneViewHandler* thisPtr, Vector2I* inputPos, Vector2I* inputDelta);
+		static void internal_UpdateSelection(ScriptSceneViewHandler* thisPtr);
+		static void internal_TrySelectHandle(ScriptSceneViewHandler* thisPtr, Vector2I* inputPos);
+		static bool internal_IsHandleActive(ScriptSceneViewHandler* thisPtr);
+		static void internal_ClearHandleSelection(ScriptSceneViewHandler* thisPtr);
+		static void internal_PickObject(ScriptSceneViewHandler* thisPtr, Vector2I* inputPos, bool additive);
+	};
 }
 }

+ 213 - 213
SBansheeEditor/Source/BsScriptDropDownWindow.cpp

@@ -1,214 +1,214 @@
-#include "BsScriptDropDownWindow.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoMethod.h"
-#include "BsMonoManager.h"
-#include "BsMonoUtil.h"
-#include "BsMonoAssembly.h"
-#include "BsRenderWindow.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptEditorWindow.h"
-#include "BsEditorWidget.h"
-#include "BsEditorWindow.h"
-#include "BsEditorWidgetContainer.h"
-#include "BsCGUIWidget.h"
-#include "BsDropDownWindowManager.h"
-#include <BsScriptObjectManager.h>
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	MonoField* ScriptDropDownWindow::guiPanelField = nullptr;
-
-	ScriptDropDownWindow::ScriptDropDownWindow(ManagedDropDownWindow* window)
-		:ScriptObject(window->getManagedInstance()), mDropDownWindow(window)
-	{
-		mOnAssemblyRefreshStartedConn = ScriptObjectManager::instance().onRefreshStarted.connect(std::bind(&ScriptDropDownWindow::onAssemblyRefreshStarted, this));
-	}
-
-	ScriptDropDownWindow::~ScriptDropDownWindow()
-	{
-		mOnAssemblyRefreshStartedConn.disconnect();
-
-		// Window must have been marked as deleted already
-		assert(mDropDownWindow == nullptr);
-	}
-
-	void ScriptDropDownWindow::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptDropDownWindow::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_Close", &ScriptDropDownWindow::internal_Close);
-		metaData.scriptClass->addInternalCall("Internal_SetWidth", &ScriptDropDownWindow::internal_SetWidth);
-		metaData.scriptClass->addInternalCall("Internal_SetHeight", &ScriptDropDownWindow::internal_SetHeight);
-		metaData.scriptClass->addInternalCall("Internal_ScreenToWindowPos", &ScriptDropDownWindow::internal_ScreenToWindowPos);
-		metaData.scriptClass->addInternalCall("Internal_WindowToScreenPos", &ScriptDropDownWindow::internal_WindowToScreenPos);
-
-		guiPanelField = metaData.scriptClass->getField("GUI");
-	}
-
-	void ScriptDropDownWindow::internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* parentWindow, 
-		Vector2I position, int width, int height)
-	{
-		ManagedDropDownWindow* dropDownWindow = nullptr;
-		if (parentWindow != nullptr && !parentWindow->isDestroyed())
-		{
-			EditorWidgetBase* editorWidget = parentWindow->getEditorWidget();
-			EditorWidgetContainer* parentContainer = editorWidget->_getParent();
-			if (parentContainer != nullptr)
-			{
-				RenderWindowPtr parentRenderWindow = parentContainer->getParentWindow()->getRenderWindow();
-				CameraPtr parentCamera = parentContainer->getParentWidget().getCamera();
-
-				position.x += editorWidget->getX();
-				position.y += editorWidget->getY();
-
-				dropDownWindow = DropDownWindowManager::instance().open<ManagedDropDownWindow>(
-					parentRenderWindow, parentCamera, position, instance, width, height);
-			}
-		}
-
-		ScriptDropDownWindow* nativeInstance = new (bs_alloc<ScriptDropDownWindow>()) ScriptDropDownWindow(dropDownWindow);
-
-		if (dropDownWindow != nullptr)
-			dropDownWindow->initialize(nativeInstance);
-	}
-
-	void ScriptDropDownWindow::internal_Close(ScriptDropDownWindow* thisPtr)
-	{
-		if (thisPtr->mDropDownWindow != nullptr)
-			DropDownWindowManager::instance().close();
-	}
-
-	void ScriptDropDownWindow::onAssemblyRefreshStarted()
-	{
-		if (mDropDownWindow != nullptr)
-			DropDownWindowManager::instance().close();
-	}
-
-	void ScriptDropDownWindow::notifyWindowClosed()
-	{
-		mDropDownWindow = nullptr;
-	}
-
-	void ScriptDropDownWindow::internal_SetWidth(ScriptDropDownWindow* thisPtr, UINT32 value)
-	{
-		if (thisPtr->mDropDownWindow != nullptr)
-			thisPtr->mDropDownWindow->setSize(value, thisPtr->mDropDownWindow->getHeight());
-	}
-
-	void ScriptDropDownWindow::internal_SetHeight(ScriptDropDownWindow* thisPtr, UINT32 value)
-	{
-		if (thisPtr->mDropDownWindow != nullptr)
-			thisPtr->mDropDownWindow->setSize(thisPtr->mDropDownWindow->getWidth(), value);
-	}
-
-	void ScriptDropDownWindow::internal_ScreenToWindowPos(ScriptDropDownWindow* thisPtr, Vector2I screenPos, Vector2I* windowPos)
-	{
-		if (thisPtr->mDropDownWindow != nullptr)
-			*windowPos = thisPtr->mDropDownWindow->screenToWindowPos(screenPos);
-		else
-			*windowPos = screenPos;
-	}
-
-	void ScriptDropDownWindow::internal_WindowToScreenPos(ScriptDropDownWindow* thisPtr, Vector2I windowPos, Vector2I* screenPos)
-	{
-		if (thisPtr->mDropDownWindow != nullptr)
-			*screenPos = thisPtr->mDropDownWindow->windowToScreenPos(windowPos);
-		else
-			*screenPos = windowPos;
-	}
-
-	ManagedDropDownWindow::ManagedDropDownWindow(const RenderWindowPtr& parent, const CameraPtr& camera,
-		const Vector2I& position, MonoObject* managedInstance, UINT32 width, UINT32 height)
-		:DropDownWindow(parent, camera, position, width, height), mUpdateThunk(nullptr), mManagedInstance(managedInstance),
-		mOnInitializeThunk(nullptr), mOnDestroyThunk(nullptr), mGCHandle(0), mScriptParent(nullptr), 
-		mContentsPanel(nullptr), mIsInitialized(false)
-	{
-		mGCHandle = mono_gchandle_new(mManagedInstance, false);
-
-		MonoObject* guiPanel = ScriptGUIPanel::createFromExisting(mContents);
-		mContentsPanel = ScriptGUILayout::toNative(guiPanel);
-		ScriptDropDownWindow::guiPanelField->setValue(mManagedInstance, guiPanel);
-
-		::MonoClass* rawMonoClass = mono_object_get_class(mManagedInstance);
-		MonoClass* monoClass = MonoManager::instance().findClass(rawMonoClass);
-
-		mNamespace = monoClass->getNamespace();
-		mTypename = monoClass->getTypeName();
-
-		reloadMonoTypes(monoClass);
-	}
-
-	ManagedDropDownWindow::~ManagedDropDownWindow()
-	{
-		mContentsPanel->destroy();
-		mContentsPanel = nullptr;
-
-		triggerOnDestroy();
-		mScriptParent->notifyWindowClosed();
-
-		mono_gchandle_free(mGCHandle);
-		mGCHandle = 0;
-	}
-
-	void ManagedDropDownWindow::initialize(ScriptDropDownWindow* parent)
-	{
-		mScriptParent = parent;
-	}
-
-	void ManagedDropDownWindow::triggerOnInitialize()
-	{
-		if (mOnInitializeThunk != nullptr && mManagedInstance != nullptr)
-		{
-			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
-			// for some extra speed.
-			MonoUtil::invokeThunk(mOnInitializeThunk, mManagedInstance);
-		}
-	}
-
-	void ManagedDropDownWindow::triggerOnDestroy()
-	{
-		if (mOnDestroyThunk != nullptr && mManagedInstance != nullptr)
-		{
-			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
-			// for some extra speed.
-			MonoUtil::invokeThunk(mOnDestroyThunk, mManagedInstance);
-		}
-	}
-
-	void ManagedDropDownWindow::update()
-	{
-		if (!mIsInitialized)
-		{
-			triggerOnInitialize();
-			mIsInitialized = true;
-		}
-
-		if (mUpdateThunk != nullptr && mManagedInstance != nullptr)
-		{
-			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
-			// for some extra speed.
-			MonoUtil::invokeThunk(mUpdateThunk, mManagedInstance);
-		}
-	}
-
-	void ManagedDropDownWindow::reloadMonoTypes(MonoClass* windowClass)
-	{
-		MonoMethod* updateMethod = windowClass->getMethod("OnEditorUpdate", 0);
-
-		if (updateMethod != nullptr)
-			mUpdateThunk = (UpdateThunkDef)updateMethod->getThunk();
-
-		MonoMethod* onInitializeMethod = windowClass->getMethod("OnInitialize", 0);
-
-		if (onInitializeMethod != nullptr)
-			mOnInitializeThunk = (OnInitializeThunkDef)onInitializeMethod->getThunk();
-
-		MonoMethod* onDestroyMethod = windowClass->getMethod("OnDestroy", 0);
-
-		if (onDestroyMethod != nullptr)
-			mOnDestroyThunk = (OnDestroyThunkDef)onDestroyMethod->getThunk();
-	}
+#include "BsScriptDropDownWindow.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoMethod.h"
+#include "BsMonoManager.h"
+#include "BsMonoUtil.h"
+#include "BsMonoAssembly.h"
+#include "BsRenderWindow.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptEditorWindow.h"
+#include "BsEditorWidget.h"
+#include "BsEditorWindow.h"
+#include "BsEditorWidgetContainer.h"
+#include "BsCGUIWidget.h"
+#include "BsDropDownWindowManager.h"
+#include <BsScriptObjectManager.h>
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	MonoField* ScriptDropDownWindow::guiPanelField = nullptr;
+
+	ScriptDropDownWindow::ScriptDropDownWindow(ManagedDropDownWindow* window)
+		:ScriptObject(window->getManagedInstance()), mDropDownWindow(window)
+	{
+		mOnAssemblyRefreshStartedConn = ScriptObjectManager::instance().onRefreshStarted.connect(std::bind(&ScriptDropDownWindow::onAssemblyRefreshStarted, this));
+	}
+
+	ScriptDropDownWindow::~ScriptDropDownWindow()
+	{
+		mOnAssemblyRefreshStartedConn.disconnect();
+
+		// Window must have been marked as deleted already
+		assert(mDropDownWindow == nullptr);
+	}
+
+	void ScriptDropDownWindow::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptDropDownWindow::internal_CreateInstance);
+		metaData.scriptClass->addInternalCall("Internal_Close", &ScriptDropDownWindow::internal_Close);
+		metaData.scriptClass->addInternalCall("Internal_SetWidth", &ScriptDropDownWindow::internal_SetWidth);
+		metaData.scriptClass->addInternalCall("Internal_SetHeight", &ScriptDropDownWindow::internal_SetHeight);
+		metaData.scriptClass->addInternalCall("Internal_ScreenToWindowPos", &ScriptDropDownWindow::internal_ScreenToWindowPos);
+		metaData.scriptClass->addInternalCall("Internal_WindowToScreenPos", &ScriptDropDownWindow::internal_WindowToScreenPos);
+
+		guiPanelField = metaData.scriptClass->getField("GUI");
+	}
+
+	void ScriptDropDownWindow::internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* parentWindow, 
+		Vector2I* position, int width, int height)
+	{
+		ManagedDropDownWindow* dropDownWindow = nullptr;
+		if (parentWindow != nullptr && !parentWindow->isDestroyed())
+		{
+			EditorWidgetBase* editorWidget = parentWindow->getEditorWidget();
+			EditorWidgetContainer* parentContainer = editorWidget->_getParent();
+			if (parentContainer != nullptr)
+			{
+				RenderWindowPtr parentRenderWindow = parentContainer->getParentWindow()->getRenderWindow();
+				CameraPtr parentCamera = parentContainer->getParentWidget().getCamera();
+
+				position->x += editorWidget->getX();
+				position->y += editorWidget->getY();
+
+				dropDownWindow = DropDownWindowManager::instance().open<ManagedDropDownWindow>(
+					parentRenderWindow, parentCamera, *position, instance, width, height);
+			}
+		}
+
+		ScriptDropDownWindow* nativeInstance = new (bs_alloc<ScriptDropDownWindow>()) ScriptDropDownWindow(dropDownWindow);
+
+		if (dropDownWindow != nullptr)
+			dropDownWindow->initialize(nativeInstance);
+	}
+
+	void ScriptDropDownWindow::internal_Close(ScriptDropDownWindow* thisPtr)
+	{
+		if (thisPtr->mDropDownWindow != nullptr)
+			DropDownWindowManager::instance().close();
+	}
+
+	void ScriptDropDownWindow::onAssemblyRefreshStarted()
+	{
+		if (mDropDownWindow != nullptr)
+			DropDownWindowManager::instance().close();
+	}
+
+	void ScriptDropDownWindow::notifyWindowClosed()
+	{
+		mDropDownWindow = nullptr;
+	}
+
+	void ScriptDropDownWindow::internal_SetWidth(ScriptDropDownWindow* thisPtr, UINT32 value)
+	{
+		if (thisPtr->mDropDownWindow != nullptr)
+			thisPtr->mDropDownWindow->setSize(value, thisPtr->mDropDownWindow->getHeight());
+	}
+
+	void ScriptDropDownWindow::internal_SetHeight(ScriptDropDownWindow* thisPtr, UINT32 value)
+	{
+		if (thisPtr->mDropDownWindow != nullptr)
+			thisPtr->mDropDownWindow->setSize(thisPtr->mDropDownWindow->getWidth(), value);
+	}
+
+	void ScriptDropDownWindow::internal_ScreenToWindowPos(ScriptDropDownWindow* thisPtr, Vector2I* screenPos, Vector2I* windowPos)
+	{
+		if (thisPtr->mDropDownWindow != nullptr)
+			*windowPos = thisPtr->mDropDownWindow->screenToWindowPos(*screenPos);
+		else
+			*windowPos = *screenPos;
+	}
+
+	void ScriptDropDownWindow::internal_WindowToScreenPos(ScriptDropDownWindow* thisPtr, Vector2I* windowPos, Vector2I* screenPos)
+	{
+		if (thisPtr->mDropDownWindow != nullptr)
+			*screenPos = thisPtr->mDropDownWindow->windowToScreenPos(*windowPos);
+		else
+			*screenPos = *windowPos;
+	}
+
+	ManagedDropDownWindow::ManagedDropDownWindow(const RenderWindowPtr& parent, const CameraPtr& camera,
+		const Vector2I& position, MonoObject* managedInstance, UINT32 width, UINT32 height)
+		:DropDownWindow(parent, camera, position, width, height), mUpdateThunk(nullptr), mManagedInstance(managedInstance),
+		mOnInitializeThunk(nullptr), mOnDestroyThunk(nullptr), mGCHandle(0), mScriptParent(nullptr), 
+		mContentsPanel(nullptr), mIsInitialized(false)
+	{
+		mGCHandle = mono_gchandle_new(mManagedInstance, false);
+
+		MonoObject* guiPanel = ScriptGUIPanel::createFromExisting(mContents);
+		mContentsPanel = ScriptGUILayout::toNative(guiPanel);
+		ScriptDropDownWindow::guiPanelField->setValue(mManagedInstance, guiPanel);
+
+		::MonoClass* rawMonoClass = mono_object_get_class(mManagedInstance);
+		MonoClass* monoClass = MonoManager::instance().findClass(rawMonoClass);
+
+		mNamespace = monoClass->getNamespace();
+		mTypename = monoClass->getTypeName();
+
+		reloadMonoTypes(monoClass);
+	}
+
+	ManagedDropDownWindow::~ManagedDropDownWindow()
+	{
+		mContentsPanel->destroy();
+		mContentsPanel = nullptr;
+
+		triggerOnDestroy();
+		mScriptParent->notifyWindowClosed();
+
+		mono_gchandle_free(mGCHandle);
+		mGCHandle = 0;
+	}
+
+	void ManagedDropDownWindow::initialize(ScriptDropDownWindow* parent)
+	{
+		mScriptParent = parent;
+	}
+
+	void ManagedDropDownWindow::triggerOnInitialize()
+	{
+		if (mOnInitializeThunk != nullptr && mManagedInstance != nullptr)
+		{
+			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
+			// for some extra speed.
+			MonoUtil::invokeThunk(mOnInitializeThunk, mManagedInstance);
+		}
+	}
+
+	void ManagedDropDownWindow::triggerOnDestroy()
+	{
+		if (mOnDestroyThunk != nullptr && mManagedInstance != nullptr)
+		{
+			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
+			// for some extra speed.
+			MonoUtil::invokeThunk(mOnDestroyThunk, mManagedInstance);
+		}
+	}
+
+	void ManagedDropDownWindow::update()
+	{
+		if (!mIsInitialized)
+		{
+			triggerOnInitialize();
+			mIsInitialized = true;
+		}
+
+		if (mUpdateThunk != nullptr && mManagedInstance != nullptr)
+		{
+			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
+			// for some extra speed.
+			MonoUtil::invokeThunk(mUpdateThunk, mManagedInstance);
+		}
+	}
+
+	void ManagedDropDownWindow::reloadMonoTypes(MonoClass* windowClass)
+	{
+		MonoMethod* updateMethod = windowClass->getMethod("OnEditorUpdate", 0);
+
+		if (updateMethod != nullptr)
+			mUpdateThunk = (UpdateThunkDef)updateMethod->getThunk();
+
+		MonoMethod* onInitializeMethod = windowClass->getMethod("OnInitialize", 0);
+
+		if (onInitializeMethod != nullptr)
+			mOnInitializeThunk = (OnInitializeThunkDef)onInitializeMethod->getThunk();
+
+		MonoMethod* onDestroyMethod = windowClass->getMethod("OnDestroy", 0);
+
+		if (onDestroyMethod != nullptr)
+			mOnDestroyThunk = (OnDestroyThunkDef)onDestroyMethod->getThunk();
+	}
 }
 }

+ 6 - 6
SBansheeEditor/Source/BsScriptEditorWindow.cpp

@@ -174,20 +174,20 @@ namespace BansheeEngine
 			return false;
 			return false;
 	}
 	}
 
 
-	void ScriptEditorWindow::internal_screenToWindowPos(ScriptEditorWindow* thisPtr, Vector2I screenPos, Vector2I* windowPos)
+	void ScriptEditorWindow::internal_screenToWindowPos(ScriptEditorWindow* thisPtr, Vector2I* screenPos, Vector2I* windowPos)
 	{
 	{
 		if (!thisPtr->isDestroyed())
 		if (!thisPtr->isDestroyed())
-			*windowPos = thisPtr->getEditorWidget()->screenToWidgetPos(screenPos);
+			*windowPos = thisPtr->getEditorWidget()->screenToWidgetPos(*screenPos);
 		else
 		else
-			*windowPos = screenPos;
+			*windowPos = *screenPos;
 	}
 	}
 
 
-	void ScriptEditorWindow::internal_windowToScreenPos(ScriptEditorWindow* thisPtr, Vector2I windowPos, Vector2I* screenPos)
+	void ScriptEditorWindow::internal_windowToScreenPos(ScriptEditorWindow* thisPtr, Vector2I* windowPos, Vector2I* screenPos)
 	{
 	{
 		if (!thisPtr->isDestroyed())
 		if (!thisPtr->isDestroyed())
-			*screenPos = thisPtr->getEditorWidget()->widgetToScreenPos(windowPos);
+			*screenPos = thisPtr->getEditorWidget()->widgetToScreenPos(*windowPos);
 		else
 		else
-			*screenPos = windowPos;
+			*screenPos = *windowPos;
 	}
 	}
 
 
 	UINT32 ScriptEditorWindow::internal_getWidth(ScriptEditorWindow* thisPtr)
 	UINT32 ScriptEditorWindow::internal_getWidth(ScriptEditorWindow* thisPtr)

+ 88 - 88
SBansheeEditor/Source/BsScriptGUIColorField.cpp

@@ -1,89 +1,89 @@
-#include "BsScriptGUIColorField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIColorField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIColorField::OnClickedThunkDef ScriptGUIColorField::onClickedThunk;
-
-	ScriptGUIColorField::ScriptGUIColorField(MonoObject* instance, GUIColorField* colorField)
-		:TScriptGUIElement(instance, colorField)
-	{
-
-	}
-
-	void ScriptGUIColorField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIColorField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIColorField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIColorField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIColorField::internal_setTint);
-
-		onClickedThunk = (OnClickedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnClicked")->getThunk();
-	}
-
-	void ScriptGUIColorField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUIColorField* guiField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiField = GUIColorField::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiField = GUIColorField::create(options, styleName);
-		}
-
-		guiField->onClicked.connect(std::bind(&ScriptGUIColorField::onClicked, instance));
-
-		ScriptGUIColorField* nativeInstance = new (bs_alloc<ScriptGUIColorField>()) ScriptGUIColorField(instance, guiField);
-	}
-
-	void ScriptGUIColorField::internal_getValue(ScriptGUIColorField* nativeInstance, Color* output)
-	{
-		GUIColorField* colorField = static_cast<GUIColorField*>(nativeInstance->getGUIElement());
-		*output = colorField->getValue();
-	}
-
-	void ScriptGUIColorField::internal_setValue(ScriptGUIColorField* nativeInstance, Color value)
-	{
-		GUIColorField* colorField = static_cast<GUIColorField*>(nativeInstance->getGUIElement());
-		return colorField->setValue(value);
-	}
-
-	void ScriptGUIColorField::internal_setTint(ScriptGUIColorField* nativeInstance, Color color)
-	{
-		GUIColorField* colorField = (GUIColorField*)nativeInstance->getGUIElement();
-		colorField->setTint(color);
-	}
-
-	void ScriptGUIColorField::onClicked(MonoObject* instance)
-	{
-		MonoUtil::invokeThunk(onClickedThunk, instance);
-	}
+#include "BsScriptGUIColorField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIColorField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIColorField::OnClickedThunkDef ScriptGUIColorField::onClickedThunk;
+
+	ScriptGUIColorField::ScriptGUIColorField(MonoObject* instance, GUIColorField* colorField)
+		:TScriptGUIElement(instance, colorField)
+	{
+
+	}
+
+	void ScriptGUIColorField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIColorField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIColorField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIColorField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIColorField::internal_setTint);
+
+		onClickedThunk = (OnClickedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnClicked")->getThunk();
+	}
+
+	void ScriptGUIColorField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUIColorField* guiField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiField = GUIColorField::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiField = GUIColorField::create(options, styleName);
+		}
+
+		guiField->onClicked.connect(std::bind(&ScriptGUIColorField::onClicked, instance));
+
+		ScriptGUIColorField* nativeInstance = new (bs_alloc<ScriptGUIColorField>()) ScriptGUIColorField(instance, guiField);
+	}
+
+	void ScriptGUIColorField::internal_getValue(ScriptGUIColorField* nativeInstance, Color* output)
+	{
+		GUIColorField* colorField = static_cast<GUIColorField*>(nativeInstance->getGUIElement());
+		*output = colorField->getValue();
+	}
+
+	void ScriptGUIColorField::internal_setValue(ScriptGUIColorField* nativeInstance, Color* value)
+	{
+		GUIColorField* colorField = static_cast<GUIColorField*>(nativeInstance->getGUIElement());
+		return colorField->setValue(*value);
+	}
+
+	void ScriptGUIColorField::internal_setTint(ScriptGUIColorField* nativeInstance, Color* color)
+	{
+		GUIColorField* colorField = (GUIColorField*)nativeInstance->getGUIElement();
+		colorField->setTint(*color);
+	}
+
+	void ScriptGUIColorField::onClicked(MonoObject* instance)
+	{
+		MonoUtil::invokeThunk(onClickedThunk, instance);
+	}
 }
 }

+ 210 - 210
SBansheeEditor/Source/BsScriptGUIEnumField.cpp

@@ -1,211 +1,211 @@
-#include "BsScriptGUIEnumField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsMonoUtil.h"
-#include "BsGUIListBoxField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIEnumField::OnSelectionChangedThunkDef ScriptGUIEnumField::onSelectionChangedThunk;
-
-	ScriptGUIEnumField::ScriptGUIEnumField(MonoObject* instance, GUIListBoxField* listBoxField, const Vector<UINT64>& values)
-		:TScriptGUIElement(instance, listBoxField), mValues(values)
-	{
-
-	}
-
-	void ScriptGUIEnumField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIEnumField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIEnumField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIEnumField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIEnumField::internal_setTint);
-		metaData.scriptClass->addInternalCall("Internal_SelectElement", &ScriptGUIEnumField::internal_selectElement);
-		metaData.scriptClass->addInternalCall("Internal_DeselectElement", &ScriptGUIEnumField::internal_deselectElement);
-		metaData.scriptClass->addInternalCall("Internal_GetElementStates", &ScriptGUIEnumField::internal_getElementStates);
-		metaData.scriptClass->addInternalCall("Internal_SetElementStates", &ScriptGUIEnumField::internal_setElementStates);
-
-		onSelectionChangedThunk = (OnSelectionChangedThunkDef)metaData.scriptClass->getMethod("DoOnSelectionChanged", 1)->getThunk();
-	}
-
-	void ScriptGUIEnumField::internal_createInstance(MonoObject* instance, MonoArray* names, MonoArray* values, 
-		bool multiselect, MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		ScriptArray namesArr(names);
-		Vector<HString> nativeNames;
-		for (UINT32 i = 0; i < namesArr.size(); i++)
-			nativeNames.push_back(HString(namesArr.get<WString>(i)));
-
-		GUIListBoxField* guiField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiField = GUIListBoxField::create(nativeNames, multiselect, nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiField = GUIListBoxField::create(nativeNames, multiselect, options, styleName);
-		}
-
-		guiField->onSelectionChanged.connect(std::bind(&ScriptGUIEnumField::onSelectionChanged, instance, _1, _2));
-
-		ScriptArray valuesArr(values);
-		UINT32 elemSize = valuesArr.elementSize();
-
-		Vector<UINT64> nativeValues;
-		for (UINT32 i = 0; i < valuesArr.size(); i++)
-		{
-			UINT64 nativeValue = 0;
-
-			switch (elemSize)
-			{
-			case sizeof(UINT8):
-			{
-				UINT8 value = 0;
-				memcpy(&value, valuesArr.getRawPtr(elemSize, i), elemSize);
-				nativeValue = (UINT64)value;
-				break;
-			}
-			case sizeof(UINT16) :
-			{
-				UINT16 value = 0;
-				memcpy(&value, valuesArr.getRawPtr(elemSize, i), elemSize);
-				nativeValue = (UINT64)value;
-				break;
-			}
-			case sizeof(UINT32):
-			{
-				UINT32 value = 0;
-				memcpy(&value, valuesArr.getRawPtr(elemSize, i), elemSize);
-				nativeValue = (UINT64)value;
-				break;
-			}
-			case sizeof(UINT64) :
-			{
-				memcpy(&nativeValue, valuesArr.getRawPtr(elemSize, i), elemSize);
-				break;
-			}
-			}
-
-			nativeValues.push_back(nativeValue);
-		}
-			
-
-		ScriptGUIEnumField* nativeInstance = new (bs_alloc<ScriptGUIEnumField>()) ScriptGUIEnumField(instance, guiField, nativeValues);
-	}
-
-	UINT64 ScriptGUIEnumField::internal_getValue(ScriptGUIEnumField* nativeInstance)
-	{
-		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
-
-		UINT32 outValue = 0;
-
-		const Vector<UINT64>& values = nativeInstance->mValues;
-		Vector<bool> states = field->getElementStates();
-		for (UINT32 i = 0; i < (UINT32)values.size(); i++)
-			outValue |= states[i] ? values[i] : 0;
-
-		return outValue;
-	}
-
-	void ScriptGUIEnumField::internal_setValue(ScriptGUIEnumField* nativeInstance, UINT64 value)
-	{
-		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
-
-		const Vector<UINT64>& values = nativeInstance->mValues;
-		Vector<bool> states = field->getElementStates();
-
-		if (field->isMultiselect())
-		{
-			for (UINT32 i = 0; i < (UINT32)values.size(); i++)
-				states[i] = (values[i] & value) == values[i];
-		}
-		else
-		{
-			for (UINT32 i = 0; i < (UINT32)values.size(); i++)
-				states[i] = values[i] == value;
-		}
-
-		field->setElementStates(states);
-	}
-
-	void ScriptGUIEnumField::internal_selectElement(ScriptGUIEnumField* nativeInstance, int idx)
-	{
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		listBox->selectElement(idx);
-	}
-
-	void ScriptGUIEnumField::internal_deselectElement(ScriptGUIEnumField* nativeInstance, int idx)
-	{
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		listBox->deselectElement(idx);
-	}
-
-	MonoArray* ScriptGUIEnumField::internal_getElementStates(ScriptGUIEnumField* nativeInstance)
-	{
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		const Vector<bool>& states = listBox->getElementStates();
-
-		UINT32 numElements = (UINT32)states.size();
-		ScriptArray outStates = ScriptArray::create<bool>(numElements);
-
-		for (UINT32 i = 0; i < numElements; i++)
-			outStates.set(i, states[i]);
-
-		return outStates.getInternal();
-	}
-
-	void ScriptGUIEnumField::internal_setElementStates(ScriptGUIEnumField* nativeInstance, MonoArray* monoStates)
-	{
-		if (monoStates == nullptr)
-			return;
-
-		ScriptArray inStates(monoStates);
-		UINT32 numElements = inStates.size();
-
-		Vector<bool> states(numElements);
-		for (UINT32 i = 0; i < numElements; i++)
-			states[i] = inStates.get<bool>(i);
-
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		listBox->setElementStates(states);
-	}
-
-	void ScriptGUIEnumField::internal_setTint(ScriptGUIEnumField* nativeInstance, Color color)
-	{
-		GUIListBoxField* field = (GUIListBoxField*)nativeInstance->getGUIElement();
-		field->setTint(color);
-	}
-
-	void ScriptGUIEnumField::onSelectionChanged(MonoObject* instance, UINT64 newIndex, bool enabled)
-	{
-		ScriptGUIEnumField* nativeInstance = ScriptGUIEnumField::toNative(instance);
-		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
-
-		UINT32 outValue = 0;
-
-		const Vector<UINT64>& values = nativeInstance->mValues;
-		Vector<bool> states = field->getElementStates();
-		for (UINT32 i = 0; i < (UINT32)values.size(); i++)
-			outValue |= states[i] ? values[i] : 0;
-
-		MonoUtil::invokeThunk(onSelectionChangedThunk, instance, outValue);
-	}
+#include "BsScriptGUIEnumField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsMonoUtil.h"
+#include "BsGUIListBoxField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIEnumField::OnSelectionChangedThunkDef ScriptGUIEnumField::onSelectionChangedThunk;
+
+	ScriptGUIEnumField::ScriptGUIEnumField(MonoObject* instance, GUIListBoxField* listBoxField, const Vector<UINT64>& values)
+		:TScriptGUIElement(instance, listBoxField), mValues(values)
+	{
+
+	}
+
+	void ScriptGUIEnumField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIEnumField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIEnumField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIEnumField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIEnumField::internal_setTint);
+		metaData.scriptClass->addInternalCall("Internal_SelectElement", &ScriptGUIEnumField::internal_selectElement);
+		metaData.scriptClass->addInternalCall("Internal_DeselectElement", &ScriptGUIEnumField::internal_deselectElement);
+		metaData.scriptClass->addInternalCall("Internal_GetElementStates", &ScriptGUIEnumField::internal_getElementStates);
+		metaData.scriptClass->addInternalCall("Internal_SetElementStates", &ScriptGUIEnumField::internal_setElementStates);
+
+		onSelectionChangedThunk = (OnSelectionChangedThunkDef)metaData.scriptClass->getMethod("DoOnSelectionChanged", 1)->getThunk();
+	}
+
+	void ScriptGUIEnumField::internal_createInstance(MonoObject* instance, MonoArray* names, MonoArray* values, 
+		bool multiselect, MonoObject* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		ScriptArray namesArr(names);
+		Vector<HString> nativeNames;
+		for (UINT32 i = 0; i < namesArr.size(); i++)
+			nativeNames.push_back(HString(namesArr.get<WString>(i)));
+
+		GUIListBoxField* guiField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiField = GUIListBoxField::create(nativeNames, multiselect, nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiField = GUIListBoxField::create(nativeNames, multiselect, options, styleName);
+		}
+
+		guiField->onSelectionChanged.connect(std::bind(&ScriptGUIEnumField::onSelectionChanged, instance, _1, _2));
+
+		ScriptArray valuesArr(values);
+		UINT32 elemSize = valuesArr.elementSize();
+
+		Vector<UINT64> nativeValues;
+		for (UINT32 i = 0; i < valuesArr.size(); i++)
+		{
+			UINT64 nativeValue = 0;
+
+			switch (elemSize)
+			{
+			case sizeof(UINT8):
+			{
+				UINT8 value = 0;
+				memcpy(&value, valuesArr.getRawPtr(elemSize, i), elemSize);
+				nativeValue = (UINT64)value;
+				break;
+			}
+			case sizeof(UINT16) :
+			{
+				UINT16 value = 0;
+				memcpy(&value, valuesArr.getRawPtr(elemSize, i), elemSize);
+				nativeValue = (UINT64)value;
+				break;
+			}
+			case sizeof(UINT32):
+			{
+				UINT32 value = 0;
+				memcpy(&value, valuesArr.getRawPtr(elemSize, i), elemSize);
+				nativeValue = (UINT64)value;
+				break;
+			}
+			case sizeof(UINT64) :
+			{
+				memcpy(&nativeValue, valuesArr.getRawPtr(elemSize, i), elemSize);
+				break;
+			}
+			}
+
+			nativeValues.push_back(nativeValue);
+		}
+			
+
+		ScriptGUIEnumField* nativeInstance = new (bs_alloc<ScriptGUIEnumField>()) ScriptGUIEnumField(instance, guiField, nativeValues);
+	}
+
+	UINT64 ScriptGUIEnumField::internal_getValue(ScriptGUIEnumField* nativeInstance)
+	{
+		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
+
+		UINT32 outValue = 0;
+
+		const Vector<UINT64>& values = nativeInstance->mValues;
+		Vector<bool> states = field->getElementStates();
+		for (UINT32 i = 0; i < (UINT32)values.size(); i++)
+			outValue |= states[i] ? values[i] : 0;
+
+		return outValue;
+	}
+
+	void ScriptGUIEnumField::internal_setValue(ScriptGUIEnumField* nativeInstance, UINT64 value)
+	{
+		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
+
+		const Vector<UINT64>& values = nativeInstance->mValues;
+		Vector<bool> states = field->getElementStates();
+
+		if (field->isMultiselect())
+		{
+			for (UINT32 i = 0; i < (UINT32)values.size(); i++)
+				states[i] = (values[i] & value) == values[i];
+		}
+		else
+		{
+			for (UINT32 i = 0; i < (UINT32)values.size(); i++)
+				states[i] = values[i] == value;
+		}
+
+		field->setElementStates(states);
+	}
+
+	void ScriptGUIEnumField::internal_selectElement(ScriptGUIEnumField* nativeInstance, int idx)
+	{
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		listBox->selectElement(idx);
+	}
+
+	void ScriptGUIEnumField::internal_deselectElement(ScriptGUIEnumField* nativeInstance, int idx)
+	{
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		listBox->deselectElement(idx);
+	}
+
+	MonoArray* ScriptGUIEnumField::internal_getElementStates(ScriptGUIEnumField* nativeInstance)
+	{
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		const Vector<bool>& states = listBox->getElementStates();
+
+		UINT32 numElements = (UINT32)states.size();
+		ScriptArray outStates = ScriptArray::create<bool>(numElements);
+
+		for (UINT32 i = 0; i < numElements; i++)
+			outStates.set(i, states[i]);
+
+		return outStates.getInternal();
+	}
+
+	void ScriptGUIEnumField::internal_setElementStates(ScriptGUIEnumField* nativeInstance, MonoArray* monoStates)
+	{
+		if (monoStates == nullptr)
+			return;
+
+		ScriptArray inStates(monoStates);
+		UINT32 numElements = inStates.size();
+
+		Vector<bool> states(numElements);
+		for (UINT32 i = 0; i < numElements; i++)
+			states[i] = inStates.get<bool>(i);
+
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		listBox->setElementStates(states);
+	}
+
+	void ScriptGUIEnumField::internal_setTint(ScriptGUIEnumField* nativeInstance, Color* color)
+	{
+		GUIListBoxField* field = (GUIListBoxField*)nativeInstance->getGUIElement();
+		field->setTint(*color);
+	}
+
+	void ScriptGUIEnumField::onSelectionChanged(MonoObject* instance, UINT64 newIndex, bool enabled)
+	{
+		ScriptGUIEnumField* nativeInstance = ScriptGUIEnumField::toNative(instance);
+		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
+
+		UINT32 outValue = 0;
+
+		const Vector<UINT64>& values = nativeInstance->mValues;
+		Vector<bool> states = field->getElementStates();
+		for (UINT32 i = 0; i < (UINT32)values.size(); i++)
+			outValue |= states[i] ? values[i] : 0;
+
+		MonoUtil::invokeThunk(onSelectionChangedThunk, instance, outValue);
+	}
 }
 }

+ 110 - 110
SBansheeEditor/Source/BsScriptGUIFloatField.cpp

@@ -1,111 +1,111 @@
-#include "BsScriptGUIFloatField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIFloatField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIFloatField::OnChangedThunkDef ScriptGUIFloatField::onChangedThunk;
-	ScriptGUIFloatField::OnConfirmedThunkDef ScriptGUIFloatField::onConfirmedThunk;
-
-	ScriptGUIFloatField::ScriptGUIFloatField(MonoObject* instance, GUIFloatField* floatField)
-		:TScriptGUIElement(instance, floatField)
-	{
-
-	}
-
-	void ScriptGUIFloatField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIFloatField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIFloatField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIFloatField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIFloatField::internal_hasInputFocus);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIFloatField::internal_setTint);
-		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUIFloatField::internal_setRange);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
-		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
-	}
-
-	void ScriptGUIFloatField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUIFloatField* guiFloatField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiFloatField = GUIFloatField::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiFloatField = GUIFloatField::create(options, styleName);
-		}
-
-		guiFloatField->onValueChanged.connect(std::bind(&ScriptGUIFloatField::onChanged, instance, _1));
-		guiFloatField->onConfirm.connect(std::bind(&ScriptGUIFloatField::onConfirmed, instance));
-
-		ScriptGUIFloatField* nativeInstance = new (bs_alloc<ScriptGUIFloatField>()) ScriptGUIFloatField(instance, guiFloatField);
-	}
-
-	void ScriptGUIFloatField::internal_getValue(ScriptGUIFloatField* nativeInstance, float* output)
-	{
-		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
-		*output = floatField->getValue();
-	}
-
-	void ScriptGUIFloatField::internal_setValue(ScriptGUIFloatField* nativeInstance, float value)
-	{
-		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
-		return floatField->setValue(value);
-	}
-
-	void ScriptGUIFloatField::internal_hasInputFocus(ScriptGUIFloatField* nativeInstance, bool* output)
-	{
-		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
-		*output = floatField->hasInputFocus();
-	}
-
-	void ScriptGUIFloatField::internal_setTint(ScriptGUIFloatField* nativeInstance, Color color)
-	{
-		GUIFloatField* floatField = (GUIFloatField*)nativeInstance->getGUIElement();
-		floatField->setTint(color);
-	}
-
-	void ScriptGUIFloatField::internal_setRange(ScriptGUIFloatField* nativeInstance, float min, float max)
-	{
-		GUIFloatField* intField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
-		intField->setRange(min, max);
-	}
-
-	void ScriptGUIFloatField::onChanged(MonoObject* instance, float newValue)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
-	}
-
-	void ScriptGUIFloatField::onConfirmed(MonoObject* instance)
-	{
-		MonoUtil::invokeThunk(onConfirmedThunk, instance);
-	}
+#include "BsScriptGUIFloatField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIFloatField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIFloatField::OnChangedThunkDef ScriptGUIFloatField::onChangedThunk;
+	ScriptGUIFloatField::OnConfirmedThunkDef ScriptGUIFloatField::onConfirmedThunk;
+
+	ScriptGUIFloatField::ScriptGUIFloatField(MonoObject* instance, GUIFloatField* floatField)
+		:TScriptGUIElement(instance, floatField)
+	{
+
+	}
+
+	void ScriptGUIFloatField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIFloatField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIFloatField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIFloatField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIFloatField::internal_hasInputFocus);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIFloatField::internal_setTint);
+		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUIFloatField::internal_setRange);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
+		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
+	}
+
+	void ScriptGUIFloatField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUIFloatField* guiFloatField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiFloatField = GUIFloatField::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiFloatField = GUIFloatField::create(options, styleName);
+		}
+
+		guiFloatField->onValueChanged.connect(std::bind(&ScriptGUIFloatField::onChanged, instance, _1));
+		guiFloatField->onConfirm.connect(std::bind(&ScriptGUIFloatField::onConfirmed, instance));
+
+		ScriptGUIFloatField* nativeInstance = new (bs_alloc<ScriptGUIFloatField>()) ScriptGUIFloatField(instance, guiFloatField);
+	}
+
+	void ScriptGUIFloatField::internal_getValue(ScriptGUIFloatField* nativeInstance, float* output)
+	{
+		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
+		*output = floatField->getValue();
+	}
+
+	void ScriptGUIFloatField::internal_setValue(ScriptGUIFloatField* nativeInstance, float value)
+	{
+		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
+		return floatField->setValue(value);
+	}
+
+	void ScriptGUIFloatField::internal_hasInputFocus(ScriptGUIFloatField* nativeInstance, bool* output)
+	{
+		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
+		*output = floatField->hasInputFocus();
+	}
+
+	void ScriptGUIFloatField::internal_setTint(ScriptGUIFloatField* nativeInstance, Color* color)
+	{
+		GUIFloatField* floatField = (GUIFloatField*)nativeInstance->getGUIElement();
+		floatField->setTint(*color);
+	}
+
+	void ScriptGUIFloatField::internal_setRange(ScriptGUIFloatField* nativeInstance, float min, float max)
+	{
+		GUIFloatField* intField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
+		intField->setRange(min, max);
+	}
+
+	void ScriptGUIFloatField::onChanged(MonoObject* instance, float newValue)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
+	}
+
+	void ScriptGUIFloatField::onConfirmed(MonoObject* instance)
+	{
+		MonoUtil::invokeThunk(onConfirmedThunk, instance);
+	}
 }
 }

+ 124 - 124
SBansheeEditor/Source/BsScriptGUIGameObjectField.cpp

@@ -1,125 +1,125 @@
-#include "BsScriptGUIGameObjectField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIGameObjectField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-#include "BsScriptGameObject.h"
-#include "BsScriptGameObjectManager.h"
-#include "BsMonoUtil.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIGameObjectField::OnChangedThunkDef ScriptGUIGameObjectField::onChangedThunk;
-
-	ScriptGUIGameObjectField::ScriptGUIGameObjectField(MonoObject* instance, GUIGameObjectField* GOField)
-		:TScriptGUIElement(instance, GOField)
-	{
-
-	}
-
-	void ScriptGUIGameObjectField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIGameObjectField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIGameObjectField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIGameObjectField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIGameObjectField::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
-	}
-
-	void ScriptGUIGameObjectField::internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		MonoType* monoType = mono_reflection_type_get_type(type);
-		::MonoClass* monoClass = mono_type_get_class(monoType);
-
-		String typeNamespace;
-		String typeName;
-		MonoUtil::getClassName(monoClass, typeNamespace, typeName);
-
-		GUIGameObjectField* guiGameObjectField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiGameObjectField = GUIGameObjectField::create(typeNamespace, typeName, nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiGameObjectField = GUIGameObjectField::create(typeNamespace, typeName, options, styleName);
-		}
-
-		guiGameObjectField->onValueChanged.connect(std::bind(&ScriptGUIGameObjectField::onChanged, instance, _1));
-
-		ScriptGUIGameObjectField* nativeInstance = new (bs_alloc<ScriptGUIGameObjectField>()) ScriptGUIGameObjectField(instance, guiGameObjectField);
-	}
-
-	void ScriptGUIGameObjectField::internal_getValue(ScriptGUIGameObjectField* nativeInstance, MonoObject** output)
-	{
-		GUIGameObjectField* gameObjectField = static_cast<GUIGameObjectField*>(nativeInstance->getGUIElement());
-
-		HGameObject gameObject = gameObjectField->getValue();
-		*output = nativeToManagedGO(gameObject);
-	}
-
-	void ScriptGUIGameObjectField::internal_setValue(ScriptGUIGameObjectField* nativeInstance, MonoObject* value)
-	{
-		GUIGameObjectField* gameObjectField = static_cast<GUIGameObjectField*>(nativeInstance->getGUIElement());
-
-		if (value == nullptr)
-			gameObjectField->setValue(HGameObject());
-		else
-		{
-			ScriptGameObjectBase* scriptGO = ScriptGameObject::toNative(value);
-			gameObjectField->setValue(scriptGO->getNativeHandle());
-		}
-	}
-
-	void ScriptGUIGameObjectField::internal_setTint(ScriptGUIGameObjectField* nativeInstance, Color color)
-	{
-		GUIGameObjectField* gameObjectField = (GUIGameObjectField*)nativeInstance->getGUIElement();
-		gameObjectField->setTint(color);
-	}
-
-	void ScriptGUIGameObjectField::onChanged(MonoObject* instance, const HGameObject& newValue)
-	{
-		MonoObject* managedObj = nativeToManagedGO(newValue);
-		MonoUtil::invokeThunk(onChangedThunk, instance, managedObj);
-	}
-
-	MonoObject* ScriptGUIGameObjectField::nativeToManagedGO(const HGameObject& instance)
-	{
-		if (instance == nullptr)
-		{
-			return nullptr;
-		}
-		else
-		{
-			ScriptGameObjectBase* scriptGO = ScriptGameObjectManager::instance().getScriptGameObject(instance->getInstanceId());
-			if (scriptGO == nullptr)
-				return nullptr;
-			else
-				return scriptGO->getManagedInstance();
-		}
-	}
+#include "BsScriptGUIGameObjectField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIGameObjectField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+#include "BsScriptGameObject.h"
+#include "BsScriptGameObjectManager.h"
+#include "BsMonoUtil.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIGameObjectField::OnChangedThunkDef ScriptGUIGameObjectField::onChangedThunk;
+
+	ScriptGUIGameObjectField::ScriptGUIGameObjectField(MonoObject* instance, GUIGameObjectField* GOField)
+		:TScriptGUIElement(instance, GOField)
+	{
+
+	}
+
+	void ScriptGUIGameObjectField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIGameObjectField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIGameObjectField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIGameObjectField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIGameObjectField::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
+	}
+
+	void ScriptGUIGameObjectField::internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		MonoType* monoType = mono_reflection_type_get_type(type);
+		::MonoClass* monoClass = mono_type_get_class(monoType);
+
+		String typeNamespace;
+		String typeName;
+		MonoUtil::getClassName(monoClass, typeNamespace, typeName);
+
+		GUIGameObjectField* guiGameObjectField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiGameObjectField = GUIGameObjectField::create(typeNamespace, typeName, nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiGameObjectField = GUIGameObjectField::create(typeNamespace, typeName, options, styleName);
+		}
+
+		guiGameObjectField->onValueChanged.connect(std::bind(&ScriptGUIGameObjectField::onChanged, instance, _1));
+
+		ScriptGUIGameObjectField* nativeInstance = new (bs_alloc<ScriptGUIGameObjectField>()) ScriptGUIGameObjectField(instance, guiGameObjectField);
+	}
+
+	void ScriptGUIGameObjectField::internal_getValue(ScriptGUIGameObjectField* nativeInstance, MonoObject** output)
+	{
+		GUIGameObjectField* gameObjectField = static_cast<GUIGameObjectField*>(nativeInstance->getGUIElement());
+
+		HGameObject gameObject = gameObjectField->getValue();
+		*output = nativeToManagedGO(gameObject);
+	}
+
+	void ScriptGUIGameObjectField::internal_setValue(ScriptGUIGameObjectField* nativeInstance, MonoObject* value)
+	{
+		GUIGameObjectField* gameObjectField = static_cast<GUIGameObjectField*>(nativeInstance->getGUIElement());
+
+		if (value == nullptr)
+			gameObjectField->setValue(HGameObject());
+		else
+		{
+			ScriptGameObjectBase* scriptGO = ScriptGameObject::toNative(value);
+			gameObjectField->setValue(scriptGO->getNativeHandle());
+		}
+	}
+
+	void ScriptGUIGameObjectField::internal_setTint(ScriptGUIGameObjectField* nativeInstance, Color* color)
+	{
+		GUIGameObjectField* gameObjectField = (GUIGameObjectField*)nativeInstance->getGUIElement();
+		gameObjectField->setTint(*color);
+	}
+
+	void ScriptGUIGameObjectField::onChanged(MonoObject* instance, const HGameObject& newValue)
+	{
+		MonoObject* managedObj = nativeToManagedGO(newValue);
+		MonoUtil::invokeThunk(onChangedThunk, instance, managedObj);
+	}
+
+	MonoObject* ScriptGUIGameObjectField::nativeToManagedGO(const HGameObject& instance)
+	{
+		if (instance == nullptr)
+		{
+			return nullptr;
+		}
+		else
+		{
+			ScriptGameObjectBase* scriptGO = ScriptGameObjectManager::instance().getScriptGameObject(instance->getInstanceId());
+			if (scriptGO == nullptr)
+				return nullptr;
+			else
+				return scriptGO->getManagedInstance();
+		}
+	}
 }
 }

+ 110 - 110
SBansheeEditor/Source/BsScriptGUIIntField.cpp

@@ -1,111 +1,111 @@
-#include "BsScriptGUIIntField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIIntField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIIntField::OnChangedThunkDef ScriptGUIIntField::onChangedThunk;
-	ScriptGUIIntField::OnConfirmedThunkDef ScriptGUIIntField::onConfirmedThunk;
-
-	ScriptGUIIntField::ScriptGUIIntField(MonoObject* instance, GUIIntField* intField)
-		:TScriptGUIElement(instance, intField)
-	{
-
-	}
-
-	void ScriptGUIIntField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIIntField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIIntField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIIntField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIIntField::internal_hasInputFocus);
-		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUIIntField::internal_setRange);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIIntField::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
-		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
-	}
-
-	void ScriptGUIIntField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth, 
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for(UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUIIntField* guiIntField = nullptr;
-		if(withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiIntField = GUIIntField::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiIntField = GUIIntField::create(options, styleName);
-		}
-
-		guiIntField->onValueChanged.connect(std::bind(&ScriptGUIIntField::onChanged, instance, _1));
-		guiIntField->onConfirm.connect(std::bind(&ScriptGUIIntField::onConfirmed, instance));
-
-		ScriptGUIIntField* nativeInstance = new (bs_alloc<ScriptGUIIntField>()) ScriptGUIIntField(instance, guiIntField);
-	}
-
-	void ScriptGUIIntField::internal_getValue(ScriptGUIIntField* nativeInstance, INT32* output)
-	{
-		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
-		*output = intField->getValue();
-	}
-
-	void ScriptGUIIntField::internal_setValue(ScriptGUIIntField* nativeInstance, INT32 value)
-	{
-		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
-		return intField->setValue(value);
-	}
-
-	void ScriptGUIIntField::internal_hasInputFocus(ScriptGUIIntField* nativeInstance, bool* output)
-	{
-		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
-		*output = intField->hasInputFocus();
-	}
-
-	void ScriptGUIIntField::internal_setRange(ScriptGUIIntField* nativeInstance, INT32 min, INT32 max)
-	{
-		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
-		intField->setRange(min, max);
-	}
-
-	void ScriptGUIIntField::internal_setTint(ScriptGUIIntField* nativeInstance, Color color)
-	{
-		GUIIntField* intField = (GUIIntField*)nativeInstance->getGUIElement();
-		intField->setTint(color);
-	}
-
-	void ScriptGUIIntField::onChanged(MonoObject* instance, INT32 newValue)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
-	}
-
-	void ScriptGUIIntField::onConfirmed(MonoObject* instance)
-	{
-		MonoUtil::invokeThunk(onConfirmedThunk, instance);
-	}
+#include "BsScriptGUIIntField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIIntField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIIntField::OnChangedThunkDef ScriptGUIIntField::onChangedThunk;
+	ScriptGUIIntField::OnConfirmedThunkDef ScriptGUIIntField::onConfirmedThunk;
+
+	ScriptGUIIntField::ScriptGUIIntField(MonoObject* instance, GUIIntField* intField)
+		:TScriptGUIElement(instance, intField)
+	{
+
+	}
+
+	void ScriptGUIIntField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIIntField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIIntField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIIntField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIIntField::internal_hasInputFocus);
+		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUIIntField::internal_setRange);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIIntField::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
+		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
+	}
+
+	void ScriptGUIIntField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth, 
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for(UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUIIntField* guiIntField = nullptr;
+		if(withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiIntField = GUIIntField::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiIntField = GUIIntField::create(options, styleName);
+		}
+
+		guiIntField->onValueChanged.connect(std::bind(&ScriptGUIIntField::onChanged, instance, _1));
+		guiIntField->onConfirm.connect(std::bind(&ScriptGUIIntField::onConfirmed, instance));
+
+		ScriptGUIIntField* nativeInstance = new (bs_alloc<ScriptGUIIntField>()) ScriptGUIIntField(instance, guiIntField);
+	}
+
+	void ScriptGUIIntField::internal_getValue(ScriptGUIIntField* nativeInstance, INT32* output)
+	{
+		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
+		*output = intField->getValue();
+	}
+
+	void ScriptGUIIntField::internal_setValue(ScriptGUIIntField* nativeInstance, INT32 value)
+	{
+		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
+		return intField->setValue(value);
+	}
+
+	void ScriptGUIIntField::internal_hasInputFocus(ScriptGUIIntField* nativeInstance, bool* output)
+	{
+		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
+		*output = intField->hasInputFocus();
+	}
+
+	void ScriptGUIIntField::internal_setRange(ScriptGUIIntField* nativeInstance, INT32 min, INT32 max)
+	{
+		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
+		intField->setRange(min, max);
+	}
+
+	void ScriptGUIIntField::internal_setTint(ScriptGUIIntField* nativeInstance, Color* color)
+	{
+		GUIIntField* intField = (GUIIntField*)nativeInstance->getGUIElement();
+		intField->setTint(*color);
+	}
+
+	void ScriptGUIIntField::onChanged(MonoObject* instance, INT32 newValue)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
+	}
+
+	void ScriptGUIIntField::onConfirmed(MonoObject* instance)
+	{
+		MonoUtil::invokeThunk(onConfirmedThunk, instance);
+	}
 }
 }

+ 189 - 189
SBansheeEditor/Source/BsScriptGUIListBoxField.cpp

@@ -1,190 +1,190 @@
-#include "BsScriptGUIListBoxField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsMonoUtil.h"
-#include "BsGUIListBoxField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIListBoxField::OnSelectionChangedThunkDef ScriptGUIListBoxField::onSelectionChangedThunk;
-
-	ScriptGUIListBoxField::ScriptGUIListBoxField(MonoObject* instance, GUIListBoxField* listBoxField)
-		:TScriptGUIElement(instance, listBoxField)
-	{
-
-	}
-
-	void ScriptGUIListBoxField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIListBoxField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_SetElements", &ScriptGUIListBoxField::internal_setElements);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIListBoxField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIListBoxField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIListBoxField::internal_setTint);
-		metaData.scriptClass->addInternalCall("Internal_SelectElement", &ScriptGUIListBoxField::internal_selectElement);
-		metaData.scriptClass->addInternalCall("Internal_DeselectElement", &ScriptGUIListBoxField::internal_deselectElement);
-		metaData.scriptClass->addInternalCall("Internal_GetElementStates", &ScriptGUIListBoxField::internal_getElementStates);
-		metaData.scriptClass->addInternalCall("Internal_SetElementStates", &ScriptGUIListBoxField::internal_setElementStates);
-
-		onSelectionChangedThunk = (OnSelectionChangedThunkDef)metaData.scriptClass->getMethod("DoOnSelectionChanged", 1)->getThunk();
-	}
-
-	void ScriptGUIListBoxField::internal_createInstance(MonoObject* instance, MonoArray* elements, bool multiselect, MonoObject* title, 
-		UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		UINT32 elementsArrayLen = (UINT32)mono_array_length(elements);
-		Vector<HString> nativeElements;
-		for (UINT32 i = 0; i < elementsArrayLen; i++)
-		{
-			MonoObject* stringManaged = (MonoObject*)mono_array_get(elements, MonoObject*, i);
-
-			if (stringManaged == nullptr)
-				nativeElements.push_back(HString::dummy());
-			else
-			{
-				ScriptHString* textScript = ScriptHString::toNative(stringManaged);
-				nativeElements.push_back(textScript->getInternalValue());
-			}
-		}
-
-		GUIListBoxField* guiField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiField = GUIListBoxField::create(nativeElements, multiselect, nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiField = GUIListBoxField::create(nativeElements, multiselect, options, styleName);
-		}
-
-		guiField->onSelectionChanged.connect(std::bind(&ScriptGUIListBoxField::onSelectionChanged, instance, _1));
-
-		ScriptGUIListBoxField* nativeInstance = new (bs_alloc<ScriptGUIListBoxField>()) ScriptGUIListBoxField(instance, guiField);
-	}
-
-	UINT32 ScriptGUIListBoxField::internal_getValue(ScriptGUIListBoxField* nativeInstance)
-	{
-		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
-
-		const Vector<bool>& states = field->getElementStates();
-		for (UINT32 i = 0; i < (UINT32)states.size(); i++)
-		{
-			if (states[i])
-				return i;
-		}
-
-		return UINT_MAX;
-	}
-
-	void ScriptGUIListBoxField::internal_setValue(ScriptGUIListBoxField* nativeInstance, UINT32 index)
-	{
-		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
-		Vector<bool> states = field->getElementStates();
-
-		UINT32 numElements = (UINT32)states.size();
-		if (index >= numElements)
-			return;
-
-		for (UINT32 i = 0; i < numElements; i++)
-		{
-			if (states[i])
-				states[i] = true;
-			else
-				states[i] = false;
-		}
-
-		field->setElementStates(states);
-	}
-
-	void ScriptGUIListBoxField::internal_setElements(ScriptGUIListBoxField* nativeInstance, MonoArray* elements)
-	{
-		UINT32 elementsArrayLen = (UINT32)mono_array_length(elements);
-		Vector<HString> nativeElements;
-		for (UINT32 i = 0; i < elementsArrayLen; i++)
-		{
-			MonoObject* stringManaged = (MonoObject*)mono_array_get(elements, MonoObject*, i);
-
-			if (stringManaged == nullptr)
-				nativeElements.push_back(HString::dummy());
-			else
-			{
-				ScriptHString* textScript = ScriptHString::toNative(stringManaged);
-				nativeElements.push_back(textScript->getInternalValue());
-			}
-		}
-
-		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
-		field->setElements(nativeElements);
-	}
-
-	void ScriptGUIListBoxField::internal_selectElement(ScriptGUIListBoxField* nativeInstance, int idx)
-	{
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		listBox->selectElement(idx);
-	}
-
-	void ScriptGUIListBoxField::internal_deselectElement(ScriptGUIListBoxField* nativeInstance, int idx)
-	{
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		listBox->deselectElement(idx);
-	}
-
-	MonoArray* ScriptGUIListBoxField::internal_getElementStates(ScriptGUIListBoxField* nativeInstance)
-	{
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		const Vector<bool>& states = listBox->getElementStates();
-
-		UINT32 numElements = (UINT32)states.size();
-		ScriptArray outStates = ScriptArray::create<bool>(numElements);
-
-		for (UINT32 i = 0; i < numElements; i++)
-			outStates.set(i, states[i]);
-
-		return outStates.getInternal();
-	}
-
-	void ScriptGUIListBoxField::internal_setElementStates(ScriptGUIListBoxField* nativeInstance, MonoArray* monoStates)
-	{
-		if (monoStates == nullptr)
-			return;
-
-		ScriptArray inStates(monoStates);
-		UINT32 numElements = inStates.size();
-
-		Vector<bool> states(numElements);
-		for (UINT32 i = 0; i < numElements; i++)
-			states[i] = inStates.get<bool>(i);
-
-		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
-		listBox->setElementStates(states);
-	}
-
-	void ScriptGUIListBoxField::internal_setTint(ScriptGUIListBoxField* nativeInstance, Color color)
-	{
-		GUIListBoxField* field = (GUIListBoxField*)nativeInstance->getGUIElement();
-		field->setTint(color);
-	}
-
-	void ScriptGUIListBoxField::onSelectionChanged(MonoObject* instance, UINT32 newIndex)
-	{
-		MonoUtil::invokeThunk(onSelectionChangedThunk, instance, newIndex);
-	}
+#include "BsScriptGUIListBoxField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsMonoUtil.h"
+#include "BsGUIListBoxField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIListBoxField::OnSelectionChangedThunkDef ScriptGUIListBoxField::onSelectionChangedThunk;
+
+	ScriptGUIListBoxField::ScriptGUIListBoxField(MonoObject* instance, GUIListBoxField* listBoxField)
+		:TScriptGUIElement(instance, listBoxField)
+	{
+
+	}
+
+	void ScriptGUIListBoxField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIListBoxField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_SetElements", &ScriptGUIListBoxField::internal_setElements);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIListBoxField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIListBoxField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIListBoxField::internal_setTint);
+		metaData.scriptClass->addInternalCall("Internal_SelectElement", &ScriptGUIListBoxField::internal_selectElement);
+		metaData.scriptClass->addInternalCall("Internal_DeselectElement", &ScriptGUIListBoxField::internal_deselectElement);
+		metaData.scriptClass->addInternalCall("Internal_GetElementStates", &ScriptGUIListBoxField::internal_getElementStates);
+		metaData.scriptClass->addInternalCall("Internal_SetElementStates", &ScriptGUIListBoxField::internal_setElementStates);
+
+		onSelectionChangedThunk = (OnSelectionChangedThunkDef)metaData.scriptClass->getMethod("DoOnSelectionChanged", 1)->getThunk();
+	}
+
+	void ScriptGUIListBoxField::internal_createInstance(MonoObject* instance, MonoArray* elements, bool multiselect, MonoObject* title, 
+		UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		UINT32 elementsArrayLen = (UINT32)mono_array_length(elements);
+		Vector<HString> nativeElements;
+		for (UINT32 i = 0; i < elementsArrayLen; i++)
+		{
+			MonoObject* stringManaged = (MonoObject*)mono_array_get(elements, MonoObject*, i);
+
+			if (stringManaged == nullptr)
+				nativeElements.push_back(HString::dummy());
+			else
+			{
+				ScriptHString* textScript = ScriptHString::toNative(stringManaged);
+				nativeElements.push_back(textScript->getInternalValue());
+			}
+		}
+
+		GUIListBoxField* guiField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiField = GUIListBoxField::create(nativeElements, multiselect, nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiField = GUIListBoxField::create(nativeElements, multiselect, options, styleName);
+		}
+
+		guiField->onSelectionChanged.connect(std::bind(&ScriptGUIListBoxField::onSelectionChanged, instance, _1));
+
+		ScriptGUIListBoxField* nativeInstance = new (bs_alloc<ScriptGUIListBoxField>()) ScriptGUIListBoxField(instance, guiField);
+	}
+
+	UINT32 ScriptGUIListBoxField::internal_getValue(ScriptGUIListBoxField* nativeInstance)
+	{
+		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
+
+		const Vector<bool>& states = field->getElementStates();
+		for (UINT32 i = 0; i < (UINT32)states.size(); i++)
+		{
+			if (states[i])
+				return i;
+		}
+
+		return UINT_MAX;
+	}
+
+	void ScriptGUIListBoxField::internal_setValue(ScriptGUIListBoxField* nativeInstance, UINT32 index)
+	{
+		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
+		Vector<bool> states = field->getElementStates();
+
+		UINT32 numElements = (UINT32)states.size();
+		if (index >= numElements)
+			return;
+
+		for (UINT32 i = 0; i < numElements; i++)
+		{
+			if (states[i])
+				states[i] = true;
+			else
+				states[i] = false;
+		}
+
+		field->setElementStates(states);
+	}
+
+	void ScriptGUIListBoxField::internal_setElements(ScriptGUIListBoxField* nativeInstance, MonoArray* elements)
+	{
+		UINT32 elementsArrayLen = (UINT32)mono_array_length(elements);
+		Vector<HString> nativeElements;
+		for (UINT32 i = 0; i < elementsArrayLen; i++)
+		{
+			MonoObject* stringManaged = (MonoObject*)mono_array_get(elements, MonoObject*, i);
+
+			if (stringManaged == nullptr)
+				nativeElements.push_back(HString::dummy());
+			else
+			{
+				ScriptHString* textScript = ScriptHString::toNative(stringManaged);
+				nativeElements.push_back(textScript->getInternalValue());
+			}
+		}
+
+		GUIListBoxField* field = static_cast<GUIListBoxField*>(nativeInstance->getGUIElement());
+		field->setElements(nativeElements);
+	}
+
+	void ScriptGUIListBoxField::internal_selectElement(ScriptGUIListBoxField* nativeInstance, int idx)
+	{
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		listBox->selectElement(idx);
+	}
+
+	void ScriptGUIListBoxField::internal_deselectElement(ScriptGUIListBoxField* nativeInstance, int idx)
+	{
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		listBox->deselectElement(idx);
+	}
+
+	MonoArray* ScriptGUIListBoxField::internal_getElementStates(ScriptGUIListBoxField* nativeInstance)
+	{
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		const Vector<bool>& states = listBox->getElementStates();
+
+		UINT32 numElements = (UINT32)states.size();
+		ScriptArray outStates = ScriptArray::create<bool>(numElements);
+
+		for (UINT32 i = 0; i < numElements; i++)
+			outStates.set(i, states[i]);
+
+		return outStates.getInternal();
+	}
+
+	void ScriptGUIListBoxField::internal_setElementStates(ScriptGUIListBoxField* nativeInstance, MonoArray* monoStates)
+	{
+		if (monoStates == nullptr)
+			return;
+
+		ScriptArray inStates(monoStates);
+		UINT32 numElements = inStates.size();
+
+		Vector<bool> states(numElements);
+		for (UINT32 i = 0; i < numElements; i++)
+			states[i] = inStates.get<bool>(i);
+
+		GUIListBoxField* listBox = (GUIListBoxField*)nativeInstance->getGUIElement();
+		listBox->setElementStates(states);
+	}
+
+	void ScriptGUIListBoxField::internal_setTint(ScriptGUIListBoxField* nativeInstance, Color* color)
+	{
+		GUIListBoxField* field = (GUIListBoxField*)nativeInstance->getGUIElement();
+		field->setTint(*color);
+	}
+
+	void ScriptGUIListBoxField::onSelectionChanged(MonoObject* instance, UINT32 newIndex)
+	{
+		MonoUtil::invokeThunk(onSelectionChangedThunk, instance, newIndex);
+	}
 }
 }

+ 152 - 152
SBansheeEditor/Source/BsScriptGUIResourceField.cpp

@@ -1,153 +1,153 @@
-#include "BsScriptGUIResourceField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIResourceField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-#include "BsScriptResource.h"
-#include "BsScriptResourceManager.h"
-#include "BsScriptResourceRef.h"
-#include "BsResources.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIResourceField::OnChangedThunkDef ScriptGUIResourceField::onChangedThunk;
-
-	ScriptGUIResourceField::ScriptGUIResourceField(MonoObject* instance, GUIResourceField* resourceField)
-		:TScriptGUIElement(instance, resourceField)
-	{
-
-	}
-
-	void ScriptGUIResourceField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIResourceField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIResourceField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIResourceField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_GetValueRef", &ScriptGUIResourceField::internal_getValueRef);
-		metaData.scriptClass->addInternalCall("Internal_SetValueRef", &ScriptGUIResourceField::internal_setValueRef);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIResourceField::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
-	}
-
-	void ScriptGUIResourceField::internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		MonoType* monoType = mono_reflection_type_get_type(type);
-		::MonoClass* monoClass = mono_type_get_class(monoType);
-
-		String typeNamespace;
-		String typeName;
-		MonoUtil::getClassName(monoClass, typeNamespace, typeName);
-
-		GUIResourceField* guiResourceField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiResourceField = GUIResourceField::create(typeNamespace, typeName, nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiResourceField = GUIResourceField::create(typeNamespace, typeName, options, styleName);
-		}
-
-		guiResourceField->onValueChanged.connect(std::bind(&ScriptGUIResourceField::onChanged, instance, _1));
-
-		ScriptGUIResourceField* nativeInstance = new (bs_alloc<ScriptGUIResourceField>()) ScriptGUIResourceField(instance, guiResourceField);
-	}
-
-	void ScriptGUIResourceField::internal_getValue(ScriptGUIResourceField* nativeInstance, MonoObject** output)
-	{
-		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
-
-		HResource resource = resourceField->getValue();
-		*output = nativeToManagedResource(resource);
-	}
-
-	void ScriptGUIResourceField::internal_setValue(ScriptGUIResourceField* nativeInstance, MonoObject* value)
-	{
-		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
-
-		if (value == nullptr)
-			resourceField->setValue(HResource());
-		else
-		{
-			ScriptResourceBase* scriptResource = ScriptResource::toNative(value);
-			resourceField->setValue(scriptResource->getGenericHandle());
-		}
-	}
-
-	void ScriptGUIResourceField::internal_getValueRef(ScriptGUIResourceField* nativeInstance, MonoObject** output)
-	{
-		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
-
-		WeakResourceHandle<Resource> resource = resourceField->getValueWeak();
-		*output = ScriptResourceRef::create(resource);
-	}
-
-	void ScriptGUIResourceField::internal_setValueRef(ScriptGUIResourceField* nativeInstance, MonoObject* value)
-	{
-		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
-
-		if (value == nullptr)
-			resourceField->setValue(HTexture());
-		else
-		{
-			ScriptResourceRef* scriptTexture = ScriptResourceRef::toNative(value);
-			resourceField->setValueWeak(static_resource_cast<Texture>(scriptTexture->getHandle()));
-		}
-	}
-
-	void ScriptGUIResourceField::internal_setTint(ScriptGUIResourceField* nativeInstance, Color color)
-	{
-		GUIResourceField* resourceField = (GUIResourceField*)nativeInstance->getGUIElement();
-		resourceField->setTint(color);
-	}
-
-	void ScriptGUIResourceField::onChanged(MonoObject* instance, const WeakResourceHandle<Resource>& newHandle)
-	{
-		MonoObject* managedObj = ScriptResourceRef::create(newHandle);
-		MonoUtil::invokeThunk(onChangedThunk, instance, managedObj);
-	}
-
-	MonoObject* ScriptGUIResourceField::nativeToManagedResource(const HResource& instance)
-	{
-		if (instance == nullptr)
-		{
-			return nullptr;
-		}
-		else
-		{
-			ScriptResourceBase* scriptResource = ScriptResourceManager::instance().getScriptResource(instance.getUUID());
-			if (scriptResource == nullptr)
-			{
-				ScriptResourceManager::instance().createScriptResource(instance, &scriptResource);
-
-				return scriptResource->getManagedInstance();
-			}
-			else
-				return scriptResource->getManagedInstance();
-		}
-	}
+#include "BsScriptGUIResourceField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIResourceField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+#include "BsScriptResource.h"
+#include "BsScriptResourceManager.h"
+#include "BsScriptResourceRef.h"
+#include "BsResources.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIResourceField::OnChangedThunkDef ScriptGUIResourceField::onChangedThunk;
+
+	ScriptGUIResourceField::ScriptGUIResourceField(MonoObject* instance, GUIResourceField* resourceField)
+		:TScriptGUIElement(instance, resourceField)
+	{
+
+	}
+
+	void ScriptGUIResourceField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIResourceField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIResourceField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIResourceField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_GetValueRef", &ScriptGUIResourceField::internal_getValueRef);
+		metaData.scriptClass->addInternalCall("Internal_SetValueRef", &ScriptGUIResourceField::internal_setValueRef);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIResourceField::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
+	}
+
+	void ScriptGUIResourceField::internal_createInstance(MonoObject* instance, MonoReflectionType* type, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		MonoType* monoType = mono_reflection_type_get_type(type);
+		::MonoClass* monoClass = mono_type_get_class(monoType);
+
+		String typeNamespace;
+		String typeName;
+		MonoUtil::getClassName(monoClass, typeNamespace, typeName);
+
+		GUIResourceField* guiResourceField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiResourceField = GUIResourceField::create(typeNamespace, typeName, nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiResourceField = GUIResourceField::create(typeNamespace, typeName, options, styleName);
+		}
+
+		guiResourceField->onValueChanged.connect(std::bind(&ScriptGUIResourceField::onChanged, instance, _1));
+
+		ScriptGUIResourceField* nativeInstance = new (bs_alloc<ScriptGUIResourceField>()) ScriptGUIResourceField(instance, guiResourceField);
+	}
+
+	void ScriptGUIResourceField::internal_getValue(ScriptGUIResourceField* nativeInstance, MonoObject** output)
+	{
+		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
+
+		HResource resource = resourceField->getValue();
+		*output = nativeToManagedResource(resource);
+	}
+
+	void ScriptGUIResourceField::internal_setValue(ScriptGUIResourceField* nativeInstance, MonoObject* value)
+	{
+		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
+
+		if (value == nullptr)
+			resourceField->setValue(HResource());
+		else
+		{
+			ScriptResourceBase* scriptResource = ScriptResource::toNative(value);
+			resourceField->setValue(scriptResource->getGenericHandle());
+		}
+	}
+
+	void ScriptGUIResourceField::internal_getValueRef(ScriptGUIResourceField* nativeInstance, MonoObject** output)
+	{
+		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
+
+		WeakResourceHandle<Resource> resource = resourceField->getValueWeak();
+		*output = ScriptResourceRef::create(resource);
+	}
+
+	void ScriptGUIResourceField::internal_setValueRef(ScriptGUIResourceField* nativeInstance, MonoObject* value)
+	{
+		GUIResourceField* resourceField = static_cast<GUIResourceField*>(nativeInstance->getGUIElement());
+
+		if (value == nullptr)
+			resourceField->setValue(HTexture());
+		else
+		{
+			ScriptResourceRef* scriptTexture = ScriptResourceRef::toNative(value);
+			resourceField->setValueWeak(static_resource_cast<Texture>(scriptTexture->getHandle()));
+		}
+	}
+
+	void ScriptGUIResourceField::internal_setTint(ScriptGUIResourceField* nativeInstance, Color* color)
+	{
+		GUIResourceField* resourceField = (GUIResourceField*)nativeInstance->getGUIElement();
+		resourceField->setTint(*color);
+	}
+
+	void ScriptGUIResourceField::onChanged(MonoObject* instance, const WeakResourceHandle<Resource>& newHandle)
+	{
+		MonoObject* managedObj = ScriptResourceRef::create(newHandle);
+		MonoUtil::invokeThunk(onChangedThunk, instance, managedObj);
+	}
+
+	MonoObject* ScriptGUIResourceField::nativeToManagedResource(const HResource& instance)
+	{
+		if (instance == nullptr)
+		{
+			return nullptr;
+		}
+		else
+		{
+			ScriptResourceBase* scriptResource = ScriptResourceManager::instance().getScriptResource(instance.getUUID());
+			if (scriptResource == nullptr)
+			{
+				ScriptResourceManager::instance().createScriptResource(instance, &scriptResource);
+
+				return scriptResource->getManagedInstance();
+			}
+			else
+				return scriptResource->getManagedInstance();
+		}
+	}
 }
 }

+ 98 - 98
SBansheeEditor/Source/BsScriptGUISliderField.cpp

@@ -1,99 +1,99 @@
-#include "BsScriptGUISliderField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsMonoUtil.h"
-#include "BsGUISliderField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUISliderField::OnChangedThunkDef ScriptGUISliderField::onChangedThunk;
-
-	ScriptGUISliderField::ScriptGUISliderField(MonoObject* instance, GUISliderField* sliderField)
-		:TScriptGUIElement(instance, sliderField)
-	{
-
-	}
-
-	void ScriptGUISliderField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISliderField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUISliderField::internal_setTint);
-		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderField::internal_setRange);
-		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderField::internal_setStep);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
-	}
-
-	void ScriptGUISliderField::internal_createInstance(MonoObject* instance, float min, float max, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUISliderField* guiSliderField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiSliderField = GUISliderField::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiSliderField = GUISliderField::create(options, styleName);
-		}
-
-		guiSliderField->setRange(min, max);
-		guiSliderField->onValueChanged.connect(std::bind(&ScriptGUISliderField::onChanged, instance, _1));
-
-		ScriptGUISliderField* nativeInstance = new (bs_alloc<ScriptGUISliderField>()) ScriptGUISliderField(instance, guiSliderField);
-	}
-
-	float ScriptGUISliderField::internal_getValue(ScriptGUISliderField* nativeInstance)
-	{
-		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
-		return sliderField->getValue();
-	}
-
-	void ScriptGUISliderField::internal_setValue(ScriptGUISliderField* nativeInstance, float value)
-	{
-		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
-		return sliderField->setValue(value);
-	}
-
-	void ScriptGUISliderField::internal_setTint(ScriptGUISliderField* nativeInstance, Color color)
-	{
-		GUISliderField* sliderField = (GUISliderField*)nativeInstance->getGUIElement();
-		sliderField->setTint(color);
-	}
-
-	void ScriptGUISliderField::internal_setRange(ScriptGUISliderField* nativeInstance, float min, float max)
-	{
-		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
-		sliderField->setRange(min, max);
-	}
-
-	void ScriptGUISliderField::internal_setStep(ScriptGUISliderField* nativeInstance, float step)
-	{
-		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
-		sliderField->setStep(step);
-	}
-
-	void ScriptGUISliderField::onChanged(MonoObject* instance, float newValue)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
-	}
+#include "BsScriptGUISliderField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsMonoUtil.h"
+#include "BsGUISliderField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUISliderField::OnChangedThunkDef ScriptGUISliderField::onChangedThunk;
+
+	ScriptGUISliderField::ScriptGUISliderField(MonoObject* instance, GUISliderField* sliderField)
+		:TScriptGUIElement(instance, sliderField)
+	{
+
+	}
+
+	void ScriptGUISliderField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUISliderField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUISliderField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUISliderField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUISliderField::internal_setTint);
+		metaData.scriptClass->addInternalCall("Internal_SetRange", &ScriptGUISliderField::internal_setRange);
+		metaData.scriptClass->addInternalCall("Internal_SetStep", &ScriptGUISliderField::internal_setStep);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
+	}
+
+	void ScriptGUISliderField::internal_createInstance(MonoObject* instance, float min, float max, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUISliderField* guiSliderField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiSliderField = GUISliderField::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiSliderField = GUISliderField::create(options, styleName);
+		}
+
+		guiSliderField->setRange(min, max);
+		guiSliderField->onValueChanged.connect(std::bind(&ScriptGUISliderField::onChanged, instance, _1));
+
+		ScriptGUISliderField* nativeInstance = new (bs_alloc<ScriptGUISliderField>()) ScriptGUISliderField(instance, guiSliderField);
+	}
+
+	float ScriptGUISliderField::internal_getValue(ScriptGUISliderField* nativeInstance)
+	{
+		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
+		return sliderField->getValue();
+	}
+
+	void ScriptGUISliderField::internal_setValue(ScriptGUISliderField* nativeInstance, float value)
+	{
+		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
+		return sliderField->setValue(value);
+	}
+
+	void ScriptGUISliderField::internal_setTint(ScriptGUISliderField* nativeInstance, Color* color)
+	{
+		GUISliderField* sliderField = (GUISliderField*)nativeInstance->getGUIElement();
+		sliderField->setTint(*color);
+	}
+
+	void ScriptGUISliderField::internal_setRange(ScriptGUISliderField* nativeInstance, float min, float max)
+	{
+		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
+		sliderField->setRange(min, max);
+	}
+
+	void ScriptGUISliderField::internal_setStep(ScriptGUISliderField* nativeInstance, float step)
+	{
+		GUISliderField* sliderField = static_cast<GUISliderField*>(nativeInstance->getGUIElement());
+		sliderField->setStep(step);
+	}
+
+	void ScriptGUISliderField::onChanged(MonoObject* instance, float newValue)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
+	}
 }
 }

+ 116 - 116
SBansheeEditor/Source/BsScriptGUITextField.cpp

@@ -1,117 +1,117 @@
-#include "BsScriptGUITextField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUITextField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUITextField::OnChangedThunkDef ScriptGUITextField::onChangedThunk;
-	ScriptGUITextField::OnConfirmedThunkDef ScriptGUITextField::onConfirmedThunk;
-
-	ScriptGUITextField::ScriptGUITextField(MonoObject* instance, GUITextField* textField)
-		:TScriptGUIElement(instance, textField)
-	{
-
-	}
-
-	void ScriptGUITextField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUITextField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUITextField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUITextField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUITextField::internal_hasInputFocus);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUITextField::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
-		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
-	}
-
-	void ScriptGUITextField::internal_createInstance(MonoObject* instance, bool multiline, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUITextField* guiField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiField = GUITextField::create(multiline, nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiField = GUITextField::create(multiline, options, styleName);
-		}
-
-		guiField->onValueChanged.connect(std::bind(&ScriptGUITextField::onChanged, instance, _1));
-		guiField->onConfirm.connect(std::bind(&ScriptGUITextField::onConfirmed, instance));
-
-		ScriptGUITextField* nativeInstance = new (bs_alloc<ScriptGUITextField>()) ScriptGUITextField(instance, guiField);
-	}
-
-	void ScriptGUITextField::internal_getValue(ScriptGUITextField* nativeInstance, MonoString** output)
-	{
-		if (nativeInstance->isDestroyed())
-			*output = MonoUtil::wstringToMono(StringUtil::WBLANK);
-
-		GUITextField* field = static_cast<GUITextField*>(nativeInstance->getGUIElement());
-		*output = MonoUtil::wstringToMono(field->getValue());
-	}
-
-	void ScriptGUITextField::internal_setValue(ScriptGUITextField* nativeInstance, MonoString* value)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		GUITextField* field = static_cast<GUITextField*>(nativeInstance->getGUIElement());
-		field->setValue(MonoUtil::monoToWString(value));
-	}
-
-	void ScriptGUITextField::internal_hasInputFocus(ScriptGUITextField* nativeInstance, bool* output)
-	{
-		if (nativeInstance->isDestroyed())
-			*output = false;
-
-		GUITextField* field = static_cast<GUITextField*>(nativeInstance->getGUIElement());
-		*output = field->hasInputFocus();
-	}
-
-	void ScriptGUITextField::internal_setTint(ScriptGUITextField* nativeInstance, Color color)
-	{
-		if (nativeInstance->isDestroyed())
-			return;
-
-		GUITextField* field = (GUITextField*)nativeInstance->getGUIElement();
-		field->setTint(color);
-	}
-
-	void ScriptGUITextField::onChanged(MonoObject* instance, const WString& newValue)
-	{
-		MonoString* monoNewValue = MonoUtil::wstringToMono(newValue);
-		MonoUtil::invokeThunk(onChangedThunk, instance, monoNewValue);
-	}
-
-	void ScriptGUITextField::onConfirmed(MonoObject* instance)
-	{
-		MonoUtil::invokeThunk(onConfirmedThunk, instance);
-	}
+#include "BsScriptGUITextField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUITextField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUITextField::OnChangedThunkDef ScriptGUITextField::onChangedThunk;
+	ScriptGUITextField::OnConfirmedThunkDef ScriptGUITextField::onConfirmedThunk;
+
+	ScriptGUITextField::ScriptGUITextField(MonoObject* instance, GUITextField* textField)
+		:TScriptGUIElement(instance, textField)
+	{
+
+	}
+
+	void ScriptGUITextField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUITextField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUITextField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUITextField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUITextField::internal_hasInputFocus);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUITextField::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
+		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
+	}
+
+	void ScriptGUITextField::internal_createInstance(MonoObject* instance, bool multiline, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUITextField* guiField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiField = GUITextField::create(multiline, nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiField = GUITextField::create(multiline, options, styleName);
+		}
+
+		guiField->onValueChanged.connect(std::bind(&ScriptGUITextField::onChanged, instance, _1));
+		guiField->onConfirm.connect(std::bind(&ScriptGUITextField::onConfirmed, instance));
+
+		ScriptGUITextField* nativeInstance = new (bs_alloc<ScriptGUITextField>()) ScriptGUITextField(instance, guiField);
+	}
+
+	void ScriptGUITextField::internal_getValue(ScriptGUITextField* nativeInstance, MonoString** output)
+	{
+		if (nativeInstance->isDestroyed())
+			*output = MonoUtil::wstringToMono(StringUtil::WBLANK);
+
+		GUITextField* field = static_cast<GUITextField*>(nativeInstance->getGUIElement());
+		*output = MonoUtil::wstringToMono(field->getValue());
+	}
+
+	void ScriptGUITextField::internal_setValue(ScriptGUITextField* nativeInstance, MonoString* value)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		GUITextField* field = static_cast<GUITextField*>(nativeInstance->getGUIElement());
+		field->setValue(MonoUtil::monoToWString(value));
+	}
+
+	void ScriptGUITextField::internal_hasInputFocus(ScriptGUITextField* nativeInstance, bool* output)
+	{
+		if (nativeInstance->isDestroyed())
+			*output = false;
+
+		GUITextField* field = static_cast<GUITextField*>(nativeInstance->getGUIElement());
+		*output = field->hasInputFocus();
+	}
+
+	void ScriptGUITextField::internal_setTint(ScriptGUITextField* nativeInstance, Color* color)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		GUITextField* field = (GUITextField*)nativeInstance->getGUIElement();
+		field->setTint(*color);
+	}
+
+	void ScriptGUITextField::onChanged(MonoObject* instance, const WString& newValue)
+	{
+		MonoString* monoNewValue = MonoUtil::wstringToMono(newValue);
+		MonoUtil::invokeThunk(onChangedThunk, instance, monoNewValue);
+	}
+
+	void ScriptGUITextField::onConfirmed(MonoObject* instance)
+	{
+		MonoUtil::invokeThunk(onConfirmedThunk, instance);
+	}
 }
 }

+ 137 - 137
SBansheeEditor/Source/BsScriptGUITextureField.cpp

@@ -1,138 +1,138 @@
-#include "BsScriptGUITextureField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUITextureField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-#include "BsScriptTexture.h"
-#include "BsScriptResourceManager.h"
-#include "BsScriptResourceRef.h"
-#include "BsResources.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUITextureField::OnChangedThunkDef ScriptGUITextureField::onChangedThunk;
-
-	ScriptGUITextureField::ScriptGUITextureField(MonoObject* instance, GUITextureField* resourceField)
-		:TScriptGUIElement(instance, resourceField)
-	{
-
-	}
-
-	void ScriptGUITextureField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUITextureField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUITextureField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUITextureField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_GetValueRef", &ScriptGUITextureField::internal_getValueRef);
-		metaData.scriptClass->addInternalCall("Internal_SetValueRef", &ScriptGUITextureField::internal_setValueRef);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUITextureField::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
-	}
-
-	void ScriptGUITextureField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUITextureField* guiTextureField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiTextureField = GUITextureField::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiTextureField = GUITextureField::create(options, styleName);
-		}
-
-		guiTextureField->onValueChanged.connect(std::bind(&ScriptGUITextureField::onChanged, instance, _1));
-
-		ScriptGUITextureField* nativeInstance = new (bs_alloc<ScriptGUITextureField>()) ScriptGUITextureField(instance, guiTextureField);
-	}
-
-	void ScriptGUITextureField::internal_getValue(ScriptGUITextureField* nativeInstance, MonoObject** output)
-	{
-		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
-
-		HTexture resource = textureField->getValue();
-		*output = nativeToManagedResource(resource);
-	}
-
-	void ScriptGUITextureField::internal_setValue(ScriptGUITextureField* nativeInstance, MonoObject* value)
-	{
-		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
-
-		if (value == nullptr)
-			textureField->setValue(HTexture());
-		else
-		{
-			ScriptTextureBase* scriptTexture = ScriptTexture::toNative(value);
-			textureField->setValue(static_resource_cast<Texture>(scriptTexture->getGenericHandle()));
-		}
-	}
-
-	void ScriptGUITextureField::internal_getValueRef(ScriptGUITextureField* nativeInstance, MonoObject** output)
-	{
-		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
-
-		WeakResourceHandle<Texture> resource = textureField->getValueWeak();
-		*output = ScriptResourceRef::create(resource);
-	}
-
-	void ScriptGUITextureField::internal_setValueRef(ScriptGUITextureField* nativeInstance, MonoObject* value)
-	{
-		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
-
-		if (value == nullptr)
-			textureField->setValue(HTexture());
-		else
-		{
-			ScriptResourceRef* scriptTexture = ScriptResourceRef::toNative(value);
-			textureField->setValueWeak(static_resource_cast<Texture>(scriptTexture->getHandle()));
-		}
-	}
-
-	void ScriptGUITextureField::internal_setTint(ScriptGUITextureField* nativeInstance, Color color)
-	{
-		GUITextureField* textureField = (GUITextureField*)nativeInstance->getGUIElement();
-		textureField->setTint(color);
-	}
-
-	void ScriptGUITextureField::onChanged(MonoObject* instance, const WeakResourceHandle<Texture>& newHandle)
-	{
-		// TODO - Always returning a 2D texture, will not work for 3D/cube textures
-		MonoObject* managedObj = ScriptResourceRef::create(newHandle);
-		MonoUtil::invokeThunk(onChangedThunk, instance, managedObj);
-	}
-
-	MonoObject* ScriptGUITextureField::nativeToManagedResource(const HTexture& instance)
-	{
-		if (instance == nullptr)
-			return nullptr;
-
-		ScriptTextureBase* scriptResource = nullptr;
-		ScriptResourceManager::instance().getScriptResource(instance, &scriptResource, true);
-
-		return scriptResource->getManagedInstance();
-	}
+#include "BsScriptGUITextureField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUITextureField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+#include "BsScriptTexture.h"
+#include "BsScriptResourceManager.h"
+#include "BsScriptResourceRef.h"
+#include "BsResources.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUITextureField::OnChangedThunkDef ScriptGUITextureField::onChangedThunk;
+
+	ScriptGUITextureField::ScriptGUITextureField(MonoObject* instance, GUITextureField* resourceField)
+		:TScriptGUIElement(instance, resourceField)
+	{
+
+	}
+
+	void ScriptGUITextureField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUITextureField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUITextureField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUITextureField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_GetValueRef", &ScriptGUITextureField::internal_getValueRef);
+		metaData.scriptClass->addInternalCall("Internal_SetValueRef", &ScriptGUITextureField::internal_setValueRef);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUITextureField::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
+	}
+
+	void ScriptGUITextureField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUITextureField* guiTextureField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiTextureField = GUITextureField::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiTextureField = GUITextureField::create(options, styleName);
+		}
+
+		guiTextureField->onValueChanged.connect(std::bind(&ScriptGUITextureField::onChanged, instance, _1));
+
+		ScriptGUITextureField* nativeInstance = new (bs_alloc<ScriptGUITextureField>()) ScriptGUITextureField(instance, guiTextureField);
+	}
+
+	void ScriptGUITextureField::internal_getValue(ScriptGUITextureField* nativeInstance, MonoObject** output)
+	{
+		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
+
+		HTexture resource = textureField->getValue();
+		*output = nativeToManagedResource(resource);
+	}
+
+	void ScriptGUITextureField::internal_setValue(ScriptGUITextureField* nativeInstance, MonoObject* value)
+	{
+		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
+
+		if (value == nullptr)
+			textureField->setValue(HTexture());
+		else
+		{
+			ScriptTextureBase* scriptTexture = ScriptTexture::toNative(value);
+			textureField->setValue(static_resource_cast<Texture>(scriptTexture->getGenericHandle()));
+		}
+	}
+
+	void ScriptGUITextureField::internal_getValueRef(ScriptGUITextureField* nativeInstance, MonoObject** output)
+	{
+		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
+
+		WeakResourceHandle<Texture> resource = textureField->getValueWeak();
+		*output = ScriptResourceRef::create(resource);
+	}
+
+	void ScriptGUITextureField::internal_setValueRef(ScriptGUITextureField* nativeInstance, MonoObject* value)
+	{
+		GUITextureField* textureField = static_cast<GUITextureField*>(nativeInstance->getGUIElement());
+
+		if (value == nullptr)
+			textureField->setValue(HTexture());
+		else
+		{
+			ScriptResourceRef* scriptTexture = ScriptResourceRef::toNative(value);
+			textureField->setValueWeak(static_resource_cast<Texture>(scriptTexture->getHandle()));
+		}
+	}
+
+	void ScriptGUITextureField::internal_setTint(ScriptGUITextureField* nativeInstance, Color* color)
+	{
+		GUITextureField* textureField = (GUITextureField*)nativeInstance->getGUIElement();
+		textureField->setTint(*color);
+	}
+
+	void ScriptGUITextureField::onChanged(MonoObject* instance, const WeakResourceHandle<Texture>& newHandle)
+	{
+		// TODO - Always returning a 2D texture, will not work for 3D/cube textures
+		MonoObject* managedObj = ScriptResourceRef::create(newHandle);
+		MonoUtil::invokeThunk(onChangedThunk, instance, managedObj);
+	}
+
+	MonoObject* ScriptGUITextureField::nativeToManagedResource(const HTexture& instance)
+	{
+		if (instance == nullptr)
+			return nullptr;
+
+		ScriptTextureBase* scriptResource = nullptr;
+		ScriptResourceManager::instance().getScriptResource(instance, &scriptResource, true);
+
+		return scriptResource->getManagedInstance();
+	}
 }
 }

+ 88 - 88
SBansheeEditor/Source/BsScriptGUIToggleField.cpp

@@ -1,89 +1,89 @@
-#include "BsScriptGUIToggleField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIToggleField.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIToggleField::OnChangedThunkDef ScriptGUIToggleField::onChangedThunk;
-
-	ScriptGUIToggleField::ScriptGUIToggleField(MonoObject* instance, GUIToggleField* toggleField)
-		:TScriptGUIElement(instance, toggleField)
-	{
-
-	}
-
-	void ScriptGUIToggleField::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIToggleField::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIToggleField::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIToggleField::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIToggleField::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
-	}
-
-	void ScriptGUIToggleField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUIToggleField* guiField = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			guiField = GUIToggleField::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			guiField = GUIToggleField::create(options, styleName);
-		}
-
-		guiField->onValueChanged.connect(std::bind(&ScriptGUIToggleField::onChanged, instance, _1));
-
-		ScriptGUIToggleField* nativeInstance = new (bs_alloc<ScriptGUIToggleField>()) ScriptGUIToggleField(instance, guiField);
-	}
-
-	void ScriptGUIToggleField::internal_getValue(ScriptGUIToggleField* nativeInstance, bool* output)
-	{
-		GUIToggleField* toggleField = static_cast<GUIToggleField*>(nativeInstance->getGUIElement());
-		*output = toggleField->getValue();
-	}
-
-	void ScriptGUIToggleField::internal_setValue(ScriptGUIToggleField* nativeInstance, bool value)
-	{
-		GUIToggleField* toggleField = static_cast<GUIToggleField*>(nativeInstance->getGUIElement());
-		return toggleField->setValue(value);
-	}
-
-	void ScriptGUIToggleField::internal_setTint(ScriptGUIToggleField* nativeInstance, Color color)
-	{
-		GUIToggleField* toggleField = (GUIToggleField*)nativeInstance->getGUIElement();
-		toggleField->setTint(color);
-	}
-
-	void ScriptGUIToggleField::onChanged(MonoObject* instance, bool newValue)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
-	}
+#include "BsScriptGUIToggleField.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIToggleField.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIToggleField::OnChangedThunkDef ScriptGUIToggleField::onChangedThunk;
+
+	ScriptGUIToggleField::ScriptGUIToggleField(MonoObject* instance, GUIToggleField* toggleField)
+		:TScriptGUIElement(instance, toggleField)
+	{
+
+	}
+
+	void ScriptGUIToggleField::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIToggleField::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIToggleField::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIToggleField::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIToggleField::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("DoOnChanged", 1)->getThunk();
+	}
+
+	void ScriptGUIToggleField::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUIToggleField* guiField = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			guiField = GUIToggleField::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			guiField = GUIToggleField::create(options, styleName);
+		}
+
+		guiField->onValueChanged.connect(std::bind(&ScriptGUIToggleField::onChanged, instance, _1));
+
+		ScriptGUIToggleField* nativeInstance = new (bs_alloc<ScriptGUIToggleField>()) ScriptGUIToggleField(instance, guiField);
+	}
+
+	void ScriptGUIToggleField::internal_getValue(ScriptGUIToggleField* nativeInstance, bool* output)
+	{
+		GUIToggleField* toggleField = static_cast<GUIToggleField*>(nativeInstance->getGUIElement());
+		*output = toggleField->getValue();
+	}
+
+	void ScriptGUIToggleField::internal_setValue(ScriptGUIToggleField* nativeInstance, bool value)
+	{
+		GUIToggleField* toggleField = static_cast<GUIToggleField*>(nativeInstance->getGUIElement());
+		return toggleField->setValue(value);
+	}
+
+	void ScriptGUIToggleField::internal_setTint(ScriptGUIToggleField* nativeInstance, Color* color)
+	{
+		GUIToggleField* toggleField = (GUIToggleField*)nativeInstance->getGUIElement();
+		toggleField->setTint(*color);
+	}
+
+	void ScriptGUIToggleField::onChanged(MonoObject* instance, bool newValue)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
+	}
 }
 }

+ 103 - 103
SBansheeEditor/Source/BsScriptGUIVector2Field.cpp

@@ -1,104 +1,104 @@
-#include "BsScriptGUIVector2Field.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIVector2Field.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIVector2Field::OnChangedThunkDef ScriptGUIVector2Field::onChangedThunk;
-	ScriptGUIVector2Field::OnConfirmedThunkDef ScriptGUIVector2Field::onConfirmedThunk;
-
-	ScriptGUIVector2Field::ScriptGUIVector2Field(MonoObject* instance, GUIVector2Field* vector2Field)
-		:TScriptGUIElement(instance, vector2Field)
-	{
-
-	}
-
-	void ScriptGUIVector2Field::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIVector2Field::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIVector2Field::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIVector2Field::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIVector2Field::internal_hasInputFocus);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIVector2Field::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
-		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
-	}
-
-	void ScriptGUIVector2Field::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUIVector2Field* field = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			field = GUIVector2Field::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			field = GUIVector2Field::create(options, styleName);
-		}
-
-		field->onValueChanged.connect(std::bind(&ScriptGUIVector2Field::onChanged, instance, _1));
-		field->onConfirm.connect(std::bind(&ScriptGUIVector2Field::onConfirmed, instance));
-
-		ScriptGUIVector2Field* nativeInstance = new (bs_alloc<ScriptGUIVector2Field>()) ScriptGUIVector2Field(instance, field);
-	}
-
-	void ScriptGUIVector2Field::internal_getValue(ScriptGUIVector2Field* nativeInstance, Vector2* output)
-	{
-		GUIVector2Field* field = static_cast<GUIVector2Field*>(nativeInstance->getGUIElement());
-		*output = field->getValue();
-	}
-
-	void ScriptGUIVector2Field::internal_setValue(ScriptGUIVector2Field* nativeInstance, Vector2 value)
-	{
-		GUIVector2Field* field = static_cast<GUIVector2Field*>(nativeInstance->getGUIElement());
-		return field->setValue(value);
-	}
-
-	void ScriptGUIVector2Field::internal_hasInputFocus(ScriptGUIVector2Field* nativeInstance, bool* output)
-	{
-		GUIVector2Field* field = static_cast<GUIVector2Field*>(nativeInstance->getGUIElement());
-		*output = field->hasInputFocus();
-	}
-
-	void ScriptGUIVector2Field::internal_setTint(ScriptGUIVector2Field* nativeInstance, Color color)
-	{
-		GUIVector2Field* field = (GUIVector2Field*)nativeInstance->getGUIElement();
-		field->setTint(color);
-	}
-
-	void ScriptGUIVector2Field::onChanged(MonoObject* instance, Vector2 newValue)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
-	}
-
-	void ScriptGUIVector2Field::onConfirmed(MonoObject* instance)
-	{
-		MonoUtil::invokeThunk(onConfirmedThunk, instance);
-	}
+#include "BsScriptGUIVector2Field.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIVector2Field.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIVector2Field::OnChangedThunkDef ScriptGUIVector2Field::onChangedThunk;
+	ScriptGUIVector2Field::OnConfirmedThunkDef ScriptGUIVector2Field::onConfirmedThunk;
+
+	ScriptGUIVector2Field::ScriptGUIVector2Field(MonoObject* instance, GUIVector2Field* vector2Field)
+		:TScriptGUIElement(instance, vector2Field)
+	{
+
+	}
+
+	void ScriptGUIVector2Field::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIVector2Field::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIVector2Field::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIVector2Field::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIVector2Field::internal_hasInputFocus);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIVector2Field::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
+		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
+	}
+
+	void ScriptGUIVector2Field::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUIVector2Field* field = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			field = GUIVector2Field::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			field = GUIVector2Field::create(options, styleName);
+		}
+
+		field->onValueChanged.connect(std::bind(&ScriptGUIVector2Field::onChanged, instance, _1));
+		field->onConfirm.connect(std::bind(&ScriptGUIVector2Field::onConfirmed, instance));
+
+		ScriptGUIVector2Field* nativeInstance = new (bs_alloc<ScriptGUIVector2Field>()) ScriptGUIVector2Field(instance, field);
+	}
+
+	void ScriptGUIVector2Field::internal_getValue(ScriptGUIVector2Field* nativeInstance, Vector2* output)
+	{
+		GUIVector2Field* field = static_cast<GUIVector2Field*>(nativeInstance->getGUIElement());
+		*output = field->getValue();
+	}
+
+	void ScriptGUIVector2Field::internal_setValue(ScriptGUIVector2Field* nativeInstance, Vector2* value)
+	{
+		GUIVector2Field* field = static_cast<GUIVector2Field*>(nativeInstance->getGUIElement());
+		return field->setValue(*value);
+	}
+
+	void ScriptGUIVector2Field::internal_hasInputFocus(ScriptGUIVector2Field* nativeInstance, bool* output)
+	{
+		GUIVector2Field* field = static_cast<GUIVector2Field*>(nativeInstance->getGUIElement());
+		*output = field->hasInputFocus();
+	}
+
+	void ScriptGUIVector2Field::internal_setTint(ScriptGUIVector2Field* nativeInstance, Color* color)
+	{
+		GUIVector2Field* field = (GUIVector2Field*)nativeInstance->getGUIElement();
+		field->setTint(*color);
+	}
+
+	void ScriptGUIVector2Field::onChanged(MonoObject* instance, Vector2 newValue)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
+	}
+
+	void ScriptGUIVector2Field::onConfirmed(MonoObject* instance)
+	{
+		MonoUtil::invokeThunk(onConfirmedThunk, instance);
+	}
 }
 }

+ 103 - 103
SBansheeEditor/Source/BsScriptGUIVector3Field.cpp

@@ -1,104 +1,104 @@
-#include "BsScriptGUIVector3Field.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIVector3Field.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIVector3Field::OnChangedThunkDef ScriptGUIVector3Field::onChangedThunk;
-	ScriptGUIVector3Field::OnConfirmedThunkDef ScriptGUIVector3Field::onConfirmedThunk;
-
-	ScriptGUIVector3Field::ScriptGUIVector3Field(MonoObject* instance, GUIVector3Field* vector3Field)
-		:TScriptGUIElement(instance, vector3Field)
-	{
-
-	}
-
-	void ScriptGUIVector3Field::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIVector3Field::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIVector3Field::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIVector3Field::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIVector3Field::internal_hasInputFocus);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIVector3Field::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
-		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
-	}
-
-	void ScriptGUIVector3Field::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUIVector3Field* field = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			field = GUIVector3Field::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			field = GUIVector3Field::create(options, styleName);
-		}
-
-		field->onValueChanged.connect(std::bind(&ScriptGUIVector3Field::onChanged, instance, _1));
-		field->onConfirm.connect(std::bind(&ScriptGUIVector3Field::onConfirmed, instance));
-
-		ScriptGUIVector3Field* nativeInstance = new (bs_alloc<ScriptGUIVector3Field>()) ScriptGUIVector3Field(instance, field);
-	}
-
-	void ScriptGUIVector3Field::internal_getValue(ScriptGUIVector3Field* nativeInstance, Vector3* output)
-	{
-		GUIVector3Field* field = static_cast<GUIVector3Field*>(nativeInstance->getGUIElement());
-		*output = field->getValue();
-	}
-
-	void ScriptGUIVector3Field::internal_setValue(ScriptGUIVector3Field* nativeInstance, Vector3 value)
-	{
-		GUIVector3Field* field = static_cast<GUIVector3Field*>(nativeInstance->getGUIElement());
-		return field->setValue(value);
-	}
-
-	void ScriptGUIVector3Field::internal_hasInputFocus(ScriptGUIVector3Field* nativeInstance, bool* output)
-	{
-		GUIVector3Field* field = static_cast<GUIVector3Field*>(nativeInstance->getGUIElement());
-		*output = field->hasInputFocus();
-	}
-
-	void ScriptGUIVector3Field::internal_setTint(ScriptGUIVector3Field* nativeInstance, Color color)
-	{
-		GUIVector3Field* field = (GUIVector3Field*)nativeInstance->getGUIElement();
-		field->setTint(color);
-	}
-
-	void ScriptGUIVector3Field::onChanged(MonoObject* instance, Vector3 newValue)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
-	}
-
-	void ScriptGUIVector3Field::onConfirmed(MonoObject* instance)
-	{
-		MonoUtil::invokeThunk(onConfirmedThunk, instance);
-	}
+#include "BsScriptGUIVector3Field.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIVector3Field.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIVector3Field::OnChangedThunkDef ScriptGUIVector3Field::onChangedThunk;
+	ScriptGUIVector3Field::OnConfirmedThunkDef ScriptGUIVector3Field::onConfirmedThunk;
+
+	ScriptGUIVector3Field::ScriptGUIVector3Field(MonoObject* instance, GUIVector3Field* vector3Field)
+		:TScriptGUIElement(instance, vector3Field)
+	{
+
+	}
+
+	void ScriptGUIVector3Field::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIVector3Field::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIVector3Field::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIVector3Field::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIVector3Field::internal_hasInputFocus);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIVector3Field::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
+		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
+	}
+
+	void ScriptGUIVector3Field::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUIVector3Field* field = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			field = GUIVector3Field::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			field = GUIVector3Field::create(options, styleName);
+		}
+
+		field->onValueChanged.connect(std::bind(&ScriptGUIVector3Field::onChanged, instance, _1));
+		field->onConfirm.connect(std::bind(&ScriptGUIVector3Field::onConfirmed, instance));
+
+		ScriptGUIVector3Field* nativeInstance = new (bs_alloc<ScriptGUIVector3Field>()) ScriptGUIVector3Field(instance, field);
+	}
+
+	void ScriptGUIVector3Field::internal_getValue(ScriptGUIVector3Field* nativeInstance, Vector3* output)
+	{
+		GUIVector3Field* field = static_cast<GUIVector3Field*>(nativeInstance->getGUIElement());
+		*output = field->getValue();
+	}
+
+	void ScriptGUIVector3Field::internal_setValue(ScriptGUIVector3Field* nativeInstance, Vector3* value)
+	{
+		GUIVector3Field* field = static_cast<GUIVector3Field*>(nativeInstance->getGUIElement());
+		return field->setValue(*value);
+	}
+
+	void ScriptGUIVector3Field::internal_hasInputFocus(ScriptGUIVector3Field* nativeInstance, bool* output)
+	{
+		GUIVector3Field* field = static_cast<GUIVector3Field*>(nativeInstance->getGUIElement());
+		*output = field->hasInputFocus();
+	}
+
+	void ScriptGUIVector3Field::internal_setTint(ScriptGUIVector3Field* nativeInstance, Color* color)
+	{
+		GUIVector3Field* field = (GUIVector3Field*)nativeInstance->getGUIElement();
+		field->setTint(*color);
+	}
+
+	void ScriptGUIVector3Field::onChanged(MonoObject* instance, Vector3 newValue)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
+	}
+
+	void ScriptGUIVector3Field::onConfirmed(MonoObject* instance)
+	{
+		MonoUtil::invokeThunk(onConfirmedThunk, instance);
+	}
 }
 }

+ 103 - 103
SBansheeEditor/Source/BsScriptGUIVector4Field.cpp

@@ -1,104 +1,104 @@
-#include "BsScriptGUIVector4Field.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
-#include "BsMonoUtil.h"
-#include "BsGUILayout.h"
-#include "BsGUIVector4Field.h"
-#include "BsGUIOptions.h"
-#include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
-#include "BsScriptGUIContent.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptGUIVector4Field::OnChangedThunkDef ScriptGUIVector4Field::onChangedThunk;
-	ScriptGUIVector4Field::OnConfirmedThunkDef ScriptGUIVector4Field::onConfirmedThunk;
-
-	ScriptGUIVector4Field::ScriptGUIVector4Field(MonoObject* instance, GUIVector4Field* vector4Field)
-		:TScriptGUIElement(instance, vector4Field)
-	{
-
-	}
-
-	void ScriptGUIVector4Field::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIVector4Field::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIVector4Field::internal_getValue);
-		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIVector4Field::internal_setValue);
-		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIVector4Field::internal_hasInputFocus);
-		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIVector4Field::internal_setTint);
-
-		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
-		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
-	}
-
-	void ScriptGUIVector4Field::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
-		MonoString* style, MonoArray* guiOptions, bool withTitle)
-	{
-		GUIOptions options;
-
-		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
-		for (UINT32 i = 0; i < arrayLen; i++)
-			options.addOption(mono_array_get(guiOptions, GUIOption, i));
-
-		String styleName = toString(MonoUtil::monoToWString(style));
-
-		GUIVector4Field* field = nullptr;
-		if (withTitle)
-		{
-			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
-			field = GUIVector4Field::create(nativeContent, titleWidth, options, styleName);
-		}
-		else
-		{
-			field = GUIVector4Field::create(options, styleName);
-		}
-
-		field->onValueChanged.connect(std::bind(&ScriptGUIVector4Field::onChanged, instance, _1));
-		field->onConfirm.connect(std::bind(&ScriptGUIVector4Field::onConfirmed, instance));
-
-		ScriptGUIVector4Field* nativeInstance = new (bs_alloc<ScriptGUIVector4Field>()) ScriptGUIVector4Field(instance, field);
-	}
-
-	void ScriptGUIVector4Field::internal_getValue(ScriptGUIVector4Field* nativeInstance, Vector4* output)
-	{
-		GUIVector4Field* field = static_cast<GUIVector4Field*>(nativeInstance->getGUIElement());
-		*output = field->getValue();
-	}
-
-	void ScriptGUIVector4Field::internal_setValue(ScriptGUIVector4Field* nativeInstance, Vector4 value)
-	{
-		GUIVector4Field* field = static_cast<GUIVector4Field*>(nativeInstance->getGUIElement());
-		return field->setValue(value);
-	}
-
-	void ScriptGUIVector4Field::internal_hasInputFocus(ScriptGUIVector4Field* nativeInstance, bool* output)
-	{
-		GUIVector4Field* field = static_cast<GUIVector4Field*>(nativeInstance->getGUIElement());
-		*output = field->hasInputFocus();
-	}
-
-	void ScriptGUIVector4Field::internal_setTint(ScriptGUIVector4Field* nativeInstance, Color color)
-	{
-		GUIVector4Field* field = (GUIVector4Field*)nativeInstance->getGUIElement();
-		field->setTint(color);
-	}
-
-	void ScriptGUIVector4Field::onChanged(MonoObject* instance, Vector4 newValue)
-	{
-		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
-	}
-
-	void ScriptGUIVector4Field::onConfirmed(MonoObject* instance)
-	{
-		MonoUtil::invokeThunk(onConfirmedThunk, instance);
-	}
+#include "BsScriptGUIVector4Field.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsSpriteTexture.h"
+#include "BsMonoUtil.h"
+#include "BsGUILayout.h"
+#include "BsGUIVector4Field.h"
+#include "BsGUIOptions.h"
+#include "BsGUIContent.h"
+#include "BsScriptGUIElementStyle.h"
+#include "BsScriptGUILayout.h"
+#include "BsScriptHString.h"
+#include "BsScriptGUIContent.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptGUIVector4Field::OnChangedThunkDef ScriptGUIVector4Field::onChangedThunk;
+	ScriptGUIVector4Field::OnConfirmedThunkDef ScriptGUIVector4Field::onConfirmedThunk;
+
+	ScriptGUIVector4Field::ScriptGUIVector4Field(MonoObject* instance, GUIVector4Field* vector4Field)
+		:TScriptGUIElement(instance, vector4Field)
+	{
+
+	}
+
+	void ScriptGUIVector4Field::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIVector4Field::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetValue", &ScriptGUIVector4Field::internal_getValue);
+		metaData.scriptClass->addInternalCall("Internal_SetValue", &ScriptGUIVector4Field::internal_setValue);
+		metaData.scriptClass->addInternalCall("Internal_HasInputFocus", &ScriptGUIVector4Field::internal_hasInputFocus);
+		metaData.scriptClass->addInternalCall("Internal_SetTint", &ScriptGUIVector4Field::internal_setTint);
+
+		onChangedThunk = (OnChangedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnChanged", 1)->getThunk();
+		onConfirmedThunk = (OnConfirmedThunkDef)metaData.scriptClass->getMethod("Internal_DoOnConfirmed", 0)->getThunk();
+	}
+
+	void ScriptGUIVector4Field::internal_createInstance(MonoObject* instance, MonoObject* title, UINT32 titleWidth,
+		MonoString* style, MonoArray* guiOptions, bool withTitle)
+	{
+		GUIOptions options;
+
+		UINT32 arrayLen = (UINT32)mono_array_length(guiOptions);
+		for (UINT32 i = 0; i < arrayLen; i++)
+			options.addOption(mono_array_get(guiOptions, GUIOption, i));
+
+		String styleName = toString(MonoUtil::monoToWString(style));
+
+		GUIVector4Field* field = nullptr;
+		if (withTitle)
+		{
+			GUIContent nativeContent(ScriptGUIContent::getText(title), ScriptGUIContent::getImage(title), ScriptGUIContent::getTooltip(title));
+			field = GUIVector4Field::create(nativeContent, titleWidth, options, styleName);
+		}
+		else
+		{
+			field = GUIVector4Field::create(options, styleName);
+		}
+
+		field->onValueChanged.connect(std::bind(&ScriptGUIVector4Field::onChanged, instance, _1));
+		field->onConfirm.connect(std::bind(&ScriptGUIVector4Field::onConfirmed, instance));
+
+		ScriptGUIVector4Field* nativeInstance = new (bs_alloc<ScriptGUIVector4Field>()) ScriptGUIVector4Field(instance, field);
+	}
+
+	void ScriptGUIVector4Field::internal_getValue(ScriptGUIVector4Field* nativeInstance, Vector4* output)
+	{
+		GUIVector4Field* field = static_cast<GUIVector4Field*>(nativeInstance->getGUIElement());
+		*output = field->getValue();
+	}
+
+	void ScriptGUIVector4Field::internal_setValue(ScriptGUIVector4Field* nativeInstance, Vector4* value)
+	{
+		GUIVector4Field* field = static_cast<GUIVector4Field*>(nativeInstance->getGUIElement());
+		return field->setValue(*value);
+	}
+
+	void ScriptGUIVector4Field::internal_hasInputFocus(ScriptGUIVector4Field* nativeInstance, bool* output)
+	{
+		GUIVector4Field* field = static_cast<GUIVector4Field*>(nativeInstance->getGUIElement());
+		*output = field->hasInputFocus();
+	}
+
+	void ScriptGUIVector4Field::internal_setTint(ScriptGUIVector4Field* nativeInstance, Color* color)
+	{
+		GUIVector4Field* field = (GUIVector4Field*)nativeInstance->getGUIElement();
+		field->setTint(*color);
+	}
+
+	void ScriptGUIVector4Field::onChanged(MonoObject* instance, Vector4 newValue)
+	{
+		MonoUtil::invokeThunk(onChangedThunk, instance, newValue);
+	}
+
+	void ScriptGUIVector4Field::onConfirmed(MonoObject* instance)
+	{
+		MonoUtil::invokeThunk(onConfirmedThunk, instance);
+	}
 }
 }

+ 82 - 82
SBansheeEditor/Source/BsScriptGizmos.cpp

@@ -1,83 +1,83 @@
-#include "BsScriptGizmos.h"
-#include "BsScriptMeta.h"
-#include "BsMonoClass.h"
-#include "BsScriptSpriteTexture.h"
-#include "BsSpriteTexture.h"
-#include "BsGizmoManager.h"
-
-namespace BansheeEngine
-{
-	void ScriptGizmos::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_SetColor", &ScriptGizmos::internal_SetColor);
-		metaData.scriptClass->addInternalCall("Internal_GetColor", &ScriptGizmos::internal_GetColor);
-		metaData.scriptClass->addInternalCall("Internal_SetTransform", &ScriptGizmos::internal_SetTransform);
-		metaData.scriptClass->addInternalCall("Internal_GetTransform", &ScriptGizmos::internal_GetTransform);
-		metaData.scriptClass->addInternalCall("Internal_DrawCube", &ScriptGizmos::internal_DrawCube);
-		metaData.scriptClass->addInternalCall("Internal_DrawSphere", &ScriptGizmos::internal_DrawSphere);
-		metaData.scriptClass->addInternalCall("Internal_DrawWireCube", &ScriptGizmos::internal_DrawWireCube);
-		metaData.scriptClass->addInternalCall("Internal_DrawWireSphere", &ScriptGizmos::internal_DrawWireSphere);
-		metaData.scriptClass->addInternalCall("Internal_DrawLine", &ScriptGizmos::internal_DrawLine);
-		metaData.scriptClass->addInternalCall("Internal_DrawFrustum", &ScriptGizmos::internal_DrawFrustum);
-		metaData.scriptClass->addInternalCall("Internal_DrawIcon", &ScriptGizmos::internal_DrawIcon);
-	}
-
-	void ScriptGizmos::internal_SetColor(Color color)
-	{
-		GizmoManager::instance().setColor(color);
-	}
-
-	void ScriptGizmos::internal_GetColor(Color* color)
-	{
-		*color = GizmoManager::instance().getColor();
-	}
-
-	void ScriptGizmos::internal_SetTransform(Matrix4 transform)
-	{
-		GizmoManager::instance().setTransform(transform);
-	}
-
-	void ScriptGizmos::internal_GetTransform(Matrix4* transform)
-	{
-		*transform = GizmoManager::instance().getTransform();
-	}
-
-	void ScriptGizmos::internal_DrawCube(Vector3 position, Vector3 extents)
-	{
-		GizmoManager::instance().drawCube(position, extents);
-	}
-
-	void ScriptGizmos::internal_DrawSphere(Vector3 position, float radius)
-	{
-		GizmoManager::instance().drawSphere(position, radius);
-	}
-
-	void ScriptGizmos::internal_DrawWireCube(Vector3 position, Vector3 extents)
-	{
-		GizmoManager::instance().drawWireCube(position, extents);
-	}
-
-	void ScriptGizmos::internal_DrawWireSphere(Vector3 position, float radius)
-	{
-		GizmoManager::instance().drawWireSphere(position, radius);
-	}
-
-	void ScriptGizmos::internal_DrawLine(Vector3 start, Vector3 end)
-	{
-		GizmoManager::instance().drawLine(start, end);
-	}
-
-	void ScriptGizmos::internal_DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far)
-	{
-		GizmoManager::instance().drawFrustum(position, aspect, FOV, near, far);
-	}
-
-	void ScriptGizmos::internal_DrawIcon(Vector3 position, MonoObject* image, bool fixedScale)
-	{
-		HSpriteTexture nativeTexture;
-		if (image != nullptr)
-			nativeTexture = ScriptSpriteTexture::toNative(image)->getHandle();
-
-		GizmoManager::instance().drawIcon(position, nativeTexture, fixedScale);
-	}
+#include "BsScriptGizmos.h"
+#include "BsScriptMeta.h"
+#include "BsMonoClass.h"
+#include "BsScriptSpriteTexture.h"
+#include "BsSpriteTexture.h"
+#include "BsGizmoManager.h"
+
+namespace BansheeEngine
+{
+	void ScriptGizmos::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_SetColor", &ScriptGizmos::internal_SetColor);
+		metaData.scriptClass->addInternalCall("Internal_GetColor", &ScriptGizmos::internal_GetColor);
+		metaData.scriptClass->addInternalCall("Internal_SetTransform", &ScriptGizmos::internal_SetTransform);
+		metaData.scriptClass->addInternalCall("Internal_GetTransform", &ScriptGizmos::internal_GetTransform);
+		metaData.scriptClass->addInternalCall("Internal_DrawCube", &ScriptGizmos::internal_DrawCube);
+		metaData.scriptClass->addInternalCall("Internal_DrawSphere", &ScriptGizmos::internal_DrawSphere);
+		metaData.scriptClass->addInternalCall("Internal_DrawWireCube", &ScriptGizmos::internal_DrawWireCube);
+		metaData.scriptClass->addInternalCall("Internal_DrawWireSphere", &ScriptGizmos::internal_DrawWireSphere);
+		metaData.scriptClass->addInternalCall("Internal_DrawLine", &ScriptGizmos::internal_DrawLine);
+		metaData.scriptClass->addInternalCall("Internal_DrawFrustum", &ScriptGizmos::internal_DrawFrustum);
+		metaData.scriptClass->addInternalCall("Internal_DrawIcon", &ScriptGizmos::internal_DrawIcon);
+	}
+
+	void ScriptGizmos::internal_SetColor(Color* color)
+	{
+		GizmoManager::instance().setColor(*color);
+	}
+
+	void ScriptGizmos::internal_GetColor(Color* color)
+	{
+		*color = GizmoManager::instance().getColor();
+	}
+
+	void ScriptGizmos::internal_SetTransform(Matrix4* transform)
+	{
+		GizmoManager::instance().setTransform(*transform);
+	}
+
+	void ScriptGizmos::internal_GetTransform(Matrix4* transform)
+	{
+		*transform = GizmoManager::instance().getTransform();
+	}
+
+	void ScriptGizmos::internal_DrawCube(Vector3* position, Vector3* extents)
+	{
+		GizmoManager::instance().drawCube(*position, *extents);
+	}
+
+	void ScriptGizmos::internal_DrawSphere(Vector3* position, float radius)
+	{
+		GizmoManager::instance().drawSphere(*position, radius);
+	}
+
+	void ScriptGizmos::internal_DrawWireCube(Vector3* position, Vector3* extents)
+	{
+		GizmoManager::instance().drawWireCube(*position, *extents);
+	}
+
+	void ScriptGizmos::internal_DrawWireSphere(Vector3* position, float radius)
+	{
+		GizmoManager::instance().drawWireSphere(*position, radius);
+	}
+
+	void ScriptGizmos::internal_DrawLine(Vector3* start, Vector3* end)
+	{
+		GizmoManager::instance().drawLine(*start, *end);
+	}
+
+	void ScriptGizmos::internal_DrawFrustum(Vector3* position, float aspect, Degree* FOV, float near, float far)
+	{
+		GizmoManager::instance().drawFrustum(*position, aspect, *FOV, near, far);
+	}
+
+	void ScriptGizmos::internal_DrawIcon(Vector3* position, MonoObject* image, bool fixedScale)
+	{
+		HSpriteTexture nativeTexture;
+		if (image != nullptr)
+			nativeTexture = ScriptSpriteTexture::toNative(image)->getHandle();
+
+		GizmoManager::instance().drawIcon(*position, nativeTexture, fixedScale);
+	}
 }
 }

+ 95 - 95
SBansheeEditor/Source/BsScriptHandleDrawing.cpp

@@ -1,96 +1,96 @@
-#include "BsScriptHandleDrawing.h"
-#include "BsScriptMeta.h"
-#include "BsMonoClass.h"
-#include "BsScriptSpriteTexture.h"
-#include "BsSpriteTexture.h"
-#include "BsHandleManager.h"
-#include "BsHandleDrawManager.h"
-
-namespace BansheeEngine
-{
-	void ScriptHandleDrawing::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_SetColor", &ScriptHandleDrawing::internal_SetColor);
-		metaData.scriptClass->addInternalCall("Internal_SetTransform", &ScriptHandleDrawing::internal_SetTransform);
-		metaData.scriptClass->addInternalCall("Internal_DrawCube", &ScriptHandleDrawing::internal_DrawCube);
-		metaData.scriptClass->addInternalCall("Internal_DrawSphere", &ScriptHandleDrawing::internal_DrawSphere);
-		metaData.scriptClass->addInternalCall("Internal_DrawWireCube", &ScriptHandleDrawing::internal_DrawWireCube);
-		metaData.scriptClass->addInternalCall("Internal_DrawWireSphere", &ScriptHandleDrawing::internal_DrawWireSphere);
-		metaData.scriptClass->addInternalCall("Internal_DrawLine", &ScriptHandleDrawing::internal_DrawLine);
-		metaData.scriptClass->addInternalCall("Internal_DrawCone", &ScriptHandleDrawing::internal_DrawCone);
-		metaData.scriptClass->addInternalCall("Internal_DrawDisc", &ScriptHandleDrawing::internal_DrawDisc);
-		metaData.scriptClass->addInternalCall("Internal_DrawWireDisc", &ScriptHandleDrawing::internal_DrawWireDisc);
-		metaData.scriptClass->addInternalCall("Internal_DrawArc", &ScriptHandleDrawing::internal_DrawArc);
-		metaData.scriptClass->addInternalCall("Internal_DrawWireArc", &ScriptHandleDrawing::internal_DrawWireArc);
-		metaData.scriptClass->addInternalCall("Internal_DrawRect", &ScriptHandleDrawing::internal_DrawRect);
-	}
-
-	void ScriptHandleDrawing::internal_SetColor(Color color)
-	{
-		HandleManager::instance().getDrawManager().setColor(color);
-	}
-
-	void ScriptHandleDrawing::internal_SetTransform(Matrix4 transform)
-	{
-		HandleManager::instance().getDrawManager().setTransform(transform);
-	}
-
-	void ScriptHandleDrawing::internal_DrawCube(Vector3 position, Vector3 extents, float size)
-	{
-		HandleManager::instance().getDrawManager().drawCube(position, extents, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawSphere(Vector3 position, float radius, float size)
-	{
-		HandleManager::instance().getDrawManager().drawSphere(position, radius, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawWireCube(Vector3 position, Vector3 extents, float size)
-	{
-		HandleManager::instance().getDrawManager().drawWireCube(position, extents, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawWireSphere(Vector3 position, float radius, float size)
-	{
-		HandleManager::instance().getDrawManager().drawWireSphere(position, radius, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawLine(Vector3 start, Vector3 end, float size)
-	{
-		HandleManager::instance().getDrawManager().drawLine(start, end, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size)
-	{
-		HandleManager::instance().getDrawManager().drawCone(coneBase, normal, height, radius, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawDisc(Vector3 position, Vector3 normal, float radius, float size)
-	{
-		HandleManager::instance().getDrawManager().drawDisc(position, normal, radius, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size)
-	{
-		HandleManager::instance().getDrawManager().drawWireDisc(position, normal, radius, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size)
-	{
-		HandleManager::instance().getDrawManager().drawArc(position, normal, radius, startAngle, amountAngle, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size)
-	{
-		HandleManager::instance().getDrawManager().drawWireArc(position, normal, radius, startAngle, amountAngle, size);
-	}
-
-	void ScriptHandleDrawing::internal_DrawRect(Vector3 center, Vector3 horzAxis, Vector3 vertAxis, float extentH, float extentV, float size)
-	{
-		std::array<Vector3, 2> axes = { horzAxis, vertAxis };
-		std::array<float, 2> extents = { extentH, extentV };
-
-		Rect3 area(center, axes, extents);
-		HandleManager::instance().getDrawManager().drawRect(area, size);
-	}
+#include "BsScriptHandleDrawing.h"
+#include "BsScriptMeta.h"
+#include "BsMonoClass.h"
+#include "BsScriptSpriteTexture.h"
+#include "BsSpriteTexture.h"
+#include "BsHandleManager.h"
+#include "BsHandleDrawManager.h"
+
+namespace BansheeEngine
+{
+	void ScriptHandleDrawing::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_SetColor", &ScriptHandleDrawing::internal_SetColor);
+		metaData.scriptClass->addInternalCall("Internal_SetTransform", &ScriptHandleDrawing::internal_SetTransform);
+		metaData.scriptClass->addInternalCall("Internal_DrawCube", &ScriptHandleDrawing::internal_DrawCube);
+		metaData.scriptClass->addInternalCall("Internal_DrawSphere", &ScriptHandleDrawing::internal_DrawSphere);
+		metaData.scriptClass->addInternalCall("Internal_DrawWireCube", &ScriptHandleDrawing::internal_DrawWireCube);
+		metaData.scriptClass->addInternalCall("Internal_DrawWireSphere", &ScriptHandleDrawing::internal_DrawWireSphere);
+		metaData.scriptClass->addInternalCall("Internal_DrawLine", &ScriptHandleDrawing::internal_DrawLine);
+		metaData.scriptClass->addInternalCall("Internal_DrawCone", &ScriptHandleDrawing::internal_DrawCone);
+		metaData.scriptClass->addInternalCall("Internal_DrawDisc", &ScriptHandleDrawing::internal_DrawDisc);
+		metaData.scriptClass->addInternalCall("Internal_DrawWireDisc", &ScriptHandleDrawing::internal_DrawWireDisc);
+		metaData.scriptClass->addInternalCall("Internal_DrawArc", &ScriptHandleDrawing::internal_DrawArc);
+		metaData.scriptClass->addInternalCall("Internal_DrawWireArc", &ScriptHandleDrawing::internal_DrawWireArc);
+		metaData.scriptClass->addInternalCall("Internal_DrawRect", &ScriptHandleDrawing::internal_DrawRect);
+	}
+
+	void ScriptHandleDrawing::internal_SetColor(Color* color)
+	{
+		HandleManager::instance().getDrawManager().setColor(*color);
+	}
+
+	void ScriptHandleDrawing::internal_SetTransform(Matrix4* transform)
+	{
+		HandleManager::instance().getDrawManager().setTransform(*transform);
+	}
+
+	void ScriptHandleDrawing::internal_DrawCube(Vector3* position, Vector3* extents, float size)
+	{
+		HandleManager::instance().getDrawManager().drawCube(*position, *extents, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawSphere(Vector3* position, float radius, float size)
+	{
+		HandleManager::instance().getDrawManager().drawSphere(*position, radius, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawWireCube(Vector3* position, Vector3* extents, float size)
+	{
+		HandleManager::instance().getDrawManager().drawWireCube(*position, *extents, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawWireSphere(Vector3* position, float radius, float size)
+	{
+		HandleManager::instance().getDrawManager().drawWireSphere(*position, radius, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawLine(Vector3* start, Vector3* end, float size)
+	{
+		HandleManager::instance().getDrawManager().drawLine(*start, *end, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawCone(Vector3* coneBase, Vector3* normal, float height, float radius, float size)
+	{
+		HandleManager::instance().getDrawManager().drawCone(*coneBase, *normal, height, radius, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawDisc(Vector3* position, Vector3* normal, float radius, float size)
+	{
+		HandleManager::instance().getDrawManager().drawDisc(*position, *normal, radius, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawWireDisc(Vector3* position, Vector3* normal, float radius, float size)
+	{
+		HandleManager::instance().getDrawManager().drawWireDisc(*position, *normal, radius, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawArc(Vector3* position, Vector3* normal, float radius, Degree* startAngle, Degree* amountAngle, float size)
+	{
+		HandleManager::instance().getDrawManager().drawArc(*position, *normal, radius, *startAngle, *amountAngle, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawWireArc(Vector3* position, Vector3* normal, float radius, Degree* startAngle, Degree* amountAngle, float size)
+	{
+		HandleManager::instance().getDrawManager().drawWireArc(*position, *normal, radius, *startAngle, *amountAngle, size);
+	}
+
+	void ScriptHandleDrawing::internal_DrawRect(Vector3* center, Vector3* horzAxis, Vector3* vertAxis, float extentH, float extentV, float size)
+	{
+		std::array<Vector3, 2> axes = { *horzAxis, *vertAxis };
+		std::array<float, 2> extents = { extentH, extentV };
+
+		Rect3 area(*center, axes, extents);
+		HandleManager::instance().getDrawManager().drawRect(area, size);
+	}
 }
 }

+ 82 - 82
SBansheeEditor/Source/BsScriptHandleSlider.cpp

@@ -1,83 +1,83 @@
-#include "BsScriptHandleSlider.h"
-#include "BsScriptMeta.h"
-#include "BsMonoClass.h"
-#include "BsScriptHandleSliderManager.h"
-
-namespace BansheeEngine
-{
-	ScriptHandleSliderBase::ScriptHandleSliderBase(MonoObject* managedInstance)
-		:ScriptObjectBase(managedInstance)
-	{
-		ScriptHandleSliderManager::instance().registerSlider(this);
-	}
-
-	ScriptHandleSliderBase::~ScriptHandleSliderBase()
-	{
-		ScriptHandleSliderManager::instance().unregisterSlider(this);
-	}
-
-	void ScriptHandleSliderBase::destroy()
-	{
-		ScriptHandleSliderManager::instance().unregisterSlider(this);
-
-		destroyInternal();
-	}
-
-	ScriptHandleSlider::ScriptHandleSlider(MonoObject* instance)
-		: ScriptObject(instance)
-	{
-
-	}
-
-	void ScriptHandleSlider::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_Destroy", &ScriptHandleSlider::internal_Destroy);
-		metaData.scriptClass->addInternalCall("Internal_GetPosition", &ScriptHandleSlider::internal_GetPosition);
-		metaData.scriptClass->addInternalCall("Internal_SetPosition", &ScriptHandleSlider::internal_SetPosition);
-		metaData.scriptClass->addInternalCall("Internal_GetRotation", &ScriptHandleSlider::internal_GetRotation);
-		metaData.scriptClass->addInternalCall("Internal_SetRotation", &ScriptHandleSlider::internal_SetRotation);
-		metaData.scriptClass->addInternalCall("Internal_SetScale", &ScriptHandleSlider::internal_SetScale);
-		metaData.scriptClass->addInternalCall("Internal_GetScale", &ScriptHandleSlider::internal_GetScale);
-		metaData.scriptClass->addInternalCall("Internal_GetState", &ScriptHandleSlider::internal_GetState);
-	}
-
-	void ScriptHandleSlider::internal_Destroy(ScriptHandleSliderBase* nativeInstance)
-	{
-		nativeInstance->destroy();
-	}
-
-	void ScriptHandleSlider::internal_GetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value)
-	{
-		*value = nativeInstance->getSlider()->getPosition();
-	}
-
-	void ScriptHandleSlider::internal_SetPosition(ScriptHandleSliderBase* nativeInstance, Vector3 value)
-	{
-		nativeInstance->getSlider()->setPosition(value);
-	}
-
-	void ScriptHandleSlider::internal_GetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion* value)
-	{
-		*value = nativeInstance->getSlider()->getRotation();
-	}
-
-	void ScriptHandleSlider::internal_SetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion value)
-	{
-		nativeInstance->getSlider()->setRotation(value);
-	}
-
-	void ScriptHandleSlider::internal_GetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value)
-	{
-		*value = nativeInstance->getSlider()->getScale();
-	}
-
-	void ScriptHandleSlider::internal_SetScale(ScriptHandleSliderBase* nativeInstance, Vector3 value)
-	{
-		nativeInstance->getSlider()->setScale(value);
-	}
-
-	void ScriptHandleSlider::internal_GetState(ScriptHandleSliderBase* nativeInstance, HandleSlider::State* value)
-	{
-		*value = nativeInstance->getSlider()->getState();
-	}
+#include "BsScriptHandleSlider.h"
+#include "BsScriptMeta.h"
+#include "BsMonoClass.h"
+#include "BsScriptHandleSliderManager.h"
+
+namespace BansheeEngine
+{
+	ScriptHandleSliderBase::ScriptHandleSliderBase(MonoObject* managedInstance)
+		:ScriptObjectBase(managedInstance)
+	{
+		ScriptHandleSliderManager::instance().registerSlider(this);
+	}
+
+	ScriptHandleSliderBase::~ScriptHandleSliderBase()
+	{
+		ScriptHandleSliderManager::instance().unregisterSlider(this);
+	}
+
+	void ScriptHandleSliderBase::destroy()
+	{
+		ScriptHandleSliderManager::instance().unregisterSlider(this);
+
+		destroyInternal();
+	}
+
+	ScriptHandleSlider::ScriptHandleSlider(MonoObject* instance)
+		: ScriptObject(instance)
+	{
+
+	}
+
+	void ScriptHandleSlider::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_Destroy", &ScriptHandleSlider::internal_Destroy);
+		metaData.scriptClass->addInternalCall("Internal_GetPosition", &ScriptHandleSlider::internal_GetPosition);
+		metaData.scriptClass->addInternalCall("Internal_SetPosition", &ScriptHandleSlider::internal_SetPosition);
+		metaData.scriptClass->addInternalCall("Internal_GetRotation", &ScriptHandleSlider::internal_GetRotation);
+		metaData.scriptClass->addInternalCall("Internal_SetRotation", &ScriptHandleSlider::internal_SetRotation);
+		metaData.scriptClass->addInternalCall("Internal_SetScale", &ScriptHandleSlider::internal_SetScale);
+		metaData.scriptClass->addInternalCall("Internal_GetScale", &ScriptHandleSlider::internal_GetScale);
+		metaData.scriptClass->addInternalCall("Internal_GetState", &ScriptHandleSlider::internal_GetState);
+	}
+
+	void ScriptHandleSlider::internal_Destroy(ScriptHandleSliderBase* nativeInstance)
+	{
+		nativeInstance->destroy();
+	}
+
+	void ScriptHandleSlider::internal_GetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value)
+	{
+		*value = nativeInstance->getSlider()->getPosition();
+	}
+
+	void ScriptHandleSlider::internal_SetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value)
+	{
+		nativeInstance->getSlider()->setPosition(*value);
+	}
+
+	void ScriptHandleSlider::internal_GetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion* value)
+	{
+		*value = nativeInstance->getSlider()->getRotation();
+	}
+
+	void ScriptHandleSlider::internal_SetRotation(ScriptHandleSliderBase* nativeInstance, Quaternion* value)
+	{
+		nativeInstance->getSlider()->setRotation(*value);
+	}
+
+	void ScriptHandleSlider::internal_GetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value)
+	{
+		*value = nativeInstance->getSlider()->getScale();
+	}
+
+	void ScriptHandleSlider::internal_SetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value)
+	{
+		nativeInstance->getSlider()->setScale(*value);
+	}
+
+	void ScriptHandleSlider::internal_GetState(ScriptHandleSliderBase* nativeInstance, HandleSlider::State* value)
+	{
+		*value = nativeInstance->getSlider()->getState();
+	}
 }
 }

+ 56 - 56
SBansheeEditor/Source/BsScriptHandleSliderDisc.cpp

@@ -1,57 +1,57 @@
-#include "BsScriptHandleSliderDisc.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-
-namespace BansheeEngine
-{
-	ScriptHandleSliderDisc::ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale)
-		:ScriptObject(instance), mSlider(nullptr)
-	{
-		mSlider = bs_new<HandleSliderDisc>(normal, radius, fixedScale);
-	}
-
-	ScriptHandleSliderDisc::~ScriptHandleSliderDisc()
-	{
-		if (mSlider != nullptr)
-			bs_delete(mSlider);
-	}
-
-	void ScriptHandleSliderDisc::destroyInternal()
-	{
-		if (mSlider != nullptr)
-			bs_delete(mSlider);
-
-		mSlider = nullptr;
-	}
-
-	void ScriptHandleSliderDisc::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptHandleSliderDisc::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetDelta", &ScriptHandleSliderDisc::internal_GetDelta);
-		metaData.scriptClass->addInternalCall("Internal_GetStartAngle", &ScriptHandleSliderDisc::internal_GetStartAngle);
-		metaData.scriptClass->addInternalCall("Internal_SetCutoffPlane", &ScriptHandleSliderDisc::internal_SetCutoffPlane);
-	}
-
-	void ScriptHandleSliderDisc::internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale)
-	{
-		ScriptHandleSliderDisc* nativeInstance = new (bs_alloc<ScriptHandleSliderDisc>())
-			ScriptHandleSliderDisc(instance, normal, radius, fixedScale);
-	}
-
-	void ScriptHandleSliderDisc::internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value)
-	{
-		*value = nativeInstance->mSlider->getDelta().valueDegrees();
-	}
-
-	void ScriptHandleSliderDisc::internal_GetStartAngle(ScriptHandleSliderDisc* nativeInstance, float* value)
-	{
-		*value = nativeInstance->mSlider->getStartAngle().valueDegrees();
-	}
-
-	void ScriptHandleSliderDisc::internal_SetCutoffPlane(ScriptHandleSliderDisc* nativeInstance, float value, bool enabled)
-	{
-		nativeInstance->mSlider->setCutoffPlane(Degree(value), enabled);
-	}
+#include "BsScriptHandleSliderDisc.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+
+namespace BansheeEngine
+{
+	ScriptHandleSliderDisc::ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale)
+		:ScriptObject(instance), mSlider(nullptr)
+	{
+		mSlider = bs_new<HandleSliderDisc>(normal, radius, fixedScale);
+	}
+
+	ScriptHandleSliderDisc::~ScriptHandleSliderDisc()
+	{
+		if (mSlider != nullptr)
+			bs_delete(mSlider);
+	}
+
+	void ScriptHandleSliderDisc::destroyInternal()
+	{
+		if (mSlider != nullptr)
+			bs_delete(mSlider);
+
+		mSlider = nullptr;
+	}
+
+	void ScriptHandleSliderDisc::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptHandleSliderDisc::internal_CreateInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetDelta", &ScriptHandleSliderDisc::internal_GetDelta);
+		metaData.scriptClass->addInternalCall("Internal_GetStartAngle", &ScriptHandleSliderDisc::internal_GetStartAngle);
+		metaData.scriptClass->addInternalCall("Internal_SetCutoffPlane", &ScriptHandleSliderDisc::internal_SetCutoffPlane);
+	}
+
+	void ScriptHandleSliderDisc::internal_CreateInstance(MonoObject* instance, Vector3* normal, float radius, bool fixedScale)
+	{
+		ScriptHandleSliderDisc* nativeInstance = new (bs_alloc<ScriptHandleSliderDisc>())
+			ScriptHandleSliderDisc(instance, *normal, radius, fixedScale);
+	}
+
+	void ScriptHandleSliderDisc::internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value)
+	{
+		*value = nativeInstance->mSlider->getDelta().valueDegrees();
+	}
+
+	void ScriptHandleSliderDisc::internal_GetStartAngle(ScriptHandleSliderDisc* nativeInstance, float* value)
+	{
+		*value = nativeInstance->mSlider->getStartAngle().valueDegrees();
+	}
+
+	void ScriptHandleSliderDisc::internal_SetCutoffPlane(ScriptHandleSliderDisc* nativeInstance, float value, bool enabled)
+	{
+		nativeInstance->mSlider->setCutoffPlane(Degree(value), enabled);
+	}
 }
 }

+ 44 - 44
SBansheeEditor/Source/BsScriptHandleSliderLine.cpp

@@ -1,45 +1,45 @@
-#include "BsScriptHandleSliderLine.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-
-namespace BansheeEngine
-{
-	ScriptHandleSliderLine::ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale)
-		:ScriptObject(instance), mSlider(nullptr)
-	{
-		mSlider = bs_new<HandleSliderLine>(direction, length, fixedScale);
-	}
-
-	ScriptHandleSliderLine::~ScriptHandleSliderLine()
-	{
-		if (mSlider != nullptr)
-			bs_delete(mSlider);
-	}
-
-	void ScriptHandleSliderLine::destroyInternal()
-	{
-		if (mSlider != nullptr)
-			bs_delete(mSlider);
-
-		mSlider = nullptr;
-	}
-
-	void ScriptHandleSliderLine::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptHandleSliderLine::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetDelta", &ScriptHandleSliderLine::internal_GetDelta);
-	}
-
-	void ScriptHandleSliderLine::internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale)
-	{
-		ScriptHandleSliderLine* nativeInstance = new (bs_alloc<ScriptHandleSliderLine>()) 
-			ScriptHandleSliderLine(instance, direction, length, fixedScale);
-	}
-
-	void ScriptHandleSliderLine::internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value)
-	{
-		*value = nativeInstance->mSlider->getDelta();
-	}
+#include "BsScriptHandleSliderLine.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+
+namespace BansheeEngine
+{
+	ScriptHandleSliderLine::ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale)
+		:ScriptObject(instance), mSlider(nullptr)
+	{
+		mSlider = bs_new<HandleSliderLine>(direction, length, fixedScale);
+	}
+
+	ScriptHandleSliderLine::~ScriptHandleSliderLine()
+	{
+		if (mSlider != nullptr)
+			bs_delete(mSlider);
+	}
+
+	void ScriptHandleSliderLine::destroyInternal()
+	{
+		if (mSlider != nullptr)
+			bs_delete(mSlider);
+
+		mSlider = nullptr;
+	}
+
+	void ScriptHandleSliderLine::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptHandleSliderLine::internal_CreateInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetDelta", &ScriptHandleSliderLine::internal_GetDelta);
+	}
+
+	void ScriptHandleSliderLine::internal_CreateInstance(MonoObject* instance, Vector3* direction, float length, bool fixedScale)
+	{
+		ScriptHandleSliderLine* nativeInstance = new (bs_alloc<ScriptHandleSliderLine>()) 
+			ScriptHandleSliderLine(instance, *direction, length, fixedScale);
+	}
+
+	void ScriptHandleSliderLine::internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value)
+	{
+		*value = nativeInstance->mSlider->getDelta();
+	}
 }
 }

+ 44 - 44
SBansheeEditor/Source/BsScriptHandleSliderPlane.cpp

@@ -1,45 +1,45 @@
-#include "BsScriptHandleSliderPlane.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-
-namespace BansheeEngine
-{
-	ScriptHandleSliderPlane::ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale)
-		:ScriptObject(instance), mSlider(nullptr)
-	{
-		mSlider = bs_new<HandleSliderPlane>(dir1, dir2, length, fixedScale);
-	}
-
-	ScriptHandleSliderPlane::~ScriptHandleSliderPlane()
-	{
-		if (mSlider != nullptr)
-			bs_delete(mSlider);
-	}
-
-	void ScriptHandleSliderPlane::destroyInternal()
-	{
-		if (mSlider != nullptr)
-			bs_delete(mSlider);
-
-		mSlider = nullptr;
-	}
-
-	void ScriptHandleSliderPlane::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptHandleSliderPlane::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_GetDelta", &ScriptHandleSliderPlane::internal_GetDelta);
-	}
-
-	void ScriptHandleSliderPlane::internal_CreateInstance(MonoObject* instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale)
-	{
-		ScriptHandleSliderPlane* nativeInstance = new (bs_alloc<ScriptHandleSliderPlane>())
-			ScriptHandleSliderPlane(instance, dir1, dir2, length, fixedScale);
-	}
-
-	void ScriptHandleSliderPlane::internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, Vector2* value)
-	{
-		*value = nativeInstance->mSlider->getDelta();
-	}
+#include "BsScriptHandleSliderPlane.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+
+namespace BansheeEngine
+{
+	ScriptHandleSliderPlane::ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale)
+		:ScriptObject(instance), mSlider(nullptr)
+	{
+		mSlider = bs_new<HandleSliderPlane>(dir1, dir2, length, fixedScale);
+	}
+
+	ScriptHandleSliderPlane::~ScriptHandleSliderPlane()
+	{
+		if (mSlider != nullptr)
+			bs_delete(mSlider);
+	}
+
+	void ScriptHandleSliderPlane::destroyInternal()
+	{
+		if (mSlider != nullptr)
+			bs_delete(mSlider);
+
+		mSlider = nullptr;
+	}
+
+	void ScriptHandleSliderPlane::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptHandleSliderPlane::internal_CreateInstance);
+		metaData.scriptClass->addInternalCall("Internal_GetDelta", &ScriptHandleSliderPlane::internal_GetDelta);
+	}
+
+	void ScriptHandleSliderPlane::internal_CreateInstance(MonoObject* instance, Vector3* dir1, Vector3* dir2, float length, bool fixedScale)
+	{
+		ScriptHandleSliderPlane* nativeInstance = new (bs_alloc<ScriptHandleSliderPlane>())
+			ScriptHandleSliderPlane(instance, *dir1, *dir2, length, fixedScale);
+	}
+
+	void ScriptHandleSliderPlane::internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, Vector2* value)
+	{
+		*value = nativeInstance->mSlider->getDelta();
+	}
 }
 }

+ 271 - 271
SBansheeEditor/Source/BsScriptModalWindow.cpp

@@ -1,272 +1,272 @@
-#include "BsScriptModalWindow.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoMethod.h"
-#include "BsMonoManager.h"
-#include "BsMonoUtil.h"
-#include "BsMonoAssembly.h"
-#include "BsScriptObjectManager.h"
-#include "BsScriptHString.h"
-#include "BsRenderWindow.h"
-#include "BsScriptGUILayout.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	MonoField* ScriptModalWindow::guiPanelField = nullptr;
-
-	ScriptModalWindow::ScriptModalWindow(ManagedModalWindow* window)
-		:ScriptObject(window->getManagedInstance()), mModalWindow(window)
-	{
-		mOnAssemblyRefreshStartedConn = ScriptObjectManager::instance().onRefreshStarted.connect(std::bind(&ScriptModalWindow::onAssemblyRefreshStarted, this));
-	}
-
-	ScriptModalWindow::~ScriptModalWindow()
-	{
-		mOnAssemblyRefreshStartedConn.disconnect();
-	}
-
-	void ScriptModalWindow::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptModalWindow::internal_createInstance);
-		metaData.scriptClass->addInternalCall("Internal_Close", &ScriptModalWindow::internal_close);
-		metaData.scriptClass->addInternalCall("Internal_GetWidth", &ScriptModalWindow::internal_getWidth);
-		metaData.scriptClass->addInternalCall("Internal_GetHeight", &ScriptModalWindow::internal_getHeight);
-		metaData.scriptClass->addInternalCall("Internal_SetWidth", &ScriptModalWindow::internal_setWidth);
-		metaData.scriptClass->addInternalCall("Internal_SetHeight", &ScriptModalWindow::internal_setHeight);
-		metaData.scriptClass->addInternalCall("Internal_SetTitle", &ScriptModalWindow::internal_setTitle);
-		metaData.scriptClass->addInternalCall("Internal_ScreenToWindowPos", &ScriptModalWindow::internal_screenToWindowPos);
-		metaData.scriptClass->addInternalCall("Internal_WindowToScreenPos", &ScriptModalWindow::internal_windowToScreenPos);
-
-		guiPanelField = metaData.scriptClass->getField("GUI");
-	}
-
-	void ScriptModalWindow::internal_createInstance(MonoObject* instance, bool allowCloseButton)
-	{
-		ManagedModalWindow* modalWindow = bs_new<ManagedModalWindow>(allowCloseButton, instance);
-		ScriptModalWindow* nativeInstance = new (bs_alloc<ScriptModalWindow>()) ScriptModalWindow(modalWindow);
-		modalWindow->setParent(nativeInstance);
-	}
-
-	void ScriptModalWindow::internal_close(ScriptModalWindow* thisPtr)
-	{
-		if (thisPtr->mModalWindow != nullptr)
-			thisPtr->mModalWindow->close();
-	}
-
-	void ScriptModalWindow::internal_setTitle(ScriptModalWindow* thisPtr, MonoObject* title)
-	{
-		HString titleStr = HString::dummy();
-		if (title != nullptr)
-		{
-			ScriptHString* textScript = ScriptHString::toNative(title);
-			titleStr = textScript->getInternalValue();
-		}
-
-		thisPtr->mModalWindow->setTitle(titleStr);
-	}
-
-	void ScriptModalWindow::notifyWindowDestroyed()
-	{
-		mModalWindow = nullptr;
-	}
-
-	void ScriptModalWindow::onAssemblyRefreshStarted()
-	{
-		if (mModalWindow != nullptr)
-			mModalWindow->close();
-	}
-
-	UINT32 ScriptModalWindow::internal_getWidth(ScriptModalWindow* thisPtr)
-	{
-		if (thisPtr->mModalWindow != nullptr)
-			return thisPtr->mModalWindow->getWidth();
-
-		return 0;
-	}
-
-	UINT32 ScriptModalWindow::internal_getHeight(ScriptModalWindow* thisPtr)
-	{
-		if (thisPtr->mModalWindow != nullptr)
-			return thisPtr->mModalWindow->getHeight();
-
-		return 0;
-	}
-
-	void ScriptModalWindow::internal_setWidth(ScriptModalWindow* thisPtr, UINT32 value)
-	{
-		if (thisPtr->mModalWindow != nullptr)
-			thisPtr->mModalWindow->setSize(value, thisPtr->mModalWindow->getHeight());
-	}
-
-	void ScriptModalWindow::internal_setHeight(ScriptModalWindow* thisPtr, UINT32 value)
-	{
-		if (thisPtr->mModalWindow != nullptr)
-			thisPtr->mModalWindow->setSize(thisPtr->mModalWindow->getWidth(), value);
-	}
-
-	void ScriptModalWindow::internal_screenToWindowPos(ScriptModalWindow* thisPtr, Vector2I screenPos, Vector2I* windowPos)
-	{
-		if (thisPtr->mModalWindow != nullptr)
-			*windowPos = thisPtr->mModalWindow->screenToWindowPos(screenPos);
-		else
-			*windowPos = screenPos;
-	}
-
-	void ScriptModalWindow::internal_windowToScreenPos(ScriptModalWindow* thisPtr, Vector2I windowPos, Vector2I* screenPos)
-	{
-		if (thisPtr->mModalWindow != nullptr)
-			*screenPos = thisPtr->mModalWindow->windowToScreenPos(windowPos);
-		else
-			*screenPos = windowPos;
-	}
-
-	ManagedModalWindow::ManagedModalWindow(bool allowCloseButton, MonoObject* managedInstance)
-		:ModalWindow(HString::dummy(), allowCloseButton), mUpdateThunk(nullptr), mManagedInstance(managedInstance),
-		mOnInitializeThunk(nullptr), mOnDestroyThunk(nullptr), mOnWindowResizedMethod(nullptr), mGCHandle(0),
-		mScriptParent(nullptr), mContentsPanel(nullptr), mIsInitialized(false)
-	{
-		mGCHandle = mono_gchandle_new(mManagedInstance, false);
-
-		MonoObject* guiPanel = ScriptGUIPanel::createFromExisting(mContents);
-		mContentsPanel = ScriptGUILayout::toNative(guiPanel);
-		ScriptModalWindow::guiPanelField->setValue(mManagedInstance, guiPanel);
-
-		::MonoClass* rawMonoClass = mono_object_get_class(mManagedInstance);
-		MonoClass* monoClass = MonoManager::instance().findClass(rawMonoClass);
-
-		mNamespace = monoClass->getNamespace();
-		mTypename = monoClass->getTypeName();
-
-		reloadMonoTypes(monoClass);
-	}
-
-	ManagedModalWindow::~ManagedModalWindow()
-	{
-		if (mGCHandle != 0)
-			close();
-	}
-
-	bool ManagedModalWindow::createManagedInstance()
-	{
-		MonoAssembly* assembly = MonoManager::instance().getAssembly(EDITOR_ASSEMBLY);
-
-		if (assembly != nullptr)
-		{
-			MonoClass* editorWindowClass = assembly->getClass(mNamespace, mTypename);
-
-			if (editorWindowClass != nullptr)
-			{
-				mManagedInstance = editorWindowClass->createInstance(false);
-				mGCHandle = mono_gchandle_new(mManagedInstance, false);
-
-				MonoObject* guiPanel = ScriptGUIPanel::createFromExisting(mContents);
-				mContentsPanel = ScriptGUILayout::toNative(guiPanel);
-				ScriptModalWindow::guiPanelField->setValue(mManagedInstance, guiPanel);
-
-				reloadMonoTypes(editorWindowClass);
-				return true;
-			}
-		}
-
-		return false;
-	}
-
-	void ManagedModalWindow::releaseManagedInstance()
-	{
-		mono_gchandle_free(mGCHandle);
-		mGCHandle = 0;
-	}
-
-	void ManagedModalWindow::triggerOnInitialize()
-	{
-		if (mOnInitializeThunk != nullptr && mManagedInstance != nullptr)
-		{
-			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
-			// for some extra speed.
-			MonoUtil::invokeThunk(mOnInitializeThunk, mManagedInstance);
-		}
-	}
-
-	void ManagedModalWindow::triggerOnDestroy()
-	{
-		if (mOnDestroyThunk != nullptr && mManagedInstance != nullptr)
-		{
-			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
-			// for some extra speed.
-			MonoUtil::invokeThunk(mOnDestroyThunk, mManagedInstance);
-		}
-	}
-
-	void ManagedModalWindow::setParent(ScriptModalWindow* parent)
-	{
-		mScriptParent = parent;
-	}
-
-	void ManagedModalWindow::update()
-	{
-		if (!mIsInitialized)
-		{
-			triggerOnInitialize();
-			mIsInitialized = true;
-		}
-
-		if (mUpdateThunk != nullptr && mManagedInstance != nullptr)
-		{
-			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
-			// for some extra speed.
-			MonoUtil::invokeThunk(mUpdateThunk, mManagedInstance);
-		}
-	}
-
-	void ManagedModalWindow::resized()
-	{
-		UINT32 width = getWidth();
-		UINT32 height = getHeight();
-
-		if (mOnWindowResizedMethod != nullptr && mManagedInstance != nullptr)
-		{
-			void* params[] = { &width, &height };
-			mOnWindowResizedMethod->invokeVirtual(mManagedInstance, params);
-		}
-
-		ModalWindow::resized();
-	}
-
-	void ManagedModalWindow::close()
-	{
-		triggerOnDestroy();
-
-		mContentsPanel->destroy();
-		mContentsPanel = nullptr;
-
-		releaseManagedInstance();
-
-		mScriptParent->notifyWindowDestroyed();
-
-		ModalWindow::close();
-	}
-
-	void ManagedModalWindow::reloadMonoTypes(MonoClass* windowClass)
-	{
-		MonoMethod* updateMethod = windowClass->getMethod("OnEditorUpdate", 0);
-
-		if (updateMethod != nullptr)
-			mUpdateThunk = (UpdateThunkDef)updateMethod->getThunk();
-
-		MonoMethod* onInitializeMethod = windowClass->getMethod("OnInitialize", 0);
-
-		if (onInitializeMethod != nullptr)
-			mOnInitializeThunk = (OnInitializeThunkDef)onInitializeMethod->getThunk();
-
-		MonoMethod* onDestroyMethod = windowClass->getMethod("OnDestroy", 0);
-
-		if (onDestroyMethod != nullptr)
-			mOnDestroyThunk = (OnDestroyThunkDef)onDestroyMethod->getThunk();
-
-		MonoClass* modalWindowClass = windowClass->getBaseClass();
-		mOnWindowResizedMethod = modalWindowClass->getMethod("OnWindowResized", 2);
-	}
+#include "BsScriptModalWindow.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoMethod.h"
+#include "BsMonoManager.h"
+#include "BsMonoUtil.h"
+#include "BsMonoAssembly.h"
+#include "BsScriptObjectManager.h"
+#include "BsScriptHString.h"
+#include "BsRenderWindow.h"
+#include "BsScriptGUILayout.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	MonoField* ScriptModalWindow::guiPanelField = nullptr;
+
+	ScriptModalWindow::ScriptModalWindow(ManagedModalWindow* window)
+		:ScriptObject(window->getManagedInstance()), mModalWindow(window)
+	{
+		mOnAssemblyRefreshStartedConn = ScriptObjectManager::instance().onRefreshStarted.connect(std::bind(&ScriptModalWindow::onAssemblyRefreshStarted, this));
+	}
+
+	ScriptModalWindow::~ScriptModalWindow()
+	{
+		mOnAssemblyRefreshStartedConn.disconnect();
+	}
+
+	void ScriptModalWindow::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptModalWindow::internal_createInstance);
+		metaData.scriptClass->addInternalCall("Internal_Close", &ScriptModalWindow::internal_close);
+		metaData.scriptClass->addInternalCall("Internal_GetWidth", &ScriptModalWindow::internal_getWidth);
+		metaData.scriptClass->addInternalCall("Internal_GetHeight", &ScriptModalWindow::internal_getHeight);
+		metaData.scriptClass->addInternalCall("Internal_SetWidth", &ScriptModalWindow::internal_setWidth);
+		metaData.scriptClass->addInternalCall("Internal_SetHeight", &ScriptModalWindow::internal_setHeight);
+		metaData.scriptClass->addInternalCall("Internal_SetTitle", &ScriptModalWindow::internal_setTitle);
+		metaData.scriptClass->addInternalCall("Internal_ScreenToWindowPos", &ScriptModalWindow::internal_screenToWindowPos);
+		metaData.scriptClass->addInternalCall("Internal_WindowToScreenPos", &ScriptModalWindow::internal_windowToScreenPos);
+
+		guiPanelField = metaData.scriptClass->getField("GUI");
+	}
+
+	void ScriptModalWindow::internal_createInstance(MonoObject* instance, bool allowCloseButton)
+	{
+		ManagedModalWindow* modalWindow = bs_new<ManagedModalWindow>(allowCloseButton, instance);
+		ScriptModalWindow* nativeInstance = new (bs_alloc<ScriptModalWindow>()) ScriptModalWindow(modalWindow);
+		modalWindow->setParent(nativeInstance);
+	}
+
+	void ScriptModalWindow::internal_close(ScriptModalWindow* thisPtr)
+	{
+		if (thisPtr->mModalWindow != nullptr)
+			thisPtr->mModalWindow->close();
+	}
+
+	void ScriptModalWindow::internal_setTitle(ScriptModalWindow* thisPtr, MonoObject* title)
+	{
+		HString titleStr = HString::dummy();
+		if (title != nullptr)
+		{
+			ScriptHString* textScript = ScriptHString::toNative(title);
+			titleStr = textScript->getInternalValue();
+		}
+
+		thisPtr->mModalWindow->setTitle(titleStr);
+	}
+
+	void ScriptModalWindow::notifyWindowDestroyed()
+	{
+		mModalWindow = nullptr;
+	}
+
+	void ScriptModalWindow::onAssemblyRefreshStarted()
+	{
+		if (mModalWindow != nullptr)
+			mModalWindow->close();
+	}
+
+	UINT32 ScriptModalWindow::internal_getWidth(ScriptModalWindow* thisPtr)
+	{
+		if (thisPtr->mModalWindow != nullptr)
+			return thisPtr->mModalWindow->getWidth();
+
+		return 0;
+	}
+
+	UINT32 ScriptModalWindow::internal_getHeight(ScriptModalWindow* thisPtr)
+	{
+		if (thisPtr->mModalWindow != nullptr)
+			return thisPtr->mModalWindow->getHeight();
+
+		return 0;
+	}
+
+	void ScriptModalWindow::internal_setWidth(ScriptModalWindow* thisPtr, UINT32 value)
+	{
+		if (thisPtr->mModalWindow != nullptr)
+			thisPtr->mModalWindow->setSize(value, thisPtr->mModalWindow->getHeight());
+	}
+
+	void ScriptModalWindow::internal_setHeight(ScriptModalWindow* thisPtr, UINT32 value)
+	{
+		if (thisPtr->mModalWindow != nullptr)
+			thisPtr->mModalWindow->setSize(thisPtr->mModalWindow->getWidth(), value);
+	}
+
+	void ScriptModalWindow::internal_screenToWindowPos(ScriptModalWindow* thisPtr, Vector2I* screenPos, Vector2I* windowPos)
+	{
+		if (thisPtr->mModalWindow != nullptr)
+			*windowPos = thisPtr->mModalWindow->screenToWindowPos(*screenPos);
+		else
+			*windowPos = *screenPos;
+	}
+
+	void ScriptModalWindow::internal_windowToScreenPos(ScriptModalWindow* thisPtr, Vector2I* windowPos, Vector2I* screenPos)
+	{
+		if (thisPtr->mModalWindow != nullptr)
+			*screenPos = thisPtr->mModalWindow->windowToScreenPos(*windowPos);
+		else
+			*screenPos = *windowPos;
+	}
+
+	ManagedModalWindow::ManagedModalWindow(bool allowCloseButton, MonoObject* managedInstance)
+		:ModalWindow(HString::dummy(), allowCloseButton), mUpdateThunk(nullptr), mManagedInstance(managedInstance),
+		mOnInitializeThunk(nullptr), mOnDestroyThunk(nullptr), mOnWindowResizedMethod(nullptr), mGCHandle(0),
+		mScriptParent(nullptr), mContentsPanel(nullptr), mIsInitialized(false)
+	{
+		mGCHandle = mono_gchandle_new(mManagedInstance, false);
+
+		MonoObject* guiPanel = ScriptGUIPanel::createFromExisting(mContents);
+		mContentsPanel = ScriptGUILayout::toNative(guiPanel);
+		ScriptModalWindow::guiPanelField->setValue(mManagedInstance, guiPanel);
+
+		::MonoClass* rawMonoClass = mono_object_get_class(mManagedInstance);
+		MonoClass* monoClass = MonoManager::instance().findClass(rawMonoClass);
+
+		mNamespace = monoClass->getNamespace();
+		mTypename = monoClass->getTypeName();
+
+		reloadMonoTypes(monoClass);
+	}
+
+	ManagedModalWindow::~ManagedModalWindow()
+	{
+		if (mGCHandle != 0)
+			close();
+	}
+
+	bool ManagedModalWindow::createManagedInstance()
+	{
+		MonoAssembly* assembly = MonoManager::instance().getAssembly(EDITOR_ASSEMBLY);
+
+		if (assembly != nullptr)
+		{
+			MonoClass* editorWindowClass = assembly->getClass(mNamespace, mTypename);
+
+			if (editorWindowClass != nullptr)
+			{
+				mManagedInstance = editorWindowClass->createInstance(false);
+				mGCHandle = mono_gchandle_new(mManagedInstance, false);
+
+				MonoObject* guiPanel = ScriptGUIPanel::createFromExisting(mContents);
+				mContentsPanel = ScriptGUILayout::toNative(guiPanel);
+				ScriptModalWindow::guiPanelField->setValue(mManagedInstance, guiPanel);
+
+				reloadMonoTypes(editorWindowClass);
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	void ManagedModalWindow::releaseManagedInstance()
+	{
+		mono_gchandle_free(mGCHandle);
+		mGCHandle = 0;
+	}
+
+	void ManagedModalWindow::triggerOnInitialize()
+	{
+		if (mOnInitializeThunk != nullptr && mManagedInstance != nullptr)
+		{
+			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
+			// for some extra speed.
+			MonoUtil::invokeThunk(mOnInitializeThunk, mManagedInstance);
+		}
+	}
+
+	void ManagedModalWindow::triggerOnDestroy()
+	{
+		if (mOnDestroyThunk != nullptr && mManagedInstance != nullptr)
+		{
+			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
+			// for some extra speed.
+			MonoUtil::invokeThunk(mOnDestroyThunk, mManagedInstance);
+		}
+	}
+
+	void ManagedModalWindow::setParent(ScriptModalWindow* parent)
+	{
+		mScriptParent = parent;
+	}
+
+	void ManagedModalWindow::update()
+	{
+		if (!mIsInitialized)
+		{
+			triggerOnInitialize();
+			mIsInitialized = true;
+		}
+
+		if (mUpdateThunk != nullptr && mManagedInstance != nullptr)
+		{
+			// Note: Not calling virtual methods. Can be easily done if needed but for now doing this
+			// for some extra speed.
+			MonoUtil::invokeThunk(mUpdateThunk, mManagedInstance);
+		}
+	}
+
+	void ManagedModalWindow::resized()
+	{
+		UINT32 width = getWidth();
+		UINT32 height = getHeight();
+
+		if (mOnWindowResizedMethod != nullptr && mManagedInstance != nullptr)
+		{
+			void* params[] = { &width, &height };
+			mOnWindowResizedMethod->invokeVirtual(mManagedInstance, params);
+		}
+
+		ModalWindow::resized();
+	}
+
+	void ManagedModalWindow::close()
+	{
+		triggerOnDestroy();
+
+		mContentsPanel->destroy();
+		mContentsPanel = nullptr;
+
+		releaseManagedInstance();
+
+		mScriptParent->notifyWindowDestroyed();
+
+		ModalWindow::close();
+	}
+
+	void ManagedModalWindow::reloadMonoTypes(MonoClass* windowClass)
+	{
+		MonoMethod* updateMethod = windowClass->getMethod("OnEditorUpdate", 0);
+
+		if (updateMethod != nullptr)
+			mUpdateThunk = (UpdateThunkDef)updateMethod->getThunk();
+
+		MonoMethod* onInitializeMethod = windowClass->getMethod("OnInitialize", 0);
+
+		if (onInitializeMethod != nullptr)
+			mOnInitializeThunk = (OnInitializeThunkDef)onInitializeMethod->getThunk();
+
+		MonoMethod* onDestroyMethod = windowClass->getMethod("OnDestroy", 0);
+
+		if (onDestroyMethod != nullptr)
+			mOnDestroyThunk = (OnDestroyThunkDef)onDestroyMethod->getThunk();
+
+		MonoClass* modalWindowClass = windowClass->getBaseClass();
+		mOnWindowResizedMethod = modalWindowClass->getMethod("OnWindowResized", 2);
+	}
 }
 }

+ 237 - 237
SBansheeEditor/Source/BsScriptOSDropTarget.cpp

@@ -1,238 +1,238 @@
-#include "BsScriptOSDropTarget.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
-#include "BsMonoClass.h"
-#include "BsMonoManager.h"
-#include "BsMonoMethod.h"
-#include "BsMonoUtil.h"
-#include "BsMonoArray.h"
-#include "BsRTTIType.h"
-#include "BsPlatform.h"
-#include "BsEditorWidget.h"
-#include "BsEditorWindowBase.h"
-#include "BsEditorWidgetContainer.h"
-#include "BsScriptEditorWindow.h"
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	ScriptOSDropTarget::OnEnterThunkDef ScriptOSDropTarget::onEnterThunk;
-	ScriptOSDropTarget::OnMoveDef ScriptOSDropTarget::onMoveThunk;
-	ScriptOSDropTarget::OnLeaveDef ScriptOSDropTarget::onLeaveThunk;
-	ScriptOSDropTarget::OnDropThunkDef ScriptOSDropTarget::onDropThunk;
-
-	ScriptOSDropTarget::ScriptOSDropTarget(MonoObject* instance, ScriptEditorWindow* parent)
-		:ScriptObject(instance), mDropTarget(nullptr), mIsDestroyed(false), mParent(parent)
-	{
-		EditorWidgetBase* parentWidget = getParentWidget();
-
-		if (parentWidget != nullptr)
-		{
-			mWidgetParentChangedConn = parentWidget->onParentChanged.connect(std::bind(&ScriptOSDropTarget::widgetParentChanged, this, _1));
-			mWidgetResizedConn = parentWidget->onResized.connect(std::bind(&ScriptOSDropTarget::widgetResized, this, _1, _2));
-			mWidgetMovedConn = parentWidget->onMoved.connect(std::bind(&ScriptOSDropTarget::widgetMoved, this, _1, _2));
-
-			EditorWindowBase* parentWindow = parentWidget->getParentWindow();
-
-			if (parentWindow != nullptr)
-				setDropTarget(parentWindow->getRenderWindow(), 0, 0, 0, 0);
-
-			mParentArea = parentWidget->getBounds();
-		}
-	}
-
-	ScriptOSDropTarget::~ScriptOSDropTarget()
-	{
-		if (!mIsDestroyed)
-			destroy();
-	}
-
-	void ScriptOSDropTarget::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptOSDropTarget::internal_CreateInstance);
-		metaData.scriptClass->addInternalCall("Internal_Destroy", &ScriptOSDropTarget::internal_Destroy);
-		metaData.scriptClass->addInternalCall("Internal_SetBounds", &ScriptOSDropTarget::internal_SetBounds);
-		metaData.scriptClass->addInternalCall("Internal_GetFilePaths", &ScriptOSDropTarget::internal_GetFilePaths);
-
-		onEnterThunk = (OnEnterThunkDef)metaData.scriptClass->getMethod("InternalDoOnEnter", 2)->getThunk();
-		onMoveThunk = (OnMoveDef)metaData.scriptClass->getMethod("InternalDoOnDrag", 2)->getThunk();
-		onLeaveThunk = (OnLeaveDef)metaData.scriptClass->getMethod("InternalDoOnLeave")->getThunk();
-		onDropThunk = (OnDropThunkDef)metaData.scriptClass->getMethod("InternalDoOnDrop", 2)->getThunk();
-	}
-
-	void ScriptOSDropTarget::internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* editorWindow)
-	{
-		ScriptOSDropTarget* nativeInstance = new (bs_alloc<ScriptOSDropTarget>()) ScriptOSDropTarget(instance, editorWindow);
-	}
-
-	void ScriptOSDropTarget::internal_Destroy(ScriptOSDropTarget* nativeInstance)
-	{
-		if (nativeInstance->mIsDestroyed)
-			return;
-
-		nativeInstance->destroy();
-	}
-
-	void ScriptOSDropTarget::internal_SetBounds(ScriptOSDropTarget* nativeInstance, Rect2I bounds)
-	{
-		if (nativeInstance->mIsDestroyed)
-			return;
-
-		nativeInstance->setBounds(bounds);
-	}
-
-	MonoArray* ScriptOSDropTarget::internal_GetFilePaths(ScriptOSDropTarget* nativeInstance)
-	{
-		OSDropTarget* dropTarget = nativeInstance->mDropTarget;
-
-		if (nativeInstance->mIsDestroyed || dropTarget == nullptr || dropTarget->getDropType() != OSDropType::FileList)
-			return ScriptArray::create<String>(0).getInternal();
-
-		Vector<WString> fileList = dropTarget->getFileList();
-		ScriptArray output = ScriptArray::create<WString>((UINT32)fileList.size());
-
-		UINT32 idx = 0;
-		for (auto& path : fileList)
-		{
-			output.set(idx, path);
-			idx++;
-		}
-
-		return output.getInternal();
-	}
-
-	void ScriptOSDropTarget::destroy()
-	{
-		mIsDestroyed = true;
-
-		mWidgetParentChangedConn.disconnect();
-		mWidgetResizedConn.disconnect();
-
-		setDropTarget(nullptr, 0, 0, 0, 0);
-	}
-
-	EditorWidgetBase* ScriptOSDropTarget::getParentWidget() const
-	{
-		EditorWidgetBase* parentWidget = nullptr;
-
-		if (mParent != nullptr && !mParent->isDestroyed())
-			parentWidget = mParent->getEditorWidget();
-
-		return parentWidget;
-	}
-
-	Rect2I ScriptOSDropTarget::getDropTargetArea() const
-	{
-		Rect2I dropTargetArea = mArea;
-		dropTargetArea.x += mParentArea.x;
-		dropTargetArea.y += mParentArea.y;
-
-		dropTargetArea.clip(mParentArea);
-
-		return dropTargetArea;
-	}
-
-	void ScriptOSDropTarget::setDropTarget(const RenderWindowPtr& parentWindow, INT32 x, INT32 y, UINT32 width, UINT32 height)
-	{
-		if (mDropTarget != nullptr)
-		{
-			Platform::destroyDropTarget(*mDropTarget);
-
-			mDropTargetEnterConn.disconnect();
-			mDropTargetLeaveConn.disconnect();
-			mDropTargetMoveConn.disconnect();
-			mDropTargetDroppedConn.disconnect();
-		}
-
-		if (parentWindow != nullptr)
-		{
-			mDropTarget = &Platform::createDropTarget(parentWindow.get(), x, y, width, height);
-
-			mDropTargetEnterConn = mDropTarget->onEnter.connect(std::bind(&ScriptOSDropTarget::dropTargetDragMove, this, _1, _2));
-			mDropTargetMoveConn = mDropTarget->onDragOver.connect(std::bind(&ScriptOSDropTarget::dropTargetDragMove, this, _1, _2));
-			mDropTargetLeaveConn = mDropTarget->onLeave.connect(std::bind(&ScriptOSDropTarget::dropTargetDragLeave, this));
-			mDropTargetDroppedConn = mDropTarget->onDrop.connect(std::bind(&ScriptOSDropTarget::dropTargetDragDropped, this, _1, _2));
-		}
-		else
-			mDropTarget = nullptr;
-	}
-
-	void ScriptOSDropTarget::setBounds(const Rect2I& bounds)
-	{
-		mArea = bounds;
-		Rect2I dropTargetArea = getDropTargetArea();
-
-		if (mDropTarget != nullptr)
-			mDropTarget->setArea(dropTargetArea.x, dropTargetArea.y, dropTargetArea.width, dropTargetArea.height);
-	}
-
-	void ScriptOSDropTarget::dropTargetDragEnter(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y)
-	{
-		if (thisPtr->mIsDestroyed)
-			return;
-
-		MonoUtil::invokeThunk(onEnterThunk, thisPtr->getManagedInstance(), 
-			x - thisPtr->mParentArea.x, y - thisPtr->mParentArea.y);
-	}
-
-	void ScriptOSDropTarget::dropTargetDragMove(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y)
-	{
-		if (thisPtr->mIsDestroyed)
-			return;
-
-		MonoUtil::invokeThunk(onMoveThunk, thisPtr->getManagedInstance(), 
-			x - thisPtr->mParentArea.x, y - thisPtr->mParentArea.y);
-	}
-
-	void ScriptOSDropTarget::dropTargetDragLeave(ScriptOSDropTarget* thisPtr)
-	{
-		if (thisPtr->mIsDestroyed)
-			return;
-
-		MonoUtil::invokeThunk(onLeaveThunk, thisPtr->getManagedInstance());
-	}
-
-	void ScriptOSDropTarget::dropTargetDragDropped(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y)
-	{
-		if (thisPtr->mIsDestroyed)
-			return;
-
-		MonoUtil::invokeThunk(onDropThunk, thisPtr->getManagedInstance(), 
-			x - thisPtr->mParentArea.x, y - thisPtr->mParentArea.y);
-	}
-
-	void ScriptOSDropTarget::widgetParentChanged(EditorWidgetContainer* parent)
-	{
-		RenderWindowPtr parentRenderWindow;
-		if (parent != nullptr)
-		{
-			EditorWindowBase* parentWindow = parent->getParentWindow();
-
-			if (parentWindow != nullptr)
-				parentRenderWindow = parentWindow->getRenderWindow();
-		}
-
-		if (parentRenderWindow == nullptr)
-			mParentArea = Rect2I();
-		
-		Rect2I dropTargetArea = getDropTargetArea();
-		setDropTarget(parentRenderWindow, dropTargetArea.x, dropTargetArea.y, dropTargetArea.width, dropTargetArea.height);
-	}
-
-	void ScriptOSDropTarget::widgetResized(UINT32 width, UINT32 height)
-	{
-		mParentArea.width = width;
-		mParentArea.height = height;
-
-		setBounds(mArea);
-	}
-
-	void ScriptOSDropTarget::widgetMoved(INT32 x, INT32 y)
-	{
-		mParentArea.x = x;
-		mParentArea.y = y;
-
-		setBounds(mArea);
-	}
+#include "BsScriptOSDropTarget.h"
+#include "BsScriptMeta.h"
+#include "BsMonoField.h"
+#include "BsMonoClass.h"
+#include "BsMonoManager.h"
+#include "BsMonoMethod.h"
+#include "BsMonoUtil.h"
+#include "BsMonoArray.h"
+#include "BsRTTIType.h"
+#include "BsPlatform.h"
+#include "BsEditorWidget.h"
+#include "BsEditorWindowBase.h"
+#include "BsEditorWidgetContainer.h"
+#include "BsScriptEditorWindow.h"
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	ScriptOSDropTarget::OnEnterThunkDef ScriptOSDropTarget::onEnterThunk;
+	ScriptOSDropTarget::OnMoveDef ScriptOSDropTarget::onMoveThunk;
+	ScriptOSDropTarget::OnLeaveDef ScriptOSDropTarget::onLeaveThunk;
+	ScriptOSDropTarget::OnDropThunkDef ScriptOSDropTarget::onDropThunk;
+
+	ScriptOSDropTarget::ScriptOSDropTarget(MonoObject* instance, ScriptEditorWindow* parent)
+		:ScriptObject(instance), mDropTarget(nullptr), mIsDestroyed(false), mParent(parent)
+	{
+		EditorWidgetBase* parentWidget = getParentWidget();
+
+		if (parentWidget != nullptr)
+		{
+			mWidgetParentChangedConn = parentWidget->onParentChanged.connect(std::bind(&ScriptOSDropTarget::widgetParentChanged, this, _1));
+			mWidgetResizedConn = parentWidget->onResized.connect(std::bind(&ScriptOSDropTarget::widgetResized, this, _1, _2));
+			mWidgetMovedConn = parentWidget->onMoved.connect(std::bind(&ScriptOSDropTarget::widgetMoved, this, _1, _2));
+
+			EditorWindowBase* parentWindow = parentWidget->getParentWindow();
+
+			if (parentWindow != nullptr)
+				setDropTarget(parentWindow->getRenderWindow(), 0, 0, 0, 0);
+
+			mParentArea = parentWidget->getBounds();
+		}
+	}
+
+	ScriptOSDropTarget::~ScriptOSDropTarget()
+	{
+		if (!mIsDestroyed)
+			destroy();
+	}
+
+	void ScriptOSDropTarget::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptOSDropTarget::internal_CreateInstance);
+		metaData.scriptClass->addInternalCall("Internal_Destroy", &ScriptOSDropTarget::internal_Destroy);
+		metaData.scriptClass->addInternalCall("Internal_SetBounds", &ScriptOSDropTarget::internal_SetBounds);
+		metaData.scriptClass->addInternalCall("Internal_GetFilePaths", &ScriptOSDropTarget::internal_GetFilePaths);
+
+		onEnterThunk = (OnEnterThunkDef)metaData.scriptClass->getMethod("InternalDoOnEnter", 2)->getThunk();
+		onMoveThunk = (OnMoveDef)metaData.scriptClass->getMethod("InternalDoOnDrag", 2)->getThunk();
+		onLeaveThunk = (OnLeaveDef)metaData.scriptClass->getMethod("InternalDoOnLeave")->getThunk();
+		onDropThunk = (OnDropThunkDef)metaData.scriptClass->getMethod("InternalDoOnDrop", 2)->getThunk();
+	}
+
+	void ScriptOSDropTarget::internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* editorWindow)
+	{
+		ScriptOSDropTarget* nativeInstance = new (bs_alloc<ScriptOSDropTarget>()) ScriptOSDropTarget(instance, editorWindow);
+	}
+
+	void ScriptOSDropTarget::internal_Destroy(ScriptOSDropTarget* nativeInstance)
+	{
+		if (nativeInstance->mIsDestroyed)
+			return;
+
+		nativeInstance->destroy();
+	}
+
+	void ScriptOSDropTarget::internal_SetBounds(ScriptOSDropTarget* nativeInstance, Rect2I* bounds)
+	{
+		if (nativeInstance->mIsDestroyed)
+			return;
+
+		nativeInstance->setBounds(*bounds);
+	}
+
+	MonoArray* ScriptOSDropTarget::internal_GetFilePaths(ScriptOSDropTarget* nativeInstance)
+	{
+		OSDropTarget* dropTarget = nativeInstance->mDropTarget;
+
+		if (nativeInstance->mIsDestroyed || dropTarget == nullptr || dropTarget->getDropType() != OSDropType::FileList)
+			return ScriptArray::create<String>(0).getInternal();
+
+		Vector<WString> fileList = dropTarget->getFileList();
+		ScriptArray output = ScriptArray::create<WString>((UINT32)fileList.size());
+
+		UINT32 idx = 0;
+		for (auto& path : fileList)
+		{
+			output.set(idx, path);
+			idx++;
+		}
+
+		return output.getInternal();
+	}
+
+	void ScriptOSDropTarget::destroy()
+	{
+		mIsDestroyed = true;
+
+		mWidgetParentChangedConn.disconnect();
+		mWidgetResizedConn.disconnect();
+
+		setDropTarget(nullptr, 0, 0, 0, 0);
+	}
+
+	EditorWidgetBase* ScriptOSDropTarget::getParentWidget() const
+	{
+		EditorWidgetBase* parentWidget = nullptr;
+
+		if (mParent != nullptr && !mParent->isDestroyed())
+			parentWidget = mParent->getEditorWidget();
+
+		return parentWidget;
+	}
+
+	Rect2I ScriptOSDropTarget::getDropTargetArea() const
+	{
+		Rect2I dropTargetArea = mArea;
+		dropTargetArea.x += mParentArea.x;
+		dropTargetArea.y += mParentArea.y;
+
+		dropTargetArea.clip(mParentArea);
+
+		return dropTargetArea;
+	}
+
+	void ScriptOSDropTarget::setDropTarget(const RenderWindowPtr& parentWindow, INT32 x, INT32 y, UINT32 width, UINT32 height)
+	{
+		if (mDropTarget != nullptr)
+		{
+			Platform::destroyDropTarget(*mDropTarget);
+
+			mDropTargetEnterConn.disconnect();
+			mDropTargetLeaveConn.disconnect();
+			mDropTargetMoveConn.disconnect();
+			mDropTargetDroppedConn.disconnect();
+		}
+
+		if (parentWindow != nullptr)
+		{
+			mDropTarget = &Platform::createDropTarget(parentWindow.get(), x, y, width, height);
+
+			mDropTargetEnterConn = mDropTarget->onEnter.connect(std::bind(&ScriptOSDropTarget::dropTargetDragMove, this, _1, _2));
+			mDropTargetMoveConn = mDropTarget->onDragOver.connect(std::bind(&ScriptOSDropTarget::dropTargetDragMove, this, _1, _2));
+			mDropTargetLeaveConn = mDropTarget->onLeave.connect(std::bind(&ScriptOSDropTarget::dropTargetDragLeave, this));
+			mDropTargetDroppedConn = mDropTarget->onDrop.connect(std::bind(&ScriptOSDropTarget::dropTargetDragDropped, this, _1, _2));
+		}
+		else
+			mDropTarget = nullptr;
+	}
+
+	void ScriptOSDropTarget::setBounds(const Rect2I& bounds)
+	{
+		mArea = bounds;
+		Rect2I dropTargetArea = getDropTargetArea();
+
+		if (mDropTarget != nullptr)
+			mDropTarget->setArea(dropTargetArea.x, dropTargetArea.y, dropTargetArea.width, dropTargetArea.height);
+	}
+
+	void ScriptOSDropTarget::dropTargetDragEnter(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y)
+	{
+		if (thisPtr->mIsDestroyed)
+			return;
+
+		MonoUtil::invokeThunk(onEnterThunk, thisPtr->getManagedInstance(), 
+			x - thisPtr->mParentArea.x, y - thisPtr->mParentArea.y);
+	}
+
+	void ScriptOSDropTarget::dropTargetDragMove(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y)
+	{
+		if (thisPtr->mIsDestroyed)
+			return;
+
+		MonoUtil::invokeThunk(onMoveThunk, thisPtr->getManagedInstance(), 
+			x - thisPtr->mParentArea.x, y - thisPtr->mParentArea.y);
+	}
+
+	void ScriptOSDropTarget::dropTargetDragLeave(ScriptOSDropTarget* thisPtr)
+	{
+		if (thisPtr->mIsDestroyed)
+			return;
+
+		MonoUtil::invokeThunk(onLeaveThunk, thisPtr->getManagedInstance());
+	}
+
+	void ScriptOSDropTarget::dropTargetDragDropped(ScriptOSDropTarget* thisPtr, INT32 x, INT32 y)
+	{
+		if (thisPtr->mIsDestroyed)
+			return;
+
+		MonoUtil::invokeThunk(onDropThunk, thisPtr->getManagedInstance(), 
+			x - thisPtr->mParentArea.x, y - thisPtr->mParentArea.y);
+	}
+
+	void ScriptOSDropTarget::widgetParentChanged(EditorWidgetContainer* parent)
+	{
+		RenderWindowPtr parentRenderWindow;
+		if (parent != nullptr)
+		{
+			EditorWindowBase* parentWindow = parent->getParentWindow();
+
+			if (parentWindow != nullptr)
+				parentRenderWindow = parentWindow->getRenderWindow();
+		}
+
+		if (parentRenderWindow == nullptr)
+			mParentArea = Rect2I();
+		
+		Rect2I dropTargetArea = getDropTargetArea();
+		setDropTarget(parentRenderWindow, dropTargetArea.x, dropTargetArea.y, dropTargetArea.width, dropTargetArea.height);
+	}
+
+	void ScriptOSDropTarget::widgetResized(UINT32 width, UINT32 height)
+	{
+		mParentArea.width = width;
+		mParentArea.height = height;
+
+		setBounds(mArea);
+	}
+
+	void ScriptOSDropTarget::widgetMoved(INT32 x, INT32 y)
+	{
+		mParentArea.x = x;
+		mParentArea.y = y;
+
+		setBounds(mArea);
+	}
 }
 }

+ 79 - 79
SBansheeEditor/Source/BsScriptSceneViewHandler.cpp

@@ -1,80 +1,80 @@
-#include "BsScriptSceneViewHandler.h"
-#include "BsScriptMeta.h"
-#include "BsMonoClass.h"
-#include "BsMonoUtil.h"
-#include "BsSceneViewHandler.h"
-#include "BsScriptCamera.h"
-#include "BsScriptEditorWindow.h"
-#include "BsEditorWidgetContainer.h"
-#include "BsEditorWindowBase.h"
-
-namespace BansheeEngine
-{
-	ScriptSceneViewHandler::ScriptSceneViewHandler(MonoObject* object, EditorWidgetBase* parentWidget, const SPtr<Camera>& camera)
-		:ScriptObject(object), mHandler(nullptr)
-	{ 
-		mHandler = bs_new<SceneViewHandler>(parentWidget, camera);
-	}
-
-	ScriptSceneViewHandler::~ScriptSceneViewHandler()
-	{
-		bs_delete(mHandler);
-	}
-
-	void ScriptSceneViewHandler::initRuntimeData()
-	{
-		metaData.scriptClass->addInternalCall("Internal_Create", &ScriptSceneViewHandler::internal_Create);
-		metaData.scriptClass->addInternalCall("Internal_Update", &ScriptSceneViewHandler::internal_Update);
-		metaData.scriptClass->addInternalCall("Internal_UpdateHandle", &ScriptSceneViewHandler::internal_UpdateHandle);
-		metaData.scriptClass->addInternalCall("Internal_UpdateSelection", &ScriptSceneViewHandler::internal_UpdateSelection);
-		metaData.scriptClass->addInternalCall("Internal_TrySelectHandle", &ScriptSceneViewHandler::internal_TrySelectHandle);
-		metaData.scriptClass->addInternalCall("Internal_IsHandleActive", &ScriptSceneViewHandler::internal_IsHandleActive);
-		metaData.scriptClass->addInternalCall("Internal_ClearHandleSelection", &ScriptSceneViewHandler::internal_ClearHandleSelection);
-		metaData.scriptClass->addInternalCall("Internal_PickObject", &ScriptSceneViewHandler::internal_PickObject);
-	}
-
-	void ScriptSceneViewHandler::internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCamera* camera)
-	{
-		EditorWidgetBase* widget = nullptr;
-		
-		if (parentWindow != nullptr && !parentWindow->isDestroyed())
-			widget = parentWindow->getEditorWidget();
-
-		new (bs_alloc<ScriptSceneViewHandler>()) ScriptSceneViewHandler(managedInstance, widget, camera->getInternal());
-	}
-
-	void ScriptSceneViewHandler::internal_Update(ScriptSceneViewHandler* thisPtr)
-	{
-		thisPtr->mHandler->update();
-	}
-
-	void ScriptSceneViewHandler::internal_UpdateHandle(ScriptSceneViewHandler* thisPtr, Vector2I inputPos, Vector2I inputDelta)
-	{
-		thisPtr->mHandler->updateHandle(inputPos, inputDelta);
-	}
-
-	void ScriptSceneViewHandler::internal_UpdateSelection(ScriptSceneViewHandler* thisPtr)
-	{
-		thisPtr->mHandler->updateSelection();
-	}
-
-	void ScriptSceneViewHandler::internal_TrySelectHandle(ScriptSceneViewHandler* thisPtr, Vector2I inputPos)
-	{
-		thisPtr->mHandler->trySelectHandle(inputPos);
-	}
-
-	bool ScriptSceneViewHandler::internal_IsHandleActive(ScriptSceneViewHandler* thisPtr, Vector2I inputPos)
-	{
-		return thisPtr->mHandler->isHandleActive();
-	}
-
-	void ScriptSceneViewHandler::internal_ClearHandleSelection(ScriptSceneViewHandler* thisPtr, Vector2I inputPos)
-	{
-		thisPtr->mHandler->clearHandleSelection();
-	}
-
-	void ScriptSceneViewHandler::internal_PickObject(ScriptSceneViewHandler* thisPtr, Vector2I inputPos, bool additive)
-	{
-		thisPtr->mHandler->pickObject(inputPos, additive);
-	}
+#include "BsScriptSceneViewHandler.h"
+#include "BsScriptMeta.h"
+#include "BsMonoClass.h"
+#include "BsMonoUtil.h"
+#include "BsSceneViewHandler.h"
+#include "BsScriptCamera.h"
+#include "BsScriptEditorWindow.h"
+#include "BsEditorWidgetContainer.h"
+#include "BsEditorWindowBase.h"
+
+namespace BansheeEngine
+{
+	ScriptSceneViewHandler::ScriptSceneViewHandler(MonoObject* object, EditorWidgetBase* parentWidget, const SPtr<Camera>& camera)
+		:ScriptObject(object), mHandler(nullptr)
+	{ 
+		mHandler = bs_new<SceneViewHandler>(parentWidget, camera);
+	}
+
+	ScriptSceneViewHandler::~ScriptSceneViewHandler()
+	{
+		bs_delete(mHandler);
+	}
+
+	void ScriptSceneViewHandler::initRuntimeData()
+	{
+		metaData.scriptClass->addInternalCall("Internal_Create", &ScriptSceneViewHandler::internal_Create);
+		metaData.scriptClass->addInternalCall("Internal_Update", &ScriptSceneViewHandler::internal_Update);
+		metaData.scriptClass->addInternalCall("Internal_UpdateHandle", &ScriptSceneViewHandler::internal_UpdateHandle);
+		metaData.scriptClass->addInternalCall("Internal_UpdateSelection", &ScriptSceneViewHandler::internal_UpdateSelection);
+		metaData.scriptClass->addInternalCall("Internal_TrySelectHandle", &ScriptSceneViewHandler::internal_TrySelectHandle);
+		metaData.scriptClass->addInternalCall("Internal_IsHandleActive", &ScriptSceneViewHandler::internal_IsHandleActive);
+		metaData.scriptClass->addInternalCall("Internal_ClearHandleSelection", &ScriptSceneViewHandler::internal_ClearHandleSelection);
+		metaData.scriptClass->addInternalCall("Internal_PickObject", &ScriptSceneViewHandler::internal_PickObject);
+	}
+
+	void ScriptSceneViewHandler::internal_Create(MonoObject* managedInstance, ScriptEditorWindow* parentWindow, ScriptCamera* camera)
+	{
+		EditorWidgetBase* widget = nullptr;
+		
+		if (parentWindow != nullptr && !parentWindow->isDestroyed())
+			widget = parentWindow->getEditorWidget();
+
+		new (bs_alloc<ScriptSceneViewHandler>()) ScriptSceneViewHandler(managedInstance, widget, camera->getInternal());
+	}
+
+	void ScriptSceneViewHandler::internal_Update(ScriptSceneViewHandler* thisPtr)
+	{
+		thisPtr->mHandler->update();
+	}
+
+	void ScriptSceneViewHandler::internal_UpdateHandle(ScriptSceneViewHandler* thisPtr, Vector2I* inputPos, Vector2I* inputDelta)
+	{
+		thisPtr->mHandler->updateHandle(*inputPos, *inputDelta);
+	}
+
+	void ScriptSceneViewHandler::internal_UpdateSelection(ScriptSceneViewHandler* thisPtr)
+	{
+		thisPtr->mHandler->updateSelection();
+	}
+
+	void ScriptSceneViewHandler::internal_TrySelectHandle(ScriptSceneViewHandler* thisPtr, Vector2I* inputPos)
+	{
+		thisPtr->mHandler->trySelectHandle(*inputPos);
+	}
+
+	bool ScriptSceneViewHandler::internal_IsHandleActive(ScriptSceneViewHandler* thisPtr)
+	{
+		return thisPtr->mHandler->isHandleActive();
+	}
+
+	void ScriptSceneViewHandler::internal_ClearHandleSelection(ScriptSceneViewHandler* thisPtr)
+	{
+		thisPtr->mHandler->clearHandleSelection();
+	}
+
+	void ScriptSceneViewHandler::internal_PickObject(ScriptSceneViewHandler* thisPtr, Vector2I* inputPos, bool additive)
+	{
+		thisPtr->mHandler->pickObject(*inputPos, additive);
+	}
 }
 }