Browse Source

More work on improving documentation for doxygen generation

BearishSun 9 years ago
parent
commit
f1032db560
63 changed files with 7026 additions and 7133 deletions
  1. 2 0
      Source/BansheePhysX/Include/BsPhysXPrerequisites.h
  2. 106 100
      Source/SBansheeEngine/Include/BsManagedComponentRTTI.h
  3. 33 29
      Source/SBansheeEngine/Include/BsManagedDiff.h
  4. 62 56
      Source/SBansheeEngine/Include/BsManagedResourceMetaDataRTTI.h
  5. 74 68
      Source/SBansheeEngine/Include/BsManagedResourceRTTI.h
  6. 174 186
      Source/SBansheeEngine/Include/BsManagedSerializableArray.h
  7. 110 104
      Source/SBansheeEngine/Include/BsManagedSerializableArrayRTTI.h
  8. 240 254
      Source/SBansheeEngine/Include/BsManagedSerializableDictionary.h
  9. 137 131
      Source/SBansheeEngine/Include/BsManagedSerializableDictionaryRTTI.h
  10. 270 282
      Source/SBansheeEngine/Include/BsManagedSerializableDiff.h
  11. 454 448
      Source/SBansheeEngine/Include/BsManagedSerializableDiffRTTI.h
  12. 795 967
      Source/SBansheeEngine/Include/BsManagedSerializableField.h
  13. 661 655
      Source/SBansheeEngine/Include/BsManagedSerializableFieldRTTI.h
  14. 151 167
      Source/SBansheeEngine/Include/BsManagedSerializableList.h
  15. 84 78
      Source/SBansheeEngine/Include/BsManagedSerializableListRTTI.h
  16. 151 156
      Source/SBansheeEngine/Include/BsManagedSerializableObject.h
  17. 300 358
      Source/SBansheeEngine/Include/BsManagedSerializableObjectInfo.h
  18. 485 479
      Source/SBansheeEngine/Include/BsManagedSerializableObjectInfoRTTI.h
  19. 119 113
      Source/SBansheeEngine/Include/BsManagedSerializableObjectRTTI.h
  20. 109 129
      Source/SBansheeEngine/Include/BsScriptAssemblyManager.h
  21. 33 27
      Source/SBansheeEngine/Include/BsScriptBoxCollider.h
  22. 35 29
      Source/SBansheeEngine/Include/BsScriptCapsuleCollider.h
  23. 69 63
      Source/SBansheeEngine/Include/BsScriptCharacterController.h
  24. 119 113
      Source/SBansheeEngine/Include/BsScriptCollider.h
  25. 58 52
      Source/SBansheeEngine/Include/BsScriptCollisionData.h
  26. 49 43
      Source/SBansheeEngine/Include/BsScriptControllerCollision.h
  27. 40 34
      Source/SBansheeEngine/Include/BsScriptDistanceJoint.h
  28. 179 159
      Source/SBansheeEngine/Include/BsScriptEnginePrerequisites.h
  29. 45 39
      Source/SBansheeEngine/Include/BsScriptGUI.h
  30. 54 58
      Source/SBansheeEngine/Include/BsScriptGUIButton.h
  31. 38 40
      Source/SBansheeEngine/Include/BsScriptGUIContent.h
  32. 155 164
      Source/SBansheeEngine/Include/BsScriptGUIElement.h
  33. 42 43
      Source/SBansheeEngine/Include/BsScriptGUIElementStateStyle.h
  34. 104 108
      Source/SBansheeEngine/Include/BsScriptGUIElementStyle.h
  35. 36 34
      Source/SBansheeEngine/Include/BsScriptGUIFixedSpace.h
  36. 35 33
      Source/SBansheeEngine/Include/BsScriptGUIFlexibleSpace.h
  37. 45 45
      Source/SBansheeEngine/Include/BsScriptGUIInputBox.h
  38. 31 27
      Source/SBansheeEngine/Include/BsScriptGUILabel.h
  39. 116 133
      Source/SBansheeEngine/Include/BsScriptGUILayout.h
  40. 33 29
      Source/SBansheeEngine/Include/BsScriptGUILayoutUtility.h
  41. 42 40
      Source/SBansheeEngine/Include/BsScriptGUIListBox.h
  42. 32 28
      Source/SBansheeEngine/Include/BsScriptGUIProgressBar.h
  43. 32 28
      Source/SBansheeEngine/Include/BsScriptGUIRenderTexture.h
  44. 55 54
      Source/SBansheeEngine/Include/BsScriptGUIScrollArea.h
  45. 42 42
      Source/SBansheeEngine/Include/BsScriptGUISkin.h
  46. 70 72
      Source/SBansheeEngine/Include/BsScriptGUISlider.h
  47. 33 29
      Source/SBansheeEngine/Include/BsScriptGUITexture.h
  48. 61 67
      Source/SBansheeEngine/Include/BsScriptGUIToggle.h
  49. 34 32
      Source/SBansheeEngine/Include/BsScriptGUIToggleGroup.h
  50. 52 46
      Source/SBansheeEngine/Include/BsScriptGUIWidget.h
  51. 83 77
      Source/SBansheeEngine/Include/BsScriptJoint.h
  52. 137 131
      Source/SBansheeEngine/Include/BsScriptJointCommon.h
  53. 34 28
      Source/SBansheeEngine/Include/BsScriptMeshCollider.h
  54. 68 62
      Source/SBansheeEngine/Include/BsScriptPhysics.h
  55. 45 39
      Source/SBansheeEngine/Include/BsScriptPhysicsQueryHit.h
  56. 32 26
      Source/SBansheeEngine/Include/BsScriptPlaneCollider.h
  57. 122 116
      Source/SBansheeEngine/Include/BsScriptRigidbody.h
  58. 34 28
      Source/SBansheeEngine/Include/BsScriptSphereCollider.h
  59. 45 39
      Source/SBansheeEngine/Source/BsScriptD6Joint.h
  60. 32 26
      Source/SBansheeEngine/Source/BsScriptFixedJoint.h
  61. 38 32
      Source/SBansheeEngine/Source/BsScriptHingeJoint.h
  62. 36 30
      Source/SBansheeEngine/Source/BsScriptSliderJoint.h
  63. 34 28
      Source/SBansheeEngine/Source/BsScriptSphericalJoint.h

+ 2 - 0
Source/BansheePhysX/Include/BsPhysXPrerequisites.h

@@ -28,12 +28,14 @@ namespace BansheeEngine
 
 /** @defgroup PhysX BansheePhysX
  *	NVIDIA PhysX implementation of Banshee's physics.
+ *  @{
  */
 
 /** @defgroup RTTI-Impl-PhysX RTTI types
  *  Types containing RTTI for specific classes.
  */
 
+/** @} */
 /** @} */
 
 	class PhysXRigidbody;

+ 106 - 100
Source/SBansheeEngine/Include/BsManagedComponentRTTI.h

@@ -1,101 +1,107 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGameObjectRTTI.h"
-#include "BsManagedComponent.h"
-#include "BsMonoManager.h"
-#include "BsManagedSerializableObject.h"
-#include "BsGameObjectManager.h"
-#include "BsScriptComponent.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedComponentRTTI : public RTTIType<ManagedComponent, Component, ManagedComponentRTTI>
-	{
-	private:
-		String& getNamespace(ManagedComponent* obj)
-		{
-			return obj->mNamespace;
-		}
-
-		void setNamespace(ManagedComponent* obj, String& val)
-		{
-			obj->mNamespace = val;
-		}
-
-		String& getTypename(ManagedComponent* obj)
-		{
-			return obj->mTypeName;
-		}
-
-		void setTypename(ManagedComponent* obj, String& val)
-		{
-			obj->mTypeName = val;
-		}
-
-		ManagedSerializableObjectPtr getObjectData(ManagedComponent* obj)
-		{
-			return any_cast<ManagedSerializableObjectPtr>(obj->mRTTIData);
-		}
-
-		void setObjectData(ManagedComponent* obj, ManagedSerializableObjectPtr val)
-		{
-			obj->mSerializedObjectData = val;
-		}
-
-		bool& getMissingType(ManagedComponent* obj)
-		{
-			return obj->mMissingType;
-		}
-
-		void setMissingType(ManagedComponent* obj, bool& val)
-		{
-			obj->mMissingType = val;
-		}
-
-	public:
-		ManagedComponentRTTI()
-		{
-			addPlainField("mNamespace", 0, &ManagedComponentRTTI::getNamespace, &ManagedComponentRTTI::setNamespace);
-			addPlainField("mTypename", 1, &ManagedComponentRTTI::getTypename, &ManagedComponentRTTI::setTypename);
-			addReflectablePtrField("mObjectData", 2, &ManagedComponentRTTI::getObjectData, &ManagedComponentRTTI::setObjectData);
-			addPlainField("mMissingType", 3, &ManagedComponentRTTI::getMissingType, &ManagedComponentRTTI::setMissingType);
-		}
-
-		void onSerializationStarted(IReflectable* obj) override
-		{
-			ManagedComponent* mc = static_cast<ManagedComponent*>(obj);
-			MonoObject* managedInstance = mc->getManagedInstance();
-
-			if (managedInstance != nullptr)
-				mc->mRTTIData = ManagedSerializableObject::createFromExisting(managedInstance);
-			else
-				mc->mRTTIData = mc->mSerializedObjectData;
-		}
-
-		void onSerializationEnded(IReflectable* obj) override
-		{
-			ManagedComponent* mc = static_cast<ManagedComponent*>(obj);
-			mc->mRTTIData = nullptr;
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ManagedComponent";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_ManagedComponent;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<ManagedComponent>();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsGameObjectRTTI.h"
+#include "BsManagedComponent.h"
+#include "BsMonoManager.h"
+#include "BsManagedSerializableObject.h"
+#include "BsGameObjectManager.h"
+#include "BsScriptComponent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedComponentRTTI : public RTTIType<ManagedComponent, Component, ManagedComponentRTTI>
+	{
+	private:
+		String& getNamespace(ManagedComponent* obj)
+		{
+			return obj->mNamespace;
+		}
+
+		void setNamespace(ManagedComponent* obj, String& val)
+		{
+			obj->mNamespace = val;
+		}
+
+		String& getTypename(ManagedComponent* obj)
+		{
+			return obj->mTypeName;
+		}
+
+		void setTypename(ManagedComponent* obj, String& val)
+		{
+			obj->mTypeName = val;
+		}
+
+		ManagedSerializableObjectPtr getObjectData(ManagedComponent* obj)
+		{
+			return any_cast<ManagedSerializableObjectPtr>(obj->mRTTIData);
+		}
+
+		void setObjectData(ManagedComponent* obj, ManagedSerializableObjectPtr val)
+		{
+			obj->mSerializedObjectData = val;
+		}
+
+		bool& getMissingType(ManagedComponent* obj)
+		{
+			return obj->mMissingType;
+		}
+
+		void setMissingType(ManagedComponent* obj, bool& val)
+		{
+			obj->mMissingType = val;
+		}
+
+	public:
+		ManagedComponentRTTI()
+		{
+			addPlainField("mNamespace", 0, &ManagedComponentRTTI::getNamespace, &ManagedComponentRTTI::setNamespace);
+			addPlainField("mTypename", 1, &ManagedComponentRTTI::getTypename, &ManagedComponentRTTI::setTypename);
+			addReflectablePtrField("mObjectData", 2, &ManagedComponentRTTI::getObjectData, &ManagedComponentRTTI::setObjectData);
+			addPlainField("mMissingType", 3, &ManagedComponentRTTI::getMissingType, &ManagedComponentRTTI::setMissingType);
+		}
+
+		void onSerializationStarted(IReflectable* obj) override
+		{
+			ManagedComponent* mc = static_cast<ManagedComponent*>(obj);
+			MonoObject* managedInstance = mc->getManagedInstance();
+
+			if (managedInstance != nullptr)
+				mc->mRTTIData = ManagedSerializableObject::createFromExisting(managedInstance);
+			else
+				mc->mRTTIData = mc->mSerializedObjectData;
+		}
+
+		void onSerializationEnded(IReflectable* obj) override
+		{
+			ManagedComponent* mc = static_cast<ManagedComponent*>(obj);
+			mc->mRTTIData = nullptr;
+		}
+
+		virtual const String& getRTTIName() override
+		{
+			static String name = "ManagedComponent";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId() override
+		{
+			return TID_ManagedComponent;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<ManagedComponent>();
+		}
+	};
+
+	/** @} */
 }

+ 33 - 29
Source/SBansheeEngine/Include/BsManagedDiff.h

@@ -1,30 +1,34 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsBinaryDiff.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Diff handler that performs RTTI object diff for
-	 *			managed objects. Managed objects require special diff
-	 *			handling since their serialization works differently.
-	 */
-	class BS_SCR_BE_EXPORT ManagedDiff : public IDiff
-	{
-	protected:
-		/**
-		 * @copydoc	IDiff::generateDiff(const SPtr<SerializedObject>&, const SPtr<SerializedObject>&, ObjectMap&)
-		 */
-		SPtr<SerializedObject> generateDiff(const SPtr<SerializedObject>& orgSerzObj,
-			const SPtr<SerializedObject>& newSerzObj, ObjectMap& objectMap) override;
-
-		/**
-		 * @copydoc	IDiff::applyDiff(const SPtr<IReflectable>&, const SPtr<SerializedObject>&, DiffObjectMap&, Vector<DiffCommand>&)
-		 */
-		void applyDiff(const SPtr<IReflectable>& object, const SPtr<SerializedObject>& serzDiff,
-			DiffObjectMap& objectMap, Vector<DiffCommand>& diffCommands) override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsBinaryDiff.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**
+	 * Diff handler that performs RTTI object diff for managed objects. Managed objects require special diff handling since
+	 * their serialization works differently.
+	 */
+	class BS_SCR_BE_EXPORT ManagedDiff : public IDiff
+	{
+	protected:
+		/** @copydoc IDiff::generateDiff(const SPtr<SerializedObject>&, const SPtr<SerializedObject>&, ObjectMap&) */
+		SPtr<SerializedObject> generateDiff(const SPtr<SerializedObject>& orgSerzObj,
+			const SPtr<SerializedObject>& newSerzObj, ObjectMap& objectMap) override;
+
+		/**
+		 * @copydoc	IDiff::applyDiff(const SPtr<IReflectable>&, const SPtr<SerializedObject>&, 
+		 *			DiffObjectMap&, Vector<DiffCommand>&)
+		 */
+		void applyDiff(const SPtr<IReflectable>& object, const SPtr<SerializedObject>& serzDiff,
+			DiffObjectMap& objectMap, Vector<DiffCommand>& diffCommands) override;
+	};
+
+	/** @} */
 }

+ 62 - 56
Source/SBansheeEngine/Include/BsManagedResourceMetaDataRTTI.h

@@ -1,57 +1,63 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsManagedResourceMetaData.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedResourceMetaDataRTTI : public RTTIType<ManagedResourceMetaData, ResourceMetaData, ManagedResourceMetaDataRTTI>
-	{
-	private:
-		String& getNamespace(ManagedResourceMetaData* obj)
-		{
-			return obj->typeNamespace;
-		}
-
-		void setNamespace(ManagedResourceMetaData* obj, String& val)
-		{
-			obj->typeNamespace = val;
-		}
-
-		String& getTypename(ManagedResourceMetaData* obj)
-		{
-			return obj->typeName;
-		}
-
-		void setTypename(ManagedResourceMetaData* obj, String& val)
-		{
-			obj->typeName = val;
-		}
-
-	public:
-		ManagedResourceMetaDataRTTI()
-		{
-			addPlainField("mTypeNamespace", 0, &ManagedResourceMetaDataRTTI::getNamespace, &ManagedResourceMetaDataRTTI::setNamespace);
-			addPlainField("mTypeName", 1, &ManagedResourceMetaDataRTTI::getTypename, &ManagedResourceMetaDataRTTI::setTypename);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ManagedResourceMetaData";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ManagedResourceMetaData;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return bs_shared_ptr_new<ManagedResourceMetaData>();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsManagedResourceMetaData.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedResourceMetaDataRTTI : public RTTIType<ManagedResourceMetaData, ResourceMetaData, ManagedResourceMetaDataRTTI>
+	{
+	private:
+		String& getNamespace(ManagedResourceMetaData* obj)
+		{
+			return obj->typeNamespace;
+		}
+
+		void setNamespace(ManagedResourceMetaData* obj, String& val)
+		{
+			obj->typeNamespace = val;
+		}
+
+		String& getTypename(ManagedResourceMetaData* obj)
+		{
+			return obj->typeName;
+		}
+
+		void setTypename(ManagedResourceMetaData* obj, String& val)
+		{
+			obj->typeName = val;
+		}
+
+	public:
+		ManagedResourceMetaDataRTTI()
+		{
+			addPlainField("mTypeNamespace", 0, &ManagedResourceMetaDataRTTI::getNamespace, &ManagedResourceMetaDataRTTI::setNamespace);
+			addPlainField("mTypeName", 1, &ManagedResourceMetaDataRTTI::getTypename, &ManagedResourceMetaDataRTTI::setTypename);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ManagedResourceMetaData";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ManagedResourceMetaData;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedResourceMetaData>();
+		}
+	};
+
+	/** @} */
 }

+ 74 - 68
Source/SBansheeEngine/Include/BsManagedResourceRTTI.h

@@ -1,69 +1,75 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsResourceRTTI.h"
-#include "BsManagedResource.h"
-#include "BsMonoManager.h"
-#include "BsManagedSerializableObject.h"
-#include "BsResources.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedResourceRTTI : public RTTIType<ManagedResource, Resource, ManagedResourceRTTI>
-	{
-	private:
-		ManagedSerializableObjectPtr getObjectData(ManagedResource* obj)
-		{
-			return any_cast<ManagedSerializableObjectPtr>(obj->mRTTIData);
-		}
-
-		void setObjectData(ManagedResource* obj, ManagedSerializableObjectPtr val)
-		{
-			obj->mRTTIData = val;
-		}
-
-	public:
-		ManagedResourceRTTI()
-		{
-			addReflectablePtrField("mObjectData", 0, &ManagedResourceRTTI::getObjectData, &ManagedResourceRTTI::setObjectData);
-		}
-
-		void onSerializationStarted(IReflectable* obj)
-		{
-			ManagedResource* mc = static_cast<ManagedResource*>(obj);
-
-			mc->mRTTIData = ManagedSerializableObject::createFromExisting(mc->getManagedInstance());
-		}
-
-		virtual void onDeserializationEnded(IReflectable* obj)
-		{
-			ManagedResource* mr = static_cast<ManagedResource*>(obj);
-			ManagedSerializableObjectPtr serializableObject = any_cast<ManagedSerializableObjectPtr>(mr->mRTTIData);
-			serializableObject->deserialize();
-
-			ResourcePtr mrPtr = std::static_pointer_cast<Resource>(mr->getThisPtr());
-			HManagedResource handle = static_resource_cast<ManagedResource>(gResources()._createResourceHandle(mrPtr));
-			mr->setHandle(serializableObject->getManagedInstance(), handle);
-			mr->mRTTIData = nullptr;
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ManagedResource";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ManagedResource;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedResource::createEmpty();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsResourceRTTI.h"
+#include "BsManagedResource.h"
+#include "BsMonoManager.h"
+#include "BsManagedSerializableObject.h"
+#include "BsResources.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedResourceRTTI : public RTTIType<ManagedResource, Resource, ManagedResourceRTTI>
+	{
+	private:
+		ManagedSerializableObjectPtr getObjectData(ManagedResource* obj)
+		{
+			return any_cast<ManagedSerializableObjectPtr>(obj->mRTTIData);
+		}
+
+		void setObjectData(ManagedResource* obj, ManagedSerializableObjectPtr val)
+		{
+			obj->mRTTIData = val;
+		}
+
+	public:
+		ManagedResourceRTTI()
+		{
+			addReflectablePtrField("mObjectData", 0, &ManagedResourceRTTI::getObjectData, &ManagedResourceRTTI::setObjectData);
+		}
+
+		void onSerializationStarted(IReflectable* obj) override
+		{
+			ManagedResource* mc = static_cast<ManagedResource*>(obj);
+
+			mc->mRTTIData = ManagedSerializableObject::createFromExisting(mc->getManagedInstance());
+		}
+
+		void onDeserializationEnded(IReflectable* obj) override
+		{
+			ManagedResource* mr = static_cast<ManagedResource*>(obj);
+			ManagedSerializableObjectPtr serializableObject = any_cast<ManagedSerializableObjectPtr>(mr->mRTTIData);
+			serializableObject->deserialize();
+
+			ResourcePtr mrPtr = std::static_pointer_cast<Resource>(mr->getThisPtr());
+			HManagedResource handle = static_resource_cast<ManagedResource>(gResources()._createResourceHandle(mrPtr));
+			mr->setHandle(serializableObject->getManagedInstance(), handle);
+			mr->mRTTIData = nullptr;
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ManagedResource";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ManagedResource;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedResource::createEmpty();
+		}
+	};
+
+	/** @} */
 }

+ 174 - 186
Source/SBansheeEngine/Include/BsManagedSerializableArray.h

@@ -1,187 +1,175 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsIReflectable.h"
-#include <mono/jit/jit.h>
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Allows access to an underlying managed array, or a cached version of that array that
-	 *			can be serialized/deserialized.
-	 *
-	 * @note	This class can be in two states:
-	 *			 - Linked - When the object has a link to a managed object. This is the default 
-	 *                      state when a new instance of ManagedSerializableObject is created.
-	 *						Any operations during this state will operate directly on the linked
-	 *						managed object.
-	 *			 - Serialized - When the object has no link to the managed object but instead just
-	 *							contains cached object and field data that may be used for initializing
-	 *							a managed object. Any operations during this state will operate
-	 *							only on the cached internal data.
-	 *			You can transfer between these states by calling serialize(linked->serialized) &
-	 *			deserialize (serialized->linked).
-	 *	
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableArray : public IReflectable
-	{
-	private:
-		struct ConstructPrivately {};
-
-	public:
-		ManagedSerializableArray(const ConstructPrivately& dummy, const ManagedSerializableTypeInfoArrayPtr& typeInfo, MonoObject* managedInstance);
-		ManagedSerializableArray(const ConstructPrivately& dummy);
-
-		/**
-		 * @brief	Returns the internal managed instance of the array. This will return null if
-		 *			the object is in serialized mode.
-		 */
-		MonoObject* getManagedInstance() const { return mManagedInstance; }
-
-		/**
-		 * @brief	Returns the type information for the internal array.
-		 */
-		ManagedSerializableTypeInfoArrayPtr getTypeInfo() const { return mArrayTypeInfo; }
-
-		/**
-		 * @brief	Changes the size of the array. Operates on managed object if in linked state, 
-		 *			or on cached data otherwise.
-		 *
-		 * @param	newSizes	Array of sizes, one per array dimension. Number of sizes
-		 *						must match number of array dimensions as specified by its type.
-		 */
-		void resize(const Vector<UINT32>& newSizes);
-
-		/**
-		 * @brief	Returns the size of a specific dimension of the array. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 */
-		UINT32 getLength(UINT32 dimension) const { return mNumElements[dimension]; }
-
-		/**
-		 * @brief	Returns the sizes of a all dimensions of the array. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 */
-		Vector<UINT32> getLengths() const { return mNumElements; }
-
-		/**
-		 * @brief	Returns the total of all sizes of all dimensions of the array. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 */
-		UINT32 getTotalLength() const;
-
-		/**
-		 * @brief	Sets a new element value at the specified array index. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 *
-		 * @param	arrayIdx	Index at which to set the value.
-		 * @param	val			Wrapper around the value to store in the array. Must be of the
-		 *						array element type.
-		 */
-		void setFieldData(UINT32 arrayIdx, const ManagedSerializableFieldDataPtr& val);
-
-		/**
-		 * @brief	Returns the element value at the specified array index. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 *
-		 * @param	arrayIdx	Index at which to retrieve the value.
-		 *
-		 * @return	A wrapper around the element value in the array.
-		 */
-		ManagedSerializableFieldDataPtr getFieldData(UINT32 arrayIdx);
-
-		/**
-		 * @brief	Serializes the internal managed object into a set of cached data that can be saved
-		 *			in memory/disk and can be deserialized later. Does nothing if object is already is 
-		 *			serialized mode. When in serialized mode the reference to the managed instance will be lost.
-		 */
-		void serialize();
-
-		/**
-		 * @brief	Deserializes a set of cached data into a managed object. This action may fail in case the cached
-		 *			data contains a type that no longer exists. You may check if it completely successfully if ::getManagedInstance
-		 *			returns non-null after.
-		 *
-		 *			This action transfers the object into linked mode. All further operations will operate directly on the managed instance
-		 *			and the cached data will be cleared. If you call this method on an already linked object the old object will be
-		 *			replaced and initialized with empty data (since cached data does not exist).
-		 */
-		void deserialize();
-
-		/**
-		 * @brief	Creates a managed serializable array that references an existing managed array. Created object will be in linked mode.
-		 *
-		 * @param	managedInstance		Constructed managed instance of the array to link with. Its type must correspond with the provided type info.
-		 * @param	typeInfo			Type information for the array and its elements.
-		 */
-		static ManagedSerializableArrayPtr createFromExisting(MonoObject* managedInstance, const ManagedSerializableTypeInfoArrayPtr& typeInfo);
-
-		/**
-		 * @brief	Creates a managed serializable array that creates and references a brand new managed array instance.
-		 *
-		 * @param	typeInfo	Type of the array to create.
-		 * @param	sizes		Array of sizes, one per array dimension. Number of sizes must match number 
-		 *						of array dimensions as specified by its type.
-		 */
-		static ManagedSerializableArrayPtr createNew(const ManagedSerializableTypeInfoArrayPtr& typeInfo, const Vector<UINT32>& sizes);
-
-		/**
-		 * @brief	Creates a managed array instance.
-		 *
-		 * @param	typeInfo	Type of the array to create.
-		 * @param	sizes		Array of sizes, one per array dimension. Number of sizes must match number 
-		 *						of array dimensions as specified by its type.
-		 */
-		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoArrayPtr& typeInfo, const Vector<UINT32>& sizes);
-
-	protected:
-		/**
-		 * @brief	Retrieves needed Mono types and methods. Should be called
-		 *			before performing any operations with the managed object.
-		 */
-		void initMonoObjects();
-
-		/**
-		 * @brief	Returns the size of the specified dimension of the array.
-		 *			Operates on the internal managed object.
-		 */
-		UINT32 getLengthInternal(UINT32 dimension) const;
-
-		/**
-		 * @brief	Sets a value at the specified index in the array.
-		 *			Operates on the internal managed object.
-		 */
-		void setValueInternal(UINT32 arrayIdx, void* val);
-
-		/**
-		 * @brief	Converts a multi-dimensional array index into
-		 *			a sequential one-dimensional index.
-		 */
-		UINT32 toSequentialIdx(const Vector<UINT32>& idx) const;
-
-		MonoObject* mManagedInstance;
-		::MonoClass* mElementMonoClass;
-		MonoMethod* mCopyMethod;
-
-		ManagedSerializableTypeInfoArrayPtr mArrayTypeInfo;
-		Vector<ManagedSerializableFieldDataPtr> mCachedEntries;
-		Vector<UINT32> mNumElements;
-		UINT32 mElemSize;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-		
-		/**
-		 * @brief	Creates an empty and uninitialized object used for serialization purposes.
-		 */
-		static ManagedSerializableArrayPtr createNew();
-
-	public:
-		friend class ManagedSerializableArrayRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsIReflectable.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**
+	 * Allows access to an underlying managed array, or a cached version of that array that can be serialized/deserialized.
+	 *
+	 * @note	
+	 * This class can be in two states:
+	 *	 - Linked - When the object has a link to a managed object. This is the default state when a new instance
+	 *				of ManagedSerializableObject is created. Any operations during this state will operate directly
+	 *				on the linked managed object.
+	 *	 - Serialized - When the object has no link to the managed object but instead just contains cached object
+	 *					and field data that may be used for initializing a managed object. Any operations during
+	 *					this state will operate only on the cached internal data.
+	 * You can transfer between these states by calling serialize(linked->serialized) & deserialize (serialized->linked).
+	 *	
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableArray : public IReflectable
+	{
+	private:
+		struct ConstructPrivately {};
+
+	public:
+		ManagedSerializableArray(const ConstructPrivately& dummy, const ManagedSerializableTypeInfoArrayPtr& typeInfo, MonoObject* managedInstance);
+		ManagedSerializableArray(const ConstructPrivately& dummy);
+
+		/**
+		 * Returns the internal managed instance of the array. This will return null if the object is in serialized mode.
+		 */
+		MonoObject* getManagedInstance() const { return mManagedInstance; }
+
+		/**	Returns the type information for the internal array. */
+		ManagedSerializableTypeInfoArrayPtr getTypeInfo() const { return mArrayTypeInfo; }
+
+		/**
+		 * Changes the size of the array. Operates on managed object if in linked state, or on cached data otherwise.
+		 *
+		 * @param[in]	newSizes	Array of sizes, one per array dimension. Number of sizes must match number of array
+		 *							dimensions as specified by its type.
+		 */
+		void resize(const Vector<UINT32>& newSizes);
+
+		/**
+		 * Returns the size of a specific dimension of the array. Operates on managed object if in linked state, or on
+		 * cached data otherwise.
+		 */
+		UINT32 getLength(UINT32 dimension) const { return mNumElements[dimension]; }
+
+		/**
+		 * Returns the sizes of a all dimensions of the array. Operates on managed object if in linked state, or on cached
+		 * data otherwise.
+		 */
+		Vector<UINT32> getLengths() const { return mNumElements; }
+
+		/**
+		 * Returns the total of all sizes of all dimensions of the array. Operates on managed object if in linked state, or
+		 * on cached data otherwise.
+		 */
+		UINT32 getTotalLength() const;
+
+		/**
+		 * Sets a new element value at the specified array index. Operates on managed object if in linked state, or on
+		 * cached data otherwise.
+		 *
+		 * @param[in]	arrayIdx	Index at which to set the value.
+		 * @param[in]	val			Wrapper around the value to store in the array. Must be of the array element type.
+		 */
+		void setFieldData(UINT32 arrayIdx, const ManagedSerializableFieldDataPtr& val);
+
+		/**
+		 * Returns the element value at the specified array index. Operates on managed object if in linked state, or on
+		 * cached data otherwise.
+		 *
+		 * @param[in]	arrayIdx	Index at which to retrieve the value.
+		 * @return					A wrapper around the element value in the array.
+		 */
+		ManagedSerializableFieldDataPtr getFieldData(UINT32 arrayIdx);
+
+		/**
+		 * Serializes the internal managed object into a set of cached data that can be saved in memory/disk and can be
+		 * deserialized later. Does nothing if object is already is serialized mode. When in serialized mode the reference
+		 * to the managed instance will be lost.
+		 */
+		void serialize();
+
+		/**
+		 * Deserializes a set of cached data into a managed object. This action may fail in case the cached data contains a
+		 * type that no longer exists. You may check if it completely successfully if getManagedInstance() returns non-null
+		 * after.
+		 *
+		 * This action transfers the object into linked mode. All further operations will operate directly on the managed
+		 * instance and the cached data will be cleared. If you call this method on an already linked object the old object
+		 * will be replaced and initialized with empty data (since cached data does not exist).
+		 */
+		void deserialize();
+
+		/**
+		 * Creates a managed serializable array that references an existing managed array. Created object will be in linked
+		 * mode.
+		 *
+		 * @param[in]	managedInstance		Constructed managed instance of the array to link with. Its type must correspond
+		 *									with the provided type info.
+		 * @param[in]	typeInfo			Type information for the array and its elements.
+		 */
+		static ManagedSerializableArrayPtr createFromExisting(MonoObject* managedInstance, const ManagedSerializableTypeInfoArrayPtr& typeInfo);
+
+		/**
+		 * Creates a managed serializable array that creates and references a brand new managed array instance.
+		 *
+		 * @param[in]	typeInfo	Type of the array to create.
+		 * @param[in]	sizes		Array of sizes, one per array dimension. Number of sizes must match number of array
+		 *							dimensions as specified by its type.
+		 */
+		static ManagedSerializableArrayPtr createNew(const ManagedSerializableTypeInfoArrayPtr& typeInfo, const Vector<UINT32>& sizes);
+
+		/**
+		 * Creates a managed array instance.
+		 *
+		 * @param[in]	typeInfo	Type of the array to create.
+		 * @param[in]	sizes		Array of sizes, one per array dimension. Number of sizes must match number of array
+		 *							dimensions as specified by its type.
+		 */
+		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoArrayPtr& typeInfo, const Vector<UINT32>& sizes);
+
+	protected:
+		/**
+		 * Retrieves needed Mono types and methods. Should be called before performing any operations with the managed
+		 * object.
+		 */
+		void initMonoObjects();
+
+		/** Returns the size of the specified dimension of the array. Operates on the internal managed object. */
+		UINT32 getLengthInternal(UINT32 dimension) const;
+
+		/**	Sets a value at the specified index in the array. Operates on the internal managed object. */
+		void setValueInternal(UINT32 arrayIdx, void* val);
+
+		/** Converts a multi-dimensional array index into a sequential one-dimensional index. */
+		UINT32 toSequentialIdx(const Vector<UINT32>& idx) const;
+
+		MonoObject* mManagedInstance;
+		::MonoClass* mElementMonoClass;
+		MonoMethod* mCopyMethod;
+
+		ManagedSerializableTypeInfoArrayPtr mArrayTypeInfo;
+		Vector<ManagedSerializableFieldDataPtr> mCachedEntries;
+		Vector<UINT32> mNumElements;
+		UINT32 mElemSize;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+		
+		/**	Creates an empty and uninitialized object used for serialization purposes. */
+		static ManagedSerializableArrayPtr createNew();
+
+	public:
+		friend class ManagedSerializableArrayRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 110 - 104
Source/SBansheeEngine/Include/BsManagedSerializableArrayRTTI.h

@@ -1,105 +1,111 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGameObjectManager.h"
-#include "BsManagedSerializableArray.h"
-#include "BsScriptAssemblyManager.h"
-#include "BsMonoManager.h"
-#include "BsMonoClass.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedSerializableArrayRTTI : public RTTIType<ManagedSerializableArray, IReflectable, ManagedSerializableArrayRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoArrayPtr getTypeInfo(ManagedSerializableArray* obj)
-		{
-			return obj->mArrayTypeInfo;
-		}
-
-		void setTypeInfo(ManagedSerializableArray* obj, ManagedSerializableTypeInfoArrayPtr val)
-		{
-			obj->mArrayTypeInfo = val;
-		}
-
-		UINT32& getElementSize(ManagedSerializableArray* obj)
-		{
-			return (UINT32&)obj->mElemSize;
-		}
-
-		void setElementSize(ManagedSerializableArray* obj, UINT32& numElements)
-		{
-			obj->mElemSize = numElements;
-		}
-
-		UINT32& getNumElements(ManagedSerializableArray* obj, UINT32 arrayIdx)
-		{
-			return (UINT32&)obj->mNumElements[arrayIdx];
-		}
-
-		void setNumElements(ManagedSerializableArray* obj, UINT32 arrayIdx, UINT32& numElements)
-		{
-			obj->mNumElements[arrayIdx] = numElements;
-		}
-
-		UINT32 getNumElementsNumEntries(ManagedSerializableArray* obj)
-		{
-			return (UINT32)obj->mNumElements.size();
-		}
-
-		void setNumElementsNumEntries(ManagedSerializableArray* obj, UINT32 numEntries)
-		{
-			obj->mNumElements.resize(numEntries);
-		}
-
-		ManagedSerializableFieldDataPtr getArrayEntry(ManagedSerializableArray* obj, UINT32 arrayIdx)
-		{
-			return obj->getFieldData(arrayIdx);
-		}
-
-		void setArrayEntry(ManagedSerializableArray* obj, UINT32 arrayIdx, ManagedSerializableFieldDataPtr val)
-		{
-			obj->setFieldData(arrayIdx, val);
-		}
-
-		UINT32 getNumArrayEntries(ManagedSerializableArray* obj)
-		{
-			return obj->getTotalLength();
-		}
-
-		void setNumArrayEntries(ManagedSerializableArray* obj, UINT32 numEntries)
-		{
-			obj->mCachedEntries = Vector<ManagedSerializableFieldDataPtr>(numEntries);
-		}
-
-	public:
-		ManagedSerializableArrayRTTI()
-		{
-			addReflectablePtrField("mArrayTypeInfo", 0, &ManagedSerializableArrayRTTI::getTypeInfo, &ManagedSerializableArrayRTTI::setTypeInfo);
-			addPlainField("mElementSize", 1, &ManagedSerializableArrayRTTI::getElementSize, &ManagedSerializableArrayRTTI::setElementSize);
-			addPlainArrayField("mNumElements", 2, &ManagedSerializableArrayRTTI::getNumElements, &ManagedSerializableArrayRTTI::getNumElementsNumEntries, 
-				&ManagedSerializableArrayRTTI::setNumElements, &ManagedSerializableArrayRTTI::setNumElementsNumEntries);
-			addReflectablePtrArrayField("mArrayEntries", 3, &ManagedSerializableArrayRTTI::getArrayEntry, &ManagedSerializableArrayRTTI::getNumArrayEntries, 
-				&ManagedSerializableArrayRTTI::setArrayEntry, &ManagedSerializableArrayRTTI::setNumArrayEntries);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptSerializableArray";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptSerializableArray;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedSerializableArray::createNew();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsGameObjectManager.h"
+#include "BsManagedSerializableArray.h"
+#include "BsScriptAssemblyManager.h"
+#include "BsMonoManager.h"
+#include "BsMonoClass.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedSerializableArrayRTTI : public RTTIType<ManagedSerializableArray, IReflectable, ManagedSerializableArrayRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoArrayPtr getTypeInfo(ManagedSerializableArray* obj)
+		{
+			return obj->mArrayTypeInfo;
+		}
+
+		void setTypeInfo(ManagedSerializableArray* obj, ManagedSerializableTypeInfoArrayPtr val)
+		{
+			obj->mArrayTypeInfo = val;
+		}
+
+		UINT32& getElementSize(ManagedSerializableArray* obj)
+		{
+			return (UINT32&)obj->mElemSize;
+		}
+
+		void setElementSize(ManagedSerializableArray* obj, UINT32& numElements)
+		{
+			obj->mElemSize = numElements;
+		}
+
+		UINT32& getNumElements(ManagedSerializableArray* obj, UINT32 arrayIdx)
+		{
+			return (UINT32&)obj->mNumElements[arrayIdx];
+		}
+
+		void setNumElements(ManagedSerializableArray* obj, UINT32 arrayIdx, UINT32& numElements)
+		{
+			obj->mNumElements[arrayIdx] = numElements;
+		}
+
+		UINT32 getNumElementsNumEntries(ManagedSerializableArray* obj)
+		{
+			return (UINT32)obj->mNumElements.size();
+		}
+
+		void setNumElementsNumEntries(ManagedSerializableArray* obj, UINT32 numEntries)
+		{
+			obj->mNumElements.resize(numEntries);
+		}
+
+		ManagedSerializableFieldDataPtr getArrayEntry(ManagedSerializableArray* obj, UINT32 arrayIdx)
+		{
+			return obj->getFieldData(arrayIdx);
+		}
+
+		void setArrayEntry(ManagedSerializableArray* obj, UINT32 arrayIdx, ManagedSerializableFieldDataPtr val)
+		{
+			obj->setFieldData(arrayIdx, val);
+		}
+
+		UINT32 getNumArrayEntries(ManagedSerializableArray* obj)
+		{
+			return obj->getTotalLength();
+		}
+
+		void setNumArrayEntries(ManagedSerializableArray* obj, UINT32 numEntries)
+		{
+			obj->mCachedEntries = Vector<ManagedSerializableFieldDataPtr>(numEntries);
+		}
+
+	public:
+		ManagedSerializableArrayRTTI()
+		{
+			addReflectablePtrField("mArrayTypeInfo", 0, &ManagedSerializableArrayRTTI::getTypeInfo, &ManagedSerializableArrayRTTI::setTypeInfo);
+			addPlainField("mElementSize", 1, &ManagedSerializableArrayRTTI::getElementSize, &ManagedSerializableArrayRTTI::setElementSize);
+			addPlainArrayField("mNumElements", 2, &ManagedSerializableArrayRTTI::getNumElements, &ManagedSerializableArrayRTTI::getNumElementsNumEntries, 
+				&ManagedSerializableArrayRTTI::setNumElements, &ManagedSerializableArrayRTTI::setNumElementsNumEntries);
+			addReflectablePtrArrayField("mArrayEntries", 3, &ManagedSerializableArrayRTTI::getArrayEntry, &ManagedSerializableArrayRTTI::getNumArrayEntries, 
+				&ManagedSerializableArrayRTTI::setArrayEntry, &ManagedSerializableArrayRTTI::setNumArrayEntries);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableArray";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptSerializableArray;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableArray::createNew();
+		}
+	};
+
+	/** @} */
 }

+ 240 - 254
Source/SBansheeEngine/Include/BsManagedSerializableDictionary.h

@@ -1,255 +1,241 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsIReflectable.h"
-#include <mono/jit/jit.h>
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Contains key and value data used for serializing a managed dictionary.
-	 */
-	struct BS_SCR_BE_EXPORT ManagedSerializableDictionaryKeyValue : public IReflectable
-	{
-		ManagedSerializableDictionaryKeyValue() {}
-		ManagedSerializableDictionaryKeyValue(const ManagedSerializableFieldDataPtr& key,
-			const ManagedSerializableFieldDataPtr& value);
-
-		ManagedSerializableFieldDataPtr key;
-		ManagedSerializableFieldDataPtr value;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableDictionaryKeyValueRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Allows access to an underlying managed dictionary, or a cached version of that dictionary that
-	 *			can be serialized/deserialized.
-	 *
-	 * @note	This class can be in two states:
-	 *			 - Linked - When the object has a link to a managed object. This is the default 
-	 *                      state when a new instance of ManagedSerializableObject is created.
-	 *						Any operations during this state will operate directly on the linked
-	 *						managed object.
-	 *			 - Serialized - When the object has no link to the managed object but instead just
-	 *							contains cached object and field data that may be used for initializing
-	 *							a managed object. Any operations during this state will operate
-	 *							only on the cached internal data.
-	 *			You can transfer between these states by calling serialize(linked->serialized) &
-	 *			deserialize (serialized->linked).
-	 *	
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableDictionary : public IReflectable
-	{
-	private:
-		struct ConstructPrivately {};
-		
-		/**
-		 * @brief	Generates a hash value for field data.
-		 */
-		struct BS_SCR_BE_EXPORT Hash
-		{
-			inline size_t operator()(const ManagedSerializableFieldDataPtr& x) const;
-		};
-
-		/**
-		 * @brief	Compares two field data objects.
-		 */
-		struct BS_SCR_BE_EXPORT Equals
-		{
-			inline bool operator()(const ManagedSerializableFieldDataPtr& a, const ManagedSerializableFieldDataPtr& b) const;
-		};
-
-	public:
-		typedef UnorderedMap<ManagedSerializableFieldDataPtr, ManagedSerializableFieldDataPtr> CachedEntriesMap;
-
-		/**
-		 * @brief	Helper class that enumerates over all entires in a managed dictionary. Operates on 
-		 *			managed object if the parent dictionary is in linked state, or on cached data otherwise.
-		 */
-		class Enumerator
-		{
-		public:
-			/**
-			 * @brief	Constructs a new enumerator for the provided managed object.
-			 *
-			 * @param	instance	Managed instance of type System.Collections.Generic.Dictionary.
-			 * @param	parent		Serializable parent of the managed instance.
-			 */
-			Enumerator(MonoObject* instance, const ManagedSerializableDictionary* parent);
-
-			/**
-			 * @brief	Returns the wrapped key data at the current enumerator position.
-			 *			Only valid to call this if enumerator is valid (i.e. last call to 
-			 *			::moveNext returned true).
-			 */
-			ManagedSerializableFieldDataPtr getKey() const;
-
-			/**
-			 * @brief	Returns the wrapped value data at the current enumerator position.
-			 *			Only valid to call this if enumerator is valid (i.e. last call to 
-			 *			::moveNext returned true).
-			 */
-			ManagedSerializableFieldDataPtr getValue() const;
-
-			/**
-			 * @brief	Moves the enumerator to the next position. Initially enumerator is
-			 *			at an invalid position and must be called at least once before accesing
-			 *			its data.
-			 *
-			 * @return	Returns if the enumerator is at valid position. When the enumerator returns
-			 *			false it means there are no more elements to enumerate.
-			 */
-			bool moveNext();
-
-		private:
-			MonoObject* mInstance;
-			MonoObject* mCurrent;
-			CachedEntriesMap::const_iterator mCachedIter;
-			bool mIteratorInitialized;
-
-			const ManagedSerializableDictionary* mParent;
-		};
-
-	public:
-		ManagedSerializableDictionary(const ConstructPrivately& dummy, const ManagedSerializableTypeInfoDictionaryPtr& typeInfo, MonoObject* managedInstance);
-		ManagedSerializableDictionary(const ConstructPrivately& dummy);
-
-		/**
-		 * @brief	Returns the internal managed instance of the dictionary. This will return null if
-		 *			the object is in serialized mode.
-		 */
-		MonoObject* getManagedInstance() const { return mManagedInstance; }
-
-		/**
-		 * @brief	Returns the type information for the internal dictionary.
-		 */
-		ManagedSerializableTypeInfoDictionaryPtr getTypeInfo() const { return mDictionaryTypeInfo; }
-
-		/**
-		 * @brief	Returns the dictionary value at the specified key. If the key doesn't exist
-		 *			the default value for the type is returned. Operates on managed object if in 
-		 *			linked state, or on cached data otherwise.
-		 *
-		 * @param	key		Wrapper around the key data at which to retrieve the value.
-		 *
-		 * @return	A wrapper around the value in the dictionary at the specified key.
-		 */
-		ManagedSerializableFieldDataPtr getFieldData(const ManagedSerializableFieldDataPtr& key);
-
-		/**
-		 * @brief	Sets the dictionary value at the specified key. Operates on managed object if in 
-		 *			linked state, or on cached data otherwise.
-		 *
-		 * @param	key		Wrapper around the key data at which to set the value.
-		 * @param	val		Wrapper around the value to set at the specified key.
-		 */
-		void setFieldData(const ManagedSerializableFieldDataPtr& key, const ManagedSerializableFieldDataPtr& val);
-
-		/**
-		 * @brief	Deletes the key/value pair at the specified key. If the key doesn't exist
-		 *			this operation does nothing. Operates on managed object if in linked state, 
-		 *			or on cached data otherwise.
-		 *
-		 * @param	key		Wrapper around the key data at which to delete the value.
-		 */
-		void removeFieldData(const ManagedSerializableFieldDataPtr& key);
-
-		/**
-		 * @brief	Checks if the dictionary contains the specified key. Operates on managed object 
-		 *			if in linked state, or on cached data otherwise.
-		 *
-		 * @param	key		Wrapper around the key data which to check.
-		 */
-		bool contains(const ManagedSerializableFieldDataPtr& key) const;
-
-		/**
-		 * @brief	Returns an enumerator object that allows you to iterate over
-		 *			all key/value pairs in the dictionary.
-		 */
-		Enumerator getEnumerator() const;
-
-		/**
-		 * @brief	Serializes the internal managed object into a set of cached data that can be saved
-		 *			in memory/disk and can be deserialized later. Does nothing if object is already is 
-		 *			serialized mode. When in serialized mode the reference to the managed instance will be lost.
-		 */
-		void serialize();
-
-		/**
-		 * @brief	Deserializes a set of cached data into a managed object. This action may fail in case the cached
-		 *			data contains a type that no longer exists. You may check if it completely successfully if ::getManagedInstance
-		 *			returns non-null after.
-		 *
-		 *			This action transfers the object into linked mode. All further operations will operate directly on the managed instance
-		 *			and the cached data will be cleared. If you call this method on an already linked object the old object will be
-		 *			replaced and initialized with empty data (since cached data does not exist).
-		 */
-		void deserialize();
-
-		/**
-		 * @brief	Creates a managed serializable dictionary that references an existing managed dictionary. Created object will be in linked mode.
-		 *
-		 * @param	managedInstance		Constructed managed instance of the dictionary to link with. Its type must correspond with the provided type info.
-		 * @param	typeInfo			Type information for the dictionary and its key/value pair.
-		 */
-		static ManagedSerializableDictionaryPtr createFromExisting(MonoObject* managedInstance, const ManagedSerializableTypeInfoDictionaryPtr& typeInfo);
-
-		/**
-		 * @brief	Creates a managed serializable dictionary that creates and references a brand new managed dictionary instance.
-		 *
-		 * @param	typeInfo	Type of the dictionary to create.
-		 */
-		static ManagedSerializableDictionaryPtr createNew(const ManagedSerializableTypeInfoDictionaryPtr& typeInfo);
-
-		/**
-		 * @brief	Creates a managed dictionary instance.
-		 *
-		 * @param	typeInfo	Type of the dictionary to create.
-		 */
-		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoDictionaryPtr& typeInfo);
-
-	protected:
-		/**
-		 * @brief	Retrieves needed Mono types and methods. Should be called
-		 *			before performing any operations with the managed object.
-		 */
-		void initMonoObjects(MonoClass* dictionaryClass);
-
-		MonoObject* mManagedInstance;
-
-		MonoMethod* mAddMethod;
-		MonoMethod* mRemoveMethod;
-		MonoMethod* mTryGetValueMethod;
-		MonoMethod* mContainsKeyMethod;
-		MonoMethod* mGetEnumerator;
-		MonoMethod* mEnumMoveNext;
-		MonoProperty* mEnumCurrentProp;
-		MonoProperty* mKeyProp;
-		MonoProperty* mValueProp;
-
-		ManagedSerializableTypeInfoDictionaryPtr mDictionaryTypeInfo;
-		CachedEntriesMap mCachedEntries;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-		
-		/**
-		 * @brief	Creates an empty and uninitialized object used for serialization purposes.
-		 */
-		static ManagedSerializableDictionaryPtr createEmpty();
-
-	public:
-		friend class ManagedSerializableDictionaryRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsIReflectable.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**	Contains key and value data used for serializing a managed dictionary. */
+	struct BS_SCR_BE_EXPORT ManagedSerializableDictionaryKeyValue : public IReflectable
+	{
+		ManagedSerializableDictionaryKeyValue() {}
+		ManagedSerializableDictionaryKeyValue(const ManagedSerializableFieldDataPtr& key,
+			const ManagedSerializableFieldDataPtr& value);
+
+		ManagedSerializableFieldDataPtr key;
+		ManagedSerializableFieldDataPtr value;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableDictionaryKeyValueRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Allows access to an underlying managed dictionary, or a cached version of that dictionary that can be
+	 * serialized/deserialized.
+	 *
+	 * @note
+	 * This class can be in two states:
+	 *	 - Linked - When the object has a link to a managed object. This is the default state when a new instance
+	 *				of ManagedSerializableObject is created. Any operations during this state will operate directly
+	 *				on the linked managed object.
+	 *	 - Serialized - When the object has no link to the managed object but instead just contains cached object
+	 *					and field data that may be used for initializing a managed object. Any operations during
+	 *					this state will operate only on the cached internal data.
+	 * You can transfer between these states by calling serialize(linked->serialized) & deserialize (serialized->linked).
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableDictionary : public IReflectable
+	{
+	private:
+		struct ConstructPrivately {};
+		
+		/**	Generates a hash value for field data. */
+		struct BS_SCR_BE_EXPORT Hash
+		{
+			inline size_t operator()(const ManagedSerializableFieldDataPtr& x) const;
+		};
+
+		/**	Compares two field data objects. */
+		struct BS_SCR_BE_EXPORT Equals
+		{
+			inline bool operator()(const ManagedSerializableFieldDataPtr& a, const ManagedSerializableFieldDataPtr& b) const;
+		};
+
+	public:
+		typedef UnorderedMap<ManagedSerializableFieldDataPtr, ManagedSerializableFieldDataPtr> CachedEntriesMap;
+
+		/**
+		 * Helper class that enumerates over all entires in a managed dictionary. Operates on managed object if the parent
+		 * dictionary is in linked state, or on cached data otherwise.
+		 */
+		class Enumerator
+		{
+		public:
+			/**
+			 * Constructs a new enumerator for the provided managed object.
+			 *
+			 * @param[in]	instance	Managed instance of type System.Collections.Generic.Dictionary.
+			 * @param[in]	parent		Serializable parent of the managed instance.
+			 */
+			Enumerator(MonoObject* instance, const ManagedSerializableDictionary* parent);
+
+			/**
+			 * Returns the wrapped key data at the current enumerator position. Only valid to call this if enumerator is
+			 * valid (i.e. last call to moveNext() returned true).
+			 */
+			ManagedSerializableFieldDataPtr getKey() const;
+
+			/**
+			 * Returns the wrapped value data at the current enumerator position. Only valid to call this if enumerator is
+			 * valid (i.e. last call to moveNext() returned true).
+			 */
+			ManagedSerializableFieldDataPtr getValue() const;
+
+			/**
+			 * Moves the enumerator to the next position. Initially enumerator is at an invalid position and must be called
+			 * at least once before accesing its data.
+			 *
+			 * @return	Returns if the enumerator is at valid position. When the enumerator returns false it means there are
+			 *			no more elements to enumerate.
+			 */
+			bool moveNext();
+
+		private:
+			MonoObject* mInstance;
+			MonoObject* mCurrent;
+			CachedEntriesMap::const_iterator mCachedIter;
+			bool mIteratorInitialized;
+
+			const ManagedSerializableDictionary* mParent;
+		};
+
+	public:
+		ManagedSerializableDictionary(const ConstructPrivately& dummy, const ManagedSerializableTypeInfoDictionaryPtr& typeInfo, MonoObject* managedInstance);
+		ManagedSerializableDictionary(const ConstructPrivately& dummy);
+
+		/**
+		 * Returns the internal managed instance of the dictionary. This will return null if the object is in serialized
+		 * mode.
+		 */
+		MonoObject* getManagedInstance() const { return mManagedInstance; }
+
+		/**	Returns the type information for the internal dictionary. */
+		ManagedSerializableTypeInfoDictionaryPtr getTypeInfo() const { return mDictionaryTypeInfo; }
+
+		/**
+		 * Returns the dictionary value at the specified key. If the key doesn't exist the default value for the type is
+		 * returned. Operates on managed object if in linked state, or on cached data otherwise.
+		 *
+		 * @param[in]	key		Wrapper around the key data at which to retrieve the value.
+		 * @return				A wrapper around the value in the dictionary at the specified key.
+		 */
+		ManagedSerializableFieldDataPtr getFieldData(const ManagedSerializableFieldDataPtr& key);
+
+		/**
+		 * Sets the dictionary value at the specified key. Operates on managed object if in linked state, or on cached data
+		 * otherwise.
+		 *
+		 * @param[in]	key		Wrapper around the key data at which to set the value.
+		 * @param[in]	val		Wrapper around the value to set at the specified key.
+		 */
+		void setFieldData(const ManagedSerializableFieldDataPtr& key, const ManagedSerializableFieldDataPtr& val);
+
+		/**
+		 * Deletes the key/value pair at the specified key. If the key doesn't exist this operation does nothing. Operates
+		 * on managed object if in linked state, or on cached data otherwise.
+		 *
+		 * @param[in]	key		Wrapper around the key data at which to delete the value.
+		 */
+		void removeFieldData(const ManagedSerializableFieldDataPtr& key);
+
+		/**
+		 * Checks if the dictionary contains the specified key. Operates on managed object if in linked state, or on cached
+		 * data otherwise.
+		 *
+		 * @param[in]	key		Wrapper around the key data which to check.
+		 */
+		bool contains(const ManagedSerializableFieldDataPtr& key) const;
+
+		/** Returns an enumerator object that allows you to iterate over all key/value pairs in the dictionary. */
+		Enumerator getEnumerator() const;
+
+		/**
+		 * Serializes the internal managed object into a set of cached data that can be saved in memory/disk and can be
+		 * deserialized later. Does nothing if object is already is serialized mode. When in serialized mode the reference
+		 * to the managed instance will be lost.
+		 */
+		void serialize();
+
+		/**
+		 * Deserializes a set of cached data into a managed object. This action may fail in case the cached	data contains a
+		 * type that no longer exists. You may check if it completely successfully if getManagedInstance() returns non-null
+		 * after.
+		 *
+		 * This action transfers the object into linked mode. All further operations will operate directly on the managed
+		 * instance and the cached data will be cleared. If you call this method on an already linked object the old object
+		 * will be replaced and initialized with empty data (since cached data does not exist).
+		 */
+		void deserialize();
+
+		/**
+		 * Creates a managed serializable dictionary that references an existing managed dictionary. Created object will be
+		 * in linked mode.
+		 *
+		 * @param[in]	managedInstance		Constructed managed instance of the dictionary to link with. Its type must
+		 *									correspond with the provided type info.
+		 * @param[in]	typeInfo			Type information for the dictionary and its key/value pair.
+		 */
+		static ManagedSerializableDictionaryPtr createFromExisting(MonoObject* managedInstance, const ManagedSerializableTypeInfoDictionaryPtr& typeInfo);
+
+		/**
+		 * Creates a managed serializable dictionary that creates and references a brand new managed dictionary instance.
+		 *
+		 * @param[in]	typeInfo	Type of the dictionary to create.
+		 */
+		static ManagedSerializableDictionaryPtr createNew(const ManagedSerializableTypeInfoDictionaryPtr& typeInfo);
+
+		/**
+		 * Creates a managed dictionary instance.
+		 *
+		 * @param[in]	typeInfo	Type of the dictionary to create.
+		 */
+		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoDictionaryPtr& typeInfo);
+
+	protected:
+		/**
+		 * Retrieves needed Mono types and methods. Should be called before performing any operations with the managed
+		 * object.
+		 */
+		void initMonoObjects(MonoClass* dictionaryClass);
+
+		MonoObject* mManagedInstance;
+
+		MonoMethod* mAddMethod;
+		MonoMethod* mRemoveMethod;
+		MonoMethod* mTryGetValueMethod;
+		MonoMethod* mContainsKeyMethod;
+		MonoMethod* mGetEnumerator;
+		MonoMethod* mEnumMoveNext;
+		MonoProperty* mEnumCurrentProp;
+		MonoProperty* mKeyProp;
+		MonoProperty* mValueProp;
+
+		ManagedSerializableTypeInfoDictionaryPtr mDictionaryTypeInfo;
+		CachedEntriesMap mCachedEntries;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+		
+		/**	Creates an empty and uninitialized object used for serialization purposes. */
+		static ManagedSerializableDictionaryPtr createEmpty();
+
+	public:
+		friend class ManagedSerializableDictionaryRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 137 - 131
Source/SBansheeEngine/Include/BsManagedSerializableDictionaryRTTI.h

@@ -1,132 +1,138 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsManagedSerializableDictionary.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedSerializableDictionaryKeyValueRTTI : 
-		public RTTIType <ManagedSerializableDictionaryKeyValue, IReflectable, ManagedSerializableDictionaryKeyValueRTTI>
-	{
-	private:
-		ManagedSerializableFieldDataPtr getKey(ManagedSerializableDictionaryKeyValue* obj)
-		{
-			return obj->key;
-		}
-
-		void setKey(ManagedSerializableDictionaryKeyValue* obj, ManagedSerializableFieldDataPtr val)
-		{
-			obj->key = val;
-		}
-
-		ManagedSerializableFieldDataPtr getValue(ManagedSerializableDictionaryKeyValue* obj)
-		{
-			return obj->value;
-		}
-
-		void setValue(ManagedSerializableDictionaryKeyValue* obj, ManagedSerializableFieldDataPtr val)
-		{
-			obj->value = val;
-		}
-
-	public:
-		ManagedSerializableDictionaryKeyValueRTTI()
-		{
-			addReflectablePtrField("key", 0, &ManagedSerializableDictionaryKeyValueRTTI::getKey, &ManagedSerializableDictionaryKeyValueRTTI::setKey);
-			addReflectablePtrField("value", 1, &ManagedSerializableDictionaryKeyValueRTTI::getValue, &ManagedSerializableDictionaryKeyValueRTTI::setValue);
-		}
-		
-		virtual const String& getRTTIName()
-		{
-			static String name = "ManagedSerializableDictionaryKeyValue";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptSerializableDictionaryKeyValue;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return bs_shared_ptr_new<ManagedSerializableDictionaryKeyValue>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableDictionaryRTTI : public RTTIType<ManagedSerializableDictionary, IReflectable, ManagedSerializableDictionaryRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoDictionaryPtr getTypeInfo(ManagedSerializableDictionary* obj) { return obj->mDictionaryTypeInfo; }
-		void setTypeInfo(ManagedSerializableDictionary* obj, ManagedSerializableTypeInfoDictionaryPtr val) { obj->mDictionaryTypeInfo = val; }
-
-		ManagedSerializableDictionaryKeyValue& getEntry(ManagedSerializableDictionary* obj, UINT32 arrayIdx)
-		{ 
-			Vector<ManagedSerializableDictionaryKeyValue>& sequentialData = any_cast_ref<Vector<ManagedSerializableDictionaryKeyValue>>(obj->mRTTIData);
-
-			return sequentialData[arrayIdx];
-		}
-
-		void setEntry(ManagedSerializableDictionary* obj, UINT32 arrayIdx, ManagedSerializableDictionaryKeyValue& val)
-		{ 
-			obj->setFieldData(val.key, val.value);
-		}
-
-		UINT32 getNumEntries(ManagedSerializableDictionary* obj) 
-		{ 
-			Vector<ManagedSerializableDictionaryKeyValue>& sequentialData = any_cast_ref<Vector<ManagedSerializableDictionaryKeyValue>>(obj->mRTTIData);
-
-			return (UINT32)sequentialData.size();
-		}
-
-		void setNumEntries(ManagedSerializableDictionary* obj, UINT32 numEntries) 
-		{ 
-			// Do nothing
-		}
-		
-	public:
-		ManagedSerializableDictionaryRTTI()
-		{
-			addReflectablePtrField("mListTypeInfo", 0, &ManagedSerializableDictionaryRTTI::getTypeInfo, &ManagedSerializableDictionaryRTTI::setTypeInfo);
-			addReflectableArrayField("mEntries", 1, &ManagedSerializableDictionaryRTTI::getEntry, &ManagedSerializableDictionaryRTTI::getNumEntries,
-				&ManagedSerializableDictionaryRTTI::setEntry, &ManagedSerializableDictionaryRTTI::setNumEntries);
-		}
-
-		virtual void onSerializationStarted(IReflectable* obj) override
-		{
-			ManagedSerializableDictionary* serializableObject = static_cast<ManagedSerializableDictionary*>(obj);
-
-			Vector<ManagedSerializableDictionaryKeyValue> sequentialData;
-			auto enumerator = serializableObject->getEnumerator();
-
-			while (enumerator.moveNext())
-				sequentialData.push_back(ManagedSerializableDictionaryKeyValue(enumerator.getKey(), enumerator.getValue()));
-
-			serializableObject->mRTTIData = sequentialData;
-		}
-
-		virtual void onSerializationEnded(IReflectable* obj) override
-		{
-			ManagedSerializableDictionary* serializableObject = static_cast<ManagedSerializableDictionary*>(obj);
-			serializableObject->mRTTIData = nullptr;
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableDictionary";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_ScriptSerializableDictionary;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedSerializableDictionary::createEmpty();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsManagedSerializableDictionary.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedSerializableDictionaryKeyValueRTTI : 
+		public RTTIType <ManagedSerializableDictionaryKeyValue, IReflectable, ManagedSerializableDictionaryKeyValueRTTI>
+	{
+	private:
+		ManagedSerializableFieldDataPtr getKey(ManagedSerializableDictionaryKeyValue* obj)
+		{
+			return obj->key;
+		}
+
+		void setKey(ManagedSerializableDictionaryKeyValue* obj, ManagedSerializableFieldDataPtr val)
+		{
+			obj->key = val;
+		}
+
+		ManagedSerializableFieldDataPtr getValue(ManagedSerializableDictionaryKeyValue* obj)
+		{
+			return obj->value;
+		}
+
+		void setValue(ManagedSerializableDictionaryKeyValue* obj, ManagedSerializableFieldDataPtr val)
+		{
+			obj->value = val;
+		}
+
+	public:
+		ManagedSerializableDictionaryKeyValueRTTI()
+		{
+			addReflectablePtrField("key", 0, &ManagedSerializableDictionaryKeyValueRTTI::getKey, &ManagedSerializableDictionaryKeyValueRTTI::setKey);
+			addReflectablePtrField("value", 1, &ManagedSerializableDictionaryKeyValueRTTI::getValue, &ManagedSerializableDictionaryKeyValueRTTI::setValue);
+		}
+		
+		const String& getRTTIName() override
+		{
+			static String name = "ManagedSerializableDictionaryKeyValue";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptSerializableDictionaryKeyValue;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableDictionaryKeyValue>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableDictionaryRTTI : public RTTIType<ManagedSerializableDictionary, IReflectable, ManagedSerializableDictionaryRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoDictionaryPtr getTypeInfo(ManagedSerializableDictionary* obj) { return obj->mDictionaryTypeInfo; }
+		void setTypeInfo(ManagedSerializableDictionary* obj, ManagedSerializableTypeInfoDictionaryPtr val) { obj->mDictionaryTypeInfo = val; }
+
+		ManagedSerializableDictionaryKeyValue& getEntry(ManagedSerializableDictionary* obj, UINT32 arrayIdx)
+		{ 
+			Vector<ManagedSerializableDictionaryKeyValue>& sequentialData = any_cast_ref<Vector<ManagedSerializableDictionaryKeyValue>>(obj->mRTTIData);
+
+			return sequentialData[arrayIdx];
+		}
+
+		void setEntry(ManagedSerializableDictionary* obj, UINT32 arrayIdx, ManagedSerializableDictionaryKeyValue& val)
+		{ 
+			obj->setFieldData(val.key, val.value);
+		}
+
+		UINT32 getNumEntries(ManagedSerializableDictionary* obj) 
+		{ 
+			Vector<ManagedSerializableDictionaryKeyValue>& sequentialData = any_cast_ref<Vector<ManagedSerializableDictionaryKeyValue>>(obj->mRTTIData);
+
+			return (UINT32)sequentialData.size();
+		}
+
+		void setNumEntries(ManagedSerializableDictionary* obj, UINT32 numEntries) 
+		{ 
+			// Do nothing
+		}
+		
+	public:
+		ManagedSerializableDictionaryRTTI()
+		{
+			addReflectablePtrField("mListTypeInfo", 0, &ManagedSerializableDictionaryRTTI::getTypeInfo, &ManagedSerializableDictionaryRTTI::setTypeInfo);
+			addReflectableArrayField("mEntries", 1, &ManagedSerializableDictionaryRTTI::getEntry, &ManagedSerializableDictionaryRTTI::getNumEntries,
+				&ManagedSerializableDictionaryRTTI::setEntry, &ManagedSerializableDictionaryRTTI::setNumEntries);
+		}
+
+		void onSerializationStarted(IReflectable* obj) override
+		{
+			ManagedSerializableDictionary* serializableObject = static_cast<ManagedSerializableDictionary*>(obj);
+
+			Vector<ManagedSerializableDictionaryKeyValue> sequentialData;
+			auto enumerator = serializableObject->getEnumerator();
+
+			while (enumerator.moveNext())
+				sequentialData.push_back(ManagedSerializableDictionaryKeyValue(enumerator.getKey(), enumerator.getValue()));
+
+			serializableObject->mRTTIData = sequentialData;
+		}
+
+		void onSerializationEnded(IReflectable* obj) override
+		{
+			ManagedSerializableDictionary* serializableObject = static_cast<ManagedSerializableDictionary*>(obj);
+			serializableObject->mRTTIData = nullptr;
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableDictionary";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptSerializableDictionary;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableDictionary::createEmpty();
+		}
+	};
+
+	/** @} */
 }

+ 270 - 282
Source/SBansheeEngine/Include/BsManagedSerializableDiff.h

@@ -1,283 +1,271 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsIReflectable.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles creation and applying of managed diffs. A diff contains differences
-	 *			between two objects of identical types. If the initial state of an object
-	 *			is known the recorded differences can be saved and applied to the original
-	 *			state to restore the modified object.
-	 *
-	 *			Differences are recorded per primitive field in an object. 
-	 *			Complex objects are recursed. Special handling is implemented
-	 *			to properly generate diffs for arrays, lists and dictionaries.
-	 *
-	 *			All primitive types supported by managed serialization are supported.
-	 *			(see ScriptPrimitiveType)
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableDiff : public IReflectable
-	{
-	public:
-		/**
-		 * @brief	A base class for all modifications recorded in a diff.
-		 */
-		struct BS_SCR_BE_EXPORT Modification : public IReflectable
-		{
-			virtual ~Modification();
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModificationRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-		/**
-		 * @brief	Contains a modification of a specific field in an object along
-		 *			with information about the field and its parent object.
-		 */
-		struct BS_SCR_BE_EXPORT ModifiedField : public IReflectable
-		{
-			ModifiedField() { }
-			ModifiedField(const ManagedSerializableTypeInfoPtr& parentType,
-				const ManagedSerializableFieldInfoPtr& fieldType, const SPtr<Modification>& modification);
-
-			ManagedSerializableTypeInfoPtr parentType; /**< Type of the parent object the field belongs to. */
-			ManagedSerializableFieldInfoPtr fieldType; /**< Data type of the field. */
-			SPtr<Modification> modification; /**< Recorded modification(s) on the field. */
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModifiedFieldRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-		/**
-		 * @brief	Represents a single modified array or list entry.
-		 */
-		struct BS_SCR_BE_EXPORT ModifiedArrayEntry : public IReflectable
-		{
-			ModifiedArrayEntry() { }
-			ModifiedArrayEntry(UINT32 idx, const SPtr<Modification>& modification);
-
-			UINT32 idx; /**< Index of the array/list entry that is modified. */
-			SPtr<Modification> modification; /**< Recorded modification(s) on the entry. */
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModifiedArrayEntryRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-		/**
-		 * @brief	Represents a single modified dictionary entry.
-		 */
-		struct BS_SCR_BE_EXPORT ModifiedDictionaryEntry : public IReflectable
-		{
-			ModifiedDictionaryEntry() { }
-			ModifiedDictionaryEntry(const ManagedSerializableFieldDataPtr& key, const SPtr<Modification>& modification);
-
-			ManagedSerializableFieldDataPtr key; /**< Serialized value of the key for the modified entry. */
-			SPtr<Modification> modification; /**< Recorded modification(s) on the dictionary entry value. */
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModifiedArrayEntryRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-		/**
-		 * @brief	Contains data about all modifications in a single complex object.
-		 *			(aside from arrays, list, dictionaries which are handled specially).
-		 */
-		struct BS_SCR_BE_EXPORT ModifiedObject : Modification
-		{
-			static SPtr<ModifiedObject> create();
-
-			Vector<ModifiedField> entries; /**< A list of entries containing each modified field in the object. */
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModifiedObjectRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-		/**
-		 * @brief	Contains data about all modifications in an array or a list.
-		 */
-		struct BS_SCR_BE_EXPORT ModifiedArray : Modification
-		{
-			static SPtr<ModifiedArray> create();
-
-			Vector<ModifiedArrayEntry> entries; /**< A list of all modified array/list entries along with their indices. */
-			Vector<UINT32> origSizes; /**< Original size of the array/list (one size per dimension). */
-			Vector<UINT32> newSizes; /**< New size of the array/list (one size per dimension). */
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModifiedArrayRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-		/**
-		 * @brief	Contains data about all modifications in a dictionary.
-		 */
-		struct BS_SCR_BE_EXPORT ModifiedDictionary : Modification
-		{
-			static SPtr<ModifiedDictionary> create();
-
-			Vector<ModifiedDictionaryEntry> entries; /**< A list of modified entries in the dictionary. */
-			Vector<ManagedSerializableFieldDataPtr> removed; /**< A list of keys for entries that were removed from the dictionary. */
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModifiedDictionaryRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-		/**
-		 * @brief	Contains data about modification of a primitive field.
-		 *			(i.e. fields new value)
-		 */
-		struct BS_SCR_BE_EXPORT ModifiedEntry : Modification
-		{
-			ModifiedEntry() { }
-			ModifiedEntry(const ManagedSerializableFieldDataPtr& value);
-
-			static SPtr<ModifiedEntry> create(const ManagedSerializableFieldDataPtr& value);
-
-			ManagedSerializableFieldDataPtr value;
-
-			/************************************************************************/
-			/* 								RTTI		                     		*/
-			/************************************************************************/
-		public:
-			friend class ModifiedEntryRTTI;
-			static RTTITypeBase* getRTTIStatic();
-			virtual RTTITypeBase* getRTTI() const override;
-		};
-
-	public:
-		ManagedSerializableDiff();
-		~ManagedSerializableDiff();
-
-		/**
-		 * @brief	Generates a new managed diff object by comparing two objects of the same type. Callers must
-		 *			ensure both objects are not null and of identical types.
-		 *
-		 * @param	oldObj	Original object. This is the object you can apply the diff to to convert it to \p newObj.
-		 * @param	newObj	New modified object. Any values in this object that differ from the original object will be
-		 *					recorded in the diff.
-		 *
-		 * @return	Returns null if objects are identical.
-		 */
-		static ManagedSerializableDiffPtr create(const ManagedSerializableObjectPtr& oldObj, const ManagedSerializableObjectPtr& newObj);
-
-		/**
-		 * @brief	Applies the diff data stored in this object to the specified object, modifying all
-		 *			fields in the object to correspond to the stored diff data.
-		 */
-		void apply(const ManagedSerializableObjectPtr& obj);
-
-	private:
-		/**
-		 * @brief	Recursively generates a diff between all fields of the specified objects. Returns null if objects are identical.
-		 */
-		SPtr<ModifiedObject> generateDiff(const ManagedSerializableObjectPtr& oldObj, const ManagedSerializableObjectPtr& newObj);
-
-		/**
-		 * @brief	Generates a diff between two fields. Fields can be of any type and the system will generate the diff appropriately.
-		 *			Diff is generated recursively on all complex objects as well. Returns null if fields contain identical data.
-		 */
-		SPtr<Modification> generateDiff(const ManagedSerializableFieldDataPtr& oldData, const ManagedSerializableFieldDataPtr& newData,
-			UINT32 fieldTypeId);
-
-		/**
-		 * @brief	Applies an object modification to a managed object. Modifications are applied recursively.
-		 *
-		 * @param	mod Object modification to apply.
-		 * @param	obj	Object to apply the modification to.
-		 *
-		 * @return	New field data in the case modification needed the object to be re-created instead of just modified.
-		 */
-		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedObject>& mod, const ManagedSerializableObjectPtr& obj);
-
-		/**
-		 * @brief	Applies an array modification to a managed array. Modifications are applied recursively.
-		 *
-		 * @param	mod Array modification to apply.
-		 * @param	obj	Array to apply the modification to.
-		 *
-		 * @return	New field data in the case modification needed the array to be re-created instead of just modified.
-		 */
-		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedArray>& mod, const ManagedSerializableArrayPtr& obj);
-
-		/**
-		 * @brief	Applies an list modification to a managed list. Modifications are applied recursively.
-		 *
-		 * @param	mod List modification to apply.
-		 * @param	obj	List to apply the modification to.
-		 *
-		 * @return	New field data in the case modification needed the list to be re-created instead of just modified.
-		 */
-		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedArray>& mod, const ManagedSerializableListPtr& obj);
-
-		/**
-		 * @brief	Applies an dictionary modification to a managed dictionary. Modifications are applied recursively.
-		 *
-		 * @param	mod Dictionary modification to apply.
-		 * @param	obj	Dictionary to apply the modification to.
-		 *
-		 * @return	New field data in the case modification needed the dictionary to be re-created instead of just modified.
-		 */
-		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedDictionary>& mod, const ManagedSerializableDictionaryPtr& obj);
-
-		/**
-		 * @brief	Applies a modification to a single field. Field type is determined and the modification is applied
-		 *			to the specific field type as needed. Modifications are applied recursively.
-		 *
-		 * @param	mod			Modification to apply.
-		 * @param	fieldType	Type of the field we're applying the modification to.
-		 * @param	origData	Original data of the field.
-		 *
-		 * @return	New field data in the case modification needed the field data to be re-created instead of just modified.
-		 */
-		ManagedSerializableFieldDataPtr applyDiff(const SPtr<Modification>& mod, const ManagedSerializableTypeInfoPtr& fieldType,
-			const ManagedSerializableFieldDataPtr& origData);
-
-		SPtr<ModifiedObject> mModificationRoot;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableDiffRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsIReflectable.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**
+	 * Handles creation and applying of managed diffs. A diff contains differences between two objects of identical types.
+	 * If the initial state of an object is known the recorded differences can be saved and applied to the original state to
+	 * restore the modified object.
+	 *
+	 * Differences are recorded per primitive field in an object. Complex objects are recursed. Special handling is
+	 * implemented to properly generate diffs for arrays, lists and dictionaries.
+	 *
+	 * All primitive types supported by managed serialization are supported (see ScriptPrimitiveType).
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableDiff : public IReflectable
+	{
+	public:
+		/**	A base class for all modifications recorded in a diff. */
+		struct BS_SCR_BE_EXPORT Modification : public IReflectable
+		{
+			virtual ~Modification();
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModificationRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+		/**
+		 * Contains a modification of a specific field in an object along with information about the field and its parent
+		 * object.
+		 */
+		struct BS_SCR_BE_EXPORT ModifiedField : public IReflectable
+		{
+			ModifiedField() { }
+			ModifiedField(const ManagedSerializableTypeInfoPtr& parentType,
+				const ManagedSerializableFieldInfoPtr& fieldType, const SPtr<Modification>& modification);
+
+			ManagedSerializableTypeInfoPtr parentType; /**< Type of the parent object the field belongs to. */
+			ManagedSerializableFieldInfoPtr fieldType; /**< Data type of the field. */
+			SPtr<Modification> modification; /**< Recorded modification(s) on the field. */
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModifiedFieldRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+		/**	Represents a single modified array or list entry. */
+		struct BS_SCR_BE_EXPORT ModifiedArrayEntry : public IReflectable
+		{
+			ModifiedArrayEntry() { }
+			ModifiedArrayEntry(UINT32 idx, const SPtr<Modification>& modification);
+
+			UINT32 idx; /**< Index of the array/list entry that is modified. */
+			SPtr<Modification> modification; /**< Recorded modification(s) on the entry. */
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModifiedArrayEntryRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+		/**	Represents a single modified dictionary entry. */
+		struct BS_SCR_BE_EXPORT ModifiedDictionaryEntry : public IReflectable
+		{
+			ModifiedDictionaryEntry() { }
+			ModifiedDictionaryEntry(const ManagedSerializableFieldDataPtr& key, const SPtr<Modification>& modification);
+
+			ManagedSerializableFieldDataPtr key; /**< Serialized value of the key for the modified entry. */
+			SPtr<Modification> modification; /**< Recorded modification(s) on the dictionary entry value. */
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModifiedArrayEntryRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+		/**
+		 * Contains data about all modifications in a single complex object (aside from arrays, list, dictionaries which are
+		 * handled specially).
+		 */
+		struct BS_SCR_BE_EXPORT ModifiedObject : Modification
+		{
+			static SPtr<ModifiedObject> create();
+
+			Vector<ModifiedField> entries; /**< A list of entries containing each modified field in the object. */
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModifiedObjectRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+		/**	Contains data about all modifications in an array or a list. */
+		struct BS_SCR_BE_EXPORT ModifiedArray : Modification
+		{
+			static SPtr<ModifiedArray> create();
+
+			Vector<ModifiedArrayEntry> entries; /**< A list of all modified array/list entries along with their indices. */
+			Vector<UINT32> origSizes; /**< Original size of the array/list (one size per dimension). */
+			Vector<UINT32> newSizes; /**< New size of the array/list (one size per dimension). */
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModifiedArrayRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+		/**	Contains data about all modifications in a dictionary. */
+		struct BS_SCR_BE_EXPORT ModifiedDictionary : Modification
+		{
+			static SPtr<ModifiedDictionary> create();
+
+			/** A list of modified entries in the dictionary. */
+			Vector<ModifiedDictionaryEntry> entries; 
+			/** A list of keys for entries that were removed from the dictionary. */
+			Vector<ManagedSerializableFieldDataPtr> removed; 
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModifiedDictionaryRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+		/** Contains data about modification of a primitive field (i.e. fields new value). */
+		struct BS_SCR_BE_EXPORT ModifiedEntry : Modification
+		{
+			ModifiedEntry() { }
+			ModifiedEntry(const ManagedSerializableFieldDataPtr& value);
+
+			static SPtr<ModifiedEntry> create(const ManagedSerializableFieldDataPtr& value);
+
+			ManagedSerializableFieldDataPtr value;
+
+			/************************************************************************/
+			/* 								RTTI		                     		*/
+			/************************************************************************/
+		public:
+			friend class ModifiedEntryRTTI;
+			static RTTITypeBase* getRTTIStatic();
+			virtual RTTITypeBase* getRTTI() const override;
+		};
+
+	public:
+		ManagedSerializableDiff();
+		~ManagedSerializableDiff();
+
+		/**
+		 * Generates a new managed diff object by comparing two objects of the same type. Callers must ensure both objects
+		 * are not null and of identical types.
+		 *
+		 * @param[in]	oldObj	Original object. This is the object you can apply the diff to to convert it to @p newObj.
+		 * @param[in]	newObj	New modified object. Any values in this object that differ from the original object will be
+		 *						recorded in the diff.
+		 * @return				Returns null if objects are identical.
+		 */
+		static ManagedSerializableDiffPtr create(const ManagedSerializableObjectPtr& oldObj, const ManagedSerializableObjectPtr& newObj);
+
+		/**
+		 * Applies the diff data stored in this object to the specified object, modifying all fields in the object to
+		 * correspond to the stored diff data.
+		 */
+		void apply(const ManagedSerializableObjectPtr& obj);
+
+	private:
+		/**
+		 * Recursively generates a diff between all fields of the specified objects. Returns null if objects are identical.
+		 */
+		SPtr<ModifiedObject> generateDiff(const ManagedSerializableObjectPtr& oldObj, const ManagedSerializableObjectPtr& newObj);
+
+		/**
+		 * Generates a diff between two fields. Fields can be of any type and the system will generate the diff 
+		 * appropriately. Diff is generated recursively on all complex objects as well. Returns null if fields contain
+		 * identical data.
+		 */
+		SPtr<Modification> generateDiff(const ManagedSerializableFieldDataPtr& oldData, const ManagedSerializableFieldDataPtr& newData,
+			UINT32 fieldTypeId);
+
+		/**
+		 * Applies an object modification to a managed object. Modifications are applied recursively.
+		 *
+		 * @param[in]	mod Object modification to apply.
+		 * @param[in]	obj	Object to apply the modification to.
+		 * @return		New field data in the case modification needed the object to be re-created instead of just modified.
+		 */
+		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedObject>& mod, const ManagedSerializableObjectPtr& obj);
+
+		/**
+		 * Applies an array modification to a managed array. Modifications are applied recursively.
+		 *
+		 * @param[in]	mod Array modification to apply.
+		 * @param[in]	obj	Array to apply the modification to.
+		 * @return		New field data in the case modification needed the array to be re-created instead of just modified.
+		 */
+		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedArray>& mod, const ManagedSerializableArrayPtr& obj);
+
+		/**
+		 * Applies an list modification to a managed list. Modifications are applied recursively.
+		 *
+		 * @param[in]	mod List modification to apply.
+		 * @param[in]	obj	List to apply the modification to.
+		 * @return		New field data in the case modification needed the list to be re-created instead of just modified.
+		 */
+		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedArray>& mod, const ManagedSerializableListPtr& obj);
+
+		/**
+		 * Applies an dictionary modification to a managed dictionary. Modifications are applied recursively.
+		 *
+		 * @param[in]	mod Dictionary modification to apply.
+		 * @param[in]	obj	Dictionary to apply the modification to.
+		 * @return	New field data in the case modification needed the dictionary to be re-created instead of just modified.
+		 */
+		ManagedSerializableFieldDataPtr applyDiff(const SPtr<ModifiedDictionary>& mod, const ManagedSerializableDictionaryPtr& obj);
+
+		/**
+		 * Applies a modification to a single field. Field type is determined and the modification is applied to the
+		 * specific field type as needed. Modifications are applied recursively.
+		 *
+		 * @param[in]	mod			Modification to apply.
+		 * @param[in]	fieldType	Type of the field we're applying the modification to.
+		 * @param[in]	origData	Original data of the field.
+		 * @return					New field data in the case modification needed the field data to be re-created instead
+		 *							of just modified.
+		 */
+		ManagedSerializableFieldDataPtr applyDiff(const SPtr<Modification>& mod, const ManagedSerializableTypeInfoPtr& fieldType,
+			const ManagedSerializableFieldDataPtr& origData);
+
+		SPtr<ModifiedObject> mModificationRoot;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableDiffRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 454 - 448
Source/SBansheeEngine/Include/BsManagedSerializableDiffRTTI.h

@@ -1,449 +1,455 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsManagedSerializableDiff.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ModifiedFieldRTTI :
-		public RTTIType < ManagedSerializableDiff::ModifiedField, IReflectable, ModifiedFieldRTTI >
-	{
-	private:
-		ManagedSerializableTypeInfoPtr getParentType(ManagedSerializableDiff::ModifiedField* obj)
-		{
-			return obj->parentType;
-		}
-
-		void setParentType(ManagedSerializableDiff::ModifiedField* obj, ManagedSerializableTypeInfoPtr val)
-		{
-			obj->parentType = val;
-		}
-
-		ManagedSerializableFieldInfoPtr getFieldType(ManagedSerializableDiff::ModifiedField* obj)
-		{
-			return obj->fieldType;
-		}
-
-		void setFieldType(ManagedSerializableDiff::ModifiedField* obj, ManagedSerializableFieldInfoPtr val)
-		{
-			obj->fieldType = val;
-		}
-
-		SPtr<ManagedSerializableDiff::Modification> getModification(ManagedSerializableDiff::ModifiedField* obj)
-		{
-			return obj->modification;
-		}
-
-		void setModification(ManagedSerializableDiff::ModifiedField* obj, SPtr<ManagedSerializableDiff::Modification> val)
-		{
-			obj->modification = val;
-		}
-	public:
-		ModifiedFieldRTTI()
-		{
-			addReflectablePtrField("parentType", 0, &ModifiedFieldRTTI::getParentType, &ModifiedFieldRTTI::setParentType);
-			addReflectablePtrField("fieldType", 1, &ModifiedFieldRTTI::getFieldType, &ModifiedFieldRTTI::setFieldType);
-			addReflectablePtrField("modification", 2, &ModifiedFieldRTTI::getModification, &ModifiedFieldRTTI::setModification);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModifiedField";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModifiedField;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return bs_shared_ptr_new<ManagedSerializableDiff::ModifiedField>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ModifiedArrayEntryRTTI :
-		public RTTIType < ManagedSerializableDiff::ModifiedArrayEntry, IReflectable, ModifiedArrayEntryRTTI >
-	{
-	private:
-		UINT32& getIdx(ManagedSerializableDiff::ModifiedArrayEntry* obj)
-		{
-			return obj->idx;
-		}
-
-		void setIdx(ManagedSerializableDiff::ModifiedArrayEntry* obj, UINT32& val)
-		{
-			obj->idx = val;
-		}
-
-		SPtr<ManagedSerializableDiff::Modification> getModification(ManagedSerializableDiff::ModifiedArrayEntry* obj)
-		{
-			return obj->modification;
-		}
-
-		void setModification(ManagedSerializableDiff::ModifiedArrayEntry* obj, SPtr<ManagedSerializableDiff::Modification> val)
-		{
-			obj->modification = val;
-		}
-	public:
-		ModifiedArrayEntryRTTI()
-		{
-			addPlainField("idx", 0, &ModifiedArrayEntryRTTI::getIdx, &ModifiedArrayEntryRTTI::setIdx);
-			addReflectablePtrField("modification", 1, &ModifiedArrayEntryRTTI::getModification, &ModifiedArrayEntryRTTI::setModification);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModifiedArrayEntry";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModifiedArrayEntry;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return bs_shared_ptr_new<ManagedSerializableDiff::ModifiedArrayEntry>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ModifiedDictionaryEntryRTTI :
-		public RTTIType < ManagedSerializableDiff::ModifiedDictionaryEntry, IReflectable, ModifiedDictionaryEntryRTTI >
-	{
-	private:
-		ManagedSerializableFieldDataPtr getKey(ManagedSerializableDiff::ModifiedDictionaryEntry* obj)
-		{
-			return obj->key;
-		}
-
-		void setKey(ManagedSerializableDiff::ModifiedDictionaryEntry* obj, ManagedSerializableFieldDataPtr val)
-		{
-			obj->key = val;
-		}
-
-		SPtr<ManagedSerializableDiff::Modification> getModification(ManagedSerializableDiff::ModifiedDictionaryEntry* obj)
-		{
-			return obj->modification;
-		}
-
-		void setModification(ManagedSerializableDiff::ModifiedDictionaryEntry* obj, SPtr<ManagedSerializableDiff::Modification> val)
-		{
-			obj->modification = val;
-		}
-	public:
-		ModifiedDictionaryEntryRTTI()
-		{
-			addReflectablePtrField("key", 0, &ModifiedDictionaryEntryRTTI::getKey, &ModifiedDictionaryEntryRTTI::setKey);
-			addReflectablePtrField("modification", 1, &ModifiedDictionaryEntryRTTI::getModification, &ModifiedDictionaryEntryRTTI::setModification);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModifiedDictionaryEntry";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModifiedDictionaryEntry;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return bs_shared_ptr_new<ManagedSerializableDiff::ModifiedDictionaryEntry>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ModificationRTTI : 
-		public RTTIType < ManagedSerializableDiff::Modification, IReflectable, ModificationRTTI >
-	{
-	public:
-		ModificationRTTI()
-		{ }
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModification";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModification;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return nullptr;
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ModifiedObjectRTTI : 
-		public RTTIType < ManagedSerializableDiff::ModifiedObject, ManagedSerializableDiff::Modification, ModifiedObjectRTTI >
-	{
-	private:
-		ManagedSerializableDiff::ModifiedField& getFieldEntry(ManagedSerializableDiff::ModifiedObject* obj, UINT32 arrayIdx)
-		{
-			return obj->entries[arrayIdx];
-		}
-
-		void setFieldEntry(ManagedSerializableDiff::ModifiedObject* obj, UINT32 arrayIdx, ManagedSerializableDiff::ModifiedField& val)
-		{
-			obj->entries[arrayIdx] = val;
-		}
-
-		UINT32 getNumFieldEntries(ManagedSerializableDiff::ModifiedObject* obj)
-		{
-			return (UINT32)obj->entries.size();
-		}
-
-		void setNumFieldEntries(ManagedSerializableDiff::ModifiedObject* obj, UINT32 numEntries)
-		{
-			obj->entries = Vector<ManagedSerializableDiff::ModifiedField>(numEntries);
-		}
-
-	public:
-		ModifiedObjectRTTI()
-		{
-			addReflectableArrayField("entries", 0, &ModifiedObjectRTTI::getFieldEntry, &ModifiedObjectRTTI::getNumFieldEntries,
-				&ModifiedObjectRTTI::setFieldEntry, &ModifiedObjectRTTI::setNumFieldEntries);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModifiedObject";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModifiedObject;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedSerializableDiff::ModifiedObject::create();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ModifiedArrayRTTI :
-		public RTTIType < ManagedSerializableDiff::ModifiedArray, ManagedSerializableDiff::Modification, ModifiedArrayRTTI >
-	{
-	private:
-		Vector<UINT32>& getOrigSizes(ManagedSerializableDiff::ModifiedArray* obj)
-		{
-			return obj->origSizes;
-		}
-
-		void setOrigSizes(ManagedSerializableDiff::ModifiedArray* obj, Vector<UINT32>& val)
-		{
-			obj->origSizes = val;
-		}
-
-		Vector<UINT32>& getNewSizes(ManagedSerializableDiff::ModifiedArray* obj)
-		{
-			return obj->newSizes;
-		}
-
-		void setNewSizes(ManagedSerializableDiff::ModifiedArray* obj, Vector<UINT32>& val)
-		{
-			obj->newSizes = val;
-		}
-
-		ManagedSerializableDiff::ModifiedArrayEntry& getFieldEntry(ManagedSerializableDiff::ModifiedArray* obj, UINT32 arrayIdx)
-		{
-			return obj->entries[arrayIdx];
-		}
-
-		void setFieldEntry(ManagedSerializableDiff::ModifiedArray* obj, UINT32 arrayIdx, ManagedSerializableDiff::ModifiedArrayEntry& val)
-		{
-			obj->entries[arrayIdx] = val;
-		}
-
-		UINT32 getNumFieldEntries(ManagedSerializableDiff::ModifiedArray* obj)
-		{
-			return (UINT32)obj->entries.size();
-		}
-
-		void setNumFieldEntries(ManagedSerializableDiff::ModifiedArray* obj, UINT32 numEntries)
-		{
-			obj->entries = Vector<ManagedSerializableDiff::ModifiedArrayEntry>(numEntries);
-		}
-
-	public:
-		ModifiedArrayRTTI()
-		{
-			addPlainField("origSizes", 0, &ModifiedArrayRTTI::getOrigSizes, &ModifiedArrayRTTI::setOrigSizes);
-			addPlainField("newSizes", 1, &ModifiedArrayRTTI::getNewSizes, &ModifiedArrayRTTI::setNewSizes);
-			addReflectableArrayField("entries", 2, &ModifiedArrayRTTI::getFieldEntry, &ModifiedArrayRTTI::getNumFieldEntries,
-				&ModifiedArrayRTTI::setFieldEntry, &ModifiedArrayRTTI::setNumFieldEntries);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModifiedArray";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModifiedArray;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedSerializableDiff::ModifiedArray::create();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ModifiedDictionaryRTTI :
-		public RTTIType < ManagedSerializableDiff::ModifiedDictionary, ManagedSerializableDiff::Modification, ModifiedDictionaryRTTI >
-	{
-	private:
-		ManagedSerializableFieldDataPtr getRemovedEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx)
-		{
-			return obj->removed[arrayIdx];
-		}
-
-		void setRemovedEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx, ManagedSerializableFieldDataPtr val)
-		{
-			obj->removed[arrayIdx] = val;
-		}
-
-		UINT32 getNumRemovedEntries(ManagedSerializableDiff::ModifiedDictionary* obj)
-		{
-			return (UINT32)obj->removed.size();
-		}
-
-		void setNumRemovedEntries(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 numEntries)
-		{
-			obj->removed = Vector<ManagedSerializableFieldDataPtr>(numEntries);
-		}
-
-		ManagedSerializableDiff::ModifiedDictionaryEntry& getFieldEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx)
-		{
-			return obj->entries[arrayIdx];
-		}
-
-		void setFieldEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx, ManagedSerializableDiff::ModifiedDictionaryEntry& val)
-		{
-			obj->entries[arrayIdx] = val;
-		}
-
-		UINT32 getNumFieldEntries(ManagedSerializableDiff::ModifiedDictionary* obj)
-		{
-			return (UINT32)obj->entries.size();
-		}
-
-		void setNumFieldEntries(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 numEntries)
-		{
-			obj->entries = Vector<ManagedSerializableDiff::ModifiedDictionaryEntry>(numEntries);
-		}
-
-	public:
-		ModifiedDictionaryRTTI()
-		{
-			addReflectablePtrArrayField("removed", 0, &ModifiedDictionaryRTTI::getRemovedEntry, &ModifiedDictionaryRTTI::getNumRemovedEntries,
-				&ModifiedDictionaryRTTI::setRemovedEntry, &ModifiedDictionaryRTTI::setNumRemovedEntries);
-			addReflectableArrayField("entries", 1, &ModifiedDictionaryRTTI::getFieldEntry, &ModifiedDictionaryRTTI::getNumFieldEntries,
-				&ModifiedDictionaryRTTI::setFieldEntry, &ModifiedDictionaryRTTI::setNumFieldEntries);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModifiedDictionary";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModifiedDictionary;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedSerializableDiff::ModifiedDictionary::create();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ModifiedEntryRTTI :
-		public RTTIType < ManagedSerializableDiff::ModifiedEntry, ManagedSerializableDiff::Modification, ModifiedEntryRTTI >
-	{
-	private:
-		ManagedSerializableFieldDataPtr getValue(ManagedSerializableDiff::ModifiedEntry* obj)
-		{
-			return obj->value;
-		}
-
-		void setValue(ManagedSerializableDiff::ModifiedEntry* obj, ManagedSerializableFieldDataPtr val)
-		{
-			obj->value = val;
-		}
-
-	public:
-		ModifiedEntryRTTI()
-		{
-			addReflectablePtrField("value", 0, &ModifiedEntryRTTI::getValue, &ModifiedEntryRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptModifiedEntry";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptModifiedEntry;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedSerializableDiff::ModifiedEntry::create(nullptr);
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableDiffRTTI : public RTTIType <ManagedSerializableDiff, IReflectable, ManagedSerializableDiffRTTI>
-	{
-	private:
-		SPtr<ManagedSerializableDiff::ModifiedObject> getModificationRoot(ManagedSerializableDiff* obj)
-		{
-			return obj->mModificationRoot;
-		}
-
-		void setModificationRoot(ManagedSerializableDiff* obj, SPtr<ManagedSerializableDiff::ModifiedObject> val)
-		{
-			obj->mModificationRoot = val;
-		}
-
-	public:
-		ManagedSerializableDiffRTTI()
-		{
-			addReflectablePtrField("mModificationRoot", 0, &ManagedSerializableDiffRTTI::getModificationRoot, 
-				&ManagedSerializableDiffRTTI::setModificationRoot);
-
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptSerializableDiff";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptSerializableDiff;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return bs_shared_ptr_new<ManagedSerializableDiff>();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsManagedSerializableDiff.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ModifiedFieldRTTI :
+		public RTTIType < ManagedSerializableDiff::ModifiedField, IReflectable, ModifiedFieldRTTI >
+	{
+	private:
+		ManagedSerializableTypeInfoPtr getParentType(ManagedSerializableDiff::ModifiedField* obj)
+		{
+			return obj->parentType;
+		}
+
+		void setParentType(ManagedSerializableDiff::ModifiedField* obj, ManagedSerializableTypeInfoPtr val)
+		{
+			obj->parentType = val;
+		}
+
+		ManagedSerializableFieldInfoPtr getFieldType(ManagedSerializableDiff::ModifiedField* obj)
+		{
+			return obj->fieldType;
+		}
+
+		void setFieldType(ManagedSerializableDiff::ModifiedField* obj, ManagedSerializableFieldInfoPtr val)
+		{
+			obj->fieldType = val;
+		}
+
+		SPtr<ManagedSerializableDiff::Modification> getModification(ManagedSerializableDiff::ModifiedField* obj)
+		{
+			return obj->modification;
+		}
+
+		void setModification(ManagedSerializableDiff::ModifiedField* obj, SPtr<ManagedSerializableDiff::Modification> val)
+		{
+			obj->modification = val;
+		}
+	public:
+		ModifiedFieldRTTI()
+		{
+			addReflectablePtrField("parentType", 0, &ModifiedFieldRTTI::getParentType, &ModifiedFieldRTTI::setParentType);
+			addReflectablePtrField("fieldType", 1, &ModifiedFieldRTTI::getFieldType, &ModifiedFieldRTTI::setFieldType);
+			addReflectablePtrField("modification", 2, &ModifiedFieldRTTI::getModification, &ModifiedFieldRTTI::setModification);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModifiedField";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModifiedField;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableDiff::ModifiedField>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ModifiedArrayEntryRTTI :
+		public RTTIType < ManagedSerializableDiff::ModifiedArrayEntry, IReflectable, ModifiedArrayEntryRTTI >
+	{
+	private:
+		UINT32& getIdx(ManagedSerializableDiff::ModifiedArrayEntry* obj)
+		{
+			return obj->idx;
+		}
+
+		void setIdx(ManagedSerializableDiff::ModifiedArrayEntry* obj, UINT32& val)
+		{
+			obj->idx = val;
+		}
+
+		SPtr<ManagedSerializableDiff::Modification> getModification(ManagedSerializableDiff::ModifiedArrayEntry* obj)
+		{
+			return obj->modification;
+		}
+
+		void setModification(ManagedSerializableDiff::ModifiedArrayEntry* obj, SPtr<ManagedSerializableDiff::Modification> val)
+		{
+			obj->modification = val;
+		}
+	public:
+		ModifiedArrayEntryRTTI()
+		{
+			addPlainField("idx", 0, &ModifiedArrayEntryRTTI::getIdx, &ModifiedArrayEntryRTTI::setIdx);
+			addReflectablePtrField("modification", 1, &ModifiedArrayEntryRTTI::getModification, &ModifiedArrayEntryRTTI::setModification);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModifiedArrayEntry";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModifiedArrayEntry;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableDiff::ModifiedArrayEntry>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ModifiedDictionaryEntryRTTI :
+		public RTTIType < ManagedSerializableDiff::ModifiedDictionaryEntry, IReflectable, ModifiedDictionaryEntryRTTI >
+	{
+	private:
+		ManagedSerializableFieldDataPtr getKey(ManagedSerializableDiff::ModifiedDictionaryEntry* obj)
+		{
+			return obj->key;
+		}
+
+		void setKey(ManagedSerializableDiff::ModifiedDictionaryEntry* obj, ManagedSerializableFieldDataPtr val)
+		{
+			obj->key = val;
+		}
+
+		SPtr<ManagedSerializableDiff::Modification> getModification(ManagedSerializableDiff::ModifiedDictionaryEntry* obj)
+		{
+			return obj->modification;
+		}
+
+		void setModification(ManagedSerializableDiff::ModifiedDictionaryEntry* obj, SPtr<ManagedSerializableDiff::Modification> val)
+		{
+			obj->modification = val;
+		}
+	public:
+		ModifiedDictionaryEntryRTTI()
+		{
+			addReflectablePtrField("key", 0, &ModifiedDictionaryEntryRTTI::getKey, &ModifiedDictionaryEntryRTTI::setKey);
+			addReflectablePtrField("modification", 1, &ModifiedDictionaryEntryRTTI::getModification, &ModifiedDictionaryEntryRTTI::setModification);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModifiedDictionaryEntry";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModifiedDictionaryEntry;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableDiff::ModifiedDictionaryEntry>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ModificationRTTI : 
+		public RTTIType < ManagedSerializableDiff::Modification, IReflectable, ModificationRTTI >
+	{
+	public:
+		ModificationRTTI()
+		{ }
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModification";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModification;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return nullptr;
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ModifiedObjectRTTI : 
+		public RTTIType < ManagedSerializableDiff::ModifiedObject, ManagedSerializableDiff::Modification, ModifiedObjectRTTI >
+	{
+	private:
+		ManagedSerializableDiff::ModifiedField& getFieldEntry(ManagedSerializableDiff::ModifiedObject* obj, UINT32 arrayIdx)
+		{
+			return obj->entries[arrayIdx];
+		}
+
+		void setFieldEntry(ManagedSerializableDiff::ModifiedObject* obj, UINT32 arrayIdx, ManagedSerializableDiff::ModifiedField& val)
+		{
+			obj->entries[arrayIdx] = val;
+		}
+
+		UINT32 getNumFieldEntries(ManagedSerializableDiff::ModifiedObject* obj)
+		{
+			return (UINT32)obj->entries.size();
+		}
+
+		void setNumFieldEntries(ManagedSerializableDiff::ModifiedObject* obj, UINT32 numEntries)
+		{
+			obj->entries = Vector<ManagedSerializableDiff::ModifiedField>(numEntries);
+		}
+
+	public:
+		ModifiedObjectRTTI()
+		{
+			addReflectableArrayField("entries", 0, &ModifiedObjectRTTI::getFieldEntry, &ModifiedObjectRTTI::getNumFieldEntries,
+				&ModifiedObjectRTTI::setFieldEntry, &ModifiedObjectRTTI::setNumFieldEntries);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModifiedObject";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModifiedObject;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableDiff::ModifiedObject::create();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ModifiedArrayRTTI :
+		public RTTIType < ManagedSerializableDiff::ModifiedArray, ManagedSerializableDiff::Modification, ModifiedArrayRTTI >
+	{
+	private:
+		Vector<UINT32>& getOrigSizes(ManagedSerializableDiff::ModifiedArray* obj)
+		{
+			return obj->origSizes;
+		}
+
+		void setOrigSizes(ManagedSerializableDiff::ModifiedArray* obj, Vector<UINT32>& val)
+		{
+			obj->origSizes = val;
+		}
+
+		Vector<UINT32>& getNewSizes(ManagedSerializableDiff::ModifiedArray* obj)
+		{
+			return obj->newSizes;
+		}
+
+		void setNewSizes(ManagedSerializableDiff::ModifiedArray* obj, Vector<UINT32>& val)
+		{
+			obj->newSizes = val;
+		}
+
+		ManagedSerializableDiff::ModifiedArrayEntry& getFieldEntry(ManagedSerializableDiff::ModifiedArray* obj, UINT32 arrayIdx)
+		{
+			return obj->entries[arrayIdx];
+		}
+
+		void setFieldEntry(ManagedSerializableDiff::ModifiedArray* obj, UINT32 arrayIdx, ManagedSerializableDiff::ModifiedArrayEntry& val)
+		{
+			obj->entries[arrayIdx] = val;
+		}
+
+		UINT32 getNumFieldEntries(ManagedSerializableDiff::ModifiedArray* obj)
+		{
+			return (UINT32)obj->entries.size();
+		}
+
+		void setNumFieldEntries(ManagedSerializableDiff::ModifiedArray* obj, UINT32 numEntries)
+		{
+			obj->entries = Vector<ManagedSerializableDiff::ModifiedArrayEntry>(numEntries);
+		}
+
+	public:
+		ModifiedArrayRTTI()
+		{
+			addPlainField("origSizes", 0, &ModifiedArrayRTTI::getOrigSizes, &ModifiedArrayRTTI::setOrigSizes);
+			addPlainField("newSizes", 1, &ModifiedArrayRTTI::getNewSizes, &ModifiedArrayRTTI::setNewSizes);
+			addReflectableArrayField("entries", 2, &ModifiedArrayRTTI::getFieldEntry, &ModifiedArrayRTTI::getNumFieldEntries,
+				&ModifiedArrayRTTI::setFieldEntry, &ModifiedArrayRTTI::setNumFieldEntries);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModifiedArray";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModifiedArray;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableDiff::ModifiedArray::create();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ModifiedDictionaryRTTI :
+		public RTTIType < ManagedSerializableDiff::ModifiedDictionary, ManagedSerializableDiff::Modification, ModifiedDictionaryRTTI >
+	{
+	private:
+		ManagedSerializableFieldDataPtr getRemovedEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx)
+		{
+			return obj->removed[arrayIdx];
+		}
+
+		void setRemovedEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx, ManagedSerializableFieldDataPtr val)
+		{
+			obj->removed[arrayIdx] = val;
+		}
+
+		UINT32 getNumRemovedEntries(ManagedSerializableDiff::ModifiedDictionary* obj)
+		{
+			return (UINT32)obj->removed.size();
+		}
+
+		void setNumRemovedEntries(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 numEntries)
+		{
+			obj->removed = Vector<ManagedSerializableFieldDataPtr>(numEntries);
+		}
+
+		ManagedSerializableDiff::ModifiedDictionaryEntry& getFieldEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx)
+		{
+			return obj->entries[arrayIdx];
+		}
+
+		void setFieldEntry(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 arrayIdx, ManagedSerializableDiff::ModifiedDictionaryEntry& val)
+		{
+			obj->entries[arrayIdx] = val;
+		}
+
+		UINT32 getNumFieldEntries(ManagedSerializableDiff::ModifiedDictionary* obj)
+		{
+			return (UINT32)obj->entries.size();
+		}
+
+		void setNumFieldEntries(ManagedSerializableDiff::ModifiedDictionary* obj, UINT32 numEntries)
+		{
+			obj->entries = Vector<ManagedSerializableDiff::ModifiedDictionaryEntry>(numEntries);
+		}
+
+	public:
+		ModifiedDictionaryRTTI()
+		{
+			addReflectablePtrArrayField("removed", 0, &ModifiedDictionaryRTTI::getRemovedEntry, &ModifiedDictionaryRTTI::getNumRemovedEntries,
+				&ModifiedDictionaryRTTI::setRemovedEntry, &ModifiedDictionaryRTTI::setNumRemovedEntries);
+			addReflectableArrayField("entries", 1, &ModifiedDictionaryRTTI::getFieldEntry, &ModifiedDictionaryRTTI::getNumFieldEntries,
+				&ModifiedDictionaryRTTI::setFieldEntry, &ModifiedDictionaryRTTI::setNumFieldEntries);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModifiedDictionary";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModifiedDictionary;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableDiff::ModifiedDictionary::create();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ModifiedEntryRTTI :
+		public RTTIType < ManagedSerializableDiff::ModifiedEntry, ManagedSerializableDiff::Modification, ModifiedEntryRTTI >
+	{
+	private:
+		ManagedSerializableFieldDataPtr getValue(ManagedSerializableDiff::ModifiedEntry* obj)
+		{
+			return obj->value;
+		}
+
+		void setValue(ManagedSerializableDiff::ModifiedEntry* obj, ManagedSerializableFieldDataPtr val)
+		{
+			obj->value = val;
+		}
+
+	public:
+		ModifiedEntryRTTI()
+		{
+			addReflectablePtrField("value", 0, &ModifiedEntryRTTI::getValue, &ModifiedEntryRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptModifiedEntry";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptModifiedEntry;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableDiff::ModifiedEntry::create(nullptr);
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableDiffRTTI : public RTTIType <ManagedSerializableDiff, IReflectable, ManagedSerializableDiffRTTI>
+	{
+	private:
+		SPtr<ManagedSerializableDiff::ModifiedObject> getModificationRoot(ManagedSerializableDiff* obj)
+		{
+			return obj->mModificationRoot;
+		}
+
+		void setModificationRoot(ManagedSerializableDiff* obj, SPtr<ManagedSerializableDiff::ModifiedObject> val)
+		{
+			obj->mModificationRoot = val;
+		}
+
+	public:
+		ManagedSerializableDiffRTTI()
+		{
+			addReflectablePtrField("mModificationRoot", 0, &ManagedSerializableDiffRTTI::getModificationRoot, 
+				&ManagedSerializableDiffRTTI::setModificationRoot);
+
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableDiff";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptSerializableDiff;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableDiff>();
+		}
+	};
+
+	/** @} */
 }

+ 795 - 967
Source/SBansheeEngine/Include/BsManagedSerializableField.h

@@ -1,968 +1,796 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsIReflectable.h"
-#include <mono/jit/jit.h>
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Contains data that can be used for identifying a field in an object
-	 *			when cross referenced with the object type.
-	 *
-	 * @note	Essentially a light-weight identifier for the field so that we
-	 *			don't need to store entire field type for each field when serializing.
-	 *			Instead field types are stored separately and we just use this object
-	 *			for lookup.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldKey : public IReflectable
-	{
-	public:
-		ManagedSerializableFieldKey();
-		ManagedSerializableFieldKey(UINT16 typeId, UINT16 fieldId);
-
-		/**
-		 * @brief	Creates a new field key.
-		 *
-		 * @param	typeId	Unique ID of the parent type the field belongs to. See ManagedSerializableTypeInfoObject.
-		 * @param	fieldId	Unique ID of the field within its parent class. See ManagedSerializableObjectInfo.
-		 */
-		static ManagedSerializableFieldKeyPtr create(UINT16 typeId, UINT16 fieldId);
-
-		UINT16 mTypeId;
-		UINT16 mFieldId;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ScriptSerializableFieldDataKeyRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains value of a single field in a managed object. This
-	 *			class can contain any data type and should be overridden for specific types.
-	 *
-	 *			Stored values can be serialized and stored for later use, and deserialized
-	 *			back to managed objects when needed. You must call ::serialize before
-	 *			performing RTTI serialization. After field data has been serialized
-	 *			you should not call any methods on it before calling ::deserialize.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldData : public IReflectable
-	{
-	public:
-		virtual ~ManagedSerializableFieldData() { }
-
-		/**
-		 * @brief	Creates a new data wrapper for some field data.
-		 *
-		 * @param	typeInfo	Type of the data we're storing.
-		 * @param	value		Managed boxed value to store in the field. Value will be copied 
-		 *						into the internal buffer and stored.
-		 */
-		static ManagedSerializableFieldDataPtr create(const ManagedSerializableTypeInfoPtr& typeInfo, MonoObject* value);
-
-		/**
-		 * @brief	Creates a new data wrapper containing default instance of the provided type.
-		 *
-		 * @param	typeInfo	Type of the data we're storing.
-		 */
-		static ManagedSerializableFieldDataPtr createDefault(const ManagedSerializableTypeInfoPtr& typeInfo);
-
-		/**
-		 * @brief	Returns the internal value.
-		 *
-		 * @param	typeInfo	Type of the data we're looking to retrieve. This isn't required
-		 *						for actually retrieving the data but is used as an extra check
-		 *						to ensure the field contains the data type we're looking for.
-		 *
-		 * @return	Pointer to the internal serialized data. Caller must ensure the pointer
-		 *			is cast to the proper type.
-		 */
-		virtual void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) = 0;
-
-		/**
-		 * @brief	Boxes the internal value and returns it.
-		 *
-		 * @param	typeInfo	Type of the data we're looking to retrieve. This isn't required
-		 *						for actually retrieving the data but is used as an extra check
-		 *						to ensure the field contains the data type we're looking for.
-		 *
-		 * @return	Boxed representation of the internal value.
-		 */
-		virtual MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) = 0;
-
-		/**
-		 * @brief	Checks if the internal value stored in this object matches the value stored in another.
-		 *			Does shallow comparison for complex objects.
-		 */
-		virtual bool equals(const ManagedSerializableFieldDataPtr& other) = 0;
-
-		/**
-		 * @brief	Returns a hash value for the internally stored value.
-		 */
-		virtual size_t getHash() = 0;
-
-		/**
-		 * @brief	Serializes the internal value so that it may be stored and deserialized later.
-		 *
-		 * @note	This is generally only relevant for complex objects, as primitive types have their
-		 *			values copied and serialized automatically whenever field data is created.
-		 */
-		virtual void serialize() { }
-
-		/**
-		 * @brief	Deserializes the internal value so that the managed instance can be retrieved.
-		 */
-		virtual void deserialize() { }
-
-	private:
-		/**
-		 * @brief	Creates a new data wrapper for some field data.
-		 *
-		 * @param	typeInfo	Type of the data we're storing.
-		 * @param	value		Managed boxed value to store in the field. Value will be copied 
-		 *						into the internal buffer and stored.
-		 * @param	allowNull	Determines should null values be allowed. If false the objects with null values will instead
-		 *						be instantiated to their default values.
-		 */
-		static ManagedSerializableFieldDataPtr create(const ManagedSerializableTypeInfoPtr& typeInfo, MonoObject* value, 
-			bool allowNull);
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains type and value of a single field in an object.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataEntry : public IReflectable
-	{
-	public:
-		static ManagedSerializableFieldDataEntryPtr create(const ManagedSerializableFieldKeyPtr& key, const ManagedSerializableFieldDataPtr& value);
-
-		ManagedSerializableFieldKeyPtr mKey;
-		ManagedSerializableFieldDataPtr mValue;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataEntryRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains boolean field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataBool : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		bool value = false;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataBoolRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains wide character field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataChar : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		wchar_t value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataCharRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains signed 8-bit integer field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */	
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI8 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		INT8 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataI8RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains unsigned 8-bit integer field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU8 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		UINT8 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataU8RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains signed 16-bit integer field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI16 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		INT16 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataI16RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains unsigned 16-bit field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU16 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		UINT16 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataU16RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains signed 32-bit integer field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI32 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		INT32 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataI32RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains unsigned 32-bit integer field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU32 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		UINT32 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataU32RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains signed 64-bit integer field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI64 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		INT64 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataI64RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains unsigned 64-bit integer field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU64 : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		UINT64 value = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataU64RTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains single precision floating point field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataFloat : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		float value = 0.0f;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataFloatRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains double precision floating point field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDouble : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		double value = 0.0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataDoubleRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains wide character string field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataString : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		WString value;
-		bool isNull = false;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataStringRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains resource reference field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataResourceRef : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		HResource value;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataResourceRefRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains game object reference field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataGameObjectRef : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		HGameObject value;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataGameObjectRefRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains complex object field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataObject : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::serialize
-		 */
-		virtual void serialize() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::deserialize
-		 */
-		virtual void deserialize() override;
-
-		ManagedSerializableObjectPtr value;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataObjectRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains array field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataArray : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::serialize
-		 */
-		virtual void serialize() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::deserialize
-		 */
-		virtual void deserialize() override;
-
-		ManagedSerializableArrayPtr value;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataArrayRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains list field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataList : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::serialize
-		 */
-		virtual void serialize() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::deserialize
-		 */
-		virtual void deserialize() override;
-
-		ManagedSerializableListPtr value;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataListRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains dictionary field data.
-	 *
-	 * @copydoc	ManagedSerializableFieldData
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDictionary : public ManagedSerializableFieldData
-	{
-	public:
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValue
-		 */
-		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getValueBoxed
-		 */
-		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::equals
-		 */
-		bool equals(const ManagedSerializableFieldDataPtr& other) override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::getHash
-		 */
-		size_t getHash() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::serialize
-		 */
-		virtual void serialize() override;
-
-		/**
-		 * @copydoc ManagedSerializableFieldData::deserialize
-		 */
-		virtual void deserialize() override;
-
-		ManagedSerializableDictionaryPtr value;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class ManagedSerializableFieldDataDictionaryRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsIReflectable.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**
+	 * Contains data that can be used for identifying a field in an object when cross referenced with the object type.
+	 *
+	 * @note	
+	 * Essentially a light-weight identifier for the field so that we don't need to store entire field type for each field
+	 * when serializing. Instead field types are stored separately and we just use this object for lookup.
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldKey : public IReflectable
+	{
+	public:
+		ManagedSerializableFieldKey();
+		ManagedSerializableFieldKey(UINT16 typeId, UINT16 fieldId);
+
+		/**
+		 * Creates a new field key.
+		 *
+		 * @param[in]	typeId	Unique ID of the parent type the field belongs to. See ManagedSerializableTypeInfoObject.
+		 * @param[in]	fieldId	Unique ID of the field within its parent class. See ManagedSerializableObjectInfo.
+		 */
+		static ManagedSerializableFieldKeyPtr create(UINT16 typeId, UINT16 fieldId);
+
+		UINT16 mTypeId;
+		UINT16 mFieldId;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ScriptSerializableFieldDataKeyRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains value of a single field in a managed object. This class can contain any data type and should be overridden
+	 * for specific types.
+	 *
+	 * Stored values can be serialized and stored for later use, and deserialized back to managed objects when needed. You
+	 * must call serialize() before performing RTTI serialization. After field data has been serialized you should not call
+	 * any methods on it before calling deserialize().
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldData : public IReflectable
+	{
+	public:
+		virtual ~ManagedSerializableFieldData() { }
+
+		/**
+		 * Creates a new data wrapper for some field data.
+		 *
+		 * @param[in]	typeInfo	Type of the data we're storing.
+		 * @param[in]	value		Managed boxed value to store in the field. Value will be copied into the internal buffer
+		 *							and stored.
+		 */
+		static ManagedSerializableFieldDataPtr create(const ManagedSerializableTypeInfoPtr& typeInfo, MonoObject* value);
+
+		/**
+		 * Creates a new data wrapper containing default instance of the provided type.
+		 *
+		 * @param[in]	typeInfo	Type of the data we're storing.
+		 */
+		static ManagedSerializableFieldDataPtr createDefault(const ManagedSerializableTypeInfoPtr& typeInfo);
+
+		/**
+		 * Returns the internal value.
+		 *
+		 * @param[in]	typeInfo	Type of the data we're looking to retrieve. This isn't required for actually retrieving
+		 *							the data but is used as an extra check to ensure the field contains the data type we're
+		 *							looking for.
+		 * @return					Pointer to the internal serialized data. Caller must ensure the pointer is cast to the
+		 *							proper type.
+		 */
+		virtual void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) = 0;
+
+		/**
+		 * Boxes the internal value and returns it.
+		 *
+		 * @param[in]	typeInfo	Type of the data we're looking to retrieve. This isn't required for actually retrieving
+		 *							the data but is used as an extra check to ensure the field contains the data type we're
+		 *							looking for.
+		 * @return					Boxed representation of the internal value.
+		 */
+		virtual MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) = 0;
+
+		/**
+		 * Checks if the internal value stored in this object matches the value stored in another. Does shallow comparison
+		 * for complex objects.
+		 */
+		virtual bool equals(const ManagedSerializableFieldDataPtr& other) = 0;
+
+		/**	Returns a hash value for the internally stored value. */
+		virtual size_t getHash() = 0;
+
+		/**
+		 * Serializes the internal value so that it may be stored and deserialized later.
+		 *
+		 * @note	
+		 * This is generally only relevant for complex objects, as primitive types have their values copied and serialized
+		 * automatically whenever field data is created.
+		 */
+		virtual void serialize() { }
+
+		/**	Deserializes the internal value so that the managed instance can be retrieved. */
+		virtual void deserialize() { }
+
+	private:
+		/**
+		 * Creates a new data wrapper for some field data.
+		 *
+		 * @param[in]	typeInfo	Type of the data we're storing.
+		 * @param[in]	value		Managed boxed value to store in the field. Value will be copied into the internal buffer
+		 *							and stored.
+		 * @param[in]	allowNull	Determines should null values be allowed. If false the objects with null values will
+		 *							instead be instantiated to their default values.
+		 */
+		static ManagedSerializableFieldDataPtr create(const ManagedSerializableTypeInfoPtr& typeInfo, MonoObject* value, 
+			bool allowNull);
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains type and value of a single field in an object. */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataEntry : public IReflectable
+	{
+	public:
+		static ManagedSerializableFieldDataEntryPtr create(const ManagedSerializableFieldKeyPtr& key, const ManagedSerializableFieldDataPtr& value);
+
+		ManagedSerializableFieldKeyPtr mKey;
+		ManagedSerializableFieldDataPtr mValue;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataEntryRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains boolean field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataBool : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		bool value = false;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataBoolRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains wide character field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataChar : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		wchar_t value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataCharRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains signed 8-bit integer field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */	
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI8 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		INT8 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataI8RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains unsigned 8-bit integer field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU8 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		UINT8 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataU8RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains signed 16-bit integer field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI16 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		INT16 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataI16RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains unsigned 16-bit field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU16 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		UINT16 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataU16RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains signed 32-bit integer field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI32 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		INT32 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataI32RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains unsigned 32-bit integer field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU32 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		UINT32 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataU32RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains signed 64-bit integer field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI64 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		INT64 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataI64RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains unsigned 64-bit integer field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU64 : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		UINT64 value = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataU64RTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains single precision floating point field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataFloat : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		float value = 0.0f;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataFloatRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains double precision floating point field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDouble : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		double value = 0.0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataDoubleRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains wide character string field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataString : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		WString value;
+		bool isNull = false;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataStringRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains resource reference field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataResourceRef : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		HResource value;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataResourceRefRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains game object reference field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataGameObjectRef : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		HGameObject value;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataGameObjectRefRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains complex object field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataObject : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		/** @copydoc ManagedSerializableFieldData::serialize */
+		virtual void serialize() override;
+
+		/** @copydoc ManagedSerializableFieldData::deserialize */
+		virtual void deserialize() override;
+
+		ManagedSerializableObjectPtr value;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataObjectRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains array field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataArray : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		/** @copydoc ManagedSerializableFieldData::serialize */
+		virtual void serialize() override;
+
+		/** @copydoc ManagedSerializableFieldData::deserialize */
+		virtual void deserialize() override;
+
+		ManagedSerializableArrayPtr value;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataArrayRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains list field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataList : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		/** @copydoc ManagedSerializableFieldData::serialize */
+		virtual void serialize() override;
+
+		/** @copydoc ManagedSerializableFieldData::deserialize */
+		virtual void deserialize() override;
+
+		ManagedSerializableListPtr value;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataListRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**
+	 * Contains dictionary field data.
+	 *
+	 * @copydoc	ManagedSerializableFieldData
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDictionary : public ManagedSerializableFieldData
+	{
+	public:
+		/** @copydoc ManagedSerializableFieldData::getValue */
+		void* getValue(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::getValueBoxed */
+		MonoObject* getValueBoxed(const ManagedSerializableTypeInfoPtr& typeInfo) override;
+
+		/** @copydoc ManagedSerializableFieldData::equals */
+		bool equals(const ManagedSerializableFieldDataPtr& other) override;
+
+		/** @copydoc ManagedSerializableFieldData::getHash */
+		size_t getHash() override;
+
+		/** @copydoc ManagedSerializableFieldData::serialize */
+		virtual void serialize() override;
+
+		/** @copydoc ManagedSerializableFieldData::deserialize */
+		virtual void deserialize() override;
+
+		ManagedSerializableDictionaryPtr value;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class ManagedSerializableFieldDataDictionaryRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 661 - 655
Source/SBansheeEngine/Include/BsManagedSerializableFieldRTTI.h

@@ -1,656 +1,662 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsManagedSerializableField.h"
-#include "BsException.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldKeyRTTI : public RTTIType<ManagedSerializableFieldKey, IReflectable, ManagedSerializableFieldKeyRTTI>
-	{
-	private:
-		UINT16& getTypeId(ManagedSerializableFieldKey* obj) { return obj->mTypeId; }
-		void setTypeId(ManagedSerializableFieldKey* obj, UINT16& val) { obj->mTypeId = val; }
-
-		UINT16& getFieldId(ManagedSerializableFieldKey* obj) { return obj->mFieldId; }
-		void setFieldId(ManagedSerializableFieldKey* obj, UINT16& val) { obj->mFieldId = val; }
-
-	public:
-		ManagedSerializableFieldKeyRTTI()
-		{
-			addPlainField("mTypeId", 0, &ManagedSerializableFieldKeyRTTI::getTypeId, &ManagedSerializableFieldKeyRTTI::setTypeId);
-			addPlainField("mFieldId", 1, &ManagedSerializableFieldKeyRTTI::getFieldId, &ManagedSerializableFieldKeyRTTI::setFieldId);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldKey";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldKey;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldKey>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataRTTI : public RTTIType<ManagedSerializableFieldData, IReflectable, ManagedSerializableFieldDataRTTI>
-	{
-	private:
-
-	public:
-		ManagedSerializableFieldDataRTTI()
-		{
-
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldData";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldData;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			BS_EXCEPT(InvalidStateException, "Cannot instantiate an abstract class.");
-			return nullptr;
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataEntryRTTI : public RTTIType<ManagedSerializableFieldDataEntry, IReflectable, ManagedSerializableFieldDataEntryRTTI>
-	{
-	private:
-		ManagedSerializableFieldKeyPtr getKey(ManagedSerializableFieldDataEntry* obj)	{ return obj->mKey; }
-		void setKey(ManagedSerializableFieldDataEntry* obj, ManagedSerializableFieldKeyPtr val) { obj->mKey = val; }
-
-		ManagedSerializableFieldDataPtr getValue(ManagedSerializableFieldDataEntry* obj) { return obj->mValue; }
-		void setValue(ManagedSerializableFieldDataEntry* obj, ManagedSerializableFieldDataPtr val) { obj->mValue = val; }
-
-	public:
-		ManagedSerializableFieldDataEntryRTTI()
-		{
-			addReflectablePtrField("mKey", 0, &ManagedSerializableFieldDataEntryRTTI::getKey, &ManagedSerializableFieldDataEntryRTTI::setKey);
-			addReflectablePtrField("mValue", 1, &ManagedSerializableFieldDataEntryRTTI::getValue, &ManagedSerializableFieldDataEntryRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataEntry";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataEntry;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataEntry>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataBoolRTTI : public RTTIType<ManagedSerializableFieldDataBool, ManagedSerializableFieldData, ManagedSerializableFieldDataBoolRTTI>
-	{
-	private:
-		bool& getValue(ManagedSerializableFieldDataBool* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataBool* obj, bool& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataBoolRTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataBoolRTTI::getValue, &ManagedSerializableFieldDataBoolRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataBool";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataBool;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataBool>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataCharRTTI : public RTTIType<ManagedSerializableFieldDataChar, ManagedSerializableFieldData, ManagedSerializableFieldDataCharRTTI>
-	{
-	private:
-		wchar_t& getValue(ManagedSerializableFieldDataChar* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataChar* obj, wchar_t& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataCharRTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataCharRTTI::getValue, &ManagedSerializableFieldDataCharRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataChar";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataChar;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataBool>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI8RTTI : public RTTIType<ManagedSerializableFieldDataI8, ManagedSerializableFieldData, ManagedSerializableFieldDataI8RTTI>
-	{
-	private:
-		INT8& getValue(ManagedSerializableFieldDataI8* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataI8* obj, INT8& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataI8RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataI8RTTI::getValue, &ManagedSerializableFieldDataI8RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataI8";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataI8;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataI8>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU8RTTI : public RTTIType<ManagedSerializableFieldDataU8, ManagedSerializableFieldData, ManagedSerializableFieldDataU8RTTI>
-	{
-	private:
-		UINT8& getValue(ManagedSerializableFieldDataU8* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataU8* obj, UINT8& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataU8RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataU8RTTI::getValue, &ManagedSerializableFieldDataU8RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataU8";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataU8;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataU8>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI16RTTI : public RTTIType<ManagedSerializableFieldDataI16, ManagedSerializableFieldData, ManagedSerializableFieldDataI16RTTI>
-	{
-	private:
-		INT16& getValue(ManagedSerializableFieldDataI16* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataI16* obj, INT16& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataI16RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataI16RTTI::getValue, &ManagedSerializableFieldDataI16RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataI16";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataI16;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataI16>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU16RTTI : public RTTIType<ManagedSerializableFieldDataU16, ManagedSerializableFieldData, ManagedSerializableFieldDataU16RTTI>
-	{
-	private:
-		UINT16& getValue(ManagedSerializableFieldDataU16* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataU16* obj, UINT16& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataU16RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataU16RTTI::getValue, &ManagedSerializableFieldDataU16RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataU16";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataU16;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataU16>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI32RTTI : public RTTIType<ManagedSerializableFieldDataI32, ManagedSerializableFieldData, ManagedSerializableFieldDataI32RTTI>
-	{
-	private:
-		INT32& getValue(ManagedSerializableFieldDataI32* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataI32* obj, INT32& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataI32RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataI32RTTI::getValue, &ManagedSerializableFieldDataI32RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataI32";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataI32;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataI32>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU32RTTI : public RTTIType<ManagedSerializableFieldDataU32, ManagedSerializableFieldData, ManagedSerializableFieldDataU32RTTI>
-	{
-	private:
-		UINT32& getValue(ManagedSerializableFieldDataU32* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataU32* obj, UINT32& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataU32RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataU32RTTI::getValue, &ManagedSerializableFieldDataU32RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataU32";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataU32;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataU32>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI64RTTI : public RTTIType<ManagedSerializableFieldDataI64, ManagedSerializableFieldData, ManagedSerializableFieldDataI64RTTI>
-	{
-	private:
-		INT64& getValue(ManagedSerializableFieldDataI64* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataI64* obj, INT64& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataI64RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataI64RTTI::getValue, &ManagedSerializableFieldDataI64RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataI64";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataI64;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataI64>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU64RTTI : public RTTIType<ManagedSerializableFieldDataU64, ManagedSerializableFieldData, ManagedSerializableFieldDataU64RTTI>
-	{
-	private:
-		UINT64& getValue(ManagedSerializableFieldDataU64* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataU64* obj, UINT64& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataU64RTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataU64RTTI::getValue, &ManagedSerializableFieldDataU64RTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataU64";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataU64;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataU64>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataFloatRTTI : public RTTIType<ManagedSerializableFieldDataFloat, ManagedSerializableFieldData, ManagedSerializableFieldDataFloatRTTI>
-	{
-	private:
-		float& getValue(ManagedSerializableFieldDataFloat* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataFloat* obj, float& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataFloatRTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataFloatRTTI::getValue, &ManagedSerializableFieldDataFloatRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataFloat";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataFloat;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataFloat>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDoubleRTTI : public RTTIType<ManagedSerializableFieldDataDouble, ManagedSerializableFieldData, ManagedSerializableFieldDataDoubleRTTI>
-	{
-	private:
-		double& getValue(ManagedSerializableFieldDataDouble* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataDouble* obj, double& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataDoubleRTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataDoubleRTTI::getValue, &ManagedSerializableFieldDataDoubleRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataDouble";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataDouble;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataDouble>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataStringRTTI : public RTTIType<ManagedSerializableFieldDataString, ManagedSerializableFieldData, ManagedSerializableFieldDataStringRTTI>
-	{
-	private:
-		WString& getValue(ManagedSerializableFieldDataString* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataString* obj, WString& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataStringRTTI()
-		{
-			addPlainField("mValue", 0, &ManagedSerializableFieldDataStringRTTI::getValue, &ManagedSerializableFieldDataStringRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataString";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataString;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataString>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataResourceRefRTTI : public RTTIType<ManagedSerializableFieldDataResourceRef, ManagedSerializableFieldData, ManagedSerializableFieldDataResourceRefRTTI>
-	{
-	private:
-		HResource& getValue(ManagedSerializableFieldDataResourceRef* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataResourceRef* obj, HResource& val) { obj->value = HResource(val); }
-
-	public:
-		ManagedSerializableFieldDataResourceRefRTTI()
-		{
-			addReflectableField("mValue", 0, &ManagedSerializableFieldDataResourceRefRTTI::getValue, &ManagedSerializableFieldDataResourceRefRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataResourceRef";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataResourceRef;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataResourceRef>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataGameObjectRefRTTI : public RTTIType<ManagedSerializableFieldDataGameObjectRef, ManagedSerializableFieldData, ManagedSerializableFieldDataGameObjectRefRTTI>
-	{
-	private:
-		HGameObject& getValue(ManagedSerializableFieldDataGameObjectRef* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataGameObjectRef* obj, HGameObject& val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataGameObjectRefRTTI()
-		{
-			addReflectableField("mValue", 0, &ManagedSerializableFieldDataGameObjectRefRTTI::getValue, &ManagedSerializableFieldDataGameObjectRefRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataGameObjectRef";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataGameObjectRef;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataGameObjectRef>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataObjectRTTI : public RTTIType<ManagedSerializableFieldDataObject, ManagedSerializableFieldData, ManagedSerializableFieldDataObjectRTTI>
-	{
-	private:
-		ManagedSerializableObjectPtr getValue(ManagedSerializableFieldDataObject* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataObject* obj, ManagedSerializableObjectPtr val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataObjectRTTI()
-		{
-			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataObjectRTTI::getValue, &ManagedSerializableFieldDataObjectRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataObject";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataObject;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataObject>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataArrayRTTI : public RTTIType<ManagedSerializableFieldDataArray, ManagedSerializableFieldData, ManagedSerializableFieldDataArrayRTTI>
-	{
-	private:
-		ManagedSerializableArrayPtr getValue(ManagedSerializableFieldDataArray* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataArray* obj, ManagedSerializableArrayPtr val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataArrayRTTI()
-		{
-			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataArrayRTTI::getValue, &ManagedSerializableFieldDataArrayRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataArray";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataArray;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataArray>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataListRTTI : public RTTIType<ManagedSerializableFieldDataList, ManagedSerializableFieldData, ManagedSerializableFieldDataListRTTI>
-	{
-	private:
-		ManagedSerializableListPtr getValue(ManagedSerializableFieldDataList* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataList* obj, ManagedSerializableListPtr val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataListRTTI()
-		{
-			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataListRTTI::getValue, &ManagedSerializableFieldDataListRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataList";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataList;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataList>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDictionaryRTTI : public RTTIType<ManagedSerializableFieldDataDictionary, ManagedSerializableFieldData, ManagedSerializableFieldDataDictionaryRTTI>
-	{
-	private:
-		ManagedSerializableDictionaryPtr getValue(ManagedSerializableFieldDataDictionary* obj) { return obj->value; }
-		void setValue(ManagedSerializableFieldDataDictionary* obj, ManagedSerializableDictionaryPtr val) { obj->value = val; }
-
-	public:
-		ManagedSerializableFieldDataDictionaryRTTI()
-		{
-			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataDictionaryRTTI::getValue, &ManagedSerializableFieldDataDictionaryRTTI::setValue);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "SerializableFieldDataDictionary";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldDataDictionary;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldDataDictionary>();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsManagedSerializableField.h"
+#include "BsException.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldKeyRTTI : public RTTIType<ManagedSerializableFieldKey, IReflectable, ManagedSerializableFieldKeyRTTI>
+	{
+	private:
+		UINT16& getTypeId(ManagedSerializableFieldKey* obj) { return obj->mTypeId; }
+		void setTypeId(ManagedSerializableFieldKey* obj, UINT16& val) { obj->mTypeId = val; }
+
+		UINT16& getFieldId(ManagedSerializableFieldKey* obj) { return obj->mFieldId; }
+		void setFieldId(ManagedSerializableFieldKey* obj, UINT16& val) { obj->mFieldId = val; }
+
+	public:
+		ManagedSerializableFieldKeyRTTI()
+		{
+			addPlainField("mTypeId", 0, &ManagedSerializableFieldKeyRTTI::getTypeId, &ManagedSerializableFieldKeyRTTI::setTypeId);
+			addPlainField("mFieldId", 1, &ManagedSerializableFieldKeyRTTI::getFieldId, &ManagedSerializableFieldKeyRTTI::setFieldId);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldKey";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldKey;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldKey>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataRTTI : public RTTIType<ManagedSerializableFieldData, IReflectable, ManagedSerializableFieldDataRTTI>
+	{
+	private:
+
+	public:
+		ManagedSerializableFieldDataRTTI()
+		{
+
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldData";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldData;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			BS_EXCEPT(InvalidStateException, "Cannot instantiate an abstract class.");
+			return nullptr;
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataEntryRTTI : public RTTIType<ManagedSerializableFieldDataEntry, IReflectable, ManagedSerializableFieldDataEntryRTTI>
+	{
+	private:
+		ManagedSerializableFieldKeyPtr getKey(ManagedSerializableFieldDataEntry* obj)	{ return obj->mKey; }
+		void setKey(ManagedSerializableFieldDataEntry* obj, ManagedSerializableFieldKeyPtr val) { obj->mKey = val; }
+
+		ManagedSerializableFieldDataPtr getValue(ManagedSerializableFieldDataEntry* obj) { return obj->mValue; }
+		void setValue(ManagedSerializableFieldDataEntry* obj, ManagedSerializableFieldDataPtr val) { obj->mValue = val; }
+
+	public:
+		ManagedSerializableFieldDataEntryRTTI()
+		{
+			addReflectablePtrField("mKey", 0, &ManagedSerializableFieldDataEntryRTTI::getKey, &ManagedSerializableFieldDataEntryRTTI::setKey);
+			addReflectablePtrField("mValue", 1, &ManagedSerializableFieldDataEntryRTTI::getValue, &ManagedSerializableFieldDataEntryRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataEntry";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataEntry;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataEntry>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataBoolRTTI : public RTTIType<ManagedSerializableFieldDataBool, ManagedSerializableFieldData, ManagedSerializableFieldDataBoolRTTI>
+	{
+	private:
+		bool& getValue(ManagedSerializableFieldDataBool* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataBool* obj, bool& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataBoolRTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataBoolRTTI::getValue, &ManagedSerializableFieldDataBoolRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataBool";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataBool;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataBool>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataCharRTTI : public RTTIType<ManagedSerializableFieldDataChar, ManagedSerializableFieldData, ManagedSerializableFieldDataCharRTTI>
+	{
+	private:
+		wchar_t& getValue(ManagedSerializableFieldDataChar* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataChar* obj, wchar_t& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataCharRTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataCharRTTI::getValue, &ManagedSerializableFieldDataCharRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataChar";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataChar;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataBool>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI8RTTI : public RTTIType<ManagedSerializableFieldDataI8, ManagedSerializableFieldData, ManagedSerializableFieldDataI8RTTI>
+	{
+	private:
+		INT8& getValue(ManagedSerializableFieldDataI8* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataI8* obj, INT8& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataI8RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataI8RTTI::getValue, &ManagedSerializableFieldDataI8RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataI8";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataI8;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataI8>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU8RTTI : public RTTIType<ManagedSerializableFieldDataU8, ManagedSerializableFieldData, ManagedSerializableFieldDataU8RTTI>
+	{
+	private:
+		UINT8& getValue(ManagedSerializableFieldDataU8* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataU8* obj, UINT8& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataU8RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataU8RTTI::getValue, &ManagedSerializableFieldDataU8RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataU8";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataU8;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataU8>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI16RTTI : public RTTIType<ManagedSerializableFieldDataI16, ManagedSerializableFieldData, ManagedSerializableFieldDataI16RTTI>
+	{
+	private:
+		INT16& getValue(ManagedSerializableFieldDataI16* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataI16* obj, INT16& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataI16RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataI16RTTI::getValue, &ManagedSerializableFieldDataI16RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataI16";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataI16;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataI16>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU16RTTI : public RTTIType<ManagedSerializableFieldDataU16, ManagedSerializableFieldData, ManagedSerializableFieldDataU16RTTI>
+	{
+	private:
+		UINT16& getValue(ManagedSerializableFieldDataU16* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataU16* obj, UINT16& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataU16RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataU16RTTI::getValue, &ManagedSerializableFieldDataU16RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataU16";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataU16;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataU16>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI32RTTI : public RTTIType<ManagedSerializableFieldDataI32, ManagedSerializableFieldData, ManagedSerializableFieldDataI32RTTI>
+	{
+	private:
+		INT32& getValue(ManagedSerializableFieldDataI32* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataI32* obj, INT32& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataI32RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataI32RTTI::getValue, &ManagedSerializableFieldDataI32RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataI32";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataI32;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataI32>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU32RTTI : public RTTIType<ManagedSerializableFieldDataU32, ManagedSerializableFieldData, ManagedSerializableFieldDataU32RTTI>
+	{
+	private:
+		UINT32& getValue(ManagedSerializableFieldDataU32* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataU32* obj, UINT32& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataU32RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataU32RTTI::getValue, &ManagedSerializableFieldDataU32RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataU32";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataU32;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataU32>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI64RTTI : public RTTIType<ManagedSerializableFieldDataI64, ManagedSerializableFieldData, ManagedSerializableFieldDataI64RTTI>
+	{
+	private:
+		INT64& getValue(ManagedSerializableFieldDataI64* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataI64* obj, INT64& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataI64RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataI64RTTI::getValue, &ManagedSerializableFieldDataI64RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataI64";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataI64;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataI64>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU64RTTI : public RTTIType<ManagedSerializableFieldDataU64, ManagedSerializableFieldData, ManagedSerializableFieldDataU64RTTI>
+	{
+	private:
+		UINT64& getValue(ManagedSerializableFieldDataU64* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataU64* obj, UINT64& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataU64RTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataU64RTTI::getValue, &ManagedSerializableFieldDataU64RTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataU64";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataU64;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataU64>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataFloatRTTI : public RTTIType<ManagedSerializableFieldDataFloat, ManagedSerializableFieldData, ManagedSerializableFieldDataFloatRTTI>
+	{
+	private:
+		float& getValue(ManagedSerializableFieldDataFloat* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataFloat* obj, float& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataFloatRTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataFloatRTTI::getValue, &ManagedSerializableFieldDataFloatRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataFloat";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataFloat;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataFloat>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDoubleRTTI : public RTTIType<ManagedSerializableFieldDataDouble, ManagedSerializableFieldData, ManagedSerializableFieldDataDoubleRTTI>
+	{
+	private:
+		double& getValue(ManagedSerializableFieldDataDouble* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataDouble* obj, double& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataDoubleRTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataDoubleRTTI::getValue, &ManagedSerializableFieldDataDoubleRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataDouble";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataDouble;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataDouble>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataStringRTTI : public RTTIType<ManagedSerializableFieldDataString, ManagedSerializableFieldData, ManagedSerializableFieldDataStringRTTI>
+	{
+	private:
+		WString& getValue(ManagedSerializableFieldDataString* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataString* obj, WString& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataStringRTTI()
+		{
+			addPlainField("mValue", 0, &ManagedSerializableFieldDataStringRTTI::getValue, &ManagedSerializableFieldDataStringRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataString";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataString;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataString>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataResourceRefRTTI : public RTTIType<ManagedSerializableFieldDataResourceRef, ManagedSerializableFieldData, ManagedSerializableFieldDataResourceRefRTTI>
+	{
+	private:
+		HResource& getValue(ManagedSerializableFieldDataResourceRef* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataResourceRef* obj, HResource& val) { obj->value = HResource(val); }
+
+	public:
+		ManagedSerializableFieldDataResourceRefRTTI()
+		{
+			addReflectableField("mValue", 0, &ManagedSerializableFieldDataResourceRefRTTI::getValue, &ManagedSerializableFieldDataResourceRefRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataResourceRef";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataResourceRef;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataResourceRef>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataGameObjectRefRTTI : public RTTIType<ManagedSerializableFieldDataGameObjectRef, ManagedSerializableFieldData, ManagedSerializableFieldDataGameObjectRefRTTI>
+	{
+	private:
+		HGameObject& getValue(ManagedSerializableFieldDataGameObjectRef* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataGameObjectRef* obj, HGameObject& val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataGameObjectRefRTTI()
+		{
+			addReflectableField("mValue", 0, &ManagedSerializableFieldDataGameObjectRefRTTI::getValue, &ManagedSerializableFieldDataGameObjectRefRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataGameObjectRef";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataGameObjectRef;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataGameObjectRef>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataObjectRTTI : public RTTIType<ManagedSerializableFieldDataObject, ManagedSerializableFieldData, ManagedSerializableFieldDataObjectRTTI>
+	{
+	private:
+		ManagedSerializableObjectPtr getValue(ManagedSerializableFieldDataObject* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataObject* obj, ManagedSerializableObjectPtr val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataObjectRTTI()
+		{
+			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataObjectRTTI::getValue, &ManagedSerializableFieldDataObjectRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataObject";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataObject;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataObject>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataArrayRTTI : public RTTIType<ManagedSerializableFieldDataArray, ManagedSerializableFieldData, ManagedSerializableFieldDataArrayRTTI>
+	{
+	private:
+		ManagedSerializableArrayPtr getValue(ManagedSerializableFieldDataArray* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataArray* obj, ManagedSerializableArrayPtr val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataArrayRTTI()
+		{
+			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataArrayRTTI::getValue, &ManagedSerializableFieldDataArrayRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataArray";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataArray;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataArray>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataListRTTI : public RTTIType<ManagedSerializableFieldDataList, ManagedSerializableFieldData, ManagedSerializableFieldDataListRTTI>
+	{
+	private:
+		ManagedSerializableListPtr getValue(ManagedSerializableFieldDataList* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataList* obj, ManagedSerializableListPtr val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataListRTTI()
+		{
+			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataListRTTI::getValue, &ManagedSerializableFieldDataListRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataList";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataList;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataList>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDictionaryRTTI : public RTTIType<ManagedSerializableFieldDataDictionary, ManagedSerializableFieldData, ManagedSerializableFieldDataDictionaryRTTI>
+	{
+	private:
+		ManagedSerializableDictionaryPtr getValue(ManagedSerializableFieldDataDictionary* obj) { return obj->value; }
+		void setValue(ManagedSerializableFieldDataDictionary* obj, ManagedSerializableDictionaryPtr val) { obj->value = val; }
+
+	public:
+		ManagedSerializableFieldDataDictionaryRTTI()
+		{
+			addReflectablePtrField("mValue", 0, &ManagedSerializableFieldDataDictionaryRTTI::getValue, &ManagedSerializableFieldDataDictionaryRTTI::setValue);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SerializableFieldDataDictionary";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldDataDictionary;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldDataDictionary>();
+		}
+	};
+
+	/** @} */
 }

+ 151 - 167
Source/SBansheeEngine/Include/BsManagedSerializableList.h

@@ -1,168 +1,152 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsIReflectable.h"
-#include <mono/jit/jit.h>
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Allows access to an underlying managed list, or a cached version of that list that
-	 *			can be serialized/deserialized.
-	 *
-	 * @note	This class can be in two states:
-	 *			 - Linked - When the object has a link to a managed object. This is the default 
-	 *                      state when a new instance of ManagedSerializableObject is created.
-	 *						Any operations during this state will operate directly on the linked
-	 *						managed object.
-	 *			 - Serialized - When the object has no link to the managed object but instead just
-	 *							contains cached object and field data that may be used for initializing
-	 *							a managed object. Any operations during this state will operate
-	 *							only on the cached internal data.
-	 *			You can transfer between these states by calling serialize(linked->serialized) &
-	 *			deserialize (serialized->linked).
-	 *	
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableList : public IReflectable
-	{
-	private:
-		struct ConstructPrivately {};
-
-	public:
-		ManagedSerializableList(const ConstructPrivately& dummy, const ManagedSerializableTypeInfoListPtr& typeInfo, MonoObject* managedInstance);
-		ManagedSerializableList(const ConstructPrivately& dummy);
-
-		/**
-		 * @brief	Returns the internal managed instance of the list. This will return null if
-		 *			the object is in serialized mode.
-		 */
-		MonoObject* getManagedInstance() const { return mManagedInstance; }
-
-		/**
-		 * @brief	Returns the type information for the internal list.
-		 */
-		ManagedSerializableTypeInfoListPtr getTypeInfo() const { return mListTypeInfo; }
-
-		/**
-		 * @brief	Changes the size of the list. Operates on managed object if in linked state, 
-		 *			or on cached data otherwise.
-		 */
-		void resize(UINT32 newSize);
-
-		/**
-		 * @brief	Sets a new element value at the specified list index. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 *
-		 * @param	arrayIdx	Index at which to set the value.
-		 * @param	val			Wrapper around the value to store in the list. Must be of the
-		 *						list element type.
-		 */
-		void setFieldData(UINT32 arrayIdx, const ManagedSerializableFieldDataPtr& val);
-
-		/**
-		 * @brief	Returns the element value at the specified list index. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 *
-		 * @param	arrayIdx	Index at which to retrieve the value.
-		 *
-		 * @return	A wrapper around the element value in the list.
-		 */
-		ManagedSerializableFieldDataPtr getFieldData(UINT32 arrayIdx);
-
-		/**
-		 * @brief	Returns the size of the list. Operates on managed object 
-		 *			if in linked state, or on cached data otherwise.
-		 */
-		UINT32 getLength() const { return mNumElements; }
-
-		/**
-		 * @brief	Serializes the internal managed object into a set of cached data that can be saved
-		 *			in memory/disk and can be deserialized later. Does nothing if object is already is 
-		 *			serialized mode. When in serialized mode the reference to the managed instance will be lost.
-		 */
-		void serialize();
-
-		/**
-		 * @brief	Deserializes a set of cached data into a managed object. This action may fail in case the cached
-		 *			data contains a type that no longer exists. You may check if it completely successfully if ::getManagedInstance
-		 *			returns non-null after.
-		 *
-		 *			This action transfers the object into linked mode. All further operations will operate directly on the managed instance
-		 *			and the cached data will be cleared. If you call this method on an already linked object the old object will be
-		 *			replaced and initialized with empty data (since cached data does not exist).
-		 */
-		void deserialize();
-
-		/**
-		 * @brief	Creates a managed serializable list that references an existing managed list. Created object will be in linked mode.
-		 *
-		 * @param	managedInstance		Constructed managed instance of the list to link with. Its type must correspond with the provided type info.
-		 * @param	typeInfo			Type information for the list and its elements.
-		 */
-		static ManagedSerializableListPtr createFromExisting(MonoObject* managedInstance, const ManagedSerializableTypeInfoListPtr& typeInfo);
-
-		/**
-		 * @brief	Creates a managed serializable list that creates and references a brand new managed list instance.
-		 *
-		 * @param	typeInfo	Type of the list to create.
-		 * @param	size		Initial size of the list.
-		 */
-		static ManagedSerializableListPtr createNew(const ManagedSerializableTypeInfoListPtr& typeInfo, UINT32 size);
-
-		/**
-		 * @brief	Creates a managed list instance.
-		 *
-		 * @param	typeInfo	Type of the list to create.
-		 * @param	size		Initial size of the list.
-		 */
-		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoListPtr& typeInfo, UINT32 size);
-
-	protected:
-		/**
-		 * @brief	Retrieves needed Mono types and methods. Should be called
-		 *			before performing any operations with the managed object.
-		 */
-		void initMonoObjects(MonoClass* listClass);
-
-		/**
-		 * @brief	Returns the size of the list. Operates on the 
-		 *			internal managed object.
-		 */
-		UINT32 getLengthInternal() const;
-
-		/**
-		 * @brief	Appends data to the end of the list. Operates on
-		 *			the internal managed object.
-		 */
-		void addFieldDataInternal(const ManagedSerializableFieldDataPtr& val);
-
-		MonoObject* mManagedInstance;
-
-		MonoMethod* mAddMethod;
-		MonoMethod* mAddRangeMethod;
-		MonoMethod* mClearMethod;
-		MonoMethod* mCopyToMethod;
-		MonoProperty* mItemProp;
-		MonoProperty* mCountProp;
-
-		ManagedSerializableTypeInfoListPtr mListTypeInfo;
-		Vector<ManagedSerializableFieldDataPtr> mCachedEntries;
-		UINT32 mNumElements;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-		
-		/**
-		 * @brief	Creates an empty and uninitialized object used for serialization purposes.
-		 */
-		static ManagedSerializableListPtr createEmpty();
-
-	public:
-		friend class ManagedSerializableListRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsIReflectable.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**
+	 * Allows access to an underlying managed list, or a cached version of that list that can be serialized/deserialized.
+	 *
+	 * @note
+	 * This class can be in two states:
+	 *	 - Linked - When the object has a link to a managed object. This is the default state when a new instance
+	 *				of ManagedSerializableObject is created. Any operations during this state will operate directly
+	 *				on the linked managed object.
+	 *	 - Serialized - When the object has no link to the managed object but instead just contains cached object
+	 *					and field data that may be used for initializing a managed object. Any operations during
+	 *					this state will operate only on the cached internal data.
+	 * You can transfer between these states by calling serialize(linked->serialized) & deserialize (serialized->linked).
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableList : public IReflectable
+	{
+	private:
+		struct ConstructPrivately {};
+
+	public:
+		ManagedSerializableList(const ConstructPrivately& dummy, const ManagedSerializableTypeInfoListPtr& typeInfo, MonoObject* managedInstance);
+		ManagedSerializableList(const ConstructPrivately& dummy);
+
+		/** Returns the internal managed instance of the list. This will return null if the object is in serialized mode. */
+		MonoObject* getManagedInstance() const { return mManagedInstance; }
+
+		/**	Returns the type information for the internal list. */
+		ManagedSerializableTypeInfoListPtr getTypeInfo() const { return mListTypeInfo; }
+
+		/** Changes the size of the list. Operates on managed object if in linked state, or on cached data otherwise. */
+		void resize(UINT32 newSize);
+
+		/**
+		 * Sets a new element value at the specified list index. Operates on managed object if in linked state, or on cached
+		 * data otherwise.
+		 *
+		 * @param[in]	arrayIdx	Index at which to set the value.
+		 * @param[in]	val			Wrapper around the value to store in the list. Must be of the list element type.
+		 */
+		void setFieldData(UINT32 arrayIdx, const ManagedSerializableFieldDataPtr& val);
+
+		/**
+		 * Returns the element value at the specified list index. Operates on managed object if in linked state, or on
+		 * cached data otherwise.
+		 *
+		 * @param[in]	arrayIdx	Index at which to retrieve the value.
+		 * @return					A wrapper around the element value in the list.
+		 */
+		ManagedSerializableFieldDataPtr getFieldData(UINT32 arrayIdx);
+
+		/** Returns the size of the list. Operates on managed object if in linked state, or on cached data otherwise. */
+		UINT32 getLength() const { return mNumElements; }
+
+		/**
+		 * Serializes the internal managed object into a set of cached data that can be saved in memory/disk and can be
+		 * deserialized later. Does nothing if object is already is serialized mode. When in serialized mode the reference
+		 * to the managed instance will be lost.
+		 */
+		void serialize();
+
+		/**
+		 * Deserializes a set of cached data into a managed object. This action may fail in case the cached data contains a
+		 * type that no longer exists. You may check if it completely successfully if getManagedInstance() returns non-null
+		 * after.
+		 *
+		 * This action transfers the object into linked mode. All further operations will operate directly on the managed
+		 * instance and the cached data will be cleared. If you call this method on an already linked object the old object
+		 * will be replaced and initialized with empty data (since cached data does not exist).
+		 */
+		void deserialize();
+
+		/**
+		 * Creates a managed serializable list that references an existing managed list. Created object will be in linked
+		 * mode.
+		 *
+		 * @param[in]	managedInstance	Constructed managed instance of the list to link with. Its type must correspond with
+		 *								the provided type info.
+		 * @param[in]	typeInfo		Type information for the list and its elements.
+		 */
+		static ManagedSerializableListPtr createFromExisting(MonoObject* managedInstance, 
+			const ManagedSerializableTypeInfoListPtr& typeInfo);
+
+		/**
+		 * Creates a managed serializable list that creates and references a brand new managed list instance.
+		 *
+		 * @param[in]	typeInfo	Type of the list to create.
+		 * @param[in]	size		Initial size of the list.
+		 */
+		static ManagedSerializableListPtr createNew(const ManagedSerializableTypeInfoListPtr& typeInfo, UINT32 size);
+
+		/**
+		 * Creates a managed list instance.
+		 *
+		 * @param[in]	typeInfo	Type of the list to create.
+		 * @param[in]	size		Initial size of the list.
+		 */
+		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoListPtr& typeInfo, UINT32 size);
+
+	protected:
+		/**
+		 * Retrieves needed Mono types and methods. Should be called before performing any operations with the managed
+		 * object.
+		 */
+		void initMonoObjects(MonoClass* listClass);
+
+		/**	Returns the size of the list. Operates on the internal managed object. */
+		UINT32 getLengthInternal() const;
+
+		/** Appends data to the end of the list. Operates on the internal managed object. */
+		void addFieldDataInternal(const ManagedSerializableFieldDataPtr& val);
+
+		MonoObject* mManagedInstance;
+
+		MonoMethod* mAddMethod;
+		MonoMethod* mAddRangeMethod;
+		MonoMethod* mClearMethod;
+		MonoMethod* mCopyToMethod;
+		MonoProperty* mItemProp;
+		MonoProperty* mCountProp;
+
+		ManagedSerializableTypeInfoListPtr mListTypeInfo;
+		Vector<ManagedSerializableFieldDataPtr> mCachedEntries;
+		UINT32 mNumElements;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+		
+		/**	Creates an empty and uninitialized object used for serialization purposes. */
+		static ManagedSerializableListPtr createEmpty();
+
+	public:
+		friend class ManagedSerializableListRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 84 - 78
Source/SBansheeEngine/Include/BsManagedSerializableListRTTI.h

@@ -1,79 +1,85 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsManagedSerializableList.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedSerializableListRTTI : public RTTIType<ManagedSerializableList, IReflectable, ManagedSerializableListRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoListPtr getTypeInfo(ManagedSerializableList* obj)
-		{
-			return obj->mListTypeInfo;
-		}
-
-		void setTypeInfo(ManagedSerializableList* obj, ManagedSerializableTypeInfoListPtr val)
-		{
-			obj->mListTypeInfo = val;
-		}
-
-		UINT32& getNumElements(ManagedSerializableList* obj)
-		{
-			return (UINT32&)obj->mNumElements;
-		}
-
-		void setNumElements(ManagedSerializableList* obj, UINT32& numElements)
-		{
-			obj->mNumElements = numElements;
-		}
-
-		ManagedSerializableFieldDataPtr getListEntry(ManagedSerializableList* obj, UINT32 arrayIdx)
-		{
-			return obj->getFieldData(arrayIdx);
-		}
-
-		void setListEntry(ManagedSerializableList* obj, UINT32 arrayIdx, ManagedSerializableFieldDataPtr val)
-		{
-			obj->setFieldData(arrayIdx, val);
-		}
-
-		UINT32 getNumListEntries(ManagedSerializableList* obj)
-		{
-			return (UINT32)obj->mNumElements;
-		}
-
-		void setNumListEntries(ManagedSerializableList* obj, UINT32 numEntries)
-		{
-			obj->mCachedEntries = Vector<ManagedSerializableFieldDataPtr>(numEntries);
-		}
-
-	public:
-		ManagedSerializableListRTTI()
-		{
-			addReflectablePtrField("mListTypeInfo", 0, &ManagedSerializableListRTTI::getTypeInfo, &ManagedSerializableListRTTI::setTypeInfo);
-			addPlainField("mNumElements", 1, &ManagedSerializableListRTTI::getNumElements, &ManagedSerializableListRTTI::setNumElements);
-			addReflectablePtrArrayField("mListEntries", 2, &ManagedSerializableListRTTI::getListEntry, &ManagedSerializableListRTTI::getNumListEntries, 
-				&ManagedSerializableListRTTI::setListEntry, &ManagedSerializableListRTTI::setNumListEntries);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ScriptSerializableList";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ScriptSerializableList;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ManagedSerializableList::createEmpty();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsManagedSerializableList.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedSerializableListRTTI : public RTTIType<ManagedSerializableList, IReflectable, ManagedSerializableListRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoListPtr getTypeInfo(ManagedSerializableList* obj)
+		{
+			return obj->mListTypeInfo;
+		}
+
+		void setTypeInfo(ManagedSerializableList* obj, ManagedSerializableTypeInfoListPtr val)
+		{
+			obj->mListTypeInfo = val;
+		}
+
+		UINT32& getNumElements(ManagedSerializableList* obj)
+		{
+			return (UINT32&)obj->mNumElements;
+		}
+
+		void setNumElements(ManagedSerializableList* obj, UINT32& numElements)
+		{
+			obj->mNumElements = numElements;
+		}
+
+		ManagedSerializableFieldDataPtr getListEntry(ManagedSerializableList* obj, UINT32 arrayIdx)
+		{
+			return obj->getFieldData(arrayIdx);
+		}
+
+		void setListEntry(ManagedSerializableList* obj, UINT32 arrayIdx, ManagedSerializableFieldDataPtr val)
+		{
+			obj->setFieldData(arrayIdx, val);
+		}
+
+		UINT32 getNumListEntries(ManagedSerializableList* obj)
+		{
+			return (UINT32)obj->mNumElements;
+		}
+
+		void setNumListEntries(ManagedSerializableList* obj, UINT32 numEntries)
+		{
+			obj->mCachedEntries = Vector<ManagedSerializableFieldDataPtr>(numEntries);
+		}
+
+	public:
+		ManagedSerializableListRTTI()
+		{
+			addReflectablePtrField("mListTypeInfo", 0, &ManagedSerializableListRTTI::getTypeInfo, &ManagedSerializableListRTTI::setTypeInfo);
+			addPlainField("mNumElements", 1, &ManagedSerializableListRTTI::getNumElements, &ManagedSerializableListRTTI::setNumElements);
+			addReflectablePtrArrayField("mListEntries", 2, &ManagedSerializableListRTTI::getListEntry, &ManagedSerializableListRTTI::getNumListEntries, 
+				&ManagedSerializableListRTTI::setListEntry, &ManagedSerializableListRTTI::setNumListEntries);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableList";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptSerializableList;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableList::createEmpty();
+		}
+	};
+
+	/** @} */
 }

+ 151 - 156
Source/SBansheeEngine/Include/BsManagedSerializableObject.h

@@ -1,157 +1,152 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsIReflectable.h"
-#include "BsManagedSerializableField.h"
-#include <mono/jit/jit.h>
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Allows access to an underlying managed object, or a cached version of that object that
-	 *			can be serialized/deserialized.
-	 *
-	 * @note	This class can be in two states:
-	 *			 - Linked - When the object has a link to a managed object. This is the default 
-	 *                      state when a new instance of ManagedSerializableObject is created.
-	 *						Any operations during this state will operate directly on the linked
-	 *						managed object.
-	 *			 - Serialized - When the object has no link to the managed object but instead just
-	 *							contains cached object and field data that may be used for initializing
-	 *							a managed object. Any operations during this state will operate
-	 *							only on the cached internal data.
-	 *			You can transfer between these states by calling serialize(linked->serialized) &
-	 *			deserialize (serialized->linked).
-	 *	
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableObject : public IReflectable
-	{
-	private:
-		struct ConstructPrivately {};
-
-		/**
-		 * @brief	Generates a hash value for field key data identifying a single field in the object.
-		 */
-		struct BS_SCR_BE_EXPORT Hash
-		{
-			inline size_t operator()(const ManagedSerializableFieldKey& x) const;
-		};
-
-		/**
-		 * @brief	Compares two field key objects.
-		 */
-		struct BS_SCR_BE_EXPORT Equals
-		{
-			inline bool operator()(const ManagedSerializableFieldKey& a, const ManagedSerializableFieldKey& b) const;
-		};
-
-	public:
-		ManagedSerializableObject(const ConstructPrivately& dummy, ManagedSerializableObjectInfoPtr objInfo, MonoObject* managedInstance);
-		ManagedSerializableObject(const ConstructPrivately& dummy);
-
-		/**
-		 * @brief	Returns the internal managed instance of the object. This will return null if
-		 *			the object is in serialized mode.
-		 */
-		MonoObject* getManagedInstance() const { return mManagedInstance; }
-
-		/**
-		 * @brief	Returns the type information for the internal object.
-		 */
-		ManagedSerializableObjectInfoPtr getObjectInfo() const { return mObjInfo; }
-
-		/**
-		 * @brief	Sets a new value of the specified field. Operates on 
-		 *			managed object if in linked state, or on cached data otherwise.
-		 *
-		 * @param	fieldInfo	Object describing the field to which to set the value. This field
-		 *						must belong to the type this object is initialized with.
-		 * @param	val			Wrapper around the value to store in the field.
-		 */
-		void setFieldData(const ManagedSerializableFieldInfoPtr& fieldInfo, const ManagedSerializableFieldDataPtr& val);
-
-		/**
-		 * @brief	Returns the value of the specified field. Operates on managed object 
-		 *			if in linked state, or on cached data otherwise.
-		 *
-		 * @param	fieldInfo	Object describing the field to which to set the value. This field
-		 *						must belong to the type this object is initialized with.
-		 *
-		 * @return	A wrapper around the value of the field.
-		 */
-		ManagedSerializableFieldDataPtr getFieldData(const ManagedSerializableFieldInfoPtr& fieldInfo) const;
-
-		/**
-		 * @brief	Serializes the internal managed object into a set of cached data that can be saved
-		 *			in memory/disk and can be deserialized later. Does nothing if object is already is 
-		 *			serialized mode. When in serialized mode the reference to the managed instance will be lost.
-		 */
-		void serialize();
-
-		/**
-		 * @brief	Deserializes a set of cached data into a managed object. This action may fail in case the cached
-		 *			data contains a type that no longer exists. You may check if it completely successfully if ::getManagedInstance
-		 *			returns non-null after.
-		 *
-		 *			This action transfers the object into linked mode. All further operations will operate directly on the managed instance
-		 *			and the cached data will be cleared. If you call this method on an already linked object the old object will be
-		 *			replaced and initialized with empty data (since cached data does not exist).
-		 */
-		void deserialize();
-
-		/**
-		 * @brief	Deserializes a set of cached data into an existing managed object. Caller must ensure the provided object
-		 *			is of proper type.
-		 *
-		 *			This action transfers the object into linked mode. All further operations will operate directly on the managed instance
-		 *			and the cached data will be cleared. If you call this method on an already linked object the old object will be
-		 *			replaced and initialized with empty data (since cached data does not exist).
-		 *
-		 * @param	instance	Existing managed instance of the same type this serializable object represents.
-		 * @param	objInfo		Serializable object info for the managed object type.
-		 */
-		void deserialize(MonoObject* instance, const ManagedSerializableObjectInfoPtr& objInfo);
-
-		/**
-		 * @brief	Creates a managed serializable object that references an existing managed object. Created object will be in linked mode.
-		 *
-		 * @param	managedInstance		Constructed managed instance of the object to link with.
-		 */
-		static ManagedSerializableObjectPtr createFromExisting(MonoObject* managedInstance);
-
-		/**
-		 * @brief	Creates a managed serializable object that creates and references a brand new managed object instance.
-		 *
-		 * @param	type	Type of the object to create.
-		 */
-		static ManagedSerializableObjectPtr createNew(const ManagedSerializableTypeInfoObjectPtr& type);
-
-		/**
-		 * @brief	Creates a managed object instance.
-		 *
-		 * @param	type	Type of the object to create.
-		 */
-		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoObjectPtr& type);
-	protected:
-		MonoObject* mManagedInstance;
-
-		ManagedSerializableObjectInfoPtr mObjInfo;
-		UnorderedMap<ManagedSerializableFieldKey, ManagedSerializableFieldDataPtr, Hash, Equals> mCachedData;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-		
-		/**
-		 * @brief	Creates an empty and uninitialized object used for serialization purposes.
-		 */
-		static ManagedSerializableObjectPtr createEmpty();
-
-	public:
-		friend class ManagedSerializableObjectRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsIReflectable.h"
+#include "BsManagedSerializableField.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**
+	 * Allows access to an underlying managed object, or a cached version of that object that can be
+	 * serialized/deserialized.
+	 *
+	 * @note
+	 * This class can be in two states:
+	 *	 - Linked - When the object has a link to a managed object. This is the default state when a new instance
+	 *				of ManagedSerializableObject is created. Any operations during this state will operate directly
+	 *				on the linked managed object.
+	 *	 - Serialized - When the object has no link to the managed object but instead just contains cached object
+	 *					and field data that may be used for initializing a managed object. Any operations during
+	 *					this state will operate only on the cached internal data.
+	 * You can transfer between these states by calling serialize(linked->serialized) & deserialize (serialized->linked).
+	 *	
+	 */
+	class BS_SCR_BE_EXPORT ManagedSerializableObject : public IReflectable
+	{
+	private:
+		struct ConstructPrivately {};
+
+		/**	Generates a hash value for field key data identifying a single field in the object. */
+		struct BS_SCR_BE_EXPORT Hash
+		{
+			inline size_t operator()(const ManagedSerializableFieldKey& x) const;
+		};
+
+		/**	Compares two field key objects. */
+		struct BS_SCR_BE_EXPORT Equals
+		{
+			inline bool operator()(const ManagedSerializableFieldKey& a, const ManagedSerializableFieldKey& b) const;
+		};
+
+	public:
+		ManagedSerializableObject(const ConstructPrivately& dummy, ManagedSerializableObjectInfoPtr objInfo, MonoObject* managedInstance);
+		ManagedSerializableObject(const ConstructPrivately& dummy);
+
+		/**
+		 * Returns the internal managed instance of the object. This will return null if the object is in serialized mode.
+		 */
+		MonoObject* getManagedInstance() const { return mManagedInstance; }
+
+		/**	Returns the type information for the internal object. */
+		ManagedSerializableObjectInfoPtr getObjectInfo() const { return mObjInfo; }
+
+		/**
+		 * Sets a new value of the specified field. Operates on managed object if in linked state, or on cached data
+		 * otherwise.
+		 *
+		 * @param[in]	fieldInfo	Object describing the field to which to set the value. This field must belong to the
+		 *							type this object is initialized with.
+		 * @param[in]	val			Wrapper around the value to store in the field.
+		 */
+		void setFieldData(const ManagedSerializableFieldInfoPtr& fieldInfo, const ManagedSerializableFieldDataPtr& val);
+
+		/**
+		 * Returns the value of the specified field. Operates on managed object if in linked state, or on cached data
+		 * otherwise.
+		 *
+		 * @param[in]	fieldInfo	Object describing the field to which to set the value. This field must belong to the
+		 *							type this object is initialized with.
+		 * @return					A wrapper around the value of the field.
+		 */
+		ManagedSerializableFieldDataPtr getFieldData(const ManagedSerializableFieldInfoPtr& fieldInfo) const;
+
+		/**
+		 * Serializes the internal managed object into a set of cached data that can be saved in memory/disk and can be
+		 * deserialized later. Does nothing if object is already is serialized mode. When in serialized mode the reference
+		 * to the managed instance will be lost.
+		 */
+		void serialize();
+
+		/**
+		 * Deserializes a set of cached data into a managed object. This action may fail in case the cached data contains a
+		 * type that no longer exists. You may check if it completely successfully if getManagedInstance() returns non-null
+		 * after.
+		 *
+		 * This action transfers the object into linked mode. All further operations will operate directly on the managed
+		 * instance and the cached data will be cleared. If you call this method on an already linked object the old object
+		 * will be replaced and initialized with empty data (since cached data does not exist).
+		 */
+		void deserialize();
+
+		/**
+		 * Deserializes a set of cached data into an existing managed object. Caller must ensure the provided object is of
+		 * proper type.
+		 *
+		 * This action transfers the object into linked mode. All further operations will operate directly on the managed
+		 * instance and the cached data will be cleared. If you call this method on an already linked object the old object
+		 * will be replaced and initialized with empty data (since cached data does not exist).
+		 *
+		 * @param[in]	instance	Existing managed instance of the same type this serializable object represents.
+		 * @param[in]	objInfo		Serializable object info for the managed object type.
+		 */
+		void deserialize(MonoObject* instance, const ManagedSerializableObjectInfoPtr& objInfo);
+
+		/**
+		 * Creates a managed serializable object that references an existing managed object. Created object will be in
+		 * linked mode.
+		 *
+		 * @param[in]	managedInstance		Constructed managed instance of the object to link with.
+		 */
+		static ManagedSerializableObjectPtr createFromExisting(MonoObject* managedInstance);
+
+		/**
+		 * Creates a managed serializable object that creates and references a brand new managed object instance.
+		 *
+		 * @param[in]	type	Type of the object to create.
+		 */
+		static ManagedSerializableObjectPtr createNew(const ManagedSerializableTypeInfoObjectPtr& type);
+
+		/**
+		 * Creates a managed object instance.
+		 *
+		 * @param[in]	type	Type of the object to create.
+		 */
+		static MonoObject* createManagedInstance(const ManagedSerializableTypeInfoObjectPtr& type);
+	protected:
+		MonoObject* mManagedInstance;
+
+		ManagedSerializableObjectInfoPtr mObjInfo;
+		UnorderedMap<ManagedSerializableFieldKey, ManagedSerializableFieldDataPtr, Hash, Equals> mCachedData;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+		
+		/**	Creates an empty and uninitialized object used for serialization purposes. */
+		static ManagedSerializableObjectPtr createEmpty();
+
+	public:
+		friend class ManagedSerializableObjectRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 300 - 358
Source/SBansheeEngine/Include/BsManagedSerializableObjectInfo.h

@@ -1,359 +1,301 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsIReflectable.h"
-#include <mono/jit/jit.h>
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Valid serializable script types.
-	 */
-	enum class ScriptPrimitiveType
-	{
-		Bool,
-		Char,
-		I8,
-		U8,
-		I16,
-		U16,
-		I32,
-		U32,
-		I64,
-		U64,
-		Float,
-		Double,
-		String,
-		Texture2DRef,
-		Texture3DRef,
-		TextureCubeRef,
-		SpriteTextureRef,
-		ManagedResourceRef,
-		PlainTextRef,
-		ScriptCodeRef,
-		ShaderRef,
-		ShaderIncludeRef,
-		MaterialRef,
-		MeshRef,
-		PrefabRef,
-		FontRef,
-		StringTableRef,
-		GUISkinRef,
-		SceneObjectRef,
-		ComponentRef,
-		PhysicsMaterialRef,
-		PhysicsMeshRef,
-		Count // Keep at end
-	};
-
-	/**
-	 * @brief	Flags that are used to further define
-	 *			a field in a managed serializable object.
-	 */
-	enum class ScriptFieldFlags
-	{
-		Serializable = 0x01,
-		Inspectable = 0x02
-	};
-
-	/**
-	 * @brief	Contains information about a type of a managed serializable object.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfo : public IReflectable
-	{
-	public:
-		virtual ~ManagedSerializableTypeInfo() {}
-
-		/**
-		 * @brief	Checks if the current type matches the provided type.
-		 */
-		virtual bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const = 0;
-
-		/**
-		 * @brief	Checks does the managed type this object represents still exists.
-		 *
-		 * @note	e.g. If assemblies get refreshed user could have renamed or removed
-		 *			some types.
-		 */
-		virtual bool isTypeLoaded() const = 0;
-
-		/**
-		 * @brief	Returns the internal managed class of the type this object represents.
-		 *			Returns null if the type doesn't exist.
-		 */
-		virtual ::MonoClass* getMonoClass() const = 0;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableTypeInfoRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains information about a type of a managed serializable primitive (e.g. int, float, etc.).
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoPrimitive : public ManagedSerializableTypeInfo
-	{
-	public:
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::matches
-		 */
-		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::isTypeLoaded
-		 */
-		bool isTypeLoaded() const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::getMonoClass
-		 */
-		::MonoClass* getMonoClass() const override;
-
-		ScriptPrimitiveType mType;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableTypeInfoPrimitiveRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains information about a type of a managed serializable complex object (e.g. struct or class).
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoObject : public ManagedSerializableTypeInfo
-	{
-	public:
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::matches
-		 */
-		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::isTypeLoaded
-		 */
-		bool isTypeLoaded() const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::getMonoClass
-		 */
-		::MonoClass* getMonoClass() const override;
-
-		String mTypeNamespace;
-		String mTypeName;
-		bool mValueType;
-		UINT32 mTypeId;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableTypeInfoObjectRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains information about a type of a managed serializable Array.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoArray : public ManagedSerializableTypeInfo
-	{
-	public:
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::matches
-		 */
-		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::isTypeLoaded
-		 */
-		bool isTypeLoaded() const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::getMonoClass
-		 */
-		::MonoClass* getMonoClass() const override;
-
-		ManagedSerializableTypeInfoPtr mElementType;
-		UINT32 mRank;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableTypeInfoArrayRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains information about a type of a managed serializable List.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoList : public ManagedSerializableTypeInfo
-	{
-	public:
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::matches
-		 */
-		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::isTypeLoaded
-		 */
-		bool isTypeLoaded() const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::getMonoClass
-		 */
-		::MonoClass* getMonoClass() const override;
-
-		ManagedSerializableTypeInfoPtr mElementType;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableTypeInfoListRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains information about a type of a managed serializable Dictionary.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoDictionary : public ManagedSerializableTypeInfo
-	{
-	public:
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::matches
-		 */
-		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::isTypeLoaded
-		 */
-		bool isTypeLoaded() const override;
-
-		/**
-		 * @copydoc	ManagedSerializableTypeInfo::getMonoClass
-		 */
-		::MonoClass* getMonoClass() const override;
-
-		ManagedSerializableTypeInfoPtr mKeyType;
-		ManagedSerializableTypeInfoPtr mValueType;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableTypeInfoDictionaryRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains data about a single field in a managed complex object.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldInfo : public IReflectable
-	{
-	public:
-		ManagedSerializableFieldInfo();
-
-		/**
-		 * @brief	Determines should the field be serialized when serializing the parent object.
-		 */
-		bool isSerializable() const { return ((UINT32)mFlags & (UINT32)ScriptFieldFlags::Serializable) != 0; }
-
-		String mName;
-		UINT32 mFieldId;
-		UINT32 mParentTypeId;
-
-		ManagedSerializableTypeInfoPtr mTypeInfo;
-		ScriptFieldFlags mFlags;
-
-		MonoField* mMonoField;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableFieldInfoRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains data about fields of a complex object, and the object's
-	 *			class hierarchy if it belongs to one.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableObjectInfo : public IReflectable
-	{
-	public:
-		ManagedSerializableObjectInfo();
-
-		/**
-		 * @brief	Returns the managed type name of the object's type, including the namespace in format
-		 *			"namespace.typename".
-		 */
-		String getFullTypeName() const { return mTypeInfo->mTypeNamespace + "." + mTypeInfo->mTypeName; }
-
-		/**
-		 * @brief	Attempts to find a field part of this object that matches the provided parameters.
-		 *
-		 * @param	fieldInfo		Object describing the managed field. Normally this will be a field
-		 *							that was deserialized and you need to ensure it still exists in
-		 *							its parent type, while retrieving the new field info.
-		 * @param	fieldTypeInfo	Type information about the type containing the object. Used for
-		 *							debug purposes to ensure the current object's type matches.
-		 *
-		 * @return	Found field info within this object, or null if not found.
-		 */
-		ManagedSerializableFieldInfoPtr findMatchingField(const ManagedSerializableFieldInfoPtr& fieldInfo,
-			const ManagedSerializableTypeInfoPtr& fieldTypeInfo) const;
-
-		ManagedSerializableTypeInfoObjectPtr mTypeInfo;
-		MonoClass* mMonoClass;
-
-		UnorderedMap<String, UINT32> mFieldNameToId;
-		UnorderedMap<UINT32, std::shared_ptr<ManagedSerializableFieldInfo>> mFields;
-
-		std::shared_ptr<ManagedSerializableObjectInfo> mBaseClass;
-		Vector<std::weak_ptr<ManagedSerializableObjectInfo>> mDerivedClasses;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableObjectInfoRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/**
-	 * @brief	Contains information about all managed serializable objects in a specific managed assembly.
-	 */
-	class BS_SCR_BE_EXPORT ManagedSerializableAssemblyInfo : public IReflectable
-	{
-	public:
-		String mName;
-
-		UnorderedMap<String, UINT32> mTypeNameToId;
-		UnorderedMap<UINT32, std::shared_ptr<ManagedSerializableObjectInfo>> mObjectInfos;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ManagedSerializableAssemblyInfoRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsIReflectable.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**	Valid serializable script types. */
+	enum class ScriptPrimitiveType
+	{
+		Bool,
+		Char,
+		I8,
+		U8,
+		I16,
+		U16,
+		I32,
+		U32,
+		I64,
+		U64,
+		Float,
+		Double,
+		String,
+		Texture2DRef,
+		Texture3DRef,
+		TextureCubeRef,
+		SpriteTextureRef,
+		ManagedResourceRef,
+		PlainTextRef,
+		ScriptCodeRef,
+		ShaderRef,
+		ShaderIncludeRef,
+		MaterialRef,
+		MeshRef,
+		PrefabRef,
+		FontRef,
+		StringTableRef,
+		GUISkinRef,
+		SceneObjectRef,
+		ComponentRef,
+		PhysicsMaterialRef,
+		PhysicsMeshRef,
+		Count // Keep at end
+	};
+
+	/**	Flags that are used to further define a field in a managed serializable object. */
+	enum class ScriptFieldFlags
+	{
+		Serializable = 0x01,
+		Inspectable = 0x02
+	};
+
+	/**	Contains information about a type of a managed serializable object. */
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfo : public IReflectable
+	{
+	public:
+		virtual ~ManagedSerializableTypeInfo() {}
+
+		/**	Checks if the current type matches the provided type. */
+		virtual bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const = 0;
+
+		/**
+		 * Checks does the managed type this object represents still exists.
+		 *
+		 * @note	e.g. If assemblies get refreshed user could have renamed or removed some types.
+		 */
+		virtual bool isTypeLoaded() const = 0;
+
+		/**
+		 * Returns the internal managed class of the type this object represents. Returns null if the type doesn't exist.
+		 */
+		virtual ::MonoClass* getMonoClass() const = 0;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableTypeInfoRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains information about a type of a managed serializable primitive (e.g. int, float, etc.). */
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoPrimitive : public ManagedSerializableTypeInfo
+	{
+	public:
+		/** @copydoc ManagedSerializableTypeInfo::matches */
+		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::isTypeLoaded */
+		bool isTypeLoaded() const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::getMonoClass */
+		::MonoClass* getMonoClass() const override;
+
+		ScriptPrimitiveType mType;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableTypeInfoPrimitiveRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains information about a type of a managed serializable complex object (e.g. struct or class). */
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoObject : public ManagedSerializableTypeInfo
+	{
+	public:
+		/** @copydoc ManagedSerializableTypeInfo::matches */
+		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::isTypeLoaded */
+		bool isTypeLoaded() const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::getMonoClass */
+		::MonoClass* getMonoClass() const override;
+
+		String mTypeNamespace;
+		String mTypeName;
+		bool mValueType;
+		UINT32 mTypeId;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableTypeInfoObjectRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains information about a type of a managed serializable Array. */
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoArray : public ManagedSerializableTypeInfo
+	{
+	public:
+		/** @copydoc ManagedSerializableTypeInfo::matches */
+		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::isTypeLoaded */
+		bool isTypeLoaded() const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::getMonoClass */
+		::MonoClass* getMonoClass() const override;
+
+		ManagedSerializableTypeInfoPtr mElementType;
+		UINT32 mRank;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableTypeInfoArrayRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains information about a type of a managed serializable List. */
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoList : public ManagedSerializableTypeInfo
+	{
+	public:
+		/** @copydoc ManagedSerializableTypeInfo::matches */
+		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::isTypeLoaded */
+		bool isTypeLoaded() const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::getMonoClass */
+		::MonoClass* getMonoClass() const override;
+
+		ManagedSerializableTypeInfoPtr mElementType;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableTypeInfoListRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains information about a type of a managed serializable Dictionary. */
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoDictionary : public ManagedSerializableTypeInfo
+	{
+	public:
+		/** @copydoc ManagedSerializableTypeInfo::matches */
+		bool matches(const ManagedSerializableTypeInfoPtr& typeInfo) const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::isTypeLoaded */
+		bool isTypeLoaded() const override;
+
+		/** @copydoc ManagedSerializableTypeInfo::getMonoClass */
+		::MonoClass* getMonoClass() const override;
+
+		ManagedSerializableTypeInfoPtr mKeyType;
+		ManagedSerializableTypeInfoPtr mValueType;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableTypeInfoDictionaryRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains data about a single field in a managed complex object. */
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldInfo : public IReflectable
+	{
+	public:
+		ManagedSerializableFieldInfo();
+
+		/**	Determines should the field be serialized when serializing the parent object. */
+		bool isSerializable() const { return ((UINT32)mFlags & (UINT32)ScriptFieldFlags::Serializable) != 0; }
+
+		String mName;
+		UINT32 mFieldId;
+		UINT32 mParentTypeId;
+
+		ManagedSerializableTypeInfoPtr mTypeInfo;
+		ScriptFieldFlags mFlags;
+
+		MonoField* mMonoField;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableFieldInfoRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** Contains data about fields of a complex object, and the object's class hierarchy if it belongs to one. */
+	class BS_SCR_BE_EXPORT ManagedSerializableObjectInfo : public IReflectable
+	{
+	public:
+		ManagedSerializableObjectInfo();
+
+		/** Returns the managed type name of the object's type, including the namespace in format "namespace.typename". */
+		String getFullTypeName() const { return mTypeInfo->mTypeNamespace + "." + mTypeInfo->mTypeName; }
+
+		/**
+		 * Attempts to find a field part of this object that matches the provided parameters.
+		 *
+		 * @param[in]	fieldInfo		Object describing the managed field. Normally this will be a field that was
+		 *								deserialized and you need to ensure it still exists in its parent type, while
+		 *								retrieving the new field info.
+		 * @param[in]	fieldTypeInfo	Type information about the type containing the object. Used for debug purposes to
+		 *								ensure the current object's type matches.
+		 * @return						Found field info within this object, or null if not found.
+		 */
+		ManagedSerializableFieldInfoPtr findMatchingField(const ManagedSerializableFieldInfoPtr& fieldInfo,
+			const ManagedSerializableTypeInfoPtr& fieldTypeInfo) const;
+
+		ManagedSerializableTypeInfoObjectPtr mTypeInfo;
+		MonoClass* mMonoClass;
+
+		UnorderedMap<String, UINT32> mFieldNameToId;
+		UnorderedMap<UINT32, std::shared_ptr<ManagedSerializableFieldInfo>> mFields;
+
+		std::shared_ptr<ManagedSerializableObjectInfo> mBaseClass;
+		Vector<std::weak_ptr<ManagedSerializableObjectInfo>> mDerivedClasses;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableObjectInfoRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/**	Contains information about all managed serializable objects in a specific managed assembly. */
+	class BS_SCR_BE_EXPORT ManagedSerializableAssemblyInfo : public IReflectable
+	{
+	public:
+		String mName;
+
+		UnorderedMap<String, UINT32> mTypeNameToId;
+		UnorderedMap<UINT32, std::shared_ptr<ManagedSerializableObjectInfo>> mObjectInfos;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ManagedSerializableAssemblyInfoRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 485 - 479
Source/SBansheeEngine/Include/BsManagedSerializableObjectInfoRTTI.h

@@ -1,480 +1,486 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsManagedSerializableObjectInfo.h"
-#include "BsException.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedSerializableAssemblyInfoRTTI : public RTTIType<ManagedSerializableAssemblyInfo, IReflectable, ManagedSerializableAssemblyInfoRTTI>
-	{
-	private:
-		String& getName(ManagedSerializableAssemblyInfo* obj)
-		{
-			return obj->mName;
-		}
-
-		void setName(ManagedSerializableAssemblyInfo* obj, String& val)
-		{
-			obj->mName = val;
-		}
-
-		ManagedSerializableObjectInfoPtr getSerializableObjectInfo(ManagedSerializableAssemblyInfo* obj, UINT32 idx) 
-		{ 
-			auto iter = obj->mObjectInfos.begin();
-			for(UINT32 i = 0; i < idx; i++)
-				iter++;
-
-			return iter->second;
-		}
-
-		void setSerializableObjectInfo(ManagedSerializableAssemblyInfo* obj, UINT32 idx, ManagedSerializableObjectInfoPtr val) 
-		{ 
-			obj->mTypeNameToId[val->getFullTypeName()] = val->mTypeInfo->mTypeId;
-			obj->mObjectInfos[val->mTypeInfo->mTypeId] = val;
-		}
-		
-		UINT32 getSerializableObjectInfoArraySize(ManagedSerializableAssemblyInfo* obj) { return (UINT32)obj->mObjectInfos.size(); }
-		void setSerializableObjectInfoArraySize(ManagedSerializableAssemblyInfo* obj, UINT32 size) {  }
-
-	public:
-		ManagedSerializableAssemblyInfoRTTI()
-		{
-			addPlainField("mName", 0, &ManagedSerializableAssemblyInfoRTTI::getName, &ManagedSerializableAssemblyInfoRTTI::setName);
-			addReflectablePtrArrayField("mObjectInfos", 1, &ManagedSerializableAssemblyInfoRTTI::getSerializableObjectInfo, 
-				&ManagedSerializableAssemblyInfoRTTI::getSerializableObjectInfoArraySize, &ManagedSerializableAssemblyInfoRTTI::setSerializableObjectInfo, 
-				&ManagedSerializableAssemblyInfoRTTI::setSerializableObjectInfoArraySize);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableAssemblyInfo";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableAssemblyInfo;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableAssemblyInfo>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableObjectInfoRTTI : public RTTIType<ManagedSerializableObjectInfo, IReflectable, ManagedSerializableObjectInfoRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoObjectPtr getTypeInfo(ManagedSerializableObjectInfo* obj)
-		{
-			return obj->mTypeInfo;
-		}
-
-		void setTypeInfo(ManagedSerializableObjectInfo* obj, ManagedSerializableTypeInfoObjectPtr val)
-		{
-			obj->mTypeInfo = val;
-		}
-
-		ManagedSerializableObjectInfoPtr getBaseClass(ManagedSerializableObjectInfo* obj)
-		{
-			return obj->mBaseClass;
-		}
-
-		void setBaseClass(ManagedSerializableObjectInfo* obj, ManagedSerializableObjectInfoPtr val)
-		{
-			obj->mBaseClass = val;
-		}
-
-		ManagedSerializableFieldInfoPtr getSerializableFieldInfo(ManagedSerializableObjectInfo* obj, UINT32 idx) 
-		{ 
-			auto iter = obj->mFields.begin();
-			for(UINT32 i = 0; i < idx; i++)
-				iter++;
-
-			return iter->second;
-		}
-
-		void setSerializableFieldInfo(ManagedSerializableObjectInfo* obj, UINT32 idx, ManagedSerializableFieldInfoPtr val) 
-		{ 
-			obj->mFieldNameToId[val->mName] = val->mFieldId;
-			obj->mFields[val->mFieldId] = val;
-		}
-
-		UINT32 getSerializableFieldInfoArraySize(ManagedSerializableObjectInfo* obj) { return (UINT32)obj->mFields.size(); }
-		void setSerializableFieldInfoArraySize(ManagedSerializableObjectInfo* obj, UINT32 size) {  }
-
-	public:
-		ManagedSerializableObjectInfoRTTI()
-		{
-			addReflectablePtrField("mTypeInfo", 0, &ManagedSerializableObjectInfoRTTI::getTypeInfo, &ManagedSerializableObjectInfoRTTI::setTypeInfo);
-			addReflectablePtrField("mBaseClass", 2, &ManagedSerializableObjectInfoRTTI::getBaseClass, &ManagedSerializableObjectInfoRTTI::setBaseClass);
-
-			addReflectablePtrArrayField("mFields", 3, &ManagedSerializableObjectInfoRTTI::getSerializableFieldInfo, 
-				&ManagedSerializableObjectInfoRTTI::getSerializableFieldInfoArraySize, &ManagedSerializableObjectInfoRTTI::setSerializableFieldInfo, 
-				&ManagedSerializableObjectInfoRTTI::setSerializableFieldInfoArraySize);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableObjectInfo";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableObjectInfo;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableObjectInfo>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableFieldInfoRTTI : public RTTIType<ManagedSerializableFieldInfo, IReflectable, ManagedSerializableFieldInfoRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoPtr getTypeInfo(ManagedSerializableFieldInfo* obj)
-		{
-			return obj->mTypeInfo;
-		}
-
-		void setTypeInfo(ManagedSerializableFieldInfo* obj, ManagedSerializableTypeInfoPtr val)
-		{
-			obj->mTypeInfo = val;
-		}
-
-		String& getName(ManagedSerializableFieldInfo* obj)
-		{
-			return obj->mName;
-		}
-
-		void setName(ManagedSerializableFieldInfo* obj, String& val)
-		{
-			obj->mName = val;
-		}
-
-		UINT32& getFieldId(ManagedSerializableFieldInfo* obj)
-		{
-			return obj->mFieldId;
-		}
-
-		void setFieldId(ManagedSerializableFieldInfo* obj, UINT32& val)
-		{
-			obj->mFieldId = val;
-		}
-
-		UINT32& getParentTypeId(ManagedSerializableFieldInfo* obj)
-		{
-			return obj->mParentTypeId;
-		}
-
-		void setParentTypeId(ManagedSerializableFieldInfo* obj, UINT32& val)
-		{
-			obj->mParentTypeId = val;
-		}
-
-		UINT32& getFlags(ManagedSerializableFieldInfo* obj)
-		{
-			return (UINT32&)obj->mFlags;
-		}
-
-		void setFlags(ManagedSerializableFieldInfo* obj, UINT32& val)
-		{
-			obj->mFlags = (ScriptFieldFlags)val;
-		}
-
-	public:
-		ManagedSerializableFieldInfoRTTI()
-		{
-			addPlainField("mName", 0, &ManagedSerializableFieldInfoRTTI::getName, &ManagedSerializableFieldInfoRTTI::setName);
-			addReflectablePtrField("mTypeInfo", 1, &ManagedSerializableFieldInfoRTTI::getTypeInfo, &ManagedSerializableFieldInfoRTTI::setTypeInfo);
-			addPlainField("mFieldId", 2, &ManagedSerializableFieldInfoRTTI::getFieldId, &ManagedSerializableFieldInfoRTTI::setFieldId);
-			addPlainField("mFlags", 3, &ManagedSerializableFieldInfoRTTI::getFlags, &ManagedSerializableFieldInfoRTTI::setFlags);
-			addPlainField("mParentTypeId", 4, &ManagedSerializableFieldInfoRTTI::getParentTypeId, &ManagedSerializableFieldInfoRTTI::setParentTypeId);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableFieldInfo";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableFieldInfo;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableFieldInfo>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoRTTI : public RTTIType<ManagedSerializableTypeInfo, IReflectable, ManagedSerializableTypeInfoRTTI>
-	{
-	private:
-
-	public:
-		ManagedSerializableTypeInfoRTTI()
-		{
-
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableTypeInfo";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableTypeInfo;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			BS_EXCEPT(InvalidStateException, "Cannot instantiate an abstract class");
-			return nullptr;
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoPrimitiveRTTI : public RTTIType<ManagedSerializableTypeInfoPrimitive, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoPrimitiveRTTI>
-	{
-	private:
-		ScriptPrimitiveType& getType(ManagedSerializableTypeInfoPrimitive* obj)
-		{
-			return obj->mType;
-		}
-
-		void setType(ManagedSerializableTypeInfoPrimitive* obj, ScriptPrimitiveType& val)
-		{
-			obj->mType = val;
-		}
-
-	public:
-		ManagedSerializableTypeInfoPrimitiveRTTI()
-		{
-			addPlainField("mType", 0, &ManagedSerializableTypeInfoPrimitiveRTTI::getType, &ManagedSerializableTypeInfoPrimitiveRTTI::setType);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableTypeInfoPrimitive";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableTypeInfoPrimitive;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableTypeInfoPrimitive>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoObjectRTTI : public RTTIType<ManagedSerializableTypeInfoObject, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoObjectRTTI>
-	{
-	private:
-		String& getTypeNamespace(ManagedSerializableTypeInfoObject* obj)
-		{
-			return obj->mTypeNamespace;
-		}
-
-		void setTypeNamespace(ManagedSerializableTypeInfoObject* obj, String& val)
-		{
-			obj->mTypeNamespace = val;
-		}
-
-		String& getTypeName(ManagedSerializableTypeInfoObject* obj)
-		{
-			return obj->mTypeName;
-		}
-
-		void setTypeName(ManagedSerializableTypeInfoObject* obj, String& val)
-		{
-			obj->mTypeName = val;
-		}
-
-		bool& getIsValueType(ManagedSerializableTypeInfoObject* obj)
-		{
-			return obj->mValueType;
-		}
-
-		void setIsValueType(ManagedSerializableTypeInfoObject* obj, bool& val)
-		{
-			obj->mValueType = val;
-		}
-
-		UINT32& getTypeId(ManagedSerializableTypeInfoObject* obj)
-		{
-			return obj->mTypeId;
-		}
-
-		void setTypeId(ManagedSerializableTypeInfoObject* obj, UINT32& val)
-		{
-			obj->mTypeId = val;
-		}
-
-	public:
-		ManagedSerializableTypeInfoObjectRTTI()
-		{
-			addPlainField("mTypeName", 0, &ManagedSerializableTypeInfoObjectRTTI::getTypeName, &ManagedSerializableTypeInfoObjectRTTI::setTypeName);
-			addPlainField("mTypeNamespace", 1, &ManagedSerializableTypeInfoObjectRTTI::getTypeNamespace, &ManagedSerializableTypeInfoObjectRTTI::setTypeNamespace);
-			addPlainField("mValueType", 2, &ManagedSerializableTypeInfoObjectRTTI::getIsValueType, &ManagedSerializableTypeInfoObjectRTTI::setIsValueType);
-			addPlainField("mTypeId", 3, &ManagedSerializableTypeInfoObjectRTTI::getIsValueType, &ManagedSerializableTypeInfoObjectRTTI::setIsValueType);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableTypeInfoObject";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableTypeInfoObject;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableTypeInfoObject>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoArrayRTTI : public RTTIType<ManagedSerializableTypeInfoArray, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoArrayRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoPtr getElementType(ManagedSerializableTypeInfoArray* obj)
-		{
-			return obj->mElementType;
-		}
-
-		void setElementType(ManagedSerializableTypeInfoArray* obj, ManagedSerializableTypeInfoPtr val)
-		{
-			obj->mElementType = val;
-		}
-
-		UINT32& getRank(ManagedSerializableTypeInfoArray* obj)
-		{
-			return obj->mRank;
-		}
-
-		void setRank(ManagedSerializableTypeInfoArray* obj, UINT32& val)
-		{
-			obj->mRank = val;
-		}
-
-	public:
-		ManagedSerializableTypeInfoArrayRTTI()
-		{
-			addReflectablePtrField("mElementType", 0, &ManagedSerializableTypeInfoArrayRTTI::getElementType, &ManagedSerializableTypeInfoArrayRTTI::setElementType);
-			addPlainField("mRank", 1, &ManagedSerializableTypeInfoArrayRTTI::getRank, &ManagedSerializableTypeInfoArrayRTTI::setRank);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableTypeInfoArray";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableTypeInfoArray;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableTypeInfoArray>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoListRTTI : public RTTIType<ManagedSerializableTypeInfoList, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoListRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoPtr getElementType(ManagedSerializableTypeInfoList* obj)
-		{
-			return obj->mElementType;
-		}
-
-		void setElementType(ManagedSerializableTypeInfoList* obj, ManagedSerializableTypeInfoPtr val)
-		{
-			obj->mElementType = val;
-		}
-
-	public:
-		ManagedSerializableTypeInfoListRTTI()
-		{
-			addReflectablePtrField("mElementType", 0, &ManagedSerializableTypeInfoListRTTI::getElementType, &ManagedSerializableTypeInfoListRTTI::setElementType);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableTypeInfoList";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableTypeInfoList;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableTypeInfoList>();
-		}
-	};
-
-	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoDictionaryRTTI : public RTTIType<ManagedSerializableTypeInfoDictionary, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoDictionaryRTTI>
-	{
-	private:
-		ManagedSerializableTypeInfoPtr getKeyType(ManagedSerializableTypeInfoDictionary* obj)
-		{
-			return obj->mKeyType;
-		}
-
-		void setKeyType(ManagedSerializableTypeInfoDictionary* obj, ManagedSerializableTypeInfoPtr val)
-		{
-			obj->mKeyType = val;
-		}
-
-		ManagedSerializableTypeInfoPtr getValueType(ManagedSerializableTypeInfoDictionary* obj)
-		{
-			return obj->mValueType;
-		}
-
-		void setValueType(ManagedSerializableTypeInfoDictionary* obj, ManagedSerializableTypeInfoPtr val)
-		{
-			obj->mValueType = val;
-		}
-
-	public:
-		ManagedSerializableTypeInfoDictionaryRTTI()
-		{
-			addReflectablePtrField("mKeyType", 0, &ManagedSerializableTypeInfoDictionaryRTTI::getKeyType, &ManagedSerializableTypeInfoDictionaryRTTI::setKeyType);
-			addReflectablePtrField("mValueType", 1, &ManagedSerializableTypeInfoDictionaryRTTI::getValueType, &ManagedSerializableTypeInfoDictionaryRTTI::setValueType);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableTypeInfoDictionary";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_SerializableTypeInfoDictionary;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ManagedSerializableTypeInfoDictionary>();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsManagedSerializableObjectInfo.h"
+#include "BsException.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedSerializableAssemblyInfoRTTI : public RTTIType<ManagedSerializableAssemblyInfo, IReflectable, ManagedSerializableAssemblyInfoRTTI>
+	{
+	private:
+		String& getName(ManagedSerializableAssemblyInfo* obj)
+		{
+			return obj->mName;
+		}
+
+		void setName(ManagedSerializableAssemblyInfo* obj, String& val)
+		{
+			obj->mName = val;
+		}
+
+		ManagedSerializableObjectInfoPtr getSerializableObjectInfo(ManagedSerializableAssemblyInfo* obj, UINT32 idx) 
+		{ 
+			auto iter = obj->mObjectInfos.begin();
+			for(UINT32 i = 0; i < idx; i++)
+				iter++;
+
+			return iter->second;
+		}
+
+		void setSerializableObjectInfo(ManagedSerializableAssemblyInfo* obj, UINT32 idx, ManagedSerializableObjectInfoPtr val) 
+		{ 
+			obj->mTypeNameToId[val->getFullTypeName()] = val->mTypeInfo->mTypeId;
+			obj->mObjectInfos[val->mTypeInfo->mTypeId] = val;
+		}
+		
+		UINT32 getSerializableObjectInfoArraySize(ManagedSerializableAssemblyInfo* obj) { return (UINT32)obj->mObjectInfos.size(); }
+		void setSerializableObjectInfoArraySize(ManagedSerializableAssemblyInfo* obj, UINT32 size) {  }
+
+	public:
+		ManagedSerializableAssemblyInfoRTTI()
+		{
+			addPlainField("mName", 0, &ManagedSerializableAssemblyInfoRTTI::getName, &ManagedSerializableAssemblyInfoRTTI::setName);
+			addReflectablePtrArrayField("mObjectInfos", 1, &ManagedSerializableAssemblyInfoRTTI::getSerializableObjectInfo, 
+				&ManagedSerializableAssemblyInfoRTTI::getSerializableObjectInfoArraySize, &ManagedSerializableAssemblyInfoRTTI::setSerializableObjectInfo, 
+				&ManagedSerializableAssemblyInfoRTTI::setSerializableObjectInfoArraySize);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableAssemblyInfo";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableAssemblyInfo;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableAssemblyInfo>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableObjectInfoRTTI : public RTTIType<ManagedSerializableObjectInfo, IReflectable, ManagedSerializableObjectInfoRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoObjectPtr getTypeInfo(ManagedSerializableObjectInfo* obj)
+		{
+			return obj->mTypeInfo;
+		}
+
+		void setTypeInfo(ManagedSerializableObjectInfo* obj, ManagedSerializableTypeInfoObjectPtr val)
+		{
+			obj->mTypeInfo = val;
+		}
+
+		ManagedSerializableObjectInfoPtr getBaseClass(ManagedSerializableObjectInfo* obj)
+		{
+			return obj->mBaseClass;
+		}
+
+		void setBaseClass(ManagedSerializableObjectInfo* obj, ManagedSerializableObjectInfoPtr val)
+		{
+			obj->mBaseClass = val;
+		}
+
+		ManagedSerializableFieldInfoPtr getSerializableFieldInfo(ManagedSerializableObjectInfo* obj, UINT32 idx) 
+		{ 
+			auto iter = obj->mFields.begin();
+			for(UINT32 i = 0; i < idx; i++)
+				iter++;
+
+			return iter->second;
+		}
+
+		void setSerializableFieldInfo(ManagedSerializableObjectInfo* obj, UINT32 idx, ManagedSerializableFieldInfoPtr val) 
+		{ 
+			obj->mFieldNameToId[val->mName] = val->mFieldId;
+			obj->mFields[val->mFieldId] = val;
+		}
+
+		UINT32 getSerializableFieldInfoArraySize(ManagedSerializableObjectInfo* obj) { return (UINT32)obj->mFields.size(); }
+		void setSerializableFieldInfoArraySize(ManagedSerializableObjectInfo* obj, UINT32 size) {  }
+
+	public:
+		ManagedSerializableObjectInfoRTTI()
+		{
+			addReflectablePtrField("mTypeInfo", 0, &ManagedSerializableObjectInfoRTTI::getTypeInfo, &ManagedSerializableObjectInfoRTTI::setTypeInfo);
+			addReflectablePtrField("mBaseClass", 2, &ManagedSerializableObjectInfoRTTI::getBaseClass, &ManagedSerializableObjectInfoRTTI::setBaseClass);
+
+			addReflectablePtrArrayField("mFields", 3, &ManagedSerializableObjectInfoRTTI::getSerializableFieldInfo, 
+				&ManagedSerializableObjectInfoRTTI::getSerializableFieldInfoArraySize, &ManagedSerializableObjectInfoRTTI::setSerializableFieldInfo, 
+				&ManagedSerializableObjectInfoRTTI::setSerializableFieldInfoArraySize);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableObjectInfo";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableObjectInfo;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableObjectInfo>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableFieldInfoRTTI : public RTTIType<ManagedSerializableFieldInfo, IReflectable, ManagedSerializableFieldInfoRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoPtr getTypeInfo(ManagedSerializableFieldInfo* obj)
+		{
+			return obj->mTypeInfo;
+		}
+
+		void setTypeInfo(ManagedSerializableFieldInfo* obj, ManagedSerializableTypeInfoPtr val)
+		{
+			obj->mTypeInfo = val;
+		}
+
+		String& getName(ManagedSerializableFieldInfo* obj)
+		{
+			return obj->mName;
+		}
+
+		void setName(ManagedSerializableFieldInfo* obj, String& val)
+		{
+			obj->mName = val;
+		}
+
+		UINT32& getFieldId(ManagedSerializableFieldInfo* obj)
+		{
+			return obj->mFieldId;
+		}
+
+		void setFieldId(ManagedSerializableFieldInfo* obj, UINT32& val)
+		{
+			obj->mFieldId = val;
+		}
+
+		UINT32& getParentTypeId(ManagedSerializableFieldInfo* obj)
+		{
+			return obj->mParentTypeId;
+		}
+
+		void setParentTypeId(ManagedSerializableFieldInfo* obj, UINT32& val)
+		{
+			obj->mParentTypeId = val;
+		}
+
+		UINT32& getFlags(ManagedSerializableFieldInfo* obj)
+		{
+			return (UINT32&)obj->mFlags;
+		}
+
+		void setFlags(ManagedSerializableFieldInfo* obj, UINT32& val)
+		{
+			obj->mFlags = (ScriptFieldFlags)val;
+		}
+
+	public:
+		ManagedSerializableFieldInfoRTTI()
+		{
+			addPlainField("mName", 0, &ManagedSerializableFieldInfoRTTI::getName, &ManagedSerializableFieldInfoRTTI::setName);
+			addReflectablePtrField("mTypeInfo", 1, &ManagedSerializableFieldInfoRTTI::getTypeInfo, &ManagedSerializableFieldInfoRTTI::setTypeInfo);
+			addPlainField("mFieldId", 2, &ManagedSerializableFieldInfoRTTI::getFieldId, &ManagedSerializableFieldInfoRTTI::setFieldId);
+			addPlainField("mFlags", 3, &ManagedSerializableFieldInfoRTTI::getFlags, &ManagedSerializableFieldInfoRTTI::setFlags);
+			addPlainField("mParentTypeId", 4, &ManagedSerializableFieldInfoRTTI::getParentTypeId, &ManagedSerializableFieldInfoRTTI::setParentTypeId);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableFieldInfo";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableFieldInfo;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableFieldInfo>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoRTTI : public RTTIType<ManagedSerializableTypeInfo, IReflectable, ManagedSerializableTypeInfoRTTI>
+	{
+	private:
+
+	public:
+		ManagedSerializableTypeInfoRTTI()
+		{
+
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableTypeInfo";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableTypeInfo;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			BS_EXCEPT(InvalidStateException, "Cannot instantiate an abstract class");
+			return nullptr;
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoPrimitiveRTTI : public RTTIType<ManagedSerializableTypeInfoPrimitive, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoPrimitiveRTTI>
+	{
+	private:
+		ScriptPrimitiveType& getType(ManagedSerializableTypeInfoPrimitive* obj)
+		{
+			return obj->mType;
+		}
+
+		void setType(ManagedSerializableTypeInfoPrimitive* obj, ScriptPrimitiveType& val)
+		{
+			obj->mType = val;
+		}
+
+	public:
+		ManagedSerializableTypeInfoPrimitiveRTTI()
+		{
+			addPlainField("mType", 0, &ManagedSerializableTypeInfoPrimitiveRTTI::getType, &ManagedSerializableTypeInfoPrimitiveRTTI::setType);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableTypeInfoPrimitive";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableTypeInfoPrimitive;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableTypeInfoPrimitive>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoObjectRTTI : public RTTIType<ManagedSerializableTypeInfoObject, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoObjectRTTI>
+	{
+	private:
+		String& getTypeNamespace(ManagedSerializableTypeInfoObject* obj)
+		{
+			return obj->mTypeNamespace;
+		}
+
+		void setTypeNamespace(ManagedSerializableTypeInfoObject* obj, String& val)
+		{
+			obj->mTypeNamespace = val;
+		}
+
+		String& getTypeName(ManagedSerializableTypeInfoObject* obj)
+		{
+			return obj->mTypeName;
+		}
+
+		void setTypeName(ManagedSerializableTypeInfoObject* obj, String& val)
+		{
+			obj->mTypeName = val;
+		}
+
+		bool& getIsValueType(ManagedSerializableTypeInfoObject* obj)
+		{
+			return obj->mValueType;
+		}
+
+		void setIsValueType(ManagedSerializableTypeInfoObject* obj, bool& val)
+		{
+			obj->mValueType = val;
+		}
+
+		UINT32& getTypeId(ManagedSerializableTypeInfoObject* obj)
+		{
+			return obj->mTypeId;
+		}
+
+		void setTypeId(ManagedSerializableTypeInfoObject* obj, UINT32& val)
+		{
+			obj->mTypeId = val;
+		}
+
+	public:
+		ManagedSerializableTypeInfoObjectRTTI()
+		{
+			addPlainField("mTypeName", 0, &ManagedSerializableTypeInfoObjectRTTI::getTypeName, &ManagedSerializableTypeInfoObjectRTTI::setTypeName);
+			addPlainField("mTypeNamespace", 1, &ManagedSerializableTypeInfoObjectRTTI::getTypeNamespace, &ManagedSerializableTypeInfoObjectRTTI::setTypeNamespace);
+			addPlainField("mValueType", 2, &ManagedSerializableTypeInfoObjectRTTI::getIsValueType, &ManagedSerializableTypeInfoObjectRTTI::setIsValueType);
+			addPlainField("mTypeId", 3, &ManagedSerializableTypeInfoObjectRTTI::getIsValueType, &ManagedSerializableTypeInfoObjectRTTI::setIsValueType);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableTypeInfoObject";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableTypeInfoObject;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableTypeInfoObject>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoArrayRTTI : public RTTIType<ManagedSerializableTypeInfoArray, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoArrayRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoPtr getElementType(ManagedSerializableTypeInfoArray* obj)
+		{
+			return obj->mElementType;
+		}
+
+		void setElementType(ManagedSerializableTypeInfoArray* obj, ManagedSerializableTypeInfoPtr val)
+		{
+			obj->mElementType = val;
+		}
+
+		UINT32& getRank(ManagedSerializableTypeInfoArray* obj)
+		{
+			return obj->mRank;
+		}
+
+		void setRank(ManagedSerializableTypeInfoArray* obj, UINT32& val)
+		{
+			obj->mRank = val;
+		}
+
+	public:
+		ManagedSerializableTypeInfoArrayRTTI()
+		{
+			addReflectablePtrField("mElementType", 0, &ManagedSerializableTypeInfoArrayRTTI::getElementType, &ManagedSerializableTypeInfoArrayRTTI::setElementType);
+			addPlainField("mRank", 1, &ManagedSerializableTypeInfoArrayRTTI::getRank, &ManagedSerializableTypeInfoArrayRTTI::setRank);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableTypeInfoArray";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableTypeInfoArray;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableTypeInfoArray>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoListRTTI : public RTTIType<ManagedSerializableTypeInfoList, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoListRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoPtr getElementType(ManagedSerializableTypeInfoList* obj)
+		{
+			return obj->mElementType;
+		}
+
+		void setElementType(ManagedSerializableTypeInfoList* obj, ManagedSerializableTypeInfoPtr val)
+		{
+			obj->mElementType = val;
+		}
+
+	public:
+		ManagedSerializableTypeInfoListRTTI()
+		{
+			addReflectablePtrField("mElementType", 0, &ManagedSerializableTypeInfoListRTTI::getElementType, &ManagedSerializableTypeInfoListRTTI::setElementType);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableTypeInfoList";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableTypeInfoList;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableTypeInfoList>();
+		}
+	};
+
+	class BS_SCR_BE_EXPORT ManagedSerializableTypeInfoDictionaryRTTI : public RTTIType<ManagedSerializableTypeInfoDictionary, ManagedSerializableTypeInfo, ManagedSerializableTypeInfoDictionaryRTTI>
+	{
+	private:
+		ManagedSerializableTypeInfoPtr getKeyType(ManagedSerializableTypeInfoDictionary* obj)
+		{
+			return obj->mKeyType;
+		}
+
+		void setKeyType(ManagedSerializableTypeInfoDictionary* obj, ManagedSerializableTypeInfoPtr val)
+		{
+			obj->mKeyType = val;
+		}
+
+		ManagedSerializableTypeInfoPtr getValueType(ManagedSerializableTypeInfoDictionary* obj)
+		{
+			return obj->mValueType;
+		}
+
+		void setValueType(ManagedSerializableTypeInfoDictionary* obj, ManagedSerializableTypeInfoPtr val)
+		{
+			obj->mValueType = val;
+		}
+
+	public:
+		ManagedSerializableTypeInfoDictionaryRTTI()
+		{
+			addReflectablePtrField("mKeyType", 0, &ManagedSerializableTypeInfoDictionaryRTTI::getKeyType, &ManagedSerializableTypeInfoDictionaryRTTI::setKeyType);
+			addReflectablePtrField("mValueType", 1, &ManagedSerializableTypeInfoDictionaryRTTI::getValueType, &ManagedSerializableTypeInfoDictionaryRTTI::setValueType);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableTypeInfoDictionary";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SerializableTypeInfoDictionary;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ManagedSerializableTypeInfoDictionary>();
+		}
+	};
+
+	/** @} */
 }

+ 119 - 113
Source/SBansheeEngine/Include/BsManagedSerializableObjectRTTI.h

@@ -1,114 +1,120 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsScriptAssemblyManager.h"
-#include "BsManagedSerializableObject.h"
-#include "BsManagedSerializableField.h"
-#include "BsManagedDiff.h"
-
-namespace BansheeEngine
-{
-	class BS_SCR_BE_EXPORT ManagedSerializableObjectRTTI : public RTTIType<ManagedSerializableObject, IReflectable, ManagedSerializableObjectRTTI>
-	{
-	private:
-		ManagedSerializableObjectInfoPtr getInfo(ManagedSerializableObject* obj)
-		{
-			return obj->mObjInfo;
-		}
-
-		void setInfo(ManagedSerializableObject* obj, ManagedSerializableObjectInfoPtr val)
-		{
-			obj->mObjInfo = val;
-		}
-
-		ManagedSerializableFieldDataEntryPtr getFieldEntry(ManagedSerializableObject* obj, UINT32 arrayIdx)
-		{
-			Vector<ManagedSerializableFieldInfoPtr>& sequentialFields =
-				any_cast_ref<Vector<ManagedSerializableFieldInfoPtr>>(obj->mRTTIData);
-
-			ManagedSerializableFieldInfoPtr field = sequentialFields[arrayIdx];
-
-			ManagedSerializableFieldKeyPtr fieldKey = ManagedSerializableFieldKey::create(field->mParentTypeId, field->mFieldId);
-			ManagedSerializableFieldDataPtr fieldData = obj->getFieldData(field);
-
-			return ManagedSerializableFieldDataEntry::create(fieldKey, fieldData);
-		}
-
-		void setFieldsEntry(ManagedSerializableObject* obj, UINT32 arrayIdx, ManagedSerializableFieldDataEntryPtr val)
-		{
-			obj->mCachedData[*val->mKey] = val->mValue;
-		}
-
-		UINT32 getNumFieldEntries(ManagedSerializableObject* obj)
-		{
-			Vector<ManagedSerializableFieldInfoPtr>& sequentialFields =
-				any_cast_ref<Vector<ManagedSerializableFieldInfoPtr>>(obj->mRTTIData);
-
-			return (UINT32)sequentialFields.size();
-		}
-
-		void setNumFieldEntries(ManagedSerializableObject* obj, UINT32 numEntries)
-		{
-			// Do nothing
-		}
-
-	public:
-		ManagedSerializableObjectRTTI()
-		{
-			addReflectablePtrField("mObjInfo", 0, &ManagedSerializableObjectRTTI::getInfo, &ManagedSerializableObjectRTTI::setInfo);
-			addReflectablePtrArrayField("mFieldEntries", 1, &ManagedSerializableObjectRTTI::getFieldEntry, &ManagedSerializableObjectRTTI::getNumFieldEntries, 
-				&ManagedSerializableObjectRTTI::setFieldsEntry, &ManagedSerializableObjectRTTI::setNumFieldEntries);
-		}
-
-		virtual void onSerializationStarted(IReflectable* obj) override
-		{
-			ManagedSerializableObject* castObj = static_cast<ManagedSerializableObject*>(obj);
-
-			Vector<ManagedSerializableFieldInfoPtr> sequentialFields;
-			ManagedSerializableObjectInfoPtr curType = castObj->mObjInfo;
-			while (curType != nullptr)
-			{
-				for (auto& field : curType->mFields)
-				{
-					if (field.second->isSerializable())
-						sequentialFields.push_back(field.second);
-				}
-
-				curType = curType->mBaseClass;
-			}
-
-			castObj->mRTTIData = sequentialFields;
-		}
-
-		virtual void onSerializationEnded(IReflectable* obj) override
-		{
-			ManagedSerializableObject* castObj = static_cast<ManagedSerializableObject*>(obj);
-			castObj->mRTTIData = nullptr;
-		}
-
-		virtual IDiff& getDiffHandler() const override
-		{
-			static ManagedDiff managedDiffHandler;
-			return managedDiffHandler;
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "ScriptSerializableObject";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_ScriptSerializableObject;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return ManagedSerializableObject::createEmpty();
-		}
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsScriptAssemblyManager.h"
+#include "BsManagedSerializableObject.h"
+#include "BsManagedSerializableField.h"
+#include "BsManagedDiff.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup RTTI-Impl-SEngine
+	 *  @{
+	 */
+
+	class BS_SCR_BE_EXPORT ManagedSerializableObjectRTTI : public RTTIType<ManagedSerializableObject, IReflectable, ManagedSerializableObjectRTTI>
+	{
+	private:
+		ManagedSerializableObjectInfoPtr getInfo(ManagedSerializableObject* obj)
+		{
+			return obj->mObjInfo;
+		}
+
+		void setInfo(ManagedSerializableObject* obj, ManagedSerializableObjectInfoPtr val)
+		{
+			obj->mObjInfo = val;
+		}
+
+		ManagedSerializableFieldDataEntryPtr getFieldEntry(ManagedSerializableObject* obj, UINT32 arrayIdx)
+		{
+			Vector<ManagedSerializableFieldInfoPtr>& sequentialFields =
+				any_cast_ref<Vector<ManagedSerializableFieldInfoPtr>>(obj->mRTTIData);
+
+			ManagedSerializableFieldInfoPtr field = sequentialFields[arrayIdx];
+
+			ManagedSerializableFieldKeyPtr fieldKey = ManagedSerializableFieldKey::create(field->mParentTypeId, field->mFieldId);
+			ManagedSerializableFieldDataPtr fieldData = obj->getFieldData(field);
+
+			return ManagedSerializableFieldDataEntry::create(fieldKey, fieldData);
+		}
+
+		void setFieldsEntry(ManagedSerializableObject* obj, UINT32 arrayIdx, ManagedSerializableFieldDataEntryPtr val)
+		{
+			obj->mCachedData[*val->mKey] = val->mValue;
+		}
+
+		UINT32 getNumFieldEntries(ManagedSerializableObject* obj)
+		{
+			Vector<ManagedSerializableFieldInfoPtr>& sequentialFields =
+				any_cast_ref<Vector<ManagedSerializableFieldInfoPtr>>(obj->mRTTIData);
+
+			return (UINT32)sequentialFields.size();
+		}
+
+		void setNumFieldEntries(ManagedSerializableObject* obj, UINT32 numEntries)
+		{
+			// Do nothing
+		}
+
+	public:
+		ManagedSerializableObjectRTTI()
+		{
+			addReflectablePtrField("mObjInfo", 0, &ManagedSerializableObjectRTTI::getInfo, &ManagedSerializableObjectRTTI::setInfo);
+			addReflectablePtrArrayField("mFieldEntries", 1, &ManagedSerializableObjectRTTI::getFieldEntry, &ManagedSerializableObjectRTTI::getNumFieldEntries, 
+				&ManagedSerializableObjectRTTI::setFieldsEntry, &ManagedSerializableObjectRTTI::setNumFieldEntries);
+		}
+
+		void onSerializationStarted(IReflectable* obj) override
+		{
+			ManagedSerializableObject* castObj = static_cast<ManagedSerializableObject*>(obj);
+
+			Vector<ManagedSerializableFieldInfoPtr> sequentialFields;
+			ManagedSerializableObjectInfoPtr curType = castObj->mObjInfo;
+			while (curType != nullptr)
+			{
+				for (auto& field : curType->mFields)
+				{
+					if (field.second->isSerializable())
+						sequentialFields.push_back(field.second);
+				}
+
+				curType = curType->mBaseClass;
+			}
+
+			castObj->mRTTIData = sequentialFields;
+		}
+
+		void onSerializationEnded(IReflectable* obj) override
+		{
+			ManagedSerializableObject* castObj = static_cast<ManagedSerializableObject*>(obj);
+			castObj->mRTTIData = nullptr;
+		}
+
+		IDiff& getDiffHandler() const override
+		{
+			static ManagedDiff managedDiffHandler;
+			return managedDiffHandler;
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptSerializableObject";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptSerializableObject;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ManagedSerializableObject::createEmpty();
+		}
+	};
+
+	/** @} */
 }

+ 109 - 129
Source/SBansheeEngine/Include/BsScriptAssemblyManager.h

@@ -1,130 +1,110 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsManagedSerializableObjectInfo.h"
-#include "BsModule.h"
-#include <mono/jit/jit.h>
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Stores data about managed serializable objects in specified assemblies.
-	 */
-	class BS_SCR_BE_EXPORT ScriptAssemblyManager : public Module<ScriptAssemblyManager>
-	{
-	public:
-		ScriptAssemblyManager();
-		~ScriptAssemblyManager();
-
-		/**
-		 * @brief	Loads all information about managed serializable objects in an assembly with the specified name.
-		 *			Assembly must be currently loaded. Once the data has been loaded you will be able to call
-		 *			::getSerializableObjectInfo and ::hasSerializableObjectInfo to retrieve information about
-		 *			those objects. If an assembly already had data loaded it will be rebuilt.
-		 */
-		void loadAssemblyInfo(const String& assemblyName);
-
-		/**
-		 * @brief	Clears any assembly data previously loaded with ::loadAssemblyInfo.
-		 */
-		void clearAssemblyInfo();
-
-		/**
-		 * @brief	Returns managed serializable object info for a specific managed type.
-		 *
-		 * @param	ns			Namespace of the type.
-		 * @param	typeName	Name of the type.
-		 * @param	outInfo		Output object containing information about the type if the type was found, unmodified otherwise.
-		 *
-		 * @return	True if the type was found, false otherwise.
-		 */
-		bool getSerializableObjectInfo(const String& ns, const String& typeName, std::shared_ptr<ManagedSerializableObjectInfo>& outInfo);
-
-		/**
-		 * @brief	Generates or retrieves a type info object for the specified managed class,
-		 *			if the class is serializable.
-		 */
-		ManagedSerializableTypeInfoPtr getTypeInfo(MonoClass* monoClass);
-
-		/**
-		 * @brief	Checks if the managed serializable object info for the specified type exists.
-		 *
-		 * @param	ns			Namespace of the type.
-		 * @param	typeName	Name of the type.
-		 *
-		 * @return	True if the object info was found, false otherwise.
-		 */
-		bool hasSerializableObjectInfo(const String& ns, const String& typeName);
-
-		/**
-		 * @brief	Returns names of all assemblies that currently have managed serializable object
-		 *			data loaded.
-		 */
-		Vector<String> getScriptAssemblies() const;
-
-		/**
-		 * @brief	Gets the managed class for System.Array type.
-		 */
-		MonoClass* getSystemArrayClass() const { return mSystemArrayClass; }
-
-		/**
-		 * @brief	Gets the managed class for System.Collections.Generic.List<T> type.
-		 */
-		MonoClass* getSystemGenericListClass() const { return mSystemGenericListClass; }
-
-		/**
-		 * @brief	Gets the managed class for System.Collections.Generic.Dictionary<T,U> type.
-		 */
-		MonoClass* getSystemGenericDictionaryClass() const { return mSystemGenericDictionaryClass; }
-
-		/**
-		 * @brief	Gets the managed class for System.Type type.
-		 */
-		MonoClass* getSystemTypeClass() const { return mSystemTypeClass; }
-
-		/**
-		 * @brief	Gets the managed class for BansheeEngine.Component type.
-		 */
-		MonoClass* getComponentClass() const { return mComponentClass; }
-
-		/**
-		 * @brief	Gets the managed class for BansheeEngine.MissingComponent type.
-		 */
-		MonoClass* getMissingComponentClass() const { return mMissingComponentClass; }
-
-		/**
-		 * @brief	Gets the managed class for BansheeEngine.SceneObject type.
-		 */
-		MonoClass* getSceneObjectClass() const { return mSceneObjectClass; }
-	private:
-		/**
-		 * @brief	Deletes all stored managed serializable object infos for all assemblies.
-		 */
-		void clearScriptObjects();
-
-		/**
-		 * @brief	Initializes the base managed types. These are the types we expect must
-		 *			exist in loaded assemblies as they're used for various common operations.
-		 */
-		void initializeBaseTypes();
-
-		UnorderedMap<String, std::shared_ptr<ManagedSerializableAssemblyInfo>> mAssemblyInfos;
-		bool mBaseTypesInitialized;
-
-		MonoClass* mSystemArrayClass;
-		MonoClass* mSystemGenericListClass;
-		MonoClass* mSystemGenericDictionaryClass;
-		MonoClass* mSystemTypeClass;
-
-		MonoClass* mComponentClass;
-		MonoClass* mSceneObjectClass;
-		MonoClass* mMissingComponentClass;
-
-		MonoClass* mSerializeObjectAttribute;
-		MonoClass* mDontSerializeFieldAttribute;
-		MonoClass* mSerializeFieldAttribute;
-		MonoClass* mHideInInspectorAttribute;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsManagedSerializableObjectInfo.h"
+#include "BsModule.h"
+#include <mono/jit/jit.h>
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/**	Stores data about managed serializable objects in specified assemblies. */
+	class BS_SCR_BE_EXPORT ScriptAssemblyManager : public Module<ScriptAssemblyManager>
+	{
+	public:
+		ScriptAssemblyManager();
+		~ScriptAssemblyManager();
+
+		/**
+		 * Loads all information about managed serializable objects in an assembly with the specified name. Assembly must be
+		 * currently loaded. Once the data has been loaded you will be able to call getSerializableObjectInfo() and
+		 * hasSerializableObjectInfo() to retrieve information about those objects. If an assembly already had data loaded
+		 * it will be rebuilt.
+		 */
+		void loadAssemblyInfo(const String& assemblyName);
+
+		/**	Clears any assembly data previously loaded with loadAssemblyInfo(). */
+		void clearAssemblyInfo();
+
+		/**
+		 * Returns managed serializable object info for a specific managed type.
+		 *
+		 * @param[in]	ns			Namespace of the type.
+		 * @param[in]	typeName	Name of the type.
+		 * @param[out]	outInfo		Output object containing information about the type if the type was found, unmodified
+		 *							otherwise.
+		 * @return					True if the type was found, false otherwise.
+		 */
+		bool getSerializableObjectInfo(const String& ns, const String& typeName, 
+			SPtr<ManagedSerializableObjectInfo>& outInfo);
+
+		/**	Generates or retrieves a type info object for the specified managed class, if the class is serializable. */
+		ManagedSerializableTypeInfoPtr getTypeInfo(MonoClass* monoClass);
+
+		/**
+		 * Checks if the managed serializable object info for the specified type exists.
+		 *
+		 * @param[in]	ns			Namespace of the type.
+		 * @param[in]	typeName	Name of the type.
+		 * @return					True if the object info was found, false otherwise.
+		 */
+		bool hasSerializableObjectInfo(const String& ns, const String& typeName);
+
+		/**	Returns names of all assemblies that currently have managed serializable object data loaded. */
+		Vector<String> getScriptAssemblies() const;
+
+		/**	Gets the managed class for System.Array type. */
+		MonoClass* getSystemArrayClass() const { return mSystemArrayClass; }
+
+		/**	Gets the managed class for System.Collections.Generic.List<T> type. */
+		MonoClass* getSystemGenericListClass() const { return mSystemGenericListClass; }
+
+		/**	Gets the managed class for System.Collections.Generic.Dictionary<T,U> type. */
+		MonoClass* getSystemGenericDictionaryClass() const { return mSystemGenericDictionaryClass; }
+
+		/**	Gets the managed class for System.Type type. */
+		MonoClass* getSystemTypeClass() const { return mSystemTypeClass; }
+
+		/**	Gets the managed class for BansheeEngine.Component type. */
+		MonoClass* getComponentClass() const { return mComponentClass; }
+
+		/**	Gets the managed class for BansheeEngine.MissingComponent type. */
+		MonoClass* getMissingComponentClass() const { return mMissingComponentClass; }
+
+		/**	Gets the managed class for BansheeEngine.SceneObject type. */
+		MonoClass* getSceneObjectClass() const { return mSceneObjectClass; }
+	private:
+		/**	Deletes all stored managed serializable object infos for all assemblies. */
+		void clearScriptObjects();
+
+		/**
+		 * Initializes the base managed types. These are the types we expect must exist in loaded assemblies as they're used
+		 * for various common operations.
+		 */
+		void initializeBaseTypes();
+
+		UnorderedMap<String, std::shared_ptr<ManagedSerializableAssemblyInfo>> mAssemblyInfos;
+		bool mBaseTypesInitialized;
+
+		MonoClass* mSystemArrayClass;
+		MonoClass* mSystemGenericListClass;
+		MonoClass* mSystemGenericDictionaryClass;
+		MonoClass* mSystemTypeClass;
+
+		MonoClass* mComponentClass;
+		MonoClass* mSceneObjectClass;
+		MonoClass* mMissingComponentClass;
+
+		MonoClass* mSerializeObjectAttribute;
+		MonoClass* mDontSerializeFieldAttribute;
+		MonoClass* mSerializeFieldAttribute;
+		MonoClass* mHideInInspectorAttribute;
+	};
+
+	/** @} */
 }

+ 33 - 27
Source/SBansheeEngine/Include/BsScriptBoxCollider.h

@@ -1,28 +1,34 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for BoxCollider. */
-	class BS_SCR_BE_EXPORT ScriptBoxCollider : public TScriptCollider<ScriptBoxCollider>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeBoxCollider")
-	private:
-		ScriptBoxCollider(MonoObject* instance, const SPtr<Collider>& collider);
-
-		/** Returns the native box collider wrapped by this object. */
-		BoxCollider* getBoxCollider() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static void internal_SetExtents(ScriptBoxCollider* thisPtr, Vector3* extents);
-		static void internal_GetExtents(ScriptBoxCollider* thisPtr, Vector3* extents);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for BoxCollider. */
+	class BS_SCR_BE_EXPORT ScriptBoxCollider : public TScriptCollider<ScriptBoxCollider>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeBoxCollider")
+	private:
+		ScriptBoxCollider(MonoObject* instance, const SPtr<Collider>& collider);
+
+		/** Returns the native box collider wrapped by this object. */
+		BoxCollider* getBoxCollider() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static void internal_SetExtents(ScriptBoxCollider* thisPtr, Vector3* extents);
+		static void internal_GetExtents(ScriptBoxCollider* thisPtr, Vector3* extents);
+	};
+
+	/** @} */
 }

+ 35 - 29
Source/SBansheeEngine/Include/BsScriptCapsuleCollider.h

@@ -1,30 +1,36 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for CapsuleCollider. */
-	class BS_SCR_BE_EXPORT ScriptCapsuleCollider : public TScriptCollider<ScriptCapsuleCollider>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeCapsuleCollider")
-	private:
-		ScriptCapsuleCollider(MonoObject* instance, const SPtr<Collider>& collider);
-
-		/** Returns the native capsule collider wrapped by this object. */
-		CapsuleCollider* getCapsuleCollider() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static void internal_SetHalfHeight(ScriptCapsuleCollider* thisPtr, float halfHeight);
-		static float internal_GetHalfHeight(ScriptCapsuleCollider* thisPtr);
-		static void internal_SetRadius(ScriptCapsuleCollider* thisPtr, float radius);
-		static float internal_GetRadius(ScriptCapsuleCollider* thisPtr);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for CapsuleCollider. */
+	class BS_SCR_BE_EXPORT ScriptCapsuleCollider : public TScriptCollider<ScriptCapsuleCollider>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeCapsuleCollider")
+	private:
+		ScriptCapsuleCollider(MonoObject* instance, const SPtr<Collider>& collider);
+
+		/** Returns the native capsule collider wrapped by this object. */
+		CapsuleCollider* getCapsuleCollider() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static void internal_SetHalfHeight(ScriptCapsuleCollider* thisPtr, float halfHeight);
+		static float internal_GetHalfHeight(ScriptCapsuleCollider* thisPtr);
+		static void internal_SetRadius(ScriptCapsuleCollider* thisPtr, float radius);
+		static float internal_GetRadius(ScriptCapsuleCollider* thisPtr);
+	};
+
+	/** @} */
 }

+ 69 - 63
Source/SBansheeEngine/Include/BsScriptCharacterController.h

@@ -1,64 +1,70 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsCharacterController.h"
-#include "BsScriptControllerCollision.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for CharacterController. */
-	class BS_SCR_BE_EXPORT ScriptCharacterController : public ScriptObject<ScriptCharacterController>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeCharacterController")
-
-		/** Returns the native CharacterController object. */
-		CharacterController* getCharController() const { return mCharacterController.get(); }
-
-	private:
-		friend class ScriptColliderBase;
-
-		ScriptCharacterController(MonoObject* instance, const SPtr<CharacterController>& controller);
-
-		/** Triggered when the controller hits a collider. */
-		static void onColliderHit(MonoObject* instance, const ControllerColliderCollision& collisionData);
-
-		/** Triggered when the controller hits another controller. */
-		static void onControllerHit(MonoObject* instance, const ControllerControllerCollision& collisionData);
-
-		SPtr<CharacterController> mCharacterController;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, CHAR_CONTROLLER_DESC* initData);
-		static void internal_Destroy(ScriptCharacterController* thisPtr);
-
-		static CharacterCollisionFlags internal_Move(ScriptCharacterController* thisPtr, Vector3* displacement);
-
-		static void internal_GetPosition(ScriptCharacterController* thisPtr, Vector3* position);
-		static void internal_SetPosition(ScriptCharacterController* thisPtr, Vector3* position);
-
-		static void internal_GetFootPosition(ScriptCharacterController* thisPtr, Vector3* position);
-		static void internal_SetFootPosition(ScriptCharacterController* thisPtr, Vector3* position);
-
-		static void internal_SetRadius(ScriptCharacterController* thisPtr, float radius);
-		static void internal_SetHeight(ScriptCharacterController* thisPtr, float height);
-		static void internal_SetUp(ScriptCharacterController* thisPtr, Vector3* up);
-		static void internal_SetClimbingMode(ScriptCharacterController* thisPtr, CharacterClimbingMode mode);
-		static void internal_SetNonWalkableMode(ScriptCharacterController* thisPtr, CharacterNonWalkableMode mode);
-		static void internal_SetMinMoveDistance(ScriptCharacterController* thisPtr, float value);
-		static void internal_SetContactOffset(ScriptCharacterController* thisPtr, float value);
-		static void internal_SetStepOffset(ScriptCharacterController* thisPtr, float value);
-		static void internal_SetSlopeLimit(ScriptCharacterController* thisPtr, float value);
-		static void internal_SetLayer(ScriptCharacterController* thisPtr, UINT64 layer);
-
-		typedef void(__stdcall *OnHitThunkDef) (MonoObject*, ScriptControllerCollision*, MonoException**);
-
-		static OnHitThunkDef onColliderHitThunk;
-		static OnHitThunkDef onControllerHitThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsCharacterController.h"
+#include "BsScriptControllerCollision.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for CharacterController. */
+	class BS_SCR_BE_EXPORT ScriptCharacterController : public ScriptObject<ScriptCharacterController>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeCharacterController")
+
+		/** Returns the native CharacterController object. */
+		CharacterController* getCharController() const { return mCharacterController.get(); }
+
+	private:
+		friend class ScriptColliderBase;
+
+		ScriptCharacterController(MonoObject* instance, const SPtr<CharacterController>& controller);
+
+		/** Triggered when the controller hits a collider. */
+		static void onColliderHit(MonoObject* instance, const ControllerColliderCollision& collisionData);
+
+		/** Triggered when the controller hits another controller. */
+		static void onControllerHit(MonoObject* instance, const ControllerControllerCollision& collisionData);
+
+		SPtr<CharacterController> mCharacterController;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, CHAR_CONTROLLER_DESC* initData);
+		static void internal_Destroy(ScriptCharacterController* thisPtr);
+
+		static CharacterCollisionFlags internal_Move(ScriptCharacterController* thisPtr, Vector3* displacement);
+
+		static void internal_GetPosition(ScriptCharacterController* thisPtr, Vector3* position);
+		static void internal_SetPosition(ScriptCharacterController* thisPtr, Vector3* position);
+
+		static void internal_GetFootPosition(ScriptCharacterController* thisPtr, Vector3* position);
+		static void internal_SetFootPosition(ScriptCharacterController* thisPtr, Vector3* position);
+
+		static void internal_SetRadius(ScriptCharacterController* thisPtr, float radius);
+		static void internal_SetHeight(ScriptCharacterController* thisPtr, float height);
+		static void internal_SetUp(ScriptCharacterController* thisPtr, Vector3* up);
+		static void internal_SetClimbingMode(ScriptCharacterController* thisPtr, CharacterClimbingMode mode);
+		static void internal_SetNonWalkableMode(ScriptCharacterController* thisPtr, CharacterNonWalkableMode mode);
+		static void internal_SetMinMoveDistance(ScriptCharacterController* thisPtr, float value);
+		static void internal_SetContactOffset(ScriptCharacterController* thisPtr, float value);
+		static void internal_SetStepOffset(ScriptCharacterController* thisPtr, float value);
+		static void internal_SetSlopeLimit(ScriptCharacterController* thisPtr, float value);
+		static void internal_SetLayer(ScriptCharacterController* thisPtr, UINT64 layer);
+
+		typedef void(__stdcall *OnHitThunkDef) (MonoObject*, ScriptControllerCollision*, MonoException**);
+
+		static OnHitThunkDef onColliderHitThunk;
+		static OnHitThunkDef onControllerHitThunk;
+	};
+
+	/** @} */
 }

+ 119 - 113
Source/SBansheeEngine/Include/BsScriptCollider.h

@@ -1,114 +1,120 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsPhysicsCommon.h"
-
-namespace BansheeEngine
-{
-	class ScriptCollider;
-
-	/** Base class for all Collider interop objects. */
-	class BS_SCR_BE_EXPORT ScriptColliderBase : public ScriptObjectBase
-	{
-	public:
-		/** Returns the native Collider object. */
-		virtual Collider* getCollider() const { return mCollider.get(); };
-	protected:
-		friend ScriptCollider;
-
-		ScriptColliderBase(MonoObject* instance);
-		virtual ~ScriptColliderBase() {}
-
-		/** Initializes the interop object with a native collider. Must be called right after construction. */
-		void initialize(const SPtr<Collider>& collider);
-
-		/** Destroys the internal collider object. */
-		void destroyCollider();
-
-		SPtr<Collider> mCollider;
-	};
-
-	/** A more specialized version of ScriptObject that allows the constructor to set the native collider. */
-	template <class Type>
-	class TScriptCollider : public ScriptObject<Type, ScriptColliderBase>
-	{
-	public:
-		virtual ~TScriptCollider() {}
-
-	protected:
-		TScriptCollider(MonoObject* instance, const SPtr<Collider>& collider)
-			:ScriptObject(instance)
-		{
-			initialize(collider);
-		}
-	};
-
-	/** Interop class between C++ & CLR for Collider. */
-	class BS_SCR_BE_EXPORT ScriptCollider : public TScriptCollider<ScriptCollider>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeCollider")
-
-	private:
-		friend class ScriptColliderBase;
-
-		ScriptCollider(MonoObject* instance);
-
-		/** Triggered when some object starts interacting with the collider. */
-		static void onCollisionBegin(MonoObject* instance, const CollisionData& collisionData);
-
-		/** Triggered when some object remains interacting with the collider throughout a frame. */
-		static void onCollisionStay(MonoObject* instance, const CollisionData& collisionData);
-
-		/** Triggered when some object ends interacting with the collider. */
-		static void onCollisionEnd(MonoObject* instance, const CollisionData& collisionData);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_Destroy(ScriptColliderBase* thisPtr);
-		
-		static void internal_GetPosition(ScriptColliderBase* thisPtr, Vector3* pos);
-		static void internal_GetRotation(ScriptColliderBase* thisPtr, Quaternion* rot);
-		static void internal_SetTransform(ScriptColliderBase* thisPtr, Vector3* pos, Quaternion* rot);
-
-		static void internal_SetScale(ScriptColliderBase* thisPtr, Vector3* scale);
-		static void internal_GetScale(ScriptColliderBase* thisPtr, Vector3* scale);
-
-		static void internal_SetIsTrigger(ScriptColliderBase* thisPtr, bool value);
-		static bool internal_GetIsTrigger(ScriptColliderBase* thisPtr);
-
-		static void internal_SetRigidbody(ScriptColliderBase* thisPtr, ScriptRigidbody* value);
-		static MonoObject* internal_GetRigidbody(ScriptColliderBase* thisPtr);
-
-		static void internal_SetMass(ScriptColliderBase* thisPtr, float mass);
-		static float internal_GetMass(ScriptColliderBase* thisPtr);
-
-		static void internal_SetMaterial(ScriptColliderBase* thisPtr, ScriptPhysicsMaterial* material);
-		static MonoObject* internal_GetMaterial(ScriptColliderBase* thisPtr);
-
-		static void internal_SetContactOffset(ScriptColliderBase* thisPtr, float value);
-		static float internal_GetContactOffset(ScriptColliderBase* thisPtr);
-
-		static void internal_SetRestOffset(ScriptColliderBase* thisPtr, float value);
-		static float internal_GetRestOffset(ScriptColliderBase* thisPtr);
-
-		static void internal_SetLayer(ScriptColliderBase* thisPtr, UINT64 layer);
-		static UINT64 internal_GetLayer(ScriptColliderBase* thisPtr);
-
-		static void internal_SetCollisionReportMode(ScriptColliderBase* thisPtr, CollisionReportMode mode);
-		static CollisionReportMode internal_GetCollisionReportMode(ScriptColliderBase* thisPtr);
-
-		static bool internal_RayCast(ScriptColliderBase* thisPtr, Vector3* origin, Vector3* unitDir, MonoObject** hit, 
-			float maxDist);
-
-		typedef void(__stdcall *OnCollisionThunkDef) (MonoObject*, MonoObject*, MonoException**);
-
-		static OnCollisionThunkDef onCollisionBeginThunk;
-		static OnCollisionThunkDef onCollisionStayThunk;
-		static OnCollisionThunkDef onCollisionEndThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsPhysicsCommon.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	class ScriptCollider;
+
+	/** Base class for all Collider interop objects. */
+	class BS_SCR_BE_EXPORT ScriptColliderBase : public ScriptObjectBase
+	{
+	public:
+		/** Returns the native Collider object. */
+		virtual Collider* getCollider() const { return mCollider.get(); };
+	protected:
+		friend ScriptCollider;
+
+		ScriptColliderBase(MonoObject* instance);
+		virtual ~ScriptColliderBase() {}
+
+		/** Initializes the interop object with a native collider. Must be called right after construction. */
+		void initialize(const SPtr<Collider>& collider);
+
+		/** Destroys the internal collider object. */
+		void destroyCollider();
+
+		SPtr<Collider> mCollider;
+	};
+
+	/** A more specialized version of ScriptObject that allows the constructor to set the native collider. */
+	template <class Type>
+	class TScriptCollider : public ScriptObject<Type, ScriptColliderBase>
+	{
+	public:
+		virtual ~TScriptCollider() {}
+
+	protected:
+		TScriptCollider(MonoObject* instance, const SPtr<Collider>& collider)
+			:ScriptObject(instance)
+		{
+			initialize(collider);
+		}
+	};
+
+	/** Interop class between C++ & CLR for Collider. */
+	class BS_SCR_BE_EXPORT ScriptCollider : public TScriptCollider<ScriptCollider>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeCollider")
+
+	private:
+		friend class ScriptColliderBase;
+
+		ScriptCollider(MonoObject* instance);
+
+		/** Triggered when some object starts interacting with the collider. */
+		static void onCollisionBegin(MonoObject* instance, const CollisionData& collisionData);
+
+		/** Triggered when some object remains interacting with the collider throughout a frame. */
+		static void onCollisionStay(MonoObject* instance, const CollisionData& collisionData);
+
+		/** Triggered when some object ends interacting with the collider. */
+		static void onCollisionEnd(MonoObject* instance, const CollisionData& collisionData);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_Destroy(ScriptColliderBase* thisPtr);
+		
+		static void internal_GetPosition(ScriptColliderBase* thisPtr, Vector3* pos);
+		static void internal_GetRotation(ScriptColliderBase* thisPtr, Quaternion* rot);
+		static void internal_SetTransform(ScriptColliderBase* thisPtr, Vector3* pos, Quaternion* rot);
+
+		static void internal_SetScale(ScriptColliderBase* thisPtr, Vector3* scale);
+		static void internal_GetScale(ScriptColliderBase* thisPtr, Vector3* scale);
+
+		static void internal_SetIsTrigger(ScriptColliderBase* thisPtr, bool value);
+		static bool internal_GetIsTrigger(ScriptColliderBase* thisPtr);
+
+		static void internal_SetRigidbody(ScriptColliderBase* thisPtr, ScriptRigidbody* value);
+		static MonoObject* internal_GetRigidbody(ScriptColliderBase* thisPtr);
+
+		static void internal_SetMass(ScriptColliderBase* thisPtr, float mass);
+		static float internal_GetMass(ScriptColliderBase* thisPtr);
+
+		static void internal_SetMaterial(ScriptColliderBase* thisPtr, ScriptPhysicsMaterial* material);
+		static MonoObject* internal_GetMaterial(ScriptColliderBase* thisPtr);
+
+		static void internal_SetContactOffset(ScriptColliderBase* thisPtr, float value);
+		static float internal_GetContactOffset(ScriptColliderBase* thisPtr);
+
+		static void internal_SetRestOffset(ScriptColliderBase* thisPtr, float value);
+		static float internal_GetRestOffset(ScriptColliderBase* thisPtr);
+
+		static void internal_SetLayer(ScriptColliderBase* thisPtr, UINT64 layer);
+		static UINT64 internal_GetLayer(ScriptColliderBase* thisPtr);
+
+		static void internal_SetCollisionReportMode(ScriptColliderBase* thisPtr, CollisionReportMode mode);
+		static CollisionReportMode internal_GetCollisionReportMode(ScriptColliderBase* thisPtr);
+
+		static bool internal_RayCast(ScriptColliderBase* thisPtr, Vector3* origin, Vector3* unitDir, MonoObject** hit, 
+			float maxDist);
+
+		typedef void(__stdcall *OnCollisionThunkDef) (MonoObject*, MonoObject*, MonoException**);
+
+		static OnCollisionThunkDef onCollisionBeginThunk;
+		static OnCollisionThunkDef onCollisionStayThunk;
+		static OnCollisionThunkDef onCollisionEndThunk;
+	};
+
+	/** @} */
 }

+ 58 - 52
Source/SBansheeEngine/Include/BsScriptCollisionData.h

@@ -1,53 +1,59 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsPhysicsCommon.h"
-
-namespace BansheeEngine
-{
-	/** Interop struct between C++ & CLR for CollisionData. */
-	struct ScriptCollisionData // Must match C# ScriptCollisionData struct layout
-	{
-		MonoObject* colliderA;
-		MonoObject* colliderB;
-		MonoArray* contactPoints;
-	};
-
-	/** Helper class for dealing with CollisionData structure. */
-	class BS_SCR_BE_EXPORT ScriptCollisionDataHelper : public ScriptObject<ScriptCollisionDataHelper>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptCollisionData")
-
-		/** Converts native collision data to its managed counterpart. */
-		static ScriptCollisionData create(const CollisionData& data);
-
-		/** Unboxes a boxed managed ScriptCollisionData struct and returns the native version of the structure. */
-		static ScriptCollisionData unbox(MonoObject* obj);
-
-		/** Boxes a native ScriptCollisionData struct and returns a managed object containing it. */
-		static MonoObject* box(const ScriptCollisionData& value);
-
-	private:
-		ScriptCollisionDataHelper(MonoObject* instance);
-	};
-
-	/** Helper class for dealing with ContactPoint structure. */
-	class BS_SCR_BE_EXPORT ScriptContactPointHelper : public ScriptObject<ScriptContactPointHelper>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ContactPoint")
-
-		/** Unboxes a boxed managed ContactPoint struct and returns the native version of the structure. */
-		static ContactPoint unbox(MonoObject* obj);
-
-		/** Boxes a native ContactPoint struct and returns a managed object containing it. */
-		static MonoObject* box(const ContactPoint& value);
-
-	private:
-		ScriptContactPointHelper(MonoObject* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsPhysicsCommon.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop struct between C++ & CLR for CollisionData. */
+	struct ScriptCollisionData // Must match C# ScriptCollisionData struct layout
+	{
+		MonoObject* colliderA;
+		MonoObject* colliderB;
+		MonoArray* contactPoints;
+	};
+
+	/** Helper class for dealing with CollisionData structure. */
+	class BS_SCR_BE_EXPORT ScriptCollisionDataHelper : public ScriptObject<ScriptCollisionDataHelper>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptCollisionData")
+
+		/** Converts native collision data to its managed counterpart. */
+		static ScriptCollisionData create(const CollisionData& data);
+
+		/** Unboxes a boxed managed ScriptCollisionData struct and returns the native version of the structure. */
+		static ScriptCollisionData unbox(MonoObject* obj);
+
+		/** Boxes a native ScriptCollisionData struct and returns a managed object containing it. */
+		static MonoObject* box(const ScriptCollisionData& value);
+
+	private:
+		ScriptCollisionDataHelper(MonoObject* instance);
+	};
+
+	/** Helper class for dealing with ContactPoint structure. */
+	class BS_SCR_BE_EXPORT ScriptContactPointHelper : public ScriptObject<ScriptContactPointHelper>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ContactPoint")
+
+		/** Unboxes a boxed managed ContactPoint struct and returns the native version of the structure. */
+		static ContactPoint unbox(MonoObject* obj);
+
+		/** Boxes a native ContactPoint struct and returns a managed object containing it. */
+		static MonoObject* box(const ContactPoint& value);
+
+	private:
+		ScriptContactPointHelper(MonoObject* instance);
+	};
+
+	/** @} */
 }

+ 49 - 43
Source/SBansheeEngine/Include/BsScriptControllerCollision.h

@@ -1,44 +1,50 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsCharacterController.h"
-
-namespace BansheeEngine
-{
-	/** Interop struct between C++ & CLR for ControllerCollision. */
-	struct ScriptControllerCollision // Note: Must match C++ struct ScriptControllerCollision
-	{
-		Vector3 position;
-		Vector3 normal;
-		Vector3 motionDir;
-		float motionAmount;
-		MonoObject* collider;
-		int triangleIndex;
-		MonoObject* controller;
-	};
-
-	/** Helper class for dealing with ControllerCollision structure. */
-	class BS_SCR_BE_EXPORT ScriptControllerCollisionHelper : public ScriptObject<ScriptControllerCollisionHelper>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptControllerCollision")
-
-		/** Converts native collision data to its managed counterpart. */
-		static ScriptControllerCollision create(const ControllerColliderCollision& data);
-
-		/** Converts native collision data to its managed counterpart. */
-		static ScriptControllerCollision create(const ControllerControllerCollision& data);
-
-		/** Unboxes a boxed managed ScriptControllerCollision struct and returns the native version of the structure. */
-		static ScriptControllerCollision unbox(MonoObject* obj);
-
-		/** Boxes a native ScriptControllerCollision struct and returns a managed object containing it. */
-		static MonoObject* box(const ScriptControllerCollision& value);
-
-	private:
-		ScriptControllerCollisionHelper(MonoObject* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsCharacterController.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop struct between C++ & CLR for ControllerCollision. */
+	struct ScriptControllerCollision // Note: Must match C++ struct ScriptControllerCollision
+	{
+		Vector3 position;
+		Vector3 normal;
+		Vector3 motionDir;
+		float motionAmount;
+		MonoObject* collider;
+		int triangleIndex;
+		MonoObject* controller;
+	};
+
+	/** Helper class for dealing with ControllerCollision structure. */
+	class BS_SCR_BE_EXPORT ScriptControllerCollisionHelper : public ScriptObject<ScriptControllerCollisionHelper>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptControllerCollision")
+
+		/** Converts native collision data to its managed counterpart. */
+		static ScriptControllerCollision create(const ControllerColliderCollision& data);
+
+		/** Converts native collision data to its managed counterpart. */
+		static ScriptControllerCollision create(const ControllerControllerCollision& data);
+
+		/** Unboxes a boxed managed ScriptControllerCollision struct and returns the native version of the structure. */
+		static ScriptControllerCollision unbox(MonoObject* obj);
+
+		/** Boxes a native ScriptControllerCollision struct and returns a managed object containing it. */
+		static MonoObject* box(const ScriptControllerCollision& value);
+
+	private:
+		ScriptControllerCollisionHelper(MonoObject* instance);
+	};
+
+	/** @} */
 }

+ 40 - 34
Source/SBansheeEngine/Include/BsScriptDistanceJoint.h

@@ -1,35 +1,41 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for DistanceJoint. */
-	class BS_SCR_BE_EXPORT ScriptDistanceJoint : public TScriptJoint<ScriptDistanceJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeDistanceJoint")
-	private:
-		ScriptDistanceJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native distance joint wrapped by this object. */
-		DistanceJoint* getDistanceJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static float internal_GetDistance(ScriptDistanceJoint* thisPtr);
-		static void internal_SetMinDistance(ScriptDistanceJoint* thisPtr, float value);
-		static void internal_SetMaxDistance(ScriptDistanceJoint* thisPtr, float value);
-		static void internal_SetTolerance(ScriptDistanceJoint* thisPtr, float value);
-		static void internal_SetSpring(ScriptDistanceJoint* thisPtr, Spring* value);
-		static void internal_SetEnableMinDistanceLimit(ScriptDistanceJoint* thisPtr, bool value);
-		static void internal_SetEnableMaxDistanceLimit(ScriptDistanceJoint* thisPtr, bool value);
-		static void internal_SetEnableSpring(ScriptDistanceJoint* thisPtr, bool value);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for DistanceJoint. */
+	class BS_SCR_BE_EXPORT ScriptDistanceJoint : public TScriptJoint<ScriptDistanceJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeDistanceJoint")
+	private:
+		ScriptDistanceJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native distance joint wrapped by this object. */
+		DistanceJoint* getDistanceJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static float internal_GetDistance(ScriptDistanceJoint* thisPtr);
+		static void internal_SetMinDistance(ScriptDistanceJoint* thisPtr, float value);
+		static void internal_SetMaxDistance(ScriptDistanceJoint* thisPtr, float value);
+		static void internal_SetTolerance(ScriptDistanceJoint* thisPtr, float value);
+		static void internal_SetSpring(ScriptDistanceJoint* thisPtr, Spring* value);
+		static void internal_SetEnableMinDistanceLimit(ScriptDistanceJoint* thisPtr, bool value);
+		static void internal_SetEnableMaxDistanceLimit(ScriptDistanceJoint* thisPtr, bool value);
+		static void internal_SetEnableSpring(ScriptDistanceJoint* thisPtr, bool value);
+	};
+
+	/** @} */
 }

+ 179 - 159
Source/SBansheeEngine/Include/BsScriptEnginePrerequisites.h

@@ -1,160 +1,180 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsMonoPrerequisites.h"
-
-#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
-#	ifdef BS_SCR_BE_EXPORTS
-#		define BS_SCR_BE_EXPORT __declspec(dllexport)
-#	else
-#       if defined( __MINGW32__ )
-#           define BS_SCR_BE_EXPORT
-#       else
-#    		define BS_SCR_BE_EXPORT __declspec(dllimport)
-#       endif
-#	endif
-#elif defined ( BS_GCC_VISIBILITY )
-#    define BS_SCR_BE_EXPORT  __attribute__ ((visibility("default")))
-#else
-#    define BS_SCR_BE_EXPORT
-#endif
-
-namespace BansheeEngine
-{
-	class ScriptObjectBase;
-	class ScriptResourceManager;
-	class ScriptResourceBase;
-	class ScriptFont;
-	class ScriptSpriteTexture;
-	class ScriptShaderInclude;
-	class ScriptTexture2D;
-	class ScriptTexture3D;
-	class ScriptTextureCube;
-	class ScriptPlainText;
-	class ScriptScriptCode;
-	class ScriptShader;
-	class ScriptMaterial;
-	class ScriptMesh;
-	class ScriptPrefab;
-	class ScriptStringTable;
-	class ScriptGUIElementStyle;
-	class ScriptGUIElementStateStyle;
-	class ScriptGUILayout;
-	class ScriptGUILabel;
-	class ScriptGUIScrollArea;
-	class ScriptGUIScrollAreaLayout;
-	class ScriptGameObjectBase;
-	class ScriptSceneObject;
-	class ScriptComponent;
-	class ScriptManagedResource;
-	class ScriptRenderTarget;
-	class ScriptRenderTexture2D;
-	class ScriptCamera;
-	class ScriptMeshData;
-	class ManagedComponent;
-	class ManagedSerializableFieldData;
-	class ManagedSerializableFieldKey;
-	class ManagedSerializableFieldDataEntry;
-	class ManagedSerializableTypeInfo;
-	class ManagedSerializableTypeInfoPrimitive;
-	class ManagedSerializableTypeInfoObject;
-	class ManagedSerializableTypeInfoArray;
-	class ManagedSerializableTypeInfoList;
-	class ManagedSerializableTypeInfoDictionary;
-	class ManagedSerializableObject;
-	class ManagedSerializableArray;
-	class ManagedSerializableList;
-	class ManagedSerializableDictionary;
-	class ManagedSerializableAssemblyInfo;
-	class ManagedSerializableObjectInfo;
-	class ManagedSerializableFieldInfo;
-	class ManagedSerializableObjectData;
-	class ManagedSerializableDiff;
-	class ManagedResource;
-	class ManagedResourceMetaData;
-	class ScriptSerializableProperty;
-	class ScriptAssemblyManager;
-	class ScriptHString;
-	class ScriptContextMenu;
-	class ScriptGUISkin;
-	class ScriptResourceRef;
-	class ScriptPhysicsMaterial;
-	class ScriptPhysicsMesh;
-	class ScriptRigidbody;
-
-	typedef GameObjectHandle<ManagedComponent> HManagedComponent;
-	typedef ResourceHandle<ManagedResource> HManagedResource;
-
-	enum TypeID_BansheeScript
-	{
-		TID_ManagedComponent = 50000,
-		TID_ScriptSerializableObject = 50001,
-		TID_ScriptSerializableArray = 50002,
-		TID_SerializableAssemblyInfo = 50004,
-		TID_SerializableObjectInfo = 50005,
-		TID_SerializableFieldInfo = 50006,
-		TID_SerializableTypeInfo = 50007,
-		TID_SerializableTypeInfoPrimitive = 50008,
-		TID_SerializableTypeInfoObject = 50009,
-		TID_SerializableTypeInfoArray = 50010,
-		TID_SerializableFieldData = 50011,
-		TID_SerializableFieldKey = 50012,
-		TID_SerializableFieldDataEntry = 50013,
-		TID_SerializableFieldDataBool = 50014,
-		TID_SerializableFieldDataChar = 50015,
-		TID_SerializableFieldDataI8 = 50016,
-		TID_SerializableFieldDataU8 = 50017,
-		TID_SerializableFieldDataI16 = 50018,
-		TID_SerializableFieldDataU16 = 50019,
-		TID_SerializableFieldDataI32 = 50020,
-		TID_SerializableFieldDataU32 = 50021,
-		TID_SerializableFieldDataI64 = 50022,
-		TID_SerializableFieldDataU64 = 50023,
-		TID_SerializableFieldDataFloat = 50024,
-		TID_SerializableFieldDataDouble = 50025,
-		TID_SerializableFieldDataString = 50026,
-		TID_SerializableFieldDataResourceRef = 50027,
-		TID_SerializableFieldDataGameObjectRef = 50028,
-		TID_SerializableFieldDataObject = 50029,
-		TID_SerializableFieldDataArray = 50030,
-		TID_SerializableFieldDataList = 50031,
-		TID_SerializableFieldDataDictionary = 50032,
-		TID_SerializableTypeInfoList = 50033,
-		TID_SerializableTypeInfoDictionary = 50034,
-		TID_ScriptSerializableList = 50035,
-		TID_ScriptSerializableDictionary = 50036,
-		TID_ManagedResource = 50037,
-		TID_ManagedResourceMetaData = 50038,
-		TID_ScriptSerializableObjectData = 50039,
-		TID_ScriptSerializableDiff = 50040,
-		TID_ScriptModification = 50041,
-		TID_ScriptModifiedObject = 50042,
-		TID_ScriptModifiedArray = 50043,
-		TID_ScriptModifiedDictionary = 50044,
-		TID_ScriptModifiedEntry = 50045,
-		TID_ScriptModifiedField = 50046,
-		TID_ScriptModifiedArrayEntry = 50047,
-		TID_ScriptModifiedDictionaryEntry = 50048,
-		TID_ScriptSerializableDictionaryKeyValue = 50049
-	};
-
-	typedef std::shared_ptr<ManagedSerializableFieldData> ManagedSerializableFieldDataPtr;
-	typedef std::shared_ptr<ManagedSerializableFieldKey> ManagedSerializableFieldKeyPtr;
-	typedef std::shared_ptr<ManagedSerializableFieldDataEntry> ManagedSerializableFieldDataEntryPtr;
-	typedef std::shared_ptr<ManagedSerializableTypeInfo> ManagedSerializableTypeInfoPtr;
-	typedef std::shared_ptr<ManagedSerializableTypeInfoObject> ManagedSerializableTypeInfoObjectPtr;
-	typedef std::shared_ptr<ManagedSerializableObject> ManagedSerializableObjectPtr;
-	typedef std::shared_ptr<ManagedSerializableArray> ManagedSerializableArrayPtr;
-	typedef std::shared_ptr<ManagedSerializableList> ManagedSerializableListPtr;
-	typedef std::shared_ptr<ManagedSerializableDictionary> ManagedSerializableDictionaryPtr;
-	typedef std::shared_ptr<ManagedSerializableAssemblyInfo> ManagedSerializableAssemblyInfoPtr;
-	typedef std::shared_ptr<ManagedSerializableObjectInfo> ManagedSerializableObjectInfoPtr;
-	typedef std::shared_ptr<ManagedSerializableFieldInfo> ManagedSerializableFieldInfoPtr;
-	typedef std::shared_ptr<ManagedSerializableTypeInfoArray> ManagedSerializableTypeInfoArrayPtr;
-	typedef std::shared_ptr<ManagedSerializableTypeInfoList> ManagedSerializableTypeInfoListPtr;
-	typedef std::shared_ptr<ManagedSerializableTypeInfoDictionary> ManagedSerializableTypeInfoDictionaryPtr;
-	typedef std::shared_ptr<ManagedSerializableDiff> ManagedSerializableDiffPtr;
-	typedef std::shared_ptr<ManagedResource> ManagedResourcePtr;
-	typedef std::shared_ptr<ManagedResourceMetaData> ManagedResourceMetaDataPtr;
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsMonoPrerequisites.h"
+
+#if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__)
+#	ifdef BS_SCR_BE_EXPORTS
+#		define BS_SCR_BE_EXPORT __declspec(dllexport)
+#	else
+#       if defined( __MINGW32__ )
+#           define BS_SCR_BE_EXPORT
+#       else
+#    		define BS_SCR_BE_EXPORT __declspec(dllimport)
+#       endif
+#	endif
+#elif defined ( BS_GCC_VISIBILITY )
+#    define BS_SCR_BE_EXPORT  __attribute__ ((visibility("default")))
+#else
+#    define BS_SCR_BE_EXPORT
+#endif
+
+/** @addtogroup Plugins
+
+/** @defgroup SBansheeEngine SBansheeEngine
+ *	Contains script interop objects and other scripting functionality.
+ *  @{
+ */
+
+/** @defgroup ScriptInteropEngine Script interop objects
+ *	Script interop objects for communicating between native code and MBansheeEngine managed assembly.
+ *  @{
+ */
+
+/** @defgroup RTTI-Impl-SEngine RTTI types
+ *	Types containing RTTI for specific classes.
+ *  @{
+ */
+
+/** @} */
+/** @} */
+
+namespace BansheeEngine
+{
+	class ScriptObjectBase;
+	class ScriptResourceManager;
+	class ScriptResourceBase;
+	class ScriptFont;
+	class ScriptSpriteTexture;
+	class ScriptShaderInclude;
+	class ScriptTexture2D;
+	class ScriptTexture3D;
+	class ScriptTextureCube;
+	class ScriptPlainText;
+	class ScriptScriptCode;
+	class ScriptShader;
+	class ScriptMaterial;
+	class ScriptMesh;
+	class ScriptPrefab;
+	class ScriptStringTable;
+	class ScriptGUIElementStyle;
+	class ScriptGUIElementStateStyle;
+	class ScriptGUILayout;
+	class ScriptGUILabel;
+	class ScriptGUIScrollArea;
+	class ScriptGUIScrollAreaLayout;
+	class ScriptGameObjectBase;
+	class ScriptSceneObject;
+	class ScriptComponent;
+	class ScriptManagedResource;
+	class ScriptRenderTarget;
+	class ScriptRenderTexture2D;
+	class ScriptCamera;
+	class ScriptMeshData;
+	class ManagedComponent;
+	class ManagedSerializableFieldData;
+	class ManagedSerializableFieldKey;
+	class ManagedSerializableFieldDataEntry;
+	class ManagedSerializableTypeInfo;
+	class ManagedSerializableTypeInfoPrimitive;
+	class ManagedSerializableTypeInfoObject;
+	class ManagedSerializableTypeInfoArray;
+	class ManagedSerializableTypeInfoList;
+	class ManagedSerializableTypeInfoDictionary;
+	class ManagedSerializableObject;
+	class ManagedSerializableArray;
+	class ManagedSerializableList;
+	class ManagedSerializableDictionary;
+	class ManagedSerializableAssemblyInfo;
+	class ManagedSerializableObjectInfo;
+	class ManagedSerializableFieldInfo;
+	class ManagedSerializableObjectData;
+	class ManagedSerializableDiff;
+	class ManagedResource;
+	class ManagedResourceMetaData;
+	class ScriptSerializableProperty;
+	class ScriptAssemblyManager;
+	class ScriptHString;
+	class ScriptContextMenu;
+	class ScriptGUISkin;
+	class ScriptResourceRef;
+	class ScriptPhysicsMaterial;
+	class ScriptPhysicsMesh;
+	class ScriptRigidbody;
+
+	typedef GameObjectHandle<ManagedComponent> HManagedComponent;
+	typedef ResourceHandle<ManagedResource> HManagedResource;
+
+	enum TypeID_BansheeScript
+	{
+		TID_ManagedComponent = 50000,
+		TID_ScriptSerializableObject = 50001,
+		TID_ScriptSerializableArray = 50002,
+		TID_SerializableAssemblyInfo = 50004,
+		TID_SerializableObjectInfo = 50005,
+		TID_SerializableFieldInfo = 50006,
+		TID_SerializableTypeInfo = 50007,
+		TID_SerializableTypeInfoPrimitive = 50008,
+		TID_SerializableTypeInfoObject = 50009,
+		TID_SerializableTypeInfoArray = 50010,
+		TID_SerializableFieldData = 50011,
+		TID_SerializableFieldKey = 50012,
+		TID_SerializableFieldDataEntry = 50013,
+		TID_SerializableFieldDataBool = 50014,
+		TID_SerializableFieldDataChar = 50015,
+		TID_SerializableFieldDataI8 = 50016,
+		TID_SerializableFieldDataU8 = 50017,
+		TID_SerializableFieldDataI16 = 50018,
+		TID_SerializableFieldDataU16 = 50019,
+		TID_SerializableFieldDataI32 = 50020,
+		TID_SerializableFieldDataU32 = 50021,
+		TID_SerializableFieldDataI64 = 50022,
+		TID_SerializableFieldDataU64 = 50023,
+		TID_SerializableFieldDataFloat = 50024,
+		TID_SerializableFieldDataDouble = 50025,
+		TID_SerializableFieldDataString = 50026,
+		TID_SerializableFieldDataResourceRef = 50027,
+		TID_SerializableFieldDataGameObjectRef = 50028,
+		TID_SerializableFieldDataObject = 50029,
+		TID_SerializableFieldDataArray = 50030,
+		TID_SerializableFieldDataList = 50031,
+		TID_SerializableFieldDataDictionary = 50032,
+		TID_SerializableTypeInfoList = 50033,
+		TID_SerializableTypeInfoDictionary = 50034,
+		TID_ScriptSerializableList = 50035,
+		TID_ScriptSerializableDictionary = 50036,
+		TID_ManagedResource = 50037,
+		TID_ManagedResourceMetaData = 50038,
+		TID_ScriptSerializableObjectData = 50039,
+		TID_ScriptSerializableDiff = 50040,
+		TID_ScriptModification = 50041,
+		TID_ScriptModifiedObject = 50042,
+		TID_ScriptModifiedArray = 50043,
+		TID_ScriptModifiedDictionary = 50044,
+		TID_ScriptModifiedEntry = 50045,
+		TID_ScriptModifiedField = 50046,
+		TID_ScriptModifiedArrayEntry = 50047,
+		TID_ScriptModifiedDictionaryEntry = 50048,
+		TID_ScriptSerializableDictionaryKeyValue = 50049
+	};
+
+	typedef std::shared_ptr<ManagedSerializableFieldData> ManagedSerializableFieldDataPtr;
+	typedef std::shared_ptr<ManagedSerializableFieldKey> ManagedSerializableFieldKeyPtr;
+	typedef std::shared_ptr<ManagedSerializableFieldDataEntry> ManagedSerializableFieldDataEntryPtr;
+	typedef std::shared_ptr<ManagedSerializableTypeInfo> ManagedSerializableTypeInfoPtr;
+	typedef std::shared_ptr<ManagedSerializableTypeInfoObject> ManagedSerializableTypeInfoObjectPtr;
+	typedef std::shared_ptr<ManagedSerializableObject> ManagedSerializableObjectPtr;
+	typedef std::shared_ptr<ManagedSerializableArray> ManagedSerializableArrayPtr;
+	typedef std::shared_ptr<ManagedSerializableList> ManagedSerializableListPtr;
+	typedef std::shared_ptr<ManagedSerializableDictionary> ManagedSerializableDictionaryPtr;
+	typedef std::shared_ptr<ManagedSerializableAssemblyInfo> ManagedSerializableAssemblyInfoPtr;
+	typedef std::shared_ptr<ManagedSerializableObjectInfo> ManagedSerializableObjectInfoPtr;
+	typedef std::shared_ptr<ManagedSerializableFieldInfo> ManagedSerializableFieldInfoPtr;
+	typedef std::shared_ptr<ManagedSerializableTypeInfoArray> ManagedSerializableTypeInfoArrayPtr;
+	typedef std::shared_ptr<ManagedSerializableTypeInfoList> ManagedSerializableTypeInfoListPtr;
+	typedef std::shared_ptr<ManagedSerializableTypeInfoDictionary> ManagedSerializableTypeInfoDictionaryPtr;
+	typedef std::shared_ptr<ManagedSerializableDiff> ManagedSerializableDiffPtr;
+	typedef std::shared_ptr<ManagedResource> ManagedResourcePtr;
+	typedef std::shared_ptr<ManagedResourceMetaData> ManagedResourceMetaDataPtr;
 }

+ 45 - 39
Source/SBansheeEngine/Include/BsScriptGUI.h

@@ -1,40 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-
-namespace BansheeEngine
-{
-	/**	Interop class between C++ & CLR for a global always-accessible GUIWidget. */
-	class BS_SCR_BE_EXPORT ScriptGUI : public ScriptObject <ScriptGUI>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUI")
-
-		/**	Creates the globally accessible GUIWidget and makes the system ready to use. */
-		static void startUp();
-
-		/** Updates the main camera the widget renders to, if it changes. Should be called every frame. */
-		static void update();
-
-		/** Destroys the globally accessible GUIWidget and all its GUI elements. */
-		static void shutDown();
-
-	private:
-		ScriptGUI(MonoObject* managedInstance);
-		~ScriptGUI();
-
-		static SPtr<GUIWidget> sGUIWidget;
-		static ScriptGUILayout* sPanel;
-		static MonoMethod* sGUIPanelMethod;
-		static HEvent sDomainUnloadConn;
-		static HEvent sDomainLoadConn;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_SetSkin(ScriptGUISkin* skin);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for a global always-accessible GUIWidget. */
+	class BS_SCR_BE_EXPORT ScriptGUI : public ScriptObject <ScriptGUI>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUI")
+
+		/**	Creates the globally accessible GUIWidget and makes the system ready to use. */
+		static void startUp();
+
+		/** Updates the main camera the widget renders to, if it changes. Should be called every frame. */
+		static void update();
+
+		/** Destroys the globally accessible GUIWidget and all its GUI elements. */
+		static void shutDown();
+
+	private:
+		ScriptGUI(MonoObject* managedInstance);
+		~ScriptGUI();
+
+		static SPtr<GUIWidget> sGUIWidget;
+		static ScriptGUILayout* sPanel;
+		static MonoMethod* sGUIPanelMethod;
+		static HEvent sDomainUnloadConn;
+		static HEvent sDomainLoadConn;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_SetSkin(ScriptGUISkin* skin);
+	};
+
+	/** @} */
 }

+ 54 - 58
Source/SBansheeEngine/Include/BsScriptGUIButton.h

@@ -1,59 +1,55 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-#include "BsColor.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIButton.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIButton : public TScriptGUIElement<ScriptGUIButton>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIButton")
-
-	private:
-		ScriptGUIButton(MonoObject* instance, GUIButton* button);
-
-		/**
-		 * @brief	Triggers when the GUI button is clicked.
-		 */
-		static void onClick(MonoObject* instance);
-
-		/**
-		 * @brief	Triggers when the GUI button is double-clicked.
-		 */
-		static void onDoubleClick(MonoObject* instance);
-
-		/**
-		 * @brief	Triggers when the GUI button is hovered over.
-		 */
-		static void onHover(MonoObject* instance);
-
-		/**
-		 * @brief	Triggers when the pointer leaves the GUI button.
-		 */
-		static void onOut(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
-		static void internal_setContent(ScriptGUIButton* nativeInstance, MonoObject* content);
-		static void internal_setTint(ScriptGUIButton* nativeInstance, Color* color);
-
-		typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
-		typedef void (__stdcall *OnDoubleClickThunkDef) (MonoObject*, MonoException**);
-		typedef void (__stdcall *OnHoverThunkDef) (MonoObject*, MonoException**);
-		typedef void (__stdcall *OnOutThunkDef) (MonoObject*, MonoException**);
-
-		static OnClickThunkDef onClickThunk;
-		static OnDoubleClickThunkDef onDoubleClickThunk;
-		static OnHoverThunkDef onHoverThunk;
-		static OnOutThunkDef onOutThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+#include "BsColor.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIButton. */
+	class BS_SCR_BE_EXPORT ScriptGUIButton : public TScriptGUIElement<ScriptGUIButton>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIButton")
+
+	private:
+		ScriptGUIButton(MonoObject* instance, GUIButton* button);
+
+		/**	Triggers when the GUI button is clicked. */
+		static void onClick(MonoObject* instance);
+
+		/**	Triggers when the GUI button is double-clicked. */
+		static void onDoubleClick(MonoObject* instance);
+
+		/**	Triggers when the GUI button is hovered over. */
+		static void onHover(MonoObject* instance);
+
+		/**	Triggers when the pointer leaves the GUI button. */
+		static void onOut(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
+		static void internal_setContent(ScriptGUIButton* nativeInstance, MonoObject* content);
+		static void internal_setTint(ScriptGUIButton* nativeInstance, Color* color);
+
+		typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
+		typedef void (__stdcall *OnDoubleClickThunkDef) (MonoObject*, MonoException**);
+		typedef void (__stdcall *OnHoverThunkDef) (MonoObject*, MonoException**);
+		typedef void (__stdcall *OnOutThunkDef) (MonoObject*, MonoException**);
+
+		static OnClickThunkDef onClickThunk;
+		static OnDoubleClickThunkDef onDoubleClickThunk;
+		static OnHoverThunkDef onHoverThunk;
+		static OnOutThunkDef onOutThunk;
+	};
+
+	/** @} */
 }

+ 38 - 40
Source/SBansheeEngine/Include/BsScriptGUIContent.h

@@ -1,41 +1,39 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsGUIContent.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIContent.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIContent : public ScriptObject<ScriptGUIContent>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIContent")
-
-		/**
-		 * @brief	Retrieves the title text in a managed GUIContent instance.
-		 */
-		static const HString& getText(MonoObject* instance);
-
-		/**
-		 * @brief	Retrieves the tooltip text in a managed GUIContent instance.
-		 */
-		static const HString& getTooltip(MonoObject* instance);
-
-		/**
-		 * @brief	Retrieves the content image in a managed GUIContent instance.
-		 */
-		static GUIContentImages getImage(MonoObject* instance);
-
-	private:
-		ScriptGUIContent(MonoObject* instance);
-
-		static MonoField* mTextField;
-		static MonoField* mTooltipField;
-		static MonoField* mImagesField;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsGUIContent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIContent. */
+	class BS_SCR_BE_EXPORT ScriptGUIContent : public ScriptObject<ScriptGUIContent>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIContent")
+
+		/**	Retrieves the title text in a managed GUIContent instance. */
+		static const HString& getText(MonoObject* instance);
+
+		/**	Retrieves the tooltip text in a managed GUIContent instance. */
+		static const HString& getTooltip(MonoObject* instance);
+
+		/**	Retrieves the content image in a managed GUIContent instance. */
+		static GUIContentImages getImage(MonoObject* instance);
+
+	private:
+		ScriptGUIContent(MonoObject* instance);
+
+		static MonoField* mTextField;
+		static MonoField* mTooltipField;
+		static MonoField* mImagesField;
+	};
+
+	/** @} */
 }

+ 155 - 164
Source/SBansheeEngine/Include/BsScriptGUIElement.h

@@ -1,165 +1,156 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsGUIOptions.h"
-#include "BsGUIElementBase.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for all elements inheriting from
-	 *			GUIElementBase.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElementBaseTBase : public ScriptObjectBase
-	{
-	public:
-		ScriptGUIElementBaseTBase(MonoObject* instance);
-		virtual ~ScriptGUIElementBaseTBase() {}
-
-		/**
-		 * @brief	Returns the underlying GUIElementBase wrapped by this object.
-		 */
-		GUIElementBase* getGUIElement() const { return (GUIElementBase*)mElement; }
-
-		/**
-		 * @brief	Destroys the underlying GUIElementBase.
-		 */
-		virtual void destroy() = 0;
-
-		/**
-		 * @brief	Checks have we destroyed the underlying GUIElementBase.
-		 */
-		bool isDestroyed() const { return mIsDestroyed; }
-
-		/**
-		 * @brief	Returns the parent interop object for a GUI layout or a GUI panel.
-		 */
-		ScriptGUILayout* getParent() const { return mParent; }
-
-		/**
-		 * @brief	Sets an interop object for a GUI layout or a panel as this object's parent.
-		 */
-		void setParent(ScriptGUILayout* parent) { mParent = parent; }
-
-	protected:
-		/**
-		 * @brief	Initializes the interop object with a previously initialized GUI
-		 *			element. You must call this before using this object.
-		 */
-		void initialize(GUIElementBase* element);
-
-		/**
-		 * @copydoc	ScriptObjectBase::_onManagedInstanceDeleted
-		 */
-		virtual void _onManagedInstanceDeleted() override;
-
-		/**
-		 * @brief	Triggered when the focus changes for the underlying GUIElementBase.
-		 */
-		static void onFocusChanged(MonoObject* instance, bool focus);
-
-		bool mIsDestroyed;
-		GUIElementBase* mElement;
-		ScriptGUILayout* mParent;
-	};
-
-	/**
-	 * @brief	A more specialized implementation of ScriptGUIElementBaseTBase that
-	 *			references a specific GUI element type instead of the generic GUIElementBase.
-	 */
-	template <class Type>
-	class TScriptGUIElementBase : public ScriptObject<Type, ScriptGUIElementBaseTBase>
-	{
-	public:
-		virtual ~TScriptGUIElementBase() {}
-
-	protected:
-		TScriptGUIElementBase(MonoObject* instance, GUIElementBase* element)
-			:ScriptObject(instance)
-		{ 
-			initialize(element);
-		}
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for all elements inheriting from
-	 *			GUIElement.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElementTBase : public ScriptGUIElementBaseTBase
-	{
-	public:
-		ScriptGUIElementTBase(MonoObject* instance);
-		virtual ~ScriptGUIElementTBase() {}
-
-		/**
-		 * @copydoc	ScriptGUIElementBaseTBase::destroy
-		 */
-		virtual void destroy() override;
-	};
-
-	/**
-	 * @brief	A more specialized implementation of ScriptGUIElementTBase that
-	 *			references a specific GUI element type instead of the generic GUIElement.
-	 */
-	template <class Type>
-	class TScriptGUIElement : public ScriptObject<Type, ScriptGUIElementTBase>
-	{
-	public:
-		virtual ~TScriptGUIElement() {}
-
-	protected:
-		TScriptGUIElement(MonoObject* instance, GUIElementBase* element)
-			:ScriptObject(instance)
-		{
-			initialize(element);
-		}
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIElement. This includes only base
-	 *			methods belonging directly to GUIElement while specific GUI element 
-	 *			implementations have their own interop classes.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElement : public ScriptObject<ScriptGUIElement>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElement")
-
-	private:
-		ScriptGUIElement(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_destroy(ScriptGUIElementBaseTBase* nativeInstance);
-		static void internal_setVisible(ScriptGUIElementBaseTBase* nativeInstance, bool visible);
-		static void internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool active);
-		static void internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled);
-		static void internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus);
-		static bool internal_getVisible(ScriptGUIElementBaseTBase* nativeInstance);
-		static bool internal_getActive(ScriptGUIElementBaseTBase* nativeInstance);
-		static bool internal_getDisabled(ScriptGUIElementBaseTBase* nativeInstance);
-		static MonoObject* internal_getParent(ScriptGUIElementBaseTBase* nativeInstance);
-		static void internal_getBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
-		static void internal_setBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
-		static void internal_getVisibleBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
-		static void internal_SetPosition(ScriptGUIElementBaseTBase* nativeInstance, INT32 x, INT32 y);
-		static void internal_SetWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 width);
-		static void internal_SetFlexibleWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minWidth, UINT32 maxWidth);
-		static void internal_SetHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 height);
-		static void internal_SetFlexibleHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minHeight, UINT32 maxHeight);
-		static void internal_SetContextMenu(ScriptGUIElementBaseTBase* nativeInstance, ScriptContextMenu* contextMenu);
-		static void internal_ResetDimensions(ScriptGUIElementBaseTBase* nativeInstance);
-		static MonoString* internal_GetStyle(ScriptGUIElementBaseTBase* nativeInstance);
-		static void internal_SetStyle(ScriptGUIElementBaseTBase* nativeInstance, MonoString* style);
-
-		typedef void(__stdcall *OnFocusChangedThunkDef) (MonoObject*, MonoException**);
-
-	public:
-		static OnFocusChangedThunkDef onFocusGainedThunk;
-		static OnFocusChangedThunkDef onFocusLostThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsGUIOptions.h"
+#include "BsGUIElementBase.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup SBansheeEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for all elements inheriting from GUIElementBase. */
+	class BS_SCR_BE_EXPORT ScriptGUIElementBaseTBase : public ScriptObjectBase
+	{
+	public:
+		ScriptGUIElementBaseTBase(MonoObject* instance);
+		virtual ~ScriptGUIElementBaseTBase() {}
+
+		/**	Returns the underlying GUIElementBase wrapped by this object. */
+		GUIElementBase* getGUIElement() const { return (GUIElementBase*)mElement; }
+
+		/**	Destroys the underlying GUIElementBase. */
+		virtual void destroy() = 0;
+
+		/**	Checks have we destroyed the underlying GUIElementBase. */
+		bool isDestroyed() const { return mIsDestroyed; }
+
+		/**	Returns the parent interop object for a GUI layout or a GUI panel. */
+		ScriptGUILayout* getParent() const { return mParent; }
+
+		/**	Sets an interop object for a GUI layout or a panel as this object's parent. */
+		void setParent(ScriptGUILayout* parent) { mParent = parent; }
+
+	protected:
+		/**
+		 * Initializes the interop object with a previously initialized GUI element. You must call this before using this
+		 * object.
+		 */
+		void initialize(GUIElementBase* element);
+
+		/** @copydoc ScriptObjectBase::_onManagedInstanceDeleted */
+		virtual void _onManagedInstanceDeleted() override;
+
+		/**	Triggered when the focus changes for the underlying GUIElementBase. */
+		static void onFocusChanged(MonoObject* instance, bool focus);
+
+		bool mIsDestroyed;
+		GUIElementBase* mElement;
+		ScriptGUILayout* mParent;
+	};
+
+	/**
+	 * A more specialized implementation of ScriptGUIElementBaseTBase that references a specific GUI element type instead
+	 * of the generic GUIElementBase.
+	 */
+	template <class Type>
+	class TScriptGUIElementBase : public ScriptObject<Type, ScriptGUIElementBaseTBase>
+	{
+	public:
+		virtual ~TScriptGUIElementBase() {}
+
+	protected:
+		TScriptGUIElementBase(MonoObject* instance, GUIElementBase* element)
+			:ScriptObject(instance)
+		{ 
+			initialize(element);
+		}
+	};
+
+	/** Interop class between C++ & CLR for all elements inheriting from GUIElement. */
+	class BS_SCR_BE_EXPORT ScriptGUIElementTBase : public ScriptGUIElementBaseTBase
+	{
+	public:
+		ScriptGUIElementTBase(MonoObject* instance);
+		virtual ~ScriptGUIElementTBase() {}
+
+		/**
+		 * @copydoc	ScriptGUIElementBaseTBase::destroy
+		 */
+		virtual void destroy() override;
+	};
+
+	/**
+	 * A more specialized implementation of ScriptGUIElementTBase that references a specific GUI element type instead of
+	 * the generic GUIElement.
+	 */
+	template <class Type>
+	class TScriptGUIElement : public ScriptObject<Type, ScriptGUIElementTBase>
+	{
+	public:
+		virtual ~TScriptGUIElement() {}
+
+	protected:
+		TScriptGUIElement(MonoObject* instance, GUIElementBase* element)
+			:ScriptObject(instance)
+		{
+			initialize(element);
+		}
+	};
+
+	/** @} */
+
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**
+	 * Interop class between C++ & CLR for GUIElement. This includes only base methods belonging directly to GUIElement
+	 * while specific GUI element implementations have their own interop classes.
+	 */
+	class BS_SCR_BE_EXPORT ScriptGUIElement : public ScriptObject<ScriptGUIElement>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElement")
+
+	private:
+		ScriptGUIElement(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_destroy(ScriptGUIElementBaseTBase* nativeInstance);
+		static void internal_setVisible(ScriptGUIElementBaseTBase* nativeInstance, bool visible);
+		static void internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool active);
+		static void internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled);
+		static void internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus);
+		static bool internal_getVisible(ScriptGUIElementBaseTBase* nativeInstance);
+		static bool internal_getActive(ScriptGUIElementBaseTBase* nativeInstance);
+		static bool internal_getDisabled(ScriptGUIElementBaseTBase* nativeInstance);
+		static MonoObject* internal_getParent(ScriptGUIElementBaseTBase* nativeInstance);
+		static void internal_getBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
+		static void internal_setBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
+		static void internal_getVisibleBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I* bounds);
+		static void internal_SetPosition(ScriptGUIElementBaseTBase* nativeInstance, INT32 x, INT32 y);
+		static void internal_SetWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 width);
+		static void internal_SetFlexibleWidth(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minWidth, UINT32 maxWidth);
+		static void internal_SetHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 height);
+		static void internal_SetFlexibleHeight(ScriptGUIElementBaseTBase* nativeInstance, UINT32 minHeight, UINT32 maxHeight);
+		static void internal_SetContextMenu(ScriptGUIElementBaseTBase* nativeInstance, ScriptContextMenu* contextMenu);
+		static void internal_ResetDimensions(ScriptGUIElementBaseTBase* nativeInstance);
+		static MonoString* internal_GetStyle(ScriptGUIElementBaseTBase* nativeInstance);
+		static void internal_SetStyle(ScriptGUIElementBaseTBase* nativeInstance, MonoString* style);
+
+		typedef void(__stdcall *OnFocusChangedThunkDef) (MonoObject*, MonoException**);
+
+	public:
+		static OnFocusChangedThunkDef onFocusGainedThunk;
+		static OnFocusChangedThunkDef onFocusLostThunk;
+	};
+
+	/** @} */
 }

+ 42 - 43
Source/SBansheeEngine/Include/BsScriptGUIElementStateStyle.h

@@ -1,44 +1,43 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsGUIElementStyle.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Contains native representation of the GUIElementStateStyle structure.
-	 *
-	 */
-	struct ScriptGUIElementStateStyleStruct // Note: Must match C# struct GUIElementStateStyle.
-	{
-		MonoObject* texture;
-		Color textColor;
-	};
-
-	/**
-	 * @brief	Performs conversion between managed GUIElementStateStyle and native GUIElementStyle::GUIElementStateStyle.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElementStateStyle : public ScriptObject<ScriptGUIElementStateStyle>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElementStateStyle")
-
-		/**
-		 * @brief	Creates a new managed instance of GUIElementStateStyle.
-		 *
-		 * @param	state	Native GUI element style state to copy to the managed instance.
-		 */
-		 static ScriptGUIElementStateStyleStruct toManaged(const GUIElementStyle::GUIElementStateStyle& state);
-
-		/**
-		 * @brief	Converts a managed instance of GUIElementStateStyle to a native GUI element style state.
-		 */
-		static GUIElementStyle::GUIElementStateStyle toNative(const ScriptGUIElementStateStyleStruct& instance);
-
-	private:
-		ScriptGUIElementStateStyle(MonoObject* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsGUIElementStyle.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Contains native representation of the GUIElementStateStyle structure. */
+	struct ScriptGUIElementStateStyleStruct // Note: Must match C# struct GUIElementStateStyle.
+	{
+		MonoObject* texture;
+		Color textColor;
+	};
+
+	/**	Performs conversion between managed GUIElementStateStyle and native GUIElementStyle::GUIElementStateStyle. */
+	class BS_SCR_BE_EXPORT ScriptGUIElementStateStyle : public ScriptObject<ScriptGUIElementStateStyle>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElementStateStyle")
+
+		/**
+		 * Creates a new managed instance of GUIElementStateStyle.
+		 *
+		 * @param[in]	state	Native GUI element style state to copy to the managed instance.
+		 */
+		 static ScriptGUIElementStateStyleStruct toManaged(const GUIElementStyle::GUIElementStateStyle& state);
+
+		/**	Converts a managed instance of GUIElementStateStyle to a native GUI element style state. */
+		static GUIElementStyle::GUIElementStateStyle toNative(const ScriptGUIElementStateStyleStruct& instance);
+
+	private:
+		ScriptGUIElementStateStyle(MonoObject* instance);
+	};
+
+	/** @} */
 }

+ 104 - 108
Source/SBansheeEngine/Include/BsScriptGUIElementStyle.h

@@ -1,109 +1,105 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsGUIElementStyle.h"
-#include "BsMonoClass.h"
-#include "BsScriptGUIElementStateStyle.h"
-#include "BsScriptFont.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIElementStyle.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIElementStyle : public ScriptObject<ScriptGUIElementStyle>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElementStyle")
-
-		~ScriptGUIElementStyle();
-
-		/**
-		 * @brief	Returns the wrapped GUIElementStyle instance.
-		 */
-		GUIElementStyle& getInternalValue() { return mElementStyle; }
-
-		/**
-		 * @brief	Creates a new managed object containing a copy of the provided style.
-		 */
-		static MonoObject* create(const GUIElementStyle& style);
-
-	private:
-		/**
-		 * @brief	Creates the interop object with a default style.
-		 */
-		ScriptGUIElementStyle(MonoObject* instance);
-
-		/**
-		 * @brief	Creates the interop object referencing an existing style.
-		 */
-		ScriptGUIElementStyle(MonoObject* instance, const GUIElementStyle& externalStyle);
-
-		GUIElementStyle mElementStyle;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance);
-		static void internal_addSubStyle(ScriptGUIElementStyle* nativeInstance, MonoString* guiType, MonoString* styleName);
-
-		static void internal_GetFont(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
-		static void internal_SetFont(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
-
-		static void internal_GetFontSize(ScriptGUIElementStyle* nativeInstance, UINT32* value);
-		static void internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, UINT32 value);
-		static void internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign*value);
-		static void internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign value);
-		static void internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign* value);
-		static void internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign value);
-		static void internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition* value);
-		static void internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition value);
-		static void internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance, bool* value);
-		static void internal_SetWordWrap(ScriptGUIElementStyle* nativeInstance, bool value);
-
-		static void internal_GetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_GetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_GetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_GetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-
-		static void internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-		static void internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
-
-		static void internal_GetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_GetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-		static void internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
-
-		static void internal_GetWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value);
-		static void internal_SetWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value);
-		static void internal_GetHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value);
-		static void internal_SetHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value);
-		static void internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value);
-		static void internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value);
-		static void internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value);
-		static void internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value);
-		static void internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value);
-		static void internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value);
-		static void internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value);
-		static void internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value);
-		static void internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool* value);
-		static void internal_SetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool value);
-		static void internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool* value);
-		static void internal_SetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool value);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsGUIElementStyle.h"
+#include "BsMonoClass.h"
+#include "BsScriptGUIElementStateStyle.h"
+#include "BsScriptFont.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIElementStyle. */
+	class BS_SCR_BE_EXPORT ScriptGUIElementStyle : public ScriptObject<ScriptGUIElementStyle>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIElementStyle")
+
+		~ScriptGUIElementStyle();
+
+		/**	Returns the wrapped GUIElementStyle instance. */
+		GUIElementStyle& getInternalValue() { return mElementStyle; }
+
+		/**	Creates a new managed object containing a copy of the provided style. */
+		static MonoObject* create(const GUIElementStyle& style);
+
+	private:
+		/**	Creates the interop object with a default style. */
+		ScriptGUIElementStyle(MonoObject* instance);
+
+		/**	Creates the interop object referencing an existing style. */
+		ScriptGUIElementStyle(MonoObject* instance, const GUIElementStyle& externalStyle);
+
+		GUIElementStyle mElementStyle;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance);
+		static void internal_addSubStyle(ScriptGUIElementStyle* nativeInstance, MonoString* guiType, MonoString* styleName);
+
+		static void internal_GetFont(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
+		static void internal_SetFont(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
+
+		static void internal_GetFontSize(ScriptGUIElementStyle* nativeInstance, UINT32* value);
+		static void internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, UINT32 value);
+		static void internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign*value);
+		static void internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign value);
+		static void internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign* value);
+		static void internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign value);
+		static void internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition* value);
+		static void internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition value);
+		static void internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance, bool* value);
+		static void internal_SetWordWrap(ScriptGUIElementStyle* nativeInstance, bool value);
+
+		static void internal_GetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetNormal(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_GetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetHover(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_GetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetActive(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_GetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetFocused(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+
+		static void internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+		static void internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, ScriptGUIElementStateStyleStruct* value);
+
+		static void internal_GetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_GetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+
+		static void internal_GetWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value);
+		static void internal_SetWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value);
+		static void internal_GetHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value);
+		static void internal_SetHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value);
+		static void internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value);
+		static void internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value);
+		static void internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value);
+		static void internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value);
+		static void internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value);
+		static void internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value);
+		static void internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value);
+		static void internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value);
+		static void internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool* value);
+		static void internal_SetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool value);
+		static void internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool* value);
+		static void internal_SetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool value);
+	};
+
+	/** @} */
 }

+ 36 - 34
Source/SBansheeEngine/Include/BsScriptGUIFixedSpace.h

@@ -1,35 +1,37 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIFixedSpace.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIFixedSpace : public TScriptGUIElementBase<ScriptGUIFixedSpace>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIFixedSpace")
-
-	private:
-		ScriptGUIFixedSpace(MonoObject* instance, GUIFixedSpace* fixedSpace);
-
-		/**
-		 * @copydoc	ScriptGUIElementBaseTBase::destroy
-		 */
-		void destroy() override;
-
-		GUIFixedSpace* mFixedSpace;
-		bool mIsDestroyed;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, UINT32 size);
-		static void internal_setSize(ScriptGUIFixedSpace* nativeInstance, UINT32 size);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIFixedSpace. */
+	class BS_SCR_BE_EXPORT ScriptGUIFixedSpace : public TScriptGUIElementBase<ScriptGUIFixedSpace>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIFixedSpace")
+
+	private:
+		ScriptGUIFixedSpace(MonoObject* instance, GUIFixedSpace* fixedSpace);
+
+		/** @copydoc ScriptGUIElementBaseTBase::destroy */
+		void destroy() override;
+
+		GUIFixedSpace* mFixedSpace;
+		bool mIsDestroyed;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, UINT32 size);
+		static void internal_setSize(ScriptGUIFixedSpace* nativeInstance, UINT32 size);
+	};
+
+	/** @} */
 }

+ 35 - 33
Source/SBansheeEngine/Include/BsScriptGUIFlexibleSpace.h

@@ -1,34 +1,36 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIFlexibleSpace.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIFlexibleSpace : public TScriptGUIElementBase<ScriptGUIFlexibleSpace>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIFlexibleSpace")
-
-	private:
-		ScriptGUIFlexibleSpace(MonoObject* instance, GUIFlexibleSpace* flexibleSpace);
-
-		/**
-		 * @copydoc	ScriptGUIElementBaseTBase::destroy
-		 */
-		void destroy() override;
-
-		GUIFlexibleSpace* mFlexibleSpace;
-		bool mIsDestroyed;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIFlexibleSpace. */
+	class BS_SCR_BE_EXPORT ScriptGUIFlexibleSpace : public TScriptGUIElementBase<ScriptGUIFlexibleSpace>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIFlexibleSpace")
+
+	private:
+		ScriptGUIFlexibleSpace(MonoObject* instance, GUIFlexibleSpace* flexibleSpace);
+
+		/** @copydoc ScriptGUIElementBaseTBase::destroy */
+		void destroy() override;
+
+		GUIFlexibleSpace* mFlexibleSpace;
+		bool mIsDestroyed;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance);
+	};
+
+	/** @} */
 }

+ 45 - 45
Source/SBansheeEngine/Include/BsScriptGUIInputBox.h

@@ -1,46 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-#include "BsGUITexture.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIInputBox.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIInputBox : public TScriptGUIElement<ScriptGUIInputBox>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUITextBox")
-
-	private:
-		ScriptGUIInputBox(MonoObject* instance, GUIInputBox* inputBox);
-
-		/**
-		 * @brief	Triggered when the value in the native input box changes.
-		 */
-		static void onChanged(MonoObject* instance, const WString& newValue);
-
-		/**
-		 * @brief	Triggered when the user confirms input in the native input box.
-		 */
-		static void onConfirmed(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, bool multiline, MonoString* style, MonoArray* guiOptions);
-		static void internal_setText(ScriptGUIInputBox* nativeInstance, MonoString* text);
-		static void internal_getText(ScriptGUIInputBox* nativeInstance, MonoString** text);
-		static void internal_setTint(ScriptGUIInputBox* nativeInstance, Color* color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoString*, MonoException**);
-		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
-
-		static OnChangedThunkDef onChangedThunk;
-		static OnConfirmedThunkDef onConfirmedThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+#include "BsGUITexture.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIInputBox. */
+	class BS_SCR_BE_EXPORT ScriptGUIInputBox : public TScriptGUIElement<ScriptGUIInputBox>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUITextBox")
+
+	private:
+		ScriptGUIInputBox(MonoObject* instance, GUIInputBox* inputBox);
+
+		/**	Triggered when the value in the native input box changes. */
+		static void onChanged(MonoObject* instance, const WString& newValue);
+
+		/**	Triggered when the user confirms input in the native input box. */
+		static void onConfirmed(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, bool multiline, MonoString* style, MonoArray* guiOptions);
+		static void internal_setText(ScriptGUIInputBox* nativeInstance, MonoString* text);
+		static void internal_getText(ScriptGUIInputBox* nativeInstance, MonoString** text);
+		static void internal_setTint(ScriptGUIInputBox* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, MonoString*, MonoException**);
+		typedef void(__stdcall *OnConfirmedThunkDef) (MonoObject*, MonoException**);
+
+		static OnChangedThunkDef onChangedThunk;
+		static OnConfirmedThunkDef onConfirmedThunk;
+	};
+
+	/** @} */
 }

+ 31 - 27
Source/SBansheeEngine/Include/BsScriptGUILabel.h

@@ -1,28 +1,32 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUILabel.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUILabel : public TScriptGUIElement<ScriptGUILabel>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUILabel")
-
-	private:
-		ScriptGUILabel(MonoObject* instance, GUILabel* label);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
-		static void internal_setContent(ScriptGUILabel* nativeInstance, MonoObject* content);
-		static void internal_setTint(ScriptGUILabel* nativeInstance, Color* color);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUILabel. */
+	class BS_SCR_BE_EXPORT ScriptGUILabel : public TScriptGUIElement<ScriptGUILabel>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUILabel")
+
+	private:
+		ScriptGUILabel(MonoObject* instance, GUILabel* label);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
+		static void internal_setContent(ScriptGUILabel* nativeInstance, MonoObject* content);
+		static void internal_setTint(ScriptGUILabel* nativeInstance, Color* color);
+	};
+
+	/** @} */
 }

+ 116 - 133
Source/SBansheeEngine/Include/BsScriptGUILayout.h

@@ -1,134 +1,117 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUILayout derived classes.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUILayout : public TScriptGUIElementBase<ScriptGUILayout>
-	{
-	protected:
-		/**
-		 * @brief	Contains information about an interop object that represents
-		 *			a child of the layout.
-		 */
-		struct ChildInfo
-		{
-			ScriptGUIElementBaseTBase* element;
-			uint32_t gcHandle;
-		};
-
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUILayout")
-
-		virtual ~ScriptGUILayout() { }
-
-		/**
-		 * @brief	Returns the internal wrapped GUILayout object.
-		 */
-		GUILayout* getInternalValue() const { return mLayout; }
-
-		/**
-		 * @brief	Registers a new managed child GUI element and inserts it at
-		 *			the end of the layout.
-		 */
-		void addChild(ScriptGUIElementBaseTBase* element);
-
-		/**
-		 * @brief	Registers a new managed child GUI element and inserts it at a specific
-		 *			location in the layout.
-		 */
-		void insertChild(UINT32 index, ScriptGUIElementBaseTBase* element);
-
-		/**
-		 * @brief	Removes a managed GUI element from the layout.
-		 */
-		void removeChild(ScriptGUIElementBaseTBase* element);
-
-		/**
-		 * @copydoc	ScriptGUIElementBaseTBase::destroy
-		 *
-		 * Destroys the layout and all of its managed children.
-		 */
-		void destroy() override;
-	protected:
-		friend class ScriptGUIPanel;
-
-		/**
-		 * @brief	Constructor.
-		 *
-		 * @param	instance	Managed GUILayout instance.
-		 * @param	layout  	Native GUILayout instance.
-		 * @param	ownsNative	Does this object own the native instance. If it does it will destroy the
-		 * 						object when ::destroy() is called, otherwise it is up to the caller to destroy it.
-		 */
-		ScriptGUILayout(MonoObject* instance, GUILayout* layout, bool ownsNative = true);
-
-		GUILayout* mLayout;
-		Vector<ChildInfo> mChildren;
-
-		bool mIsDestroyed;
-		bool mOwnsNative;
-
-	private:
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstanceX(MonoObject* instance, MonoArray* guiOptions);
-		static void internal_createInstanceY(MonoObject* instance, MonoArray* guiOptions);
-		static void internal_createInstancePanel(MonoObject* instance, INT16 depth, UINT16 depthRangeMin, UINT32 depthRangeMax, MonoArray* guiOptions);
-		static void internal_addElement(ScriptGUILayout* instance, ScriptGUIElementBaseTBase* element);
-		static void internal_insertElement(ScriptGUILayout* instance, UINT32 index, ScriptGUIElementBaseTBase* element);
-		static UINT32 internal_getChildCount(ScriptGUILayout* instance);
-		static MonoObject* internal_getChild(ScriptGUILayout* instance, UINT32 index);
-		static void internal_clear(ScriptGUILayout* instance);
-
-		static void internal_createInstanceYFromScrollArea(MonoObject* instance, MonoObject* parentScrollArea);
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIPanel. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIPanel : public ScriptObject<ScriptGUIPanel>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIPanel")
-
-		/**
-		 * @brief	Creates a new managed GUIPanel that wraps the provided native GUIPanel.
-		 */
-		static MonoObject* createFromExisting(GUIPanel* panel);
-	private:
-		ScriptGUIPanel(MonoObject* instance);
-	};
-
-	/**
-	 * @brief	Specialized ScriptGUILayout that is used only in GUI scroll areas.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIScrollAreaLayout : public ScriptGUILayout
-	{
-	public:
-		/**
-		 * @brief	Constructor.
-		 *
-		 * @param	instance	Managed GUILayout instance.
-		 * @param	layout  	Native GUILayout instance.
-		 */
-		ScriptGUIScrollAreaLayout(MonoObject* instance, GUILayout* layout);
-
-		/**
-		 * @copydoc	ScriptGUILayout::destroy
-		 */
-		void destroy() override;
-
-	private:
-		friend class ScriptGUIScrollArea;
-
-		ScriptGUIScrollArea* mParentScrollArea;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUILayout derived classes. */
+	class BS_SCR_BE_EXPORT ScriptGUILayout : public TScriptGUIElementBase<ScriptGUILayout>
+	{
+	protected:
+		/**	Contains information about an interop object that represents a child of the layout. */
+		struct ChildInfo
+		{
+			ScriptGUIElementBaseTBase* element;
+			uint32_t gcHandle;
+		};
+
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUILayout")
+
+		virtual ~ScriptGUILayout() { }
+
+		/**	Returns the internal wrapped GUILayout object. */
+		GUILayout* getInternalValue() const { return mLayout; }
+
+		/**	Registers a new managed child GUI element and inserts it at the end of the layout. */
+		void addChild(ScriptGUIElementBaseTBase* element);
+
+		/**	Registers a new managed child GUI element and inserts it at a specific location in the layout. */
+		void insertChild(UINT32 index, ScriptGUIElementBaseTBase* element);
+
+		/**	Removes a managed GUI element from the layout. */
+		void removeChild(ScriptGUIElementBaseTBase* element);
+
+		/**
+		 * @copydoc	ScriptGUIElementBaseTBase::destroy
+		 *
+		 * Destroys the layout and all of its managed children.
+		 */
+		void destroy() override;
+	protected:
+		friend class ScriptGUIPanel;
+
+		/**
+		 * Constructor.
+		 *
+		 * @param[in]	instance	Managed GUILayout instance.
+		 * @param[in]	layout  	Native GUILayout instance.
+		 * @param[in]	ownsNative	Does this object own the native instance. If it does it will destroy the
+		 * 							object when destroy() is called, otherwise it is up to the caller to destroy it.
+		 */
+		ScriptGUILayout(MonoObject* instance, GUILayout* layout, bool ownsNative = true);
+
+		GUILayout* mLayout;
+		Vector<ChildInfo> mChildren;
+
+		bool mIsDestroyed;
+		bool mOwnsNative;
+
+	private:
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstanceX(MonoObject* instance, MonoArray* guiOptions);
+		static void internal_createInstanceY(MonoObject* instance, MonoArray* guiOptions);
+		static void internal_createInstancePanel(MonoObject* instance, INT16 depth, UINT16 depthRangeMin, UINT32 depthRangeMax, MonoArray* guiOptions);
+		static void internal_addElement(ScriptGUILayout* instance, ScriptGUIElementBaseTBase* element);
+		static void internal_insertElement(ScriptGUILayout* instance, UINT32 index, ScriptGUIElementBaseTBase* element);
+		static UINT32 internal_getChildCount(ScriptGUILayout* instance);
+		static MonoObject* internal_getChild(ScriptGUILayout* instance, UINT32 index);
+		static void internal_clear(ScriptGUILayout* instance);
+
+		static void internal_createInstanceYFromScrollArea(MonoObject* instance, MonoObject* parentScrollArea);
+	};
+
+	/**	Interop class between C++ & CLR for GUIPanel.  */
+	class BS_SCR_BE_EXPORT ScriptGUIPanel : public ScriptObject<ScriptGUIPanel>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIPanel")
+
+		/**	Creates a new managed GUIPanel that wraps the provided native GUIPanel. */
+		static MonoObject* createFromExisting(GUIPanel* panel);
+	private:
+		ScriptGUIPanel(MonoObject* instance);
+	};
+
+	/**	Specialized ScriptGUILayout that is used only in GUI scroll areas. */
+	class BS_SCR_BE_EXPORT ScriptGUIScrollAreaLayout : public ScriptGUILayout
+	{
+	public:
+		/**
+		 * Constructor.
+		 *
+		 * @param[in]	instance	Managed GUILayout instance.
+		 * @param[in]	layout  	Native GUILayout instance.
+		 */
+		ScriptGUIScrollAreaLayout(MonoObject* instance, GUILayout* layout);
+
+		/** @copydoc ScriptGUILayout::destroy */
+		void destroy() override;
+
+	private:
+		friend class ScriptGUIScrollArea;
+
+		ScriptGUIScrollArea* mParentScrollArea;
+	};
+
+	/** @} */
 }

+ 33 - 29
Source/SBansheeEngine/Include/BsScriptGUILayoutUtility.h

@@ -1,30 +1,34 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsScriptGUIElement.h"
-#include "BsVector2I.h"
-#include "BsRect2I.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUILayoutUtility. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUILayoutUtility : public ScriptObject<ScriptGUILayoutUtility>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUILayoutUtility")
-
-		ScriptGUILayoutUtility();
-
-	private:
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CalculateOptimalSize(ScriptGUIElementBaseTBase* guiElement, Vector2I* output);
-		static void internal_CalculateBounds(ScriptGUIElementBaseTBase* guiElement, ScriptGUILayout* relativeTo, Rect2I* output);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsScriptGUIElement.h"
+#include "BsVector2I.h"
+#include "BsRect2I.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUILayoutUtility. */
+	class BS_SCR_BE_EXPORT ScriptGUILayoutUtility : public ScriptObject<ScriptGUILayoutUtility>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUILayoutUtility")
+
+		ScriptGUILayoutUtility();
+
+	private:
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CalculateOptimalSize(ScriptGUIElementBaseTBase* guiElement, Vector2I* output);
+		static void internal_CalculateBounds(ScriptGUIElementBaseTBase* guiElement, ScriptGUILayout* relativeTo, Rect2I* output);
+	};
+
+	/** @} */
 }

+ 42 - 40
Source/SBansheeEngine/Include/BsScriptGUIListBox.h

@@ -1,41 +1,43 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-#include "BsGUITexture.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIListBox. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIListBox : public TScriptGUIElement<ScriptGUIListBox>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIListBox")
-
-	private:
-		ScriptGUIListBox(MonoObject* instance, GUIListBox* listBox);
-
-		/**
-		 * @brief	Triggered when the selected index in the native list box changes.
-		 */
-		static void onSelectionChanged(MonoObject* instance, UINT32 index, bool enabled);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoArray* elements, bool multiselect, MonoString* style, MonoArray* guiOptions);
-		static void internal_setElements(ScriptGUIListBox* nativeInstance, MonoArray* elements);
-		static void internal_setTint(ScriptGUIListBox* nativeInstance, Color* color);
-		static void internal_selectElement(ScriptGUIListBox* nativeInstance, int idx);
-		static void internal_deselectElement(ScriptGUIListBox* nativeInstance, int idx);
-		static MonoArray* internal_getElementStates(ScriptGUIListBox* nativeInstance);
-		static void internal_setElementStates(ScriptGUIListBox* nativeInstance, MonoArray* states);
-
-		typedef void (__stdcall *OnSelectionChangedThunkDef) (MonoObject*, UINT32, MonoException**);
-		static OnSelectionChangedThunkDef onSelectionChangedThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+#include "BsGUITexture.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIListBox.  */
+	class BS_SCR_BE_EXPORT ScriptGUIListBox : public TScriptGUIElement<ScriptGUIListBox>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIListBox")
+
+	private:
+		ScriptGUIListBox(MonoObject* instance, GUIListBox* listBox);
+
+		/**	Triggered when the selected index in the native list box changes. */
+		static void onSelectionChanged(MonoObject* instance, UINT32 index, bool enabled);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoArray* elements, bool multiselect, MonoString* style, MonoArray* guiOptions);
+		static void internal_setElements(ScriptGUIListBox* nativeInstance, MonoArray* elements);
+		static void internal_setTint(ScriptGUIListBox* nativeInstance, Color* color);
+		static void internal_selectElement(ScriptGUIListBox* nativeInstance, int idx);
+		static void internal_deselectElement(ScriptGUIListBox* nativeInstance, int idx);
+		static MonoArray* internal_getElementStates(ScriptGUIListBox* nativeInstance);
+		static void internal_setElementStates(ScriptGUIListBox* nativeInstance, MonoArray* states);
+
+		typedef void (__stdcall *OnSelectionChangedThunkDef) (MonoObject*, UINT32, MonoException**);
+		static OnSelectionChangedThunkDef onSelectionChangedThunk;
+	};
+
+	/** @} */
 }

+ 32 - 28
Source/SBansheeEngine/Include/BsScriptGUIProgressBar.h

@@ -1,29 +1,33 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIProgressBar. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIProgressBar : public TScriptGUIElement <ScriptGUIProgressBar>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIProgressBar")
-
-	private:
-		ScriptGUIProgressBar(MonoObject* instance, GUIProgressBar* progressBar);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
-		static void internal_setPercent(ScriptGUIProgressBar* nativeInstance, float percent);
-		static float internal_getPercent(ScriptGUIProgressBar* nativeInstance);
-		static void internal_setTint(ScriptGUIProgressBar* nativeInstance, Color* color);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIProgressBar.  */
+	class BS_SCR_BE_EXPORT ScriptGUIProgressBar : public TScriptGUIElement <ScriptGUIProgressBar>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIProgressBar")
+
+	private:
+		ScriptGUIProgressBar(MonoObject* instance, GUIProgressBar* progressBar);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
+		static void internal_setPercent(ScriptGUIProgressBar* nativeInstance, float percent);
+		static float internal_getPercent(ScriptGUIProgressBar* nativeInstance);
+		static void internal_setTint(ScriptGUIProgressBar* nativeInstance, Color* color);
+	};
+
+	/** @} */
 }

+ 32 - 28
Source/SBansheeEngine/Include/BsScriptGUIRenderTexture.h

@@ -1,29 +1,33 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIRenderTexture. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIRenderTexture : public TScriptGUIElement < ScriptGUIRenderTexture >
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIRenderTexture")
-
-	private:
-		ScriptGUIRenderTexture(MonoObject* instance, GUIRenderTexture* texture);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, ScriptRenderTexture2D* texture, bool transparent,
-			MonoString* style, MonoArray* guiOptions);
-		static void internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture);
-		static void internal_setTint(ScriptGUIRenderTexture* nativeInstance, Color* color);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIRenderTexture. */
+	class BS_SCR_BE_EXPORT ScriptGUIRenderTexture : public TScriptGUIElement < ScriptGUIRenderTexture >
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIRenderTexture")
+
+	private:
+		ScriptGUIRenderTexture(MonoObject* instance, GUIRenderTexture* texture);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, ScriptRenderTexture2D* texture, bool transparent,
+			MonoString* style, MonoArray* guiOptions);
+		static void internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture);
+		static void internal_setTint(ScriptGUIRenderTexture* nativeInstance, Color* color);
+	};
+
+	/** @} */
 }

+ 55 - 54
Source/SBansheeEngine/Include/BsScriptGUIScrollArea.h

@@ -1,55 +1,56 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-#include "BsGUIScrollArea.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIScrollArea. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIScrollArea : public TScriptGUIElement<ScriptGUIScrollArea>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIScrollArea")
-
-		/**
-		 * @brief	Initializes the interop object by providing it with the interop object for
-		 * 			the internal layout held by the scroll area.
-		 */
-		 void initialize(ScriptGUIScrollAreaLayout* layout);
-
-	private:
-		friend class ScriptGUIScrollAreaLayout;
-
-		ScriptGUIScrollArea(MonoObject* instance, GUIScrollArea* scrollArea);
-
-		/**
-		 * @copydoc	TScriptGUIElement::destroy
-		 */
-		void destroy() override;
-
-		/**
-		 * @brief	Called when the child script GUI layout gets destroyed. Notifies this object that it shouldn't
-		 * 			use it anymore.
-		 */
-		void notifyLayoutDestroyed();
-
-		ScriptGUIScrollAreaLayout* mLayout;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, ScrollBarType vertBarType, ScrollBarType horzBarType, 
-			MonoString* scrollBarStyle, MonoString* scrollAreaStyle, MonoArray* guiOptions);
-		static void internal_getContentBounds(ScriptGUIScrollArea* nativeInstance, Rect2I* bounds);
-		static float internal_getHorzScroll(ScriptGUIScrollArea* nativeInstance);
-		static void internal_setHorzScroll(ScriptGUIScrollArea* nativeInstance, float value);
-		static float internal_getVertScroll(ScriptGUIScrollArea* nativeInstance);
-		static void internal_setVertScroll(ScriptGUIScrollArea* nativeInstance, float value);
-		static int internal_getScrollBarWidth(ScriptGUIScrollArea* nativeInstance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+#include "BsGUIScrollArea.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIScrollArea.  */
+	class BS_SCR_BE_EXPORT ScriptGUIScrollArea : public TScriptGUIElement<ScriptGUIScrollArea>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIScrollArea")
+
+		/**
+		 * Initializes the interop object by providing it with the interop object for the internal layout held by the
+		 * scroll area.
+		 */
+		 void initialize(ScriptGUIScrollAreaLayout* layout);
+
+	private:
+		friend class ScriptGUIScrollAreaLayout;
+
+		ScriptGUIScrollArea(MonoObject* instance, GUIScrollArea* scrollArea);
+
+		/** @copydoc TScriptGUIElement::destroy */
+		void destroy() override;
+
+		/**
+		 * Called when the child script GUI layout gets destroyed. Notifies this object that it shouldn't use it anymore.
+		 */
+		void notifyLayoutDestroyed();
+
+		ScriptGUIScrollAreaLayout* mLayout;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, ScrollBarType vertBarType, ScrollBarType horzBarType, 
+			MonoString* scrollBarStyle, MonoString* scrollAreaStyle, MonoArray* guiOptions);
+		static void internal_getContentBounds(ScriptGUIScrollArea* nativeInstance, Rect2I* bounds);
+		static float internal_getHorzScroll(ScriptGUIScrollArea* nativeInstance);
+		static void internal_setHorzScroll(ScriptGUIScrollArea* nativeInstance, float value);
+		static float internal_getVertScroll(ScriptGUIScrollArea* nativeInstance);
+		static void internal_setVertScroll(ScriptGUIScrollArea* nativeInstance, float value);
+		static int internal_getScrollBarWidth(ScriptGUIScrollArea* nativeInstance);
+	};
+
+	/** @} */
 }

+ 42 - 42
Source/SBansheeEngine/Include/BsScriptGUISkin.h

@@ -1,43 +1,43 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptResource.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUISkin.
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUISkin : public TScriptResource<ScriptGUISkin, GUISkin>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISkin")
-
-	private:
-		friend class ScriptResourceManager;
-
-		ScriptGUISkin(MonoObject* instance, const HGUISkin& skin);
-
-		/**
-		 * @copydoc	ScriptObjectBase::_createManagedInstance
-		 */
-		MonoObject* _createManagedInstance(bool construct) override;
-
-		/**
-		 * @brief	Creates an empty, uninitialized managed instance of the resource interop object.
-		 */
-		static MonoObject* createInstance();
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static bool internal_HasStyle(ScriptGUISkin* thisPtr, MonoString* name);
-		static MonoObject* internal_GetStyle(ScriptGUISkin* thisPtr, MonoString* name);
-		static void internal_SetStyle(ScriptGUISkin* thisPtr, MonoString* name, ScriptGUIElementStyle* style);
-		static void internal_RemoveStyle(ScriptGUISkin* thisPtr, MonoString* name);
-		static MonoArray* internal_GetStyleNames(ScriptGUISkin* thisPtr);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptResource.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUISkin. */
+	class BS_SCR_BE_EXPORT ScriptGUISkin : public TScriptResource<ScriptGUISkin, GUISkin>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISkin")
+
+	private:
+		friend class ScriptResourceManager;
+
+		ScriptGUISkin(MonoObject* instance, const HGUISkin& skin);
+
+		/** @copydoc ScriptObjectBase::_createManagedInstance */
+		MonoObject* _createManagedInstance(bool construct) override;
+
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static bool internal_HasStyle(ScriptGUISkin* thisPtr, MonoString* name);
+		static MonoObject* internal_GetStyle(ScriptGUISkin* thisPtr, MonoString* name);
+		static void internal_SetStyle(ScriptGUISkin* thisPtr, MonoString* name, ScriptGUIElementStyle* style);
+		static void internal_RemoveStyle(ScriptGUISkin* thisPtr, MonoString* name);
+		static MonoArray* internal_GetStyleNames(ScriptGUISkin* thisPtr);
+	};
+
+	/** @} */
 }

+ 70 - 72
Source/SBansheeEngine/Include/BsScriptGUISlider.h

@@ -1,73 +1,71 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUISliderH. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUISliderH : public TScriptGUIElement<ScriptGUISliderH>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderH")
-
-	private:
-		ScriptGUISliderH(MonoObject* instance, GUISliderHorz* slider);
-
-		/**
-		 * @brief	Triggered when the native slider is moved.
-		 */
-		static void onChanged(MonoObject* instance, float percent);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
-		static void internal_setPercent(ScriptGUISliderH* nativeInstance, float percent);
-		static float internal_getPercent(ScriptGUISliderH* nativeInstance);
-		static float internal_getValue(ScriptGUISliderH* nativeInstance);
-		static void internal_setValue(ScriptGUISliderH* nativeInstance, float percent);
-		static void internal_setRange(ScriptGUISliderH* nativeInstance, float min, float max);
-		static void internal_setStep(ScriptGUISliderH* nativeInstance, float step);
-		static void internal_setTint(ScriptGUISliderH* nativeInstance, Color* color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
-		static OnChangedThunkDef onChangedThunk;
-	};
-
-	/**
-	 * @brief	Interop class between C++ & CLR for GUISliderV. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUISliderV : public TScriptGUIElement<ScriptGUISliderV>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderV")
-
-	private:
-		ScriptGUISliderV(MonoObject* instance, GUISliderVert* slider);
-
-		/**
-		 * @brief	Triggered when the native slider is moved.
-		 */
-		static void onChanged(MonoObject* instance, float percent);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
-		static void internal_setPercent(ScriptGUISliderV* nativeInstance, float percent);
-		static float internal_getPercent(ScriptGUISliderV* nativeInstance);
-		static float internal_getValue(ScriptGUISliderV* nativeInstance);
-		static void internal_setValue(ScriptGUISliderV* nativeInstance, float percent);
-		static void internal_setRange(ScriptGUISliderV* nativeInstance, float min, float max);
-		static void internal_setStep(ScriptGUISliderV* nativeInstance, float step);
-		static void internal_setTint(ScriptGUISliderV* nativeInstance, Color* color);
-
-		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
-		static OnChangedThunkDef onChangedThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUISliderH.  */
+	class BS_SCR_BE_EXPORT ScriptGUISliderH : public TScriptGUIElement<ScriptGUISliderH>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderH")
+
+	private:
+		ScriptGUISliderH(MonoObject* instance, GUISliderHorz* slider);
+
+		/**	Triggered when the native slider is moved. */
+		static void onChanged(MonoObject* instance, float percent);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
+		static void internal_setPercent(ScriptGUISliderH* nativeInstance, float percent);
+		static float internal_getPercent(ScriptGUISliderH* nativeInstance);
+		static float internal_getValue(ScriptGUISliderH* nativeInstance);
+		static void internal_setValue(ScriptGUISliderH* nativeInstance, float percent);
+		static void internal_setRange(ScriptGUISliderH* nativeInstance, float min, float max);
+		static void internal_setStep(ScriptGUISliderH* nativeInstance, float step);
+		static void internal_setTint(ScriptGUISliderH* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
+		static OnChangedThunkDef onChangedThunk;
+	};
+
+	/**	Interop class between C++ & CLR for GUISliderV. */
+	class BS_SCR_BE_EXPORT ScriptGUISliderV : public TScriptGUIElement<ScriptGUISliderV>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISliderV")
+
+	private:
+		ScriptGUISliderV(MonoObject* instance, GUISliderVert* slider);
+
+		/**	Triggered when the native slider is moved. */
+		static void onChanged(MonoObject* instance, float percent);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions);
+		static void internal_setPercent(ScriptGUISliderV* nativeInstance, float percent);
+		static float internal_getPercent(ScriptGUISliderV* nativeInstance);
+		static float internal_getValue(ScriptGUISliderV* nativeInstance);
+		static void internal_setValue(ScriptGUISliderV* nativeInstance, float percent);
+		static void internal_setRange(ScriptGUISliderV* nativeInstance, float min, float max);
+		static void internal_setStep(ScriptGUISliderV* nativeInstance, float step);
+		static void internal_setTint(ScriptGUISliderV* nativeInstance, Color* color);
+
+		typedef void(__stdcall *OnChangedThunkDef) (MonoObject*, float, MonoException**);
+		static OnChangedThunkDef onChangedThunk;
+	};
+
+	/** @} */
 }

+ 33 - 29
Source/SBansheeEngine/Include/BsScriptGUITexture.h

@@ -1,30 +1,34 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-#include "BsGUITexture.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUITexture. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUITexture : public TScriptGUIElement<ScriptGUITexture>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUITexture")
-
-	private:
-		ScriptGUITexture(MonoObject* instance, GUITexture* texture);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* texture, 
-			GUIImageScaleMode scale, bool transparent, MonoString* style, MonoArray* guiOptions);
-		static void internal_setTexture(ScriptGUITexture* nativeInstance, MonoObject* texture);
-		static void internal_setTint(ScriptGUITexture* nativeInstance, Color* color);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+#include "BsGUITexture.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUITexture. */
+	class BS_SCR_BE_EXPORT ScriptGUITexture : public TScriptGUIElement<ScriptGUITexture>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUITexture")
+
+	private:
+		ScriptGUITexture(MonoObject* instance, GUITexture* texture);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* texture, 
+			GUIImageScaleMode scale, bool transparent, MonoString* style, MonoArray* guiOptions);
+		static void internal_setTexture(ScriptGUITexture* nativeInstance, MonoObject* texture);
+		static void internal_setTint(ScriptGUITexture* nativeInstance, Color* color);
+	};
+
+	/** @} */
 }

+ 61 - 67
Source/SBansheeEngine/Include/BsScriptGUIToggle.h

@@ -1,68 +1,62 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptGUIElement.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIToggle. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIToggle : public TScriptGUIElement<ScriptGUIToggle>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIToggle")
-
-	private:
-		ScriptGUIToggle(MonoObject* instance, GUIToggle* toggle);
-
-		/**
-		 * @brief	Triggered when the native toggle button is clicked.
-		 */
-		static void onClick(MonoObject* instance);
-
-		/**
-		 * @brief	Triggered when the native toggle button is hover over.
-		 */
-		static void onHover(MonoObject* instance);
-
-		/**
-		 * @brief	Triggered when the pointer leaves the native toggle button.
-		 */
-		static void onOut(MonoObject* instance);
-
-		/**
-		 * @brief	Triggered when the native toggle button is toggled.
-		 */
-		static void onToggled(MonoObject* instance, bool toggled);
-
-		/**
-		 * @brief	Triggers when the native toggle button is double-clicked.
-		 */
-		static void onDoubleClick(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, MonoObject* content,
-			MonoObject* toggleGroup, MonoString* style, MonoArray* guiOptions);
-		static void internal_setContent(ScriptGUIToggle* nativeInstance, MonoObject* content);
-		static bool internal_getValue(ScriptGUIToggle* nativeInstance);
-		static void internal_setValue(ScriptGUIToggle* nativeInstance, bool value);
-		static void internal_setTint(ScriptGUIToggle* nativeInstance, Color* color);
-
-		typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
-		typedef void (__stdcall *OnHoverThunkDef) (MonoObject*, MonoException**);
-		typedef void (__stdcall *OnOutThunkDef) (MonoObject*, MonoException**);
-		typedef void (__stdcall *OnToggledThunkDef) (MonoObject*, bool toggled, MonoException**);
-		typedef void(__stdcall *OnDoubleClickThunkDef) (MonoObject*, MonoException**);
-
-		static OnClickThunkDef onClickThunk;
-		static OnHoverThunkDef onHoverThunk;
-		static OnOutThunkDef onOutThunk;
-		static OnToggledThunkDef onToggledThunk;
-		static OnDoubleClickThunkDef onDoubleClickThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptGUIElement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIToggle.  */
+	class BS_SCR_BE_EXPORT ScriptGUIToggle : public TScriptGUIElement<ScriptGUIToggle>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIToggle")
+
+	private:
+		ScriptGUIToggle(MonoObject* instance, GUIToggle* toggle);
+
+		/**	Triggered when the native toggle button is clicked. */
+		static void onClick(MonoObject* instance);
+
+		/**	Triggered when the native toggle button is hover over. */
+		static void onHover(MonoObject* instance);
+
+		/**	Triggered when the pointer leaves the native toggle button. */
+		static void onOut(MonoObject* instance);
+
+		/**	Triggered when the native toggle button is toggled. */
+		static void onToggled(MonoObject* instance, bool toggled);
+
+		/**	Triggers when the native toggle button is double-clicked. */
+		static void onDoubleClick(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, MonoObject* content,
+			MonoObject* toggleGroup, MonoString* style, MonoArray* guiOptions);
+		static void internal_setContent(ScriptGUIToggle* nativeInstance, MonoObject* content);
+		static bool internal_getValue(ScriptGUIToggle* nativeInstance);
+		static void internal_setValue(ScriptGUIToggle* nativeInstance, bool value);
+		static void internal_setTint(ScriptGUIToggle* nativeInstance, Color* color);
+
+		typedef void (__stdcall *OnClickThunkDef) (MonoObject*, MonoException**);
+		typedef void (__stdcall *OnHoverThunkDef) (MonoObject*, MonoException**);
+		typedef void (__stdcall *OnOutThunkDef) (MonoObject*, MonoException**);
+		typedef void (__stdcall *OnToggledThunkDef) (MonoObject*, bool toggled, MonoException**);
+		typedef void(__stdcall *OnDoubleClickThunkDef) (MonoObject*, MonoException**);
+
+		static OnClickThunkDef onClickThunk;
+		static OnHoverThunkDef onHoverThunk;
+		static OnOutThunkDef onOutThunk;
+		static OnToggledThunkDef onToggledThunk;
+		static OnDoubleClickThunkDef onDoubleClickThunk;
+	};
+
+	/** @} */
 }

+ 34 - 32
Source/SBansheeEngine/Include/BsScriptGUIToggleGroup.h

@@ -1,33 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Interop class between C++ & CLR for GUIToggleGroup. 
-	 */
-	class BS_SCR_BE_EXPORT ScriptGUIToggleGroup : public ScriptObject<ScriptGUIToggleGroup>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIToggleGroup")
-
-		/**
-		 * @brief	Returns the native toggle group that this object wraps.
-		 */
-		std::shared_ptr<GUIToggleGroup> getInternalValue() const { return mToggleGroup; }
-
-	private:
-		ScriptGUIToggleGroup(MonoObject* instance, const std::shared_ptr<GUIToggleGroup>& toggleGroup);
-
-		std::shared_ptr<GUIToggleGroup> mToggleGroup;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_createInstance(MonoObject* instance, bool allowAllOff);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIToggleGroup. */
+	class BS_SCR_BE_EXPORT ScriptGUIToggleGroup : public ScriptObject<ScriptGUIToggleGroup>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUIToggleGroup")
+
+		/**	Returns the native toggle group that this object wraps. */
+		std::shared_ptr<GUIToggleGroup> getInternalValue() const { return mToggleGroup; }
+
+	private:
+		ScriptGUIToggleGroup(MonoObject* instance, const std::shared_ptr<GUIToggleGroup>& toggleGroup);
+
+		std::shared_ptr<GUIToggleGroup> mToggleGroup;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_createInstance(MonoObject* instance, bool allowAllOff);
+	};
+
+	/** @} */
 }

+ 52 - 46
Source/SBansheeEngine/Include/BsScriptGUIWidget.h

@@ -1,47 +1,53 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-
-namespace BansheeEngine
-{
-	/**	Interop class between C++ & CLR for GUIWidget. */
-	class BS_SCR_BE_EXPORT ScriptGUIWidget : public ScriptObject <ScriptGUIWidget>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeGUIWidget")
-
-		/**	Gets the wrapped native GUIWidget object. */
-		SPtr<GUIWidget> getInternal() const { return mGUIWidget; }
-
-	private:
-		ScriptGUIWidget(MonoObject* managedInstance);
-		~ScriptGUIWidget();
-
-		/**	Destroys the internal GUI widget handler object. */
-		void destroy();
-
-		/** @copydoc ScriptObject::_onManagedInstanceDeleted */
-		void _onManagedInstanceDeleted() override;
-
-		SPtr<GUIWidget> mGUIWidget;
-		ScriptGUILayout* mPanel;
-		UINT32 mLastUpdateHash;
-
-		static MonoField* sGUIPanelField;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_Create(MonoObject* instance);
-		static void internal_UpdateTransform(ScriptGUIWidget* instance, ScriptSceneObject* parentSO);
-		static void internal_UpdateMainCamera(ScriptGUIWidget* instance, ScriptCamera* camera);
-		static void internal_SetSkin(ScriptGUIWidget* instance, ScriptGUISkin* skin);
-		static void internal_SetCamera(ScriptGUIWidget* instance, ScriptCamera* camera);
-		static void internal_SetDepth(ScriptGUIWidget* instance, INT8 value);
-		static INT8 internal_GetDepth(ScriptGUIWidget* instance);
-		static void internal_Destroy(ScriptGUIWidget* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for GUIWidget. */
+	class BS_SCR_BE_EXPORT ScriptGUIWidget : public ScriptObject <ScriptGUIWidget>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeGUIWidget")
+
+		/**	Gets the wrapped native GUIWidget object. */
+		SPtr<GUIWidget> getInternal() const { return mGUIWidget; }
+
+	private:
+		ScriptGUIWidget(MonoObject* managedInstance);
+		~ScriptGUIWidget();
+
+		/**	Destroys the internal GUI widget handler object. */
+		void destroy();
+
+		/** @copydoc ScriptObject::_onManagedInstanceDeleted */
+		void _onManagedInstanceDeleted() override;
+
+		SPtr<GUIWidget> mGUIWidget;
+		ScriptGUILayout* mPanel;
+		UINT32 mLastUpdateHash;
+
+		static MonoField* sGUIPanelField;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_Create(MonoObject* instance);
+		static void internal_UpdateTransform(ScriptGUIWidget* instance, ScriptSceneObject* parentSO);
+		static void internal_UpdateMainCamera(ScriptGUIWidget* instance, ScriptCamera* camera);
+		static void internal_SetSkin(ScriptGUIWidget* instance, ScriptGUISkin* skin);
+		static void internal_SetCamera(ScriptGUIWidget* instance, ScriptCamera* camera);
+		static void internal_SetDepth(ScriptGUIWidget* instance, INT8 value);
+		static INT8 internal_GetDepth(ScriptGUIWidget* instance);
+		static void internal_Destroy(ScriptGUIWidget* instance);
+	};
+
+	/** @} */
 }

+ 83 - 77
Source/SBansheeEngine/Include/BsScriptJoint.h

@@ -1,78 +1,84 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsJoint.h"
-
-namespace BansheeEngine
-{
-	class ScriptJoint;
-
-	/** Base class for all Joint interop objects. */
-	class BS_SCR_BE_EXPORT ScriptJointBase : public ScriptObjectBase
-	{
-	public:
-		/** Returns the native Joint object. */
-		virtual Joint* getJoint() const { return mJoint.get(); };
-	protected:
-		friend ScriptJoint;
-
-		ScriptJointBase(MonoObject* instance);
-		virtual ~ScriptJointBase() {}
-
-		/** Initializes the interop object with a native joint. Must be called right after construction. */
-		void initialize(const SPtr<Joint>& joint);
-
-		/** Destroys the internal joint object. */
-		void destroyJoint();
-
-		SPtr<Joint> mJoint;
-	};
-
-	/** A more specialized version of ScriptObject that allows the constructor to set the native joint. */
-	template <class Type>
-	class TScriptJoint : public ScriptObject<Type, ScriptJointBase>
-	{
-	public:
-		virtual ~TScriptJoint() {}
-
-	protected:
-		TScriptJoint(MonoObject* instance, const SPtr<Joint>& joint)
-			:ScriptObject(instance)
-		{
-			initialize(joint);
-		}
-	};
-
-	/** Interop class between C++ & CLR for Joint. */
-	class BS_SCR_BE_EXPORT ScriptJoint : public TScriptJoint<ScriptJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeJoint")
-
-	private:
-		friend class ScriptJointBase;
-
-		ScriptJoint(MonoObject* instance);
-
-		/** Triggered the joint breaks. */
-		static void onJointBreak(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_Destroy(ScriptJointBase* thisPtr);
-		static void internal_SetBody(ScriptJointBase* thisPtr, JointBody body, ScriptRigidbody* value);
-		static void internal_SetPosition(ScriptJointBase* thisPtr, JointBody body, Vector3* position);
-		static void internal_SetRotation(ScriptJointBase* thisPtr, JointBody body, Quaternion* rotation);
-		static void internal_SetBreakForce(ScriptJointBase* thisPtr, float force);
-		static void internal_SetBreakTorque(ScriptJointBase* thisPtr, float torque);
-		static void internal_SetEnableCollision(ScriptJointBase* thisPtr, bool value);
-
-		typedef void(__stdcall *OnJointBreakThunkDef) (MonoObject*, MonoException**);
-
-		static OnJointBreakThunkDef onJointBreakThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsJoint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	class ScriptJoint;
+
+	/** Base class for all Joint interop objects. */
+	class BS_SCR_BE_EXPORT ScriptJointBase : public ScriptObjectBase
+	{
+	public:
+		/** Returns the native Joint object. */
+		virtual Joint* getJoint() const { return mJoint.get(); };
+	protected:
+		friend ScriptJoint;
+
+		ScriptJointBase(MonoObject* instance);
+		virtual ~ScriptJointBase() {}
+
+		/** Initializes the interop object with a native joint. Must be called right after construction. */
+		void initialize(const SPtr<Joint>& joint);
+
+		/** Destroys the internal joint object. */
+		void destroyJoint();
+
+		SPtr<Joint> mJoint;
+	};
+
+	/** A more specialized version of ScriptObject that allows the constructor to set the native joint. */
+	template <class Type>
+	class TScriptJoint : public ScriptObject<Type, ScriptJointBase>
+	{
+	public:
+		virtual ~TScriptJoint() {}
+
+	protected:
+		TScriptJoint(MonoObject* instance, const SPtr<Joint>& joint)
+			:ScriptObject(instance)
+		{
+			initialize(joint);
+		}
+	};
+
+	/** Interop class between C++ & CLR for Joint. */
+	class BS_SCR_BE_EXPORT ScriptJoint : public TScriptJoint<ScriptJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeJoint")
+
+	private:
+		friend class ScriptJointBase;
+
+		ScriptJoint(MonoObject* instance);
+
+		/** Triggered the joint breaks. */
+		static void onJointBreak(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_Destroy(ScriptJointBase* thisPtr);
+		static void internal_SetBody(ScriptJointBase* thisPtr, JointBody body, ScriptRigidbody* value);
+		static void internal_SetPosition(ScriptJointBase* thisPtr, JointBody body, Vector3* position);
+		static void internal_SetRotation(ScriptJointBase* thisPtr, JointBody body, Quaternion* rotation);
+		static void internal_SetBreakForce(ScriptJointBase* thisPtr, float force);
+		static void internal_SetBreakTorque(ScriptJointBase* thisPtr, float torque);
+		static void internal_SetEnableCollision(ScriptJointBase* thisPtr, bool value);
+
+		typedef void(__stdcall *OnJointBreakThunkDef) (MonoObject*, MonoException**);
+
+		static OnJointBreakThunkDef onJointBreakThunk;
+	};
+
+	/** @} */
 }

+ 137 - 131
Source/SBansheeEngine/Include/BsScriptJointCommon.h

@@ -1,132 +1,138 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsJoint.h"
-#include "BsD6Joint.h"
-#include "BsHingeJoint.h"
-
-namespace BansheeEngine
-{
-	/** Helper class for dealing with D6Joint::Drive structure. */
-	class BS_SCR_BE_EXPORT ScriptD6JointDrive : public ScriptObject<ScriptD6JointDrive>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "D6JointDrive")
-
-		/** Converts managed limit to its native counterpart. */
-		static D6Joint::Drive convert(MonoObject* object);
-
-	private:
-		ScriptD6JointDrive(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, D6Joint::Drive*, MonoException**);
-
-		static GetNativeDataThunkDef getNativeDataThunk;
-	};
-
-	/** Helper class for dealing with HingeJoint::Drive structure. */
-	class BS_SCR_BE_EXPORT ScriptHingeJointDrive : public ScriptObject<ScriptHingeJointDrive>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "HingeJointDrive")
-
-		/** Converts managed limit to its native counterpart. */
-		static HingeJoint::Drive convert(MonoObject* object);
-
-	private:
-		ScriptHingeJointDrive(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, HingeJoint::Drive*, MonoException**);
-
-		static GetNativeDataThunkDef getNativeDataThunk;
-	};
-
-	/** Helper class for dealing with LimitLinearRange structure. */
-	class BS_SCR_BE_EXPORT ScriptLimitLinearRange : public ScriptObject<ScriptLimitLinearRange>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitLinearRange")
-
-		/** Converts managed limit to its native counterpart. */
-		static LimitLinearRange convert(MonoObject* object);
-
-	private:
-		ScriptLimitLinearRange(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitLinearRange*, MonoException**);
-
-		static GetNativeDataThunkDef getNativeDataThunk;
-	};
-
-	/** Helper class for dealing with LimitLinear structure. */
-	class BS_SCR_BE_EXPORT ScriptLimitLinear : public ScriptObject<ScriptLimitLinear>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitLinear")
-
-		/** Converts managed limit to its native counterpart. */
-		static LimitLinear convert(MonoObject* object);
-
-	private:
-		ScriptLimitLinear(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitLinear*, MonoException**);
-
-		static GetNativeDataThunkDef getNativeDataThunk;
-	};
-
-	/** Helper class for dealing with LimitAngularRange structure. */
-	class BS_SCR_BE_EXPORT ScriptLimitAngularRange : public ScriptObject<ScriptLimitAngularRange>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitAngularRange")
-
-		/** Converts managed limit to its native counterpart. */
-		static LimitAngularRange convert(MonoObject* object);
-
-	private:
-		ScriptLimitAngularRange(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitAngularRange*, MonoException**);
-
-		static GetNativeDataThunkDef getNativeDataThunk;
-	};
-
-	/** Helper class for dealing with LimitConeRange structure. */
-	class BS_SCR_BE_EXPORT ScriptLimitConeRange : public ScriptObject<ScriptLimitConeRange>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitConeRange")
-
-		/** Converts managed limit to its native counterpart. */
-		static LimitConeRange convert(MonoObject* object);
-
-	private:
-		ScriptLimitConeRange(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitConeRange*, MonoException**);
-
-		static GetNativeDataThunkDef getNativeDataThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsJoint.h"
+#include "BsD6Joint.h"
+#include "BsHingeJoint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Helper class for dealing with D6Joint::Drive structure. */
+	class BS_SCR_BE_EXPORT ScriptD6JointDrive : public ScriptObject<ScriptD6JointDrive>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "D6JointDrive")
+
+		/** Converts managed limit to its native counterpart. */
+		static D6Joint::Drive convert(MonoObject* object);
+
+	private:
+		ScriptD6JointDrive(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, D6Joint::Drive*, MonoException**);
+
+		static GetNativeDataThunkDef getNativeDataThunk;
+	};
+
+	/** Helper class for dealing with HingeJoint::Drive structure. */
+	class BS_SCR_BE_EXPORT ScriptHingeJointDrive : public ScriptObject<ScriptHingeJointDrive>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "HingeJointDrive")
+
+		/** Converts managed limit to its native counterpart. */
+		static HingeJoint::Drive convert(MonoObject* object);
+
+	private:
+		ScriptHingeJointDrive(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, HingeJoint::Drive*, MonoException**);
+
+		static GetNativeDataThunkDef getNativeDataThunk;
+	};
+
+	/** Helper class for dealing with LimitLinearRange structure. */
+	class BS_SCR_BE_EXPORT ScriptLimitLinearRange : public ScriptObject<ScriptLimitLinearRange>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitLinearRange")
+
+		/** Converts managed limit to its native counterpart. */
+		static LimitLinearRange convert(MonoObject* object);
+
+	private:
+		ScriptLimitLinearRange(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitLinearRange*, MonoException**);
+
+		static GetNativeDataThunkDef getNativeDataThunk;
+	};
+
+	/** Helper class for dealing with LimitLinear structure. */
+	class BS_SCR_BE_EXPORT ScriptLimitLinear : public ScriptObject<ScriptLimitLinear>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitLinear")
+
+		/** Converts managed limit to its native counterpart. */
+		static LimitLinear convert(MonoObject* object);
+
+	private:
+		ScriptLimitLinear(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitLinear*, MonoException**);
+
+		static GetNativeDataThunkDef getNativeDataThunk;
+	};
+
+	/** Helper class for dealing with LimitAngularRange structure. */
+	class BS_SCR_BE_EXPORT ScriptLimitAngularRange : public ScriptObject<ScriptLimitAngularRange>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitAngularRange")
+
+		/** Converts managed limit to its native counterpart. */
+		static LimitAngularRange convert(MonoObject* object);
+
+	private:
+		ScriptLimitAngularRange(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitAngularRange*, MonoException**);
+
+		static GetNativeDataThunkDef getNativeDataThunk;
+	};
+
+	/** Helper class for dealing with LimitConeRange structure. */
+	class BS_SCR_BE_EXPORT ScriptLimitConeRange : public ScriptObject<ScriptLimitConeRange>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "LimitConeRange")
+
+		/** Converts managed limit to its native counterpart. */
+		static LimitConeRange convert(MonoObject* object);
+
+	private:
+		ScriptLimitConeRange(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		typedef void(__stdcall *GetNativeDataThunkDef) (MonoObject*, LimitConeRange*, MonoException**);
+
+		static GetNativeDataThunkDef getNativeDataThunk;
+	};
+
+	/** @} */
 }

+ 34 - 28
Source/SBansheeEngine/Include/BsScriptMeshCollider.h

@@ -1,29 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for MeshCollider. */
-	class BS_SCR_BE_EXPORT ScriptMeshCollider : public TScriptCollider<ScriptMeshCollider>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeMeshCollider")
-
-	private:
-		ScriptMeshCollider(MonoObject* instance, const SPtr<Collider>& collider);
-
-		/** Returns the native mesh collider wrapped by this object. */
-		MeshCollider* getMeshCollider() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static void internal_SetMesh(ScriptMeshCollider* thisPtr, ScriptPhysicsMesh* mesh);
-		static MonoObject* internal_GetMesh(ScriptMeshCollider* thisPtr);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for MeshCollider. */
+	class BS_SCR_BE_EXPORT ScriptMeshCollider : public TScriptCollider<ScriptMeshCollider>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeMeshCollider")
+
+	private:
+		ScriptMeshCollider(MonoObject* instance, const SPtr<Collider>& collider);
+
+		/** Returns the native mesh collider wrapped by this object. */
+		MeshCollider* getMeshCollider() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static void internal_SetMesh(ScriptMeshCollider* thisPtr, ScriptPhysicsMesh* mesh);
+		static MonoObject* internal_GetMesh(ScriptMeshCollider* thisPtr);
+	};
+
+	/** @} */
 }

+ 68 - 62
Source/SBansheeEngine/Include/BsScriptPhysics.h

@@ -1,63 +1,69 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsScriptPhysicsQueryHit.h"
-
-namespace BansheeEngine
-{
-	/**	Interop class between C++ & CLR for Physics. */
-	class BS_SCR_BE_EXPORT ScriptPhysics : public ScriptObject<ScriptPhysics>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Physics")
-
-	private:
-		ScriptPhysics(MonoObject* instance);
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_GetGravity(Vector3* gravity);
-		static void internal_SetGravity(Vector3* gravity);
-
-		static int internal_AddPhysicsRegion(AABox* region);
-		static void internal_RemovePhysicsRegion(int handle);
-		static void internal_ClearPhysicsRegions();
-
-		static void internal_ToggleCollision(UINT64 layerA, UINT64 layerB, bool enabled);
-		static bool internal_IsCollisionEnabled(UINT64 layerA, UINT64 layerB);
-
-		static bool internal_IsUpdateInProgress();
-
-		static bool internal_RayCast(Vector3* origin, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
-		static bool internal_BoxCast(AABox* box, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
-		static bool internal_SphereCast(Sphere* sphere, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
-		static bool internal_CapsuleCast(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
-		static bool internal_ConvexCast(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
-
-		static MonoArray* internal_RayCastAll(Vector3* origin, Vector3* unitDir, UINT64 layer, float max);
-		static MonoArray* internal_BoxCastAll(AABox* box, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
-		static MonoArray* internal_SphereCastAll(Sphere* sphere, Vector3* unitDir, UINT64 layer, float max);
-		static MonoArray* internal_CapsuleCastAll(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
-		static MonoArray* internal_ConvexCastAll(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
-
-		static bool internal_RayCastAny(Vector3* origin, Vector3* unitDir, UINT64 layer, float max);
-		static bool internal_BoxCastAny(AABox* box, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
-		static bool internal_SphereCastAny(Sphere* sphere, Vector3* unitDir, UINT64 layer, float max);
-		static bool internal_CapsuleCastAny(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
-		static bool internal_ConvexCastAny(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
-
-		static MonoArray* internal_BoxOverlap(AABox* box, Quaternion* rotation, UINT64 layer);
-		static MonoArray* internal_SphereOverlap(Sphere* sphere, UINT64 layer);
-		static MonoArray* internal_CapsuleOverlap(Capsule* capsule, Quaternion* rotation, UINT64 layer);
-		static MonoArray* internal_ConvexOverlap(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, UINT64 layer);
-
-		static bool internal_BoxOverlapAny(AABox* box, Quaternion* rotation, UINT64 layer);
-		static bool internal_SphereOverlapAny(Sphere* sphere, UINT64 layer);
-		static bool internal_CapsuleOverlapAny(Capsule* capsule, Quaternion* rotation, UINT64 layer);
-		static bool internal_ConvexOverlapAny(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, UINT64 layer);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsScriptPhysicsQueryHit.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/**	Interop class between C++ & CLR for Physics. */
+	class BS_SCR_BE_EXPORT ScriptPhysics : public ScriptObject<ScriptPhysics>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Physics")
+
+	private:
+		ScriptPhysics(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_GetGravity(Vector3* gravity);
+		static void internal_SetGravity(Vector3* gravity);
+
+		static int internal_AddPhysicsRegion(AABox* region);
+		static void internal_RemovePhysicsRegion(int handle);
+		static void internal_ClearPhysicsRegions();
+
+		static void internal_ToggleCollision(UINT64 layerA, UINT64 layerB, bool enabled);
+		static bool internal_IsCollisionEnabled(UINT64 layerA, UINT64 layerB);
+
+		static bool internal_IsUpdateInProgress();
+
+		static bool internal_RayCast(Vector3* origin, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
+		static bool internal_BoxCast(AABox* box, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
+		static bool internal_SphereCast(Sphere* sphere, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
+		static bool internal_CapsuleCast(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
+		static bool internal_ConvexCast(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, ScriptPhysicsQueryHit* hit, UINT64 layer, float max);
+
+		static MonoArray* internal_RayCastAll(Vector3* origin, Vector3* unitDir, UINT64 layer, float max);
+		static MonoArray* internal_BoxCastAll(AABox* box, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
+		static MonoArray* internal_SphereCastAll(Sphere* sphere, Vector3* unitDir, UINT64 layer, float max);
+		static MonoArray* internal_CapsuleCastAll(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
+		static MonoArray* internal_ConvexCastAll(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
+
+		static bool internal_RayCastAny(Vector3* origin, Vector3* unitDir, UINT64 layer, float max);
+		static bool internal_BoxCastAny(AABox* box, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
+		static bool internal_SphereCastAny(Sphere* sphere, Vector3* unitDir, UINT64 layer, float max);
+		static bool internal_CapsuleCastAny(Capsule* capsule, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
+		static bool internal_ConvexCastAny(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, Vector3* unitDir, UINT64 layer, float max);
+
+		static MonoArray* internal_BoxOverlap(AABox* box, Quaternion* rotation, UINT64 layer);
+		static MonoArray* internal_SphereOverlap(Sphere* sphere, UINT64 layer);
+		static MonoArray* internal_CapsuleOverlap(Capsule* capsule, Quaternion* rotation, UINT64 layer);
+		static MonoArray* internal_ConvexOverlap(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, UINT64 layer);
+
+		static bool internal_BoxOverlapAny(AABox* box, Quaternion* rotation, UINT64 layer);
+		static bool internal_SphereOverlapAny(Sphere* sphere, UINT64 layer);
+		static bool internal_CapsuleOverlapAny(Capsule* capsule, Quaternion* rotation, UINT64 layer);
+		static bool internal_ConvexOverlapAny(ScriptPhysicsMesh* mesh, Vector3* position, Quaternion* rotation, UINT64 layer);
+	};
+
+	/** @} */
 }

+ 45 - 39
Source/SBansheeEngine/Include/BsScriptPhysicsQueryHit.h

@@ -1,40 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsPhysicsCommon.h"
-
-namespace BansheeEngine
-{
-	/** Interop struct between C++ & CLR for PhysicsQueryHit. */
-	struct ScriptPhysicsQueryHit // Must match C# ScriptPhysicsQueryHit struct layout
-	{
-		Vector3 point;
-		Vector3 normal;
-		Vector2 uv;
-		float distance;
-		UINT32 triangleIdx;
-		MonoObject* collider;
-	};
-
-	/** Helper class for dealing with PhysicsQueryHit structure. */
-	class BS_SCR_BE_EXPORT ScriptPhysicsQueryHitHelper : public ScriptObject<ScriptPhysicsQueryHitHelper>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptPhysicsQueryHit")
-
-		/** Converts native physics query hit to its managed counterpart. */
-		static ScriptPhysicsQueryHit create(const PhysicsQueryHit& data);
-
-		/** Unboxes a boxed managed ScriptPhysicsQueryHit struct and returns the native version of the structure. */
-		static ScriptPhysicsQueryHit unbox(MonoObject* obj);
-
-		/** Boxes a native ScriptPhysicsQueryHit struct and returns a managed object containing it. */
-		static MonoObject* box(const ScriptPhysicsQueryHit& value);
-
-	private:
-		ScriptPhysicsQueryHitHelper(MonoObject* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsPhysicsCommon.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop struct between C++ & CLR for PhysicsQueryHit. */
+	struct ScriptPhysicsQueryHit // Must match C# ScriptPhysicsQueryHit struct layout
+	{
+		Vector3 point;
+		Vector3 normal;
+		Vector2 uv;
+		float distance;
+		UINT32 triangleIdx;
+		MonoObject* collider;
+	};
+
+	/** Helper class for dealing with PhysicsQueryHit structure. */
+	class BS_SCR_BE_EXPORT ScriptPhysicsQueryHitHelper : public ScriptObject<ScriptPhysicsQueryHitHelper>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptPhysicsQueryHit")
+
+		/** Converts native physics query hit to its managed counterpart. */
+		static ScriptPhysicsQueryHit create(const PhysicsQueryHit& data);
+
+		/** Unboxes a boxed managed ScriptPhysicsQueryHit struct and returns the native version of the structure. */
+		static ScriptPhysicsQueryHit unbox(MonoObject* obj);
+
+		/** Boxes a native ScriptPhysicsQueryHit struct and returns a managed object containing it. */
+		static MonoObject* box(const ScriptPhysicsQueryHit& value);
+
+	private:
+		ScriptPhysicsQueryHitHelper(MonoObject* instance);
+	};
+
+	/** @} */
 }

+ 32 - 26
Source/SBansheeEngine/Include/BsScriptPlaneCollider.h

@@ -1,27 +1,33 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for PlaneCollider. */
-	class BS_SCR_BE_EXPORT ScriptPlaneCollider : public TScriptCollider<ScriptPlaneCollider>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativePlaneCollider")
-
-	private:
-		ScriptPlaneCollider(MonoObject* instance, const SPtr<Collider>& collider);
-
-		/** Returns the native plane collider wrapped by this object. */
-		PlaneCollider* getPlaneCollider() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for PlaneCollider. */
+	class BS_SCR_BE_EXPORT ScriptPlaneCollider : public TScriptCollider<ScriptPlaneCollider>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativePlaneCollider")
+
+	private:
+		ScriptPlaneCollider(MonoObject* instance, const SPtr<Collider>& collider);
+
+		/** Returns the native plane collider wrapped by this object. */
+		PlaneCollider* getPlaneCollider() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+	};
+
+	/** @} */
 }

+ 122 - 116
Source/SBansheeEngine/Include/BsScriptRigidbody.h

@@ -1,117 +1,123 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptObject.h"
-#include "BsRigidbody.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for Rigidbody. */
-	class BS_SCR_BE_EXPORT ScriptRigidbody : public ScriptObject<ScriptRigidbody>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeRigidbody")
-
-		/** Returns the native Rigidbody object. */
-		Rigidbody* getRigidbody() const { return mRigidbody.get(); }
-
-	private:
-		friend class ScriptColliderBase;
-
-		ScriptRigidbody(MonoObject* instance, const SPtr<Rigidbody>& body);
-
-		/** Triggered when some object starts interacting with the rigidbody. */
-		static void onCollisionBegin(MonoObject* instance, const CollisionData& collisionData);
-
-		/** Triggered when some object remains interacting with the rigidbody throughout a frame. */
-		static void onCollisionStay(MonoObject* instance, const CollisionData& collisionData);
-
-		/** Triggered when some object ends interacting with the rigidbody. */
-		static void onCollisionEnd(MonoObject* instance, const CollisionData& collisionData);
-
-		SPtr<Rigidbody> mRigidbody;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance, ScriptSceneObject* linkedSO);
-		static void internal_Destroy(ScriptRigidbody* thisPtr);
-
-		static void internal_Move(ScriptRigidbody* thisPtr, Vector3* position);
-		static void internal_Rotate(ScriptRigidbody* thisPtr, Quaternion* rotation);
-
-		static void internal_GetPosition(ScriptRigidbody* thisPtr, Vector3* position);
-		static void internal_GetRotation(ScriptRigidbody* thisPtr, Quaternion* rotation);
-		static void internal_SetTransform(ScriptRigidbody* thisPtr, Vector3* pos, Quaternion* rot);
-
-		static void internal_SetMass(ScriptRigidbody* thisPtr, float mass);
-		static float internal_GetMass(ScriptRigidbody* thisPtr);
-
-		static void internal_SetIsKinematic(ScriptRigidbody* thisPtr, bool kinematic);
-		static bool internal_GetIsKinematic(ScriptRigidbody* thisPtr);
-
-		static bool internal_IsSleeping(ScriptRigidbody* thisPtr);
-		static void internal_Sleep(ScriptRigidbody* thisPtr);
-		static void internal_WakeUp(ScriptRigidbody* thisPtr);
-
-		static void internal_SetSleepThreshold(ScriptRigidbody* thisPtr, float threshold);
-		static float internal_GetSleepThreshold(ScriptRigidbody* thisPtr);
-
-		static void internal_SetUseGravity(ScriptRigidbody* thisPtr, bool gravity);
-		static bool internal_GetUseGravity(ScriptRigidbody* thisPtr);
-
-		static void internal_SetVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
-		static void internal_GetVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
-
-		static void internal_SetAngularVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
-		static void internal_GetAngularVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
-
-		static void internal_SetDrag(ScriptRigidbody* thisPtr, float drag);
-		static float internal_GetDrag(ScriptRigidbody* thisPtr);
-
-		static void internal_SetAngularDrag(ScriptRigidbody* thisPtr, float drag);
-		static float internal_GetAngularDrag(ScriptRigidbody* thisPtr);
-
-		static void internal_SetInertiaTensor(ScriptRigidbody* thisPtr, Vector3* tensor);
-		static void internal_GetInertiaTensor(ScriptRigidbody* thisPtr, Vector3* tensor);
-
-		static void internal_SetMaxAngularVelocity(ScriptRigidbody* thisPtr, float maxVelocity);
-		static float internal_GetMaxAngularVelocity(ScriptRigidbody* thisPtr);
-
-		static void internal_SetCenterOfMass(ScriptRigidbody* thisPtr, Vector3* position, Quaternion* rotation);
-		static void internal_GetCenterOfMassPosition(ScriptRigidbody* thisPtr, Vector3* position);
-		static void internal_GetCenterOfMassRotation(ScriptRigidbody* thisPtr, Quaternion* rotation);
-
-		static void internal_SetPositionSolverCount(ScriptRigidbody* thisPtr, UINT32 count);
-		static UINT32 internal_GetPositionSolverCount(ScriptRigidbody* thisPtr);
-
-		static void internal_SetVelocitySolverCount(ScriptRigidbody* thisPtr, UINT32 count);
-		static UINT32 internal_GetVelocitySolverCount(ScriptRigidbody* thisPtr);
-
-		static void internal_SetInterpolationMode(ScriptRigidbody* thisPtr, Rigidbody::InterpolationMode value);
-		static Rigidbody::InterpolationMode internal_GetInterpolationMode(ScriptRigidbody* thisPtr);
-
-		static void internal_SetFlags(ScriptRigidbody* thisPtr, Rigidbody::Flag flags);
-		static Rigidbody::Flag internal_GetFlags(ScriptRigidbody* thisPtr);
-
-		static void internal_AddForce(ScriptRigidbody* thisPtr, Vector3* force, ForceMode mode);
-		static void internal_AddTorque(ScriptRigidbody* thisPtr, Vector3* torque, ForceMode mode);
-		static void internal_AddForceAtPoint(ScriptRigidbody* thisPtr, Vector3* force, Vector3* position, PointForceMode mode);
-
-		static void internal_GetVelocityAtPoint(ScriptRigidbody* thisPtr, Vector3* point, Vector3* velocity);
-
-		static void internal_AddCollider(ScriptRigidbody* thisPtr, ScriptColliderBase* collider);
-		static void internal_RemoveCollider(ScriptRigidbody* thisPtr, ScriptColliderBase* collider);
-		static void internal_RemoveColliders(ScriptRigidbody* thisPtr);
-
-		static void internal_UpdateMassDistribution(ScriptRigidbody* thisPtr);
-
-		typedef void(__stdcall *OnCollisionThunkDef) (MonoObject*, MonoObject*, MonoException**);
-
-		static OnCollisionThunkDef onCollisionBeginThunk;
-		static OnCollisionThunkDef onCollisionStayThunk;
-		static OnCollisionThunkDef onCollisionEndThunk;
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptObject.h"
+#include "BsRigidbody.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for Rigidbody. */
+	class BS_SCR_BE_EXPORT ScriptRigidbody : public ScriptObject<ScriptRigidbody>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeRigidbody")
+
+		/** Returns the native Rigidbody object. */
+		Rigidbody* getRigidbody() const { return mRigidbody.get(); }
+
+	private:
+		friend class ScriptColliderBase;
+
+		ScriptRigidbody(MonoObject* instance, const SPtr<Rigidbody>& body);
+
+		/** Triggered when some object starts interacting with the rigidbody. */
+		static void onCollisionBegin(MonoObject* instance, const CollisionData& collisionData);
+
+		/** Triggered when some object remains interacting with the rigidbody throughout a frame. */
+		static void onCollisionStay(MonoObject* instance, const CollisionData& collisionData);
+
+		/** Triggered when some object ends interacting with the rigidbody. */
+		static void onCollisionEnd(MonoObject* instance, const CollisionData& collisionData);
+
+		SPtr<Rigidbody> mRigidbody;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptSceneObject* linkedSO);
+		static void internal_Destroy(ScriptRigidbody* thisPtr);
+
+		static void internal_Move(ScriptRigidbody* thisPtr, Vector3* position);
+		static void internal_Rotate(ScriptRigidbody* thisPtr, Quaternion* rotation);
+
+		static void internal_GetPosition(ScriptRigidbody* thisPtr, Vector3* position);
+		static void internal_GetRotation(ScriptRigidbody* thisPtr, Quaternion* rotation);
+		static void internal_SetTransform(ScriptRigidbody* thisPtr, Vector3* pos, Quaternion* rot);
+
+		static void internal_SetMass(ScriptRigidbody* thisPtr, float mass);
+		static float internal_GetMass(ScriptRigidbody* thisPtr);
+
+		static void internal_SetIsKinematic(ScriptRigidbody* thisPtr, bool kinematic);
+		static bool internal_GetIsKinematic(ScriptRigidbody* thisPtr);
+
+		static bool internal_IsSleeping(ScriptRigidbody* thisPtr);
+		static void internal_Sleep(ScriptRigidbody* thisPtr);
+		static void internal_WakeUp(ScriptRigidbody* thisPtr);
+
+		static void internal_SetSleepThreshold(ScriptRigidbody* thisPtr, float threshold);
+		static float internal_GetSleepThreshold(ScriptRigidbody* thisPtr);
+
+		static void internal_SetUseGravity(ScriptRigidbody* thisPtr, bool gravity);
+		static bool internal_GetUseGravity(ScriptRigidbody* thisPtr);
+
+		static void internal_SetVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
+		static void internal_GetVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
+
+		static void internal_SetAngularVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
+		static void internal_GetAngularVelocity(ScriptRigidbody* thisPtr, Vector3* velocity);
+
+		static void internal_SetDrag(ScriptRigidbody* thisPtr, float drag);
+		static float internal_GetDrag(ScriptRigidbody* thisPtr);
+
+		static void internal_SetAngularDrag(ScriptRigidbody* thisPtr, float drag);
+		static float internal_GetAngularDrag(ScriptRigidbody* thisPtr);
+
+		static void internal_SetInertiaTensor(ScriptRigidbody* thisPtr, Vector3* tensor);
+		static void internal_GetInertiaTensor(ScriptRigidbody* thisPtr, Vector3* tensor);
+
+		static void internal_SetMaxAngularVelocity(ScriptRigidbody* thisPtr, float maxVelocity);
+		static float internal_GetMaxAngularVelocity(ScriptRigidbody* thisPtr);
+
+		static void internal_SetCenterOfMass(ScriptRigidbody* thisPtr, Vector3* position, Quaternion* rotation);
+		static void internal_GetCenterOfMassPosition(ScriptRigidbody* thisPtr, Vector3* position);
+		static void internal_GetCenterOfMassRotation(ScriptRigidbody* thisPtr, Quaternion* rotation);
+
+		static void internal_SetPositionSolverCount(ScriptRigidbody* thisPtr, UINT32 count);
+		static UINT32 internal_GetPositionSolverCount(ScriptRigidbody* thisPtr);
+
+		static void internal_SetVelocitySolverCount(ScriptRigidbody* thisPtr, UINT32 count);
+		static UINT32 internal_GetVelocitySolverCount(ScriptRigidbody* thisPtr);
+
+		static void internal_SetInterpolationMode(ScriptRigidbody* thisPtr, Rigidbody::InterpolationMode value);
+		static Rigidbody::InterpolationMode internal_GetInterpolationMode(ScriptRigidbody* thisPtr);
+
+		static void internal_SetFlags(ScriptRigidbody* thisPtr, Rigidbody::Flag flags);
+		static Rigidbody::Flag internal_GetFlags(ScriptRigidbody* thisPtr);
+
+		static void internal_AddForce(ScriptRigidbody* thisPtr, Vector3* force, ForceMode mode);
+		static void internal_AddTorque(ScriptRigidbody* thisPtr, Vector3* torque, ForceMode mode);
+		static void internal_AddForceAtPoint(ScriptRigidbody* thisPtr, Vector3* force, Vector3* position, PointForceMode mode);
+
+		static void internal_GetVelocityAtPoint(ScriptRigidbody* thisPtr, Vector3* point, Vector3* velocity);
+
+		static void internal_AddCollider(ScriptRigidbody* thisPtr, ScriptColliderBase* collider);
+		static void internal_RemoveCollider(ScriptRigidbody* thisPtr, ScriptColliderBase* collider);
+		static void internal_RemoveColliders(ScriptRigidbody* thisPtr);
+
+		static void internal_UpdateMassDistribution(ScriptRigidbody* thisPtr);
+
+		typedef void(__stdcall *OnCollisionThunkDef) (MonoObject*, MonoObject*, MonoException**);
+
+		static OnCollisionThunkDef onCollisionBeginThunk;
+		static OnCollisionThunkDef onCollisionStayThunk;
+		static OnCollisionThunkDef onCollisionEndThunk;
+	};
+
+	/** @} */
 }

+ 34 - 28
Source/SBansheeEngine/Include/BsScriptSphereCollider.h

@@ -1,29 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for SphereCollider. */
-	class BS_SCR_BE_EXPORT ScriptSphereCollider : public TScriptCollider<ScriptSphereCollider>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSphereCollider")
-
-	private:
-		ScriptSphereCollider(MonoObject* instance, const SPtr<Collider>& collider);
-
-		/** Returns the native sphere collider wrapped by this object. */
-		SphereCollider* getSphereCollider() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static void internal_SetRadius(ScriptSphereCollider* thisPtr, float radius);
-		static float internal_GetRadius(ScriptSphereCollider* thisPtr);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for SphereCollider. */
+	class BS_SCR_BE_EXPORT ScriptSphereCollider : public TScriptCollider<ScriptSphereCollider>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSphereCollider")
+
+	private:
+		ScriptSphereCollider(MonoObject* instance, const SPtr<Collider>& collider);
+
+		/** Returns the native sphere collider wrapped by this object. */
+		SphereCollider* getSphereCollider() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static void internal_SetRadius(ScriptSphereCollider* thisPtr, float radius);
+		static float internal_GetRadius(ScriptSphereCollider* thisPtr);
+	};
+
+	/** @} */
 }

+ 45 - 39
Source/SBansheeEngine/Source/BsScriptD6Joint.h

@@ -1,40 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-#include "BsD6Joint.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for D6Joint. */
-	class BS_SCR_BE_EXPORT ScriptD6Joint : public TScriptJoint<ScriptD6Joint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeD6Joint")
-	private:
-		ScriptD6Joint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native D6 joint wrapped by this object. */
-		D6Joint* getD6Joint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static void internal_SetMotion(ScriptD6Joint* thisPtr, D6Joint::Axis axis, D6Joint::Motion motion);
-		static float internal_GetTwist(ScriptD6Joint* thisPtr);
-		static float internal_GetSwingY(ScriptD6Joint* thisPtr);
-		static float internal_GetSwingZ(ScriptD6Joint* thisPtr);
-		static void internal_SetLimitLinear(ScriptD6Joint* thisPtr, MonoObject* limit);
-		static void internal_SetLimitTwist(ScriptD6Joint* thisPtr, MonoObject* limit);
-		static void internal_SetLimitSwing(ScriptD6Joint* thisPtr, MonoObject* limit);
-		static void internal_SetDrive(ScriptD6Joint* thisPtr, D6Joint::DriveType type, MonoObject* drive);
-		static void internal_SetDrivePosition(ScriptD6Joint* thisPtr, Vector3* position);
-		static void internal_SetDriveRotation(ScriptD6Joint* thisPtr, Quaternion* rotation);
-		static void internal_SetDriveLinearVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
-		static void internal_SetDriveAngularVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+#include "BsD6Joint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for D6Joint. */
+	class BS_SCR_BE_EXPORT ScriptD6Joint : public TScriptJoint<ScriptD6Joint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeD6Joint")
+	private:
+		ScriptD6Joint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native D6 joint wrapped by this object. */
+		D6Joint* getD6Joint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static void internal_SetMotion(ScriptD6Joint* thisPtr, D6Joint::Axis axis, D6Joint::Motion motion);
+		static float internal_GetTwist(ScriptD6Joint* thisPtr);
+		static float internal_GetSwingY(ScriptD6Joint* thisPtr);
+		static float internal_GetSwingZ(ScriptD6Joint* thisPtr);
+		static void internal_SetLimitLinear(ScriptD6Joint* thisPtr, MonoObject* limit);
+		static void internal_SetLimitTwist(ScriptD6Joint* thisPtr, MonoObject* limit);
+		static void internal_SetLimitSwing(ScriptD6Joint* thisPtr, MonoObject* limit);
+		static void internal_SetDrive(ScriptD6Joint* thisPtr, D6Joint::DriveType type, MonoObject* drive);
+		static void internal_SetDrivePosition(ScriptD6Joint* thisPtr, Vector3* position);
+		static void internal_SetDriveRotation(ScriptD6Joint* thisPtr, Quaternion* rotation);
+		static void internal_SetDriveLinearVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
+		static void internal_SetDriveAngularVelocity(ScriptD6Joint* thisPtr, Vector3* velocity);
+	};
+
+	/** @} */
 }

+ 32 - 26
Source/SBansheeEngine/Source/BsScriptFixedJoint.h

@@ -1,27 +1,33 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for FixedJoint. */
-	class BS_SCR_BE_EXPORT ScriptFixedJoint : public TScriptJoint<ScriptFixedJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeFixedJoint")
-	private:
-		ScriptFixedJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native fixed joint wrapped by this object. */
-		FixedJoint* getFixedJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for FixedJoint. */
+	class BS_SCR_BE_EXPORT ScriptFixedJoint : public TScriptJoint<ScriptFixedJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeFixedJoint")
+	private:
+		ScriptFixedJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native fixed joint wrapped by this object. */
+		FixedJoint* getFixedJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+	};
+
+	/** @} */
 }

+ 38 - 32
Source/SBansheeEngine/Source/BsScriptHingeJoint.h

@@ -1,33 +1,39 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for HingeJoint. */
-	class BS_SCR_BE_EXPORT ScriptHingeJoint : public TScriptJoint<ScriptHingeJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeHingeJoint")
-	private:
-		ScriptHingeJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native hinge joint wrapped by this object. */
-		HingeJoint* getHingeJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static float internal_GetAngle(ScriptHingeJoint* thisPtr);
-		static float internal_GetSpeed(ScriptHingeJoint* thisPtr);
-		static void internal_SetLimit(ScriptHingeJoint* thisPtr, MonoObject* limit);
-		static void internal_SetDrive(ScriptHingeJoint* thisPtr, MonoObject* drive);
-		static void internal_SetEnableLimit(ScriptHingeJoint* thisPtr, bool value);
-		static void internal_SetEnableDrive(ScriptHingeJoint* thisPtr, bool value);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for HingeJoint. */
+	class BS_SCR_BE_EXPORT ScriptHingeJoint : public TScriptJoint<ScriptHingeJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeHingeJoint")
+	private:
+		ScriptHingeJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native hinge joint wrapped by this object. */
+		HingeJoint* getHingeJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static float internal_GetAngle(ScriptHingeJoint* thisPtr);
+		static float internal_GetSpeed(ScriptHingeJoint* thisPtr);
+		static void internal_SetLimit(ScriptHingeJoint* thisPtr, MonoObject* limit);
+		static void internal_SetDrive(ScriptHingeJoint* thisPtr, MonoObject* drive);
+		static void internal_SetEnableLimit(ScriptHingeJoint* thisPtr, bool value);
+		static void internal_SetEnableDrive(ScriptHingeJoint* thisPtr, bool value);
+	};
+
+	/** @} */
 }

+ 36 - 30
Source/SBansheeEngine/Source/BsScriptSliderJoint.h

@@ -1,31 +1,37 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for SliderJoint. */
-	class BS_SCR_BE_EXPORT ScriptSliderJoint : public TScriptJoint<ScriptSliderJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSliderJoint")
-	private:
-		ScriptSliderJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native slider joint wrapped by this object. */
-		SliderJoint* getSliderJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static float internal_GetPosition(ScriptSliderJoint* thisPtr);
-		static float internal_GetSpeed(ScriptSliderJoint* thisPtr);
-		static void internal_SetLimit(ScriptSliderJoint* thisPtr, MonoObject* limit);
-		static void internal_SetEnableLimit(ScriptSliderJoint* thisPtr, bool enable);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for SliderJoint. */
+	class BS_SCR_BE_EXPORT ScriptSliderJoint : public TScriptJoint<ScriptSliderJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSliderJoint")
+	private:
+		ScriptSliderJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native slider joint wrapped by this object. */
+		SliderJoint* getSliderJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static float internal_GetPosition(ScriptSliderJoint* thisPtr);
+		static float internal_GetSpeed(ScriptSliderJoint* thisPtr);
+		static void internal_SetLimit(ScriptSliderJoint* thisPtr, MonoObject* limit);
+		static void internal_SetEnableLimit(ScriptSliderJoint* thisPtr, bool enable);
+	};
+
+	/** @} */
 }

+ 34 - 28
Source/SBansheeEngine/Source/BsScriptSphericalJoint.h

@@ -1,29 +1,35 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsScriptEnginePrerequisites.h"
-#include "BsScriptCollider.h"
-#include "BsScriptJoint.h"
-
-namespace BansheeEngine
-{
-	/** Interop class between C++ & CLR for SphericalJoint. */
-	class BS_SCR_BE_EXPORT ScriptSphericalJoint : public TScriptJoint<ScriptSphericalJoint>
-	{
-	public:
-		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSphericalJoint")
-	private:
-		ScriptSphericalJoint(MonoObject* instance, const SPtr<Joint>& joint);
-
-		/** Returns the native spherical joint wrapped by this object. */
-		SphericalJoint* getSphericalJoint() const;
-
-		/************************************************************************/
-		/* 								CLR HOOKS						   		*/
-		/************************************************************************/
-		static void internal_CreateInstance(MonoObject* instance);
-		static void internal_SetLimit(ScriptSphericalJoint* thisPtr, MonoObject* limit);
-		static void internal_SetEnableLimit(ScriptSphericalJoint* thisPtr, bool enable);
-	};
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsScriptEnginePrerequisites.h"
+#include "BsScriptCollider.h"
+#include "BsScriptJoint.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup ScriptInteropEngine
+	 *  @{
+	 */
+
+	/** Interop class between C++ & CLR for SphericalJoint. */
+	class BS_SCR_BE_EXPORT ScriptSphericalJoint : public TScriptJoint<ScriptSphericalJoint>
+	{
+	public:
+		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "NativeSphericalJoint")
+	private:
+		ScriptSphericalJoint(MonoObject* instance, const SPtr<Joint>& joint);
+
+		/** Returns the native spherical joint wrapped by this object. */
+		SphericalJoint* getSphericalJoint() const;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance);
+		static void internal_SetLimit(ScriptSphericalJoint* thisPtr, MonoObject* limit);
+		static void internal_SetEnableLimit(ScriptSphericalJoint* thisPtr, bool enable);
+	};
+
+	/** @} */
 }