فهرست منبع

Updating struct fields in inspector no longer causes the struct inspector GUI to be rebuilt

Marko Pintera 10 سال پیش
والد
کامیت
93de4e59a0

+ 0 - 3
MBansheeEditor/Inspector/InspectableArray.cs

@@ -96,9 +96,6 @@ namespace BansheeEditor
             if (newPropertyValue == null)
             if (newPropertyValue == null)
                 return propertyValue != null;
                 return propertyValue != null;
 
 
-            if (!propertyValue.Equals(newPropertyValue))
-                return true;
-
             SerializableArray array = property.GetArray();
             SerializableArray array = property.GetArray();
             if (array.GetLength() != numArrayElements)
             if (array.GetLength() != numArrayElements)
                 return true;
                 return true;

+ 0 - 3
MBansheeEditor/Inspector/InspectableList.cs

@@ -96,9 +96,6 @@ namespace BansheeEditor
             if (newPropertyValue == null)
             if (newPropertyValue == null)
                 return propertyValue != null;
                 return propertyValue != null;
 
 
-            if (!propertyValue.Equals(newPropertyValue))
-                return true;
-
             SerializableList list = property.GetList();
             SerializableList list = property.GetList();
             if (list.GetLength() != numArrayElements)
             if (list.GetLength() != numArrayElements)
                 return true;
                 return true;

+ 0 - 3
MBansheeEditor/Inspector/InspectableObject.cs

@@ -41,9 +41,6 @@ namespace BansheeEditor
             if (newPropertyValue == null)
             if (newPropertyValue == null)
                 return propertyValue != null;
                 return propertyValue != null;
             
             
-            if (!propertyValue.Equals(newPropertyValue))
-                return true;
-
             return base.IsModified();
             return base.IsModified();
         }
         }
 
 

+ 26 - 6
MBansheeEngine/SerializableArray.cs

@@ -8,7 +8,7 @@ namespace BansheeEngine
     {
     {
         private SerializableProperty.FieldType elementType;
         private SerializableProperty.FieldType elementType;
         private Type internalElementType;
         private Type internalElementType;
-        private Array referencedArray;
+        private SerializableProperty parentProperty;
 
 
         public SerializableProperty.FieldType ElementType
         public SerializableProperty.FieldType ElementType
         {
         {
@@ -16,17 +16,32 @@ namespace BansheeEngine
         }
         }
 
 
         // Constructed from native code
         // Constructed from native code
-        private SerializableArray(Array array, Type internalElementType)
+        private SerializableArray(Type internalElementType, SerializableProperty parentProperty)
         {
         {
-            referencedArray = array;
+            this.parentProperty = parentProperty;
             this.internalElementType = internalElementType;
             this.internalElementType = internalElementType;
             elementType = SerializableProperty.DetermineFieldType(internalElementType);
             elementType = SerializableProperty.DetermineFieldType(internalElementType);
         }
         }
 
 
         public SerializableProperty GetProperty(int elementIdx)
         public SerializableProperty GetProperty(int elementIdx)
         {
         {
-            SerializableProperty.Getter getter = () => referencedArray.GetValue(elementIdx);
-            SerializableProperty.Setter setter = (object value) => referencedArray.SetValue(value, elementIdx);
+            SerializableProperty.Getter getter = () =>
+            {
+                Array array = parentProperty.GetValue<Array>();
+
+                if (array != null)
+                    return array.GetValue(elementIdx);
+                else
+                    return null;
+            };
+
+            SerializableProperty.Setter setter = (object value) =>
+            {
+                Array array = parentProperty.GetValue<Array>();
+
+                if(array != null)
+                    array.SetValue(value, elementIdx);
+            };
 
 
             SerializableProperty property = Internal_CreateProperty(mCachedPtr);
             SerializableProperty property = Internal_CreateProperty(mCachedPtr);
             property.Construct(ElementType, internalElementType, getter, setter);
             property.Construct(ElementType, internalElementType, getter, setter);
@@ -36,7 +51,12 @@ namespace BansheeEngine
 
 
         public int GetLength()
         public int GetLength()
         {
         {
-            return referencedArray.GetLength(0); // TODO - Support multi-rank arrays
+            Array array = parentProperty.GetValue<Array>();
+
+            if (array != null)
+                return array.GetLength(0); // TODO - Support multi-rank arrays
+            else
+                return 0;
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 29 - 7
MBansheeEngine/SerializableDictionary.cs

@@ -12,7 +12,7 @@ namespace BansheeEngine
         private SerializableProperty.FieldType valueType;
         private SerializableProperty.FieldType valueType;
         private Type internalKeyType;
         private Type internalKeyType;
         private Type internalValueType;
         private Type internalValueType;
-        private IDictionary referencedDict;
+        private SerializableProperty parentProperty;
 
 
         public SerializableProperty.FieldType KeyType
         public SerializableProperty.FieldType KeyType
         {
         {
@@ -25,9 +25,9 @@ namespace BansheeEngine
         }
         }
 
 
         // Constructed from native code
         // Constructed from native code
-        private SerializableDictionary(IDictionary dict, Type internalKeyType, Type internalValueType)
+        private SerializableDictionary(Type internalKeyType, Type internalValueType, SerializableProperty parentProperty)
         {
         {
-            referencedDict = dict;
+            this.parentProperty = parentProperty;
             this.internalKeyType = internalKeyType;
             this.internalKeyType = internalKeyType;
             this.internalValueType = internalValueType;
             this.internalValueType = internalValueType;
             keyType = SerializableProperty.DetermineFieldType(internalKeyType);
             keyType = SerializableProperty.DetermineFieldType(internalKeyType);
@@ -36,7 +36,9 @@ namespace BansheeEngine
 
 
         public KeyValuePair<SerializableProperty, SerializableProperty> GetProperty(object key)
         public KeyValuePair<SerializableProperty, SerializableProperty> GetProperty(object key)
         {
         {
-            if (!referencedDict.Contains(key))
+            IDictionary dictionary = parentProperty.GetValue<IDictionary>();
+
+            if (dictionary == null || !dictionary.Contains(key))
                 return new KeyValuePair<SerializableProperty, SerializableProperty>(null, null);
                 return new KeyValuePair<SerializableProperty, SerializableProperty>(null, null);
 
 
             SerializableProperty keyProperty;
             SerializableProperty keyProperty;
@@ -50,8 +52,23 @@ namespace BansheeEngine
 
 
             SerializableProperty valueProperty;
             SerializableProperty valueProperty;
             {
             {
-                SerializableProperty.Getter getter = () => referencedDict[key];
-                SerializableProperty.Setter setter = (object value) => referencedDict[key] = value;
+                SerializableProperty.Getter getter = () =>
+                {
+                    IDictionary dict = parentProperty.GetValue<IDictionary>();
+
+                    if (dict != null)
+                        return dict[key];
+                    else
+                        return null;
+                };
+
+                SerializableProperty.Setter setter = (object value) =>
+                {
+                    IDictionary dict = parentProperty.GetValue<IDictionary>();
+
+                    if (dict != null)
+                        dict[key] = value;
+                };
 
 
                 valueProperty = Internal_CreateValueProperty(mCachedPtr);
                 valueProperty = Internal_CreateValueProperty(mCachedPtr);
                 valueProperty.Construct(ValueType, internalValueType, getter, setter);
                 valueProperty.Construct(ValueType, internalValueType, getter, setter);
@@ -62,7 +79,12 @@ namespace BansheeEngine
 
 
         public int GetLength()
         public int GetLength()
         {
         {
-            return referencedDict.Count;
+            IDictionary dictionary = parentProperty.GetValue<IDictionary>();
+
+            if (dictionary != null)
+                return dictionary.Count;
+            else
+                return 0;
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 26 - 6
MBansheeEngine/SerializableList.cs

@@ -9,7 +9,7 @@ namespace BansheeEngine
     {
     {
         private SerializableProperty.FieldType elementType;
         private SerializableProperty.FieldType elementType;
         private Type internalElementType;
         private Type internalElementType;
-        private IList referencedList;
+        private SerializableProperty parentProperty;
 
 
         public SerializableProperty.FieldType ElementType
         public SerializableProperty.FieldType ElementType
         {
         {
@@ -17,17 +17,32 @@ namespace BansheeEngine
         }
         }
 
 
         // Constructed from native code
         // Constructed from native code
-        private SerializableList(IList list, Type internalElementType)
+        private SerializableList(Type internalElementType, SerializableProperty parentProperty)
         {
         {
-            referencedList = list;
+            this.parentProperty = parentProperty;
             this.internalElementType = internalElementType;
             this.internalElementType = internalElementType;
             elementType = SerializableProperty.DetermineFieldType(internalElementType);
             elementType = SerializableProperty.DetermineFieldType(internalElementType);
         }
         }
 
 
         public SerializableProperty GetProperty(int elementIdx)
         public SerializableProperty GetProperty(int elementIdx)
         {
         {
-            SerializableProperty.Getter getter = () => referencedList[elementIdx];
-            SerializableProperty.Setter setter = (object value) => referencedList[elementIdx] = value;
+            SerializableProperty.Getter getter = () =>
+            {
+                IList list = parentProperty.GetValue<IList>();
+
+                if (list != null)
+                    return list[elementIdx];
+                else
+                    return null;
+            };
+
+            SerializableProperty.Setter setter = (object value) =>
+            {
+                IList list = parentProperty.GetValue<IList>();
+
+                if (list != null)
+                    list[elementIdx] = value;
+            };
 
 
             SerializableProperty property = Internal_CreateProperty(mCachedPtr);
             SerializableProperty property = Internal_CreateProperty(mCachedPtr);
             property.Construct(ElementType, internalElementType, getter, setter);
             property.Construct(ElementType, internalElementType, getter, setter);
@@ -37,7 +52,12 @@ namespace BansheeEngine
 
 
         public int GetLength()
         public int GetLength()
         {
         {
-            return referencedList.Count;
+            IList list = parentProperty.GetValue<IList>();
+
+            if (list != null)
+                return list.Count;
+            else
+                return 0;
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 8 - 8
MBansheeEngine/SerializableProperty.cs

@@ -91,7 +91,7 @@ namespace BansheeEngine
             if (type != FieldType.Object)
             if (type != FieldType.Object)
                 throw new Exception("Attempting to retrieve object information from a field that doesn't contain an object.");
                 throw new Exception("Attempting to retrieve object information from a field that doesn't contain an object.");
 
 
-            return Internal_CreateObject(mCachedPtr, GetValue<object>());
+            return Internal_CreateObject(mCachedPtr);
         }
         }
 
 
         public SerializableArray GetArray()
         public SerializableArray GetArray()
@@ -99,7 +99,7 @@ namespace BansheeEngine
             if (type != FieldType.Array)
             if (type != FieldType.Array)
                 throw new Exception("Attempting to retrieve array information from a field that doesn't contain an array.");
                 throw new Exception("Attempting to retrieve array information from a field that doesn't contain an array.");
 
 
-            return Internal_CreateArray(mCachedPtr, GetValue<Array>());
+            return Internal_CreateArray(mCachedPtr);
         }
         }
 
 
         public SerializableList GetList()
         public SerializableList GetList()
@@ -107,7 +107,7 @@ namespace BansheeEngine
             if (type != FieldType.List)
             if (type != FieldType.List)
                 throw new Exception("Attempting to retrieve array information from a field that doesn't contain a list.");
                 throw new Exception("Attempting to retrieve array information from a field that doesn't contain a list.");
 
 
-            return Internal_CreateList(mCachedPtr, GetValue<IList>());
+            return Internal_CreateList(mCachedPtr);
         }
         }
 
 
         public SerializableDictionary GetDictionary()
         public SerializableDictionary GetDictionary()
@@ -115,7 +115,7 @@ namespace BansheeEngine
             if (type != FieldType.Dictionary)
             if (type != FieldType.Dictionary)
                 throw new Exception("Attempting to retrieve array information from a field that doesn't contain a dictionary.");
                 throw new Exception("Attempting to retrieve array information from a field that doesn't contain a dictionary.");
 
 
-            return Internal_CreateDictionary(mCachedPtr, GetValue<IDictionary>());
+            return Internal_CreateDictionary(mCachedPtr);
         }
         }
 
 
         public T CreateObjectInstance<T>()
         public T CreateObjectInstance<T>()
@@ -151,16 +151,16 @@ namespace BansheeEngine
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern SerializableObject Internal_CreateObject(IntPtr nativeInstance, object instance);
+        private static extern SerializableObject Internal_CreateObject(IntPtr nativeInstance);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern SerializableArray Internal_CreateArray(IntPtr nativeInstance, Array instance);
+        private static extern SerializableArray Internal_CreateArray(IntPtr nativeInstance);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern SerializableList Internal_CreateList(IntPtr nativeInstance, IList instance);
+        private static extern SerializableList Internal_CreateList(IntPtr nativeInstance);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern SerializableDictionary Internal_CreateDictionary(IntPtr nativeInstance, IDictionary instance);
+        private static extern SerializableDictionary Internal_CreateDictionary(IntPtr nativeInstance);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern object Internal_CreateManagedObjectInstance(IntPtr nativeInstance);
         private static extern object Internal_CreateManagedObjectInstance(IntPtr nativeInstance);

+ 1 - 1
SBansheeEngine/Include/BsScriptSerializableArray.h

@@ -10,7 +10,7 @@ namespace BansheeEngine
 	public:
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableArray")
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableArray")
 
 
-		static ScriptSerializableArray* create(const ManagedSerializableTypeInfoArrayPtr& typeInfo, MonoObject* object);
+		static ScriptSerializableArray* create(const ScriptSerializableProperty* parentProperty);
 
 
 	private:
 	private:
 		static MonoObject* internal_createProperty(ScriptSerializableArray* nativeInstance);
 		static MonoObject* internal_createProperty(ScriptSerializableArray* nativeInstance);

+ 1 - 1
SBansheeEngine/Include/BsScriptSerializableDictionary.h

@@ -10,7 +10,7 @@ namespace BansheeEngine
 	public:
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableDictionary")
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableDictionary")
 
 
-		static ScriptSerializableDictionary* create(const ManagedSerializableTypeInfoDictionaryPtr& typeInfo, MonoObject* object);
+		static ScriptSerializableDictionary* create(const ScriptSerializableProperty* parentProperty);
 
 
 	private:
 	private:
 		static MonoObject* internal_createKeyProperty(ScriptSerializableDictionary* nativeInstance);
 		static MonoObject* internal_createKeyProperty(ScriptSerializableDictionary* nativeInstance);

+ 1 - 1
SBansheeEngine/Include/BsScriptSerializableList.h

@@ -10,7 +10,7 @@ namespace BansheeEngine
 	public:
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableList")
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableList")
 
 
-			static ScriptSerializableList* create(const ManagedSerializableTypeInfoListPtr& typeInfo, MonoObject* object);
+			static ScriptSerializableList* create(const ScriptSerializableProperty* parentProperty);
 
 
 	private:
 	private:
 		static MonoObject* internal_createProperty(ScriptSerializableList* nativeInstance);
 		static MonoObject* internal_createProperty(ScriptSerializableList* nativeInstance);

+ 1 - 1
SBansheeEngine/Include/BsScriptSerializableObject.h

@@ -10,7 +10,7 @@ namespace BansheeEngine
 	public:
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableObject")
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SerializableObject")
 
 
-		static ScriptSerializableObject* create(ScriptSerializableProperty* parentProperty, MonoObject* object);
+		static ScriptSerializableObject* create(const ScriptSerializableProperty* parentProperty);
 
 
 	private:
 	private:
 		static void internal_createInstance(MonoObject* instance, MonoReflectionType* type);
 		static void internal_createInstance(MonoObject* instance, MonoReflectionType* type);

+ 4 - 4
SBansheeEngine/Include/BsScriptSerializableProperty.h

@@ -17,10 +17,10 @@ namespace BansheeEngine
 		~ScriptSerializableProperty() {}
 		~ScriptSerializableProperty() {}
 
 
 	private:
 	private:
-		static MonoObject* internal_createObject(ScriptSerializableProperty* nativeInstance, MonoObject* object);
-		static MonoObject* internal_createArray(ScriptSerializableProperty* nativeInstance, MonoObject* object);
-		static MonoObject* internal_createList(ScriptSerializableProperty* nativeInstance, MonoObject* object);
-		static MonoObject* internal_createDictionary(ScriptSerializableProperty* nativeInstance, MonoObject* object);
+		static MonoObject* internal_createObject(ScriptSerializableProperty* nativeInstance);
+		static MonoObject* internal_createArray(ScriptSerializableProperty* nativeInstance);
+		static MonoObject* internal_createList(ScriptSerializableProperty* nativeInstance);
+		static MonoObject* internal_createDictionary(ScriptSerializableProperty* nativeInstance);
 
 
 		static MonoObject* internal_createManagedObjectInstance(ScriptSerializableProperty* nativeInstance);
 		static MonoObject* internal_createManagedObjectInstance(ScriptSerializableProperty* nativeInstance);
 		static MonoObject* internal_createManagedArrayInstance(ScriptSerializableProperty* nativeInstance, MonoArray* sizes);
 		static MonoObject* internal_createManagedArrayInstance(ScriptSerializableProperty* nativeInstance, MonoArray* sizes);

+ 6 - 4
SBansheeEngine/Source/BsScriptSerializableArray.cpp

@@ -20,15 +20,17 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_CreateProperty", &ScriptSerializableArray::internal_createProperty);
 		metaData.scriptClass->addInternalCall("Internal_CreateProperty", &ScriptSerializableArray::internal_createProperty);
 	}
 	}
 
 
-	ScriptSerializableArray* ScriptSerializableArray::create(const ManagedSerializableTypeInfoArrayPtr& typeInfo, MonoObject* object)
+	ScriptSerializableArray* ScriptSerializableArray::create(const ScriptSerializableProperty* parentProperty)
 	{
 	{
-		MonoType* monoInternalElementType = mono_class_get_type(typeInfo->mElementType->getMonoClass());
+		ManagedSerializableTypeInfoArrayPtr arrayTypeInfo = std::static_pointer_cast<ManagedSerializableTypeInfoArray>(parentProperty->getTypeInfo());
+
+		MonoType* monoInternalElementType = mono_class_get_type(arrayTypeInfo->mElementType->getMonoClass());
 		MonoReflectionType* internalElementType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalElementType);
 		MonoReflectionType* internalElementType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalElementType);
 
 
-		void* params[2] = { object, internalElementType };
+		void* params[2] = { internalElementType, parentProperty->getManagedInstance() };
 		MonoObject* managedInstance = metaData.scriptClass->createInstance(params, 2);
 		MonoObject* managedInstance = metaData.scriptClass->createInstance(params, 2);
 
 
-		ScriptSerializableArray* nativeInstance = new (bs_alloc<ScriptSerializableArray>()) ScriptSerializableArray(managedInstance, typeInfo);
+		ScriptSerializableArray* nativeInstance = new (bs_alloc<ScriptSerializableArray>()) ScriptSerializableArray(managedInstance, arrayTypeInfo);
 
 
 		return nativeInstance;
 		return nativeInstance;
 	}
 	}

+ 7 - 5
SBansheeEngine/Source/BsScriptSerializableDictionary.cpp

@@ -21,18 +21,20 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_CreateValueProperty", &ScriptSerializableDictionary::internal_createValueProperty);
 		metaData.scriptClass->addInternalCall("Internal_CreateValueProperty", &ScriptSerializableDictionary::internal_createValueProperty);
 	}
 	}
 
 
-	ScriptSerializableDictionary* ScriptSerializableDictionary::create(const ManagedSerializableTypeInfoDictionaryPtr& typeInfo, MonoObject* object)
+	ScriptSerializableDictionary* ScriptSerializableDictionary::create(const ScriptSerializableProperty* parentProperty)
 	{
 	{
-		MonoType* monoInternalKeyType = mono_class_get_type(typeInfo->mKeyType->getMonoClass());
+		ManagedSerializableTypeInfoDictionaryPtr dictTypeInfo = std::static_pointer_cast<ManagedSerializableTypeInfoDictionary>(parentProperty->getTypeInfo());
+
+		MonoType* monoInternalKeyType = mono_class_get_type(dictTypeInfo->mKeyType->getMonoClass());
 		MonoReflectionType* internalKeyType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalKeyType);
 		MonoReflectionType* internalKeyType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalKeyType);
 
 
-		MonoType* monoInternalValueType = mono_class_get_type(typeInfo->mValueType->getMonoClass());
+		MonoType* monoInternalValueType = mono_class_get_type(dictTypeInfo->mValueType->getMonoClass());
 		MonoReflectionType* internalValueType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalValueType);
 		MonoReflectionType* internalValueType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalValueType);
 
 
-		void* params[3] = { object, internalKeyType, internalValueType };
+		void* params[3] = { internalKeyType, internalValueType, parentProperty->getManagedInstance() };
 		MonoObject* managedInstance = metaData.scriptClass->createInstance(params, 3);
 		MonoObject* managedInstance = metaData.scriptClass->createInstance(params, 3);
 
 
-		ScriptSerializableDictionary* nativeInstance = new (bs_alloc<ScriptSerializableDictionary>()) ScriptSerializableDictionary(managedInstance, typeInfo);
+		ScriptSerializableDictionary* nativeInstance = new (bs_alloc<ScriptSerializableDictionary>()) ScriptSerializableDictionary(managedInstance, dictTypeInfo);
 
 
 		return nativeInstance;
 		return nativeInstance;
 	}
 	}

+ 6 - 4
SBansheeEngine/Source/BsScriptSerializableList.cpp

@@ -20,15 +20,17 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_CreateProperty", &ScriptSerializableList::internal_createProperty);
 		metaData.scriptClass->addInternalCall("Internal_CreateProperty", &ScriptSerializableList::internal_createProperty);
 	}
 	}
 
 
-	ScriptSerializableList* ScriptSerializableList::create(const ManagedSerializableTypeInfoListPtr& typeInfo, MonoObject* object)
+	ScriptSerializableList* ScriptSerializableList::create(const ScriptSerializableProperty* parentProperty)
 	{
 	{
-		MonoType* monoInternalElementType = mono_class_get_type(typeInfo->mElementType->getMonoClass());
+		ManagedSerializableTypeInfoListPtr listTypeInfo = std::static_pointer_cast<ManagedSerializableTypeInfoList>(parentProperty->getTypeInfo());
+
+		MonoType* monoInternalElementType = mono_class_get_type(listTypeInfo->mElementType->getMonoClass());
 		MonoReflectionType* internalElementType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalElementType);
 		MonoReflectionType* internalElementType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalElementType);
 
 
-		void* params[2] = { object, internalElementType };
+		void* params[2] = { internalElementType, parentProperty->getManagedInstance() };
 		MonoObject* managedInstance = metaData.scriptClass->createInstance(params, 2);
 		MonoObject* managedInstance = metaData.scriptClass->createInstance(params, 2);
 
 
-		ScriptSerializableList* nativeInstance = new (bs_alloc<ScriptSerializableList>()) ScriptSerializableList(managedInstance, typeInfo);
+		ScriptSerializableList* nativeInstance = new (bs_alloc<ScriptSerializableList>()) ScriptSerializableList(managedInstance, listTypeInfo);
 
 
 		return nativeInstance;
 		return nativeInstance;
 	}
 	}

+ 1 - 1
SBansheeEngine/Source/BsScriptSerializableObject.cpp

@@ -25,7 +25,7 @@ namespace BansheeEngine
 		FieldsField = metaData.scriptClass->getField("_fields");
 		FieldsField = metaData.scriptClass->getField("_fields");
 	}
 	}
 
 
-	ScriptSerializableObject* ScriptSerializableObject::create(ScriptSerializableProperty* property, MonoObject* object)
+	ScriptSerializableObject* ScriptSerializableObject::create(const ScriptSerializableProperty* property)
 	{
 	{
 		MonoType* monoInternalElementType = mono_class_get_type(property->getTypeInfo()->getMonoClass());
 		MonoType* monoInternalElementType = mono_class_get_type(property->getTypeInfo()->getMonoClass());
 		MonoReflectionType* internalElementType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalElementType);
 		MonoReflectionType* internalElementType = mono_type_get_object(MonoManager::instance().getDomain(), monoInternalElementType);

+ 8 - 11
SBansheeEngine/Source/BsScriptSerializableProperty.cpp

@@ -46,33 +46,30 @@ namespace BansheeEngine
 		return nativeInstance;
 		return nativeInstance;
 	}
 	}
 
 
-	MonoObject* ScriptSerializableProperty::internal_createObject(ScriptSerializableProperty* nativeInstance, MonoObject* object)
+	MonoObject* ScriptSerializableProperty::internal_createObject(ScriptSerializableProperty* nativeInstance)
 	{
 	{
-		ScriptSerializableObject* newObject = ScriptSerializableObject::create(nativeInstance, object);
+		ScriptSerializableObject* newObject = ScriptSerializableObject::create(nativeInstance);
 
 
 		return newObject->getManagedInstance();
 		return newObject->getManagedInstance();
 	}
 	}
 
 
-	MonoObject* ScriptSerializableProperty::internal_createArray(ScriptSerializableProperty* nativeInstance, MonoObject* object)
+	MonoObject* ScriptSerializableProperty::internal_createArray(ScriptSerializableProperty* nativeInstance)
 	{
 	{
-		ManagedSerializableTypeInfoArrayPtr arrayTypeInfo = std::static_pointer_cast<ManagedSerializableTypeInfoArray>(nativeInstance->mTypeInfo);
-		ScriptSerializableArray* newObject = ScriptSerializableArray::create(arrayTypeInfo, object);
+		ScriptSerializableArray* newObject = ScriptSerializableArray::create(nativeInstance);
 
 
 		return newObject->getManagedInstance();
 		return newObject->getManagedInstance();
 	}
 	}
 
 
-	MonoObject* ScriptSerializableProperty::internal_createList(ScriptSerializableProperty* nativeInstance, MonoObject* object)
+	MonoObject* ScriptSerializableProperty::internal_createList(ScriptSerializableProperty* nativeInstance)
 	{
 	{
-		ManagedSerializableTypeInfoListPtr listTypeInfo = std::static_pointer_cast<ManagedSerializableTypeInfoList>(nativeInstance->mTypeInfo);
-		ScriptSerializableList* newObject = ScriptSerializableList::create(listTypeInfo, object);
+		ScriptSerializableList* newObject = ScriptSerializableList::create(nativeInstance);
 
 
 		return newObject->getManagedInstance();
 		return newObject->getManagedInstance();
 	}
 	}
 
 
-	MonoObject* ScriptSerializableProperty::internal_createDictionary(ScriptSerializableProperty* nativeInstance, MonoObject* object)
+	MonoObject* ScriptSerializableProperty::internal_createDictionary(ScriptSerializableProperty* nativeInstance)
 	{
 	{
-		ManagedSerializableTypeInfoDictionaryPtr dictTypeInfo = std::static_pointer_cast<ManagedSerializableTypeInfoDictionary>(nativeInstance->mTypeInfo);
-		ScriptSerializableDictionary* newObject = ScriptSerializableDictionary::create(dictTypeInfo, object);
+		ScriptSerializableDictionary* newObject = ScriptSerializableDictionary::create(nativeInstance);
 
 
 		return newObject->getManagedInstance();
 		return newObject->getManagedInstance();
 	}
 	}

+ 0 - 4
TODO.txt

@@ -54,10 +54,6 @@ Code quality improvements:
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 Polish
 Polish
 
 
-TODO:
- - Thoroughly test inspector
- - Writing on a child struct field unfocused input because the inspector gets rebuilt - delay rebuild until user unfocuses from the input box?
-
 Ribek use:
 Ribek use:
  - Camera, Renderable, Material, Texture inspector
  - Camera, Renderable, Material, Texture inspector
   - Material/Shader has no color type so I cannot know when to display normal vector and when color in inspector
   - Material/Shader has no color type so I cannot know when to display normal vector and when color in inspector