Przeglądaj źródła

Merge pull request #46 from MarcoROG/master

Fixes 32 bit crashes caused by Mono
Marko Pintera 9 lat temu
rodzic
commit
f3bd68d0ce

+ 5 - 15
Source/MBansheeEditor/GUI/GUIFloatField.cs

@@ -30,12 +30,7 @@ namespace BansheeEditor
         /// </summary>
         public float Value
         {
-            get
-            {
-                float value;
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
+            get { return Internal_GetValue(mCachedPtr); }
 
             set { Internal_SetValue(mCachedPtr, value); }
         }
@@ -56,12 +51,7 @@ namespace BansheeEditor
         /// </summary>
         public bool HasInputFocus
         {
-            get
-            {
-                bool value;
-                Internal_HasInputFocus(mCachedPtr, out value);
-                return value;
-            }
+            get { return Internal_HasInputFocus(mCachedPtr); }
         }
 
         /// <summary>
@@ -136,13 +126,13 @@ namespace BansheeEditor
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out float value);
+        private static extern float Internal_GetValue(IntPtr nativeInstance);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetValue(IntPtr nativeInstance, float value);
+        private static extern float Internal_SetValue(IntPtr nativeInstance, float value);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+        private static extern bool Internal_HasInputFocus(IntPtr nativeInstance);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);

+ 4 - 14
Source/MBansheeEditor/GUI/GUIIntField.cs

@@ -30,12 +30,7 @@ namespace BansheeEditor
         /// </summary>
         public int Value
         {
-            get
-            {
-                int value; 
-                Internal_GetValue(mCachedPtr, out value);
-                return value;
-            }
+            get { return Internal_GetValue(mCachedPtr); }
 
             set { Internal_SetValue(mCachedPtr, value); }
         }
@@ -56,12 +51,7 @@ namespace BansheeEditor
         /// </summary>
         public bool HasInputFocus
         {
-            get
-            {
-                bool value;
-                Internal_HasInputFocus(mCachedPtr, out value);
-                return value;
-            }
+            get { return Internal_HasInputFocus(mCachedPtr); }
         }
 
         /// <summary>
@@ -136,13 +126,13 @@ namespace BansheeEditor
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_GetValue(IntPtr nativeInstance, out int value);
+        private static extern int Internal_GetValue(IntPtr nativeInstance);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern int Internal_SetValue(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_HasInputFocus(IntPtr nativeInstance, out bool value);
+        private static extern bool Internal_HasInputFocus(IntPtr nativeInstance);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetRange(IntPtr nativeInstance, int min, int max);

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

@@ -29,7 +29,7 @@ namespace BansheeEditor
         /// <param name="style">Information about the range of the field.</param>
         public InspectableRangedInt(Inspector parent, string title, string path, int depth, InspectableFieldLayout layout,
             SerializableProperty property, InspectableFieldStyleInfo style)
-            : base(parent, title, path, SerializableProperty.FieldType.Float, depth, layout, property, style)
+            : base(parent, title, path, SerializableProperty.FieldType.Int, depth, layout, property, style)
         {
 
         }
@@ -53,7 +53,7 @@ namespace BansheeEditor
         public override InspectableState Refresh(int layoutIndex)
         {
             if (guiIntField != null && !guiIntField.HasInputFocus)
-                guiIntField.Value = property.GetValue<float>();
+                guiIntField.Value = property.GetValue<int>();
 
             InspectableState oldState = state;
             if (state.HasFlag(InspectableState.Modified))
@@ -68,7 +68,7 @@ namespace BansheeEditor
         /// <param name="newValue">New value of the float field.</param>
         private void OnFieldValueChanged(float newValue)
         {
-            property.SetValue(newValue);
+            property.SetValue((int)newValue);
             state |= InspectableState.ModifyInProgress;
         }
 

+ 2 - 2
Source/SBansheeEditor/Include/BsScriptGUIFloatField.h

@@ -41,9 +41,9 @@ namespace BansheeEngine
 		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 float internal_getValue(ScriptGUIFloatField* nativeInstance);
 		static float internal_setValue(ScriptGUIFloatField* nativeInstance, float value);
-		static void internal_hasInputFocus(ScriptGUIFloatField* nativeInstance, bool* output);
+		static bool internal_hasInputFocus(ScriptGUIFloatField* nativeInstance);
 		static void internal_setTint(ScriptGUIFloatField* nativeInstance, Color* color);
 		static void internal_setRange(ScriptGUIFloatField* nativeInstance, float min, float max);
 		static void internal_setStep(ScriptGUIFloatField* nativeInstance, float step);

+ 2 - 2
Source/SBansheeEditor/Include/BsScriptGUIIntField.h

@@ -41,9 +41,9 @@ namespace BansheeEngine
 		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 INT32 internal_getValue(ScriptGUIIntField* nativeInstance);
 		static INT32 internal_setValue(ScriptGUIIntField* nativeInstance, INT32 value);
-		static void internal_hasInputFocus(ScriptGUIIntField* nativeInstance, bool* output);
+		static bool internal_hasInputFocus(ScriptGUIIntField* nativeInstance);
 		static void internal_setRange(ScriptGUIIntField* nativeInstance, INT32 min, INT32 max);
 		static void internal_setTint(ScriptGUIIntField* nativeInstance, Color* color);
 		static void internal_setStep(ScriptGUIIntField* nativeInstance, INT32 step);

+ 4 - 4
Source/SBansheeEditor/Source/BsScriptGUIFloatField.cpp

@@ -68,10 +68,10 @@ namespace BansheeEngine
 		new (bs_alloc<ScriptGUIFloatField>()) ScriptGUIFloatField(instance, guiFloatField);
 	}
 
-	void ScriptGUIFloatField::internal_getValue(ScriptGUIFloatField* nativeInstance, float* output)
+	float ScriptGUIFloatField::internal_getValue(ScriptGUIFloatField* nativeInstance)
 	{
 		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
-		*output = floatField->getValue();
+		return floatField->getValue();
 	}
 
 	float ScriptGUIFloatField::internal_setValue(ScriptGUIFloatField* nativeInstance, float value)
@@ -80,10 +80,10 @@ namespace BansheeEngine
 		return floatField->setValue(value);
 	}
 
-	void ScriptGUIFloatField::internal_hasInputFocus(ScriptGUIFloatField* nativeInstance, bool* output)
+	bool ScriptGUIFloatField::internal_hasInputFocus(ScriptGUIFloatField* nativeInstance)
 	{
 		GUIFloatField* floatField = static_cast<GUIFloatField*>(nativeInstance->getGUIElement());
-		*output = floatField->hasInputFocus();
+		return floatField->hasInputFocus();
 	}
 
 	void ScriptGUIFloatField::internal_setRange(ScriptGUIFloatField* nativeInstance, float min, float max)

+ 4 - 4
Source/SBansheeEditor/Source/BsScriptGUIIntField.cpp

@@ -68,10 +68,10 @@ namespace BansheeEngine
 		new (bs_alloc<ScriptGUIIntField>()) ScriptGUIIntField(instance, guiIntField);
 	}
 
-	void ScriptGUIIntField::internal_getValue(ScriptGUIIntField* nativeInstance, INT32* output)
+	INT32 ScriptGUIIntField::internal_getValue(ScriptGUIIntField* nativeInstance)
 	{
 		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
-		*output = intField->getValue();
+		return intField->getValue();
 	}
 
 	INT32 ScriptGUIIntField::internal_setValue(ScriptGUIIntField* nativeInstance, INT32 value)
@@ -80,10 +80,10 @@ namespace BansheeEngine
 		return intField->setValue(value);
 	}
 
-	void ScriptGUIIntField::internal_hasInputFocus(ScriptGUIIntField* nativeInstance, bool* output)
+	bool ScriptGUIIntField::internal_hasInputFocus(ScriptGUIIntField* nativeInstance)
 	{
 		GUIIntField* intField = static_cast<GUIIntField*>(nativeInstance->getGUIElement());
-		*output = intField->hasInputFocus();
+		return intField->hasInputFocus();
 	}
 
 	void ScriptGUIIntField::internal_setRange(ScriptGUIIntField* nativeInstance, INT32 min, INT32 max)