Ver código fonte

Updated serialization/deserialization so it accepts a set of global parameters provided to all serialization/deserialization callbacks

BearishSun 9 anos atrás
pai
commit
f0f6b7ad8a
48 arquivos alterados com 158 adições e 119 exclusões
  1. 1 1
      Source/BansheeCore/Include/BsAudioClipRTTI.h
  2. 1 1
      Source/BansheeCore/Include/BsBlendStateRTTI.h
  3. 1 1
      Source/BansheeCore/Include/BsComponentRTTI.h
  4. 1 1
      Source/BansheeCore/Include/BsDepthStencilStateRTTI.h
  5. 2 2
      Source/BansheeCore/Include/BsFontRTTI.h
  6. 1 1
      Source/BansheeCore/Include/BsGameObjectHandleRTTI.h
  7. 1 1
      Source/BansheeCore/Include/BsGpuProgramRTTI.h
  8. 5 5
      Source/BansheeCore/Include/BsMaterialParamsRTTI.h
  9. 1 1
      Source/BansheeCore/Include/BsMaterialRTTI.h
  10. 1 1
      Source/BansheeCore/Include/BsMeshRTTI.h
  11. 1 1
      Source/BansheeCore/Include/BsPassRTTI.h
  12. 2 2
      Source/BansheeCore/Include/BsPhysicsMaterialRTTI.h
  13. 1 1
      Source/BansheeCore/Include/BsPhysicsMeshRTTI.h
  14. 2 2
      Source/BansheeCore/Include/BsPrefabDiffRTTI.h
  15. 1 1
      Source/BansheeCore/Include/BsPrefabRTTI.h
  16. 1 1
      Source/BansheeCore/Include/BsRasterizerStateRTTI.h
  17. 2 2
      Source/BansheeCore/Include/BsResourceHandleRTTI.h
  18. 1 1
      Source/BansheeCore/Include/BsSamplerStateRTTI.h
  19. 2 2
      Source/BansheeCore/Include/BsSceneObjectRTTI.h
  20. 2 2
      Source/BansheeCore/Include/BsShaderImportOptionsRTTI.h
  21. 1 1
      Source/BansheeCore/Include/BsShaderRTTI.h
  22. 1 1
      Source/BansheeCore/Include/BsStringTableRTTI.h
  23. 1 1
      Source/BansheeCore/Include/BsTechniqueRTTI.h
  24. 2 2
      Source/BansheeCore/Include/BsTextureRTTI.h
  25. 1 1
      Source/BansheeCore/Include/BsViewportRTTI.h
  26. 3 3
      Source/BansheeCore/Source/BsMaterialRTTI.cpp
  27. 4 2
      Source/BansheeCore/Source/BsUtility.cpp
  28. 1 1
      Source/BansheeEditor/Include/BsDockManagerLayoutRTTI.h
  29. 5 5
      Source/BansheeEditor/Include/BsSettings.h
  30. 1 1
      Source/BansheeEngine/Include/BsCameraRTTI.h
  31. 2 2
      Source/BansheeEngine/Include/BsGUISkinRTTI.h
  32. 1 1
      Source/BansheeEngine/Include/BsLightRTTI.h
  33. 1 1
      Source/BansheeEngine/Include/BsRenderableRTTI.h
  34. 13 13
      Source/BansheePhysX/Include/BsPhysXMeshRTTI.h
  35. 9 2
      Source/BansheeUtility/Include/BsBinarySerializer.h
  36. 11 3
      Source/BansheeUtility/Include/BsFileSerializer.h
  37. 11 3
      Source/BansheeUtility/Include/BsMemorySerializer.h
  38. 4 4
      Source/BansheeUtility/Include/BsRTTIType.h
  39. 4 4
      Source/BansheeUtility/Include/BsSerializedObjectRTTI.h
  40. 10 6
      Source/BansheeUtility/Source/BsBinaryCloner.cpp
  41. 8 4
      Source/BansheeUtility/Source/BsBinaryDiff.cpp
  42. 17 12
      Source/BansheeUtility/Source/BsBinarySerializer.cpp
  43. 5 4
      Source/BansheeUtility/Source/BsFileSerializer.cpp
  44. 4 4
      Source/BansheeUtility/Source/BsMemorySerializer.cpp
  45. 2 2
      Source/SBansheeEngine/Include/BsManagedComponentRTTI.h
  46. 2 2
      Source/SBansheeEngine/Include/BsManagedResourceRTTI.h
  47. 2 2
      Source/SBansheeEngine/Include/BsManagedSerializableDictionaryRTTI.h
  48. 2 2
      Source/SBansheeEngine/Include/BsManagedSerializableObjectRTTI.h

+ 1 - 1
Source/BansheeCore/Include/BsAudioClipRTTI.h

@@ -53,7 +53,7 @@ namespace BansheeEngine
 			addDataBlockField("mData", 6, &AudioClipRTTI::getData, &AudioClipRTTI::setData, 0);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			AudioClip* clip = static_cast<AudioClip*>(obj);
 			clip->initialize();

+ 1 - 1
Source/BansheeCore/Include/BsBlendStateRTTI.h

@@ -67,7 +67,7 @@ namespace BansheeEngine
 			addPlainField("mData", 0, &BlendStateRTTI::getData, &BlendStateRTTI::setData);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			BlendState* blendState = static_cast<BlendState*>(obj);
 			blendState->initialize();

+ 1 - 1
Source/BansheeCore/Include/BsComponentRTTI.h

@@ -20,7 +20,7 @@ namespace BansheeEngine
 		ComponentRTTI()
 		{ }
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Component* comp = static_cast<Component*>(obj);
 			GODeserializationData& deserializationData = any_cast_ref<GODeserializationData>(comp->mRTTIData);

+ 1 - 1
Source/BansheeCore/Include/BsDepthStencilStateRTTI.h

@@ -26,7 +26,7 @@ namespace BansheeEngine
 			addPlainField("mData", 0, &DepthStencilStateRTTI::getData, &DepthStencilStateRTTI::setData);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			DepthStencilState* depthStencilState = static_cast<DepthStencilState*>(obj);
 			depthStencilState->initialize();

+ 2 - 2
Source/BansheeCore/Include/BsFontRTTI.h

@@ -118,7 +118,7 @@ namespace BansheeEngine
 		}
 
 	protected:
-		void onDeserializationStarted(IReflectable* obj) override
+		void onDeserializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			FontInitData* initData = bs_new<FontInitData>();
 
@@ -126,7 +126,7 @@ namespace BansheeEngine
 			font->mRTTIData = initData;
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Font* font = static_cast<Font*>(obj);
 			FontInitData* initData = any_cast<FontInitData*>(font->mRTTIData);

+ 1 - 1
Source/BansheeCore/Include/BsGameObjectHandleRTTI.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 			addPlainField("mInstanceID", 0, &GameObjectHandleRTTI::getInstanceId, &GameObjectHandleRTTI::setInstanceId);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			GameObjectHandleBase* gameObjectHandle = static_cast<GameObjectHandleBase*>(obj);
 

+ 1 - 1
Source/BansheeCore/Include/BsGpuProgramRTTI.h

@@ -45,7 +45,7 @@ namespace BansheeEngine
 			addPlainField("mLanguage", 7, &GpuProgramRTTI::getLanguage, &GpuProgramRTTI::setLanguage);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			GpuProgram* gpuProgram = static_cast<GpuProgram*>(obj);
 			gpuProgram->initialize();

+ 5 - 5
Source/BansheeCore/Include/BsMaterialParamsRTTI.h

@@ -190,18 +190,18 @@ namespace BansheeEngine
 				&MaterialParamsRTTI::getSamplerStateArraySize, &MaterialParamsRTTI::setSamplerStateParam, &MaterialParamsRTTI::setSamplerStateArraySize);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			MaterialParams* paramsObj = static_cast<MaterialParams*>(obj);
-			Vector<MaterialParam> params;
+			Vector<MaterialParam> matParams;
 
 			for(auto& entry : paramsObj->mParams)
-				params.push_back({ entry.first, entry.second });
+				matParams.push_back({ entry.first, entry.second });
 
-			paramsObj->mRTTIData = params;
+			paramsObj->mRTTIData = matParams;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			MaterialParams* paramsObj = static_cast<MaterialParams*>(obj);
 			paramsObj->mRTTIData = nullptr;

+ 1 - 1
Source/BansheeCore/Include/BsMaterialRTTI.h

@@ -29,7 +29,7 @@ namespace BansheeEngine
 			addReflectablePtrField("mMaterialParams", 2, &MaterialRTTI::getMaterialParams, &MaterialRTTI::setMaterialParams);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override;
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override;
 
 		const String& getRTTIName() override
 		{

+ 1 - 1
Source/BansheeCore/Include/BsMeshRTTI.h

@@ -53,7 +53,7 @@ namespace BansheeEngine
 			addReflectablePtrField("mMeshData", 3, &MeshRTTI::getMeshData, &MeshRTTI::setMeshData);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Mesh* mesh = static_cast<Mesh*>(obj);
 			mesh->initialize();

+ 1 - 1
Source/BansheeCore/Include/BsPassRTTI.h

@@ -62,7 +62,7 @@ namespace BansheeEngine
 			addPlainField("mStencilRefValue", 9, &PassRTTI::getStencilRefValue, &PassRTTI::setStencilRefValue);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Pass* pass = static_cast<Pass*>(obj);
 			pass->initialize();

+ 2 - 2
Source/BansheeCore/Include/BsPhysicsMaterialRTTI.h

@@ -58,7 +58,7 @@ namespace BansheeEngine
 			addPlainField("restitutionCoefficient", 2, &PhysicsMaterialRTTI::getRestitutionCoefficient, &PhysicsMaterialRTTI::setRestitutionCoefficient);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			PhysicsMaterial* material = static_cast<PhysicsMaterial*>(obj);
 
@@ -72,7 +72,7 @@ namespace BansheeEngine
 			material->mRTTIData = materialData;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			PhysicsMaterial* material = static_cast<PhysicsMaterial*>(obj);
 			material->mRTTIData = nullptr;

+ 1 - 1
Source/BansheeCore/Include/BsPhysicsMeshRTTI.h

@@ -26,7 +26,7 @@ namespace BansheeEngine
 			:mInitMembers(this)
 		{ }
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			PhysicsMesh* mesh = static_cast<PhysicsMesh*>(obj);
 			mesh->initialize();

+ 2 - 2
Source/BansheeCore/Include/BsPrefabDiffRTTI.h

@@ -106,7 +106,7 @@ namespace BansheeEngine
 			:mInitMembers(this)
 		{ }
 
-		void onDeserializationStarted(IReflectable* obj) override
+		void onDeserializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			PrefabDiff* prefabDiff = static_cast<PrefabDiff*>(obj);
 
@@ -114,7 +114,7 @@ namespace BansheeEngine
 				GameObjectManager::instance().registerOnDeserializationEndCallback(std::bind(&PrefabDiffRTTI::delayedOnDeserializationEnded, prefabDiff));
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			assert(GameObjectManager::instance().isGameObjectDeserializationActive());
 

+ 1 - 1
Source/BansheeCore/Include/BsPrefabRTTI.h

@@ -37,7 +37,7 @@ namespace BansheeEngine
 			addPlainField("mUUID", 3, &PrefabRTTI::getUUID, &PrefabRTTI::setUUID);
 		}
 
-		void onDeserializationStarted(IReflectable* ptr) override
+		void onDeserializationStarted(IReflectable* ptr, const UnorderedMap<String, UINT64>& params) override
 		{
 			// Make sure external IDs are broken because we do some ID matching when dealing with prefabs and keeping
 			// the invalid external references could cause it to match invalid objects in case they end up having the

+ 1 - 1
Source/BansheeCore/Include/BsRasterizerStateRTTI.h

@@ -28,7 +28,7 @@ namespace BansheeEngine
 			addPlainField("mData", 0, &RasterizerStateRTTI::getData, &RasterizerStateRTTI::setData);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			RasterizerState* rasterizerState = static_cast<RasterizerState*>(obj);
 			rasterizerState->initialize();

+ 2 - 2
Source/BansheeCore/Include/BsResourceHandleRTTI.h

@@ -31,7 +31,7 @@ namespace BansheeEngine
 			addPlainField("mUUID", 0, &ResourceHandleRTTI::getUUID, &ResourceHandleRTTI::setUUID);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			TResourceHandleBase<false>* resourceHandle = static_cast<TResourceHandleBase<false>*>(obj);
 
@@ -84,7 +84,7 @@ namespace BansheeEngine
 			addPlainField("mUUID", 0, &WeakResourceHandleRTTI::getUUID, &WeakResourceHandleRTTI::setUUID);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			TResourceHandleBase<true>* resourceHandle = static_cast<TResourceHandleBase<true>*>(obj);
 

+ 1 - 1
Source/BansheeCore/Include/BsSamplerStateRTTI.h

@@ -28,7 +28,7 @@ namespace BansheeEngine
 			addPlainField("mData", 0, &SamplerStateRTTI::getData, &SamplerStateRTTI::setData);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			SamplerState* samplerState = static_cast<SamplerState*>(obj);
 			samplerState->initialize();

+ 2 - 2
Source/BansheeCore/Include/BsSceneObjectRTTI.h

@@ -95,7 +95,7 @@ namespace BansheeEngine
 			addPlainField("mActiveSelf", 9, &SceneObjectRTTI::getActive, &SceneObjectRTTI::setActive);
 		}
 
-		void onDeserializationStarted(IReflectable* obj) override
+		void onDeserializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			// If this is the root scene object we're deserializing, activate game object deserialization so the system
 			// can resolve deserialized handles to the newly created objects
@@ -113,7 +113,7 @@ namespace BansheeEngine
 				deserializationData.isDeserializationParent = false;
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			SceneObject* so = static_cast<SceneObject*>(obj);
 			GODeserializationData& goDeserializationData = any_cast_ref<GODeserializationData>(so->mRTTIData);

+ 2 - 2
Source/BansheeCore/Include/BsShaderImportOptionsRTTI.h

@@ -42,7 +42,7 @@ namespace BansheeEngine
 		}
 
 		/** @copydoc ShaderImportOptionsRTTI::onSerializationStarted */
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ShaderImportOptions* importOptions = static_cast<ShaderImportOptions*>(obj);
 
@@ -56,7 +56,7 @@ namespace BansheeEngine
 		}
 
 		/** @copydoc RTTIType::onSerializationEnded */
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ShaderImportOptions* importOptions = static_cast<ShaderImportOptions*>(obj);
 			importOptions->mRTTIData = nullptr;

+ 1 - 1
Source/BansheeCore/Include/BsShaderRTTI.h

@@ -295,7 +295,7 @@ namespace BansheeEngine
 			addPlainField("mFlags", 13, &ShaderRTTI::getFlags, &ShaderRTTI::setFlags);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Shader* shader = static_cast<Shader*>(obj);
 			shader->initialize();

+ 1 - 1
Source/BansheeCore/Include/BsStringTableRTTI.h

@@ -36,7 +36,7 @@ namespace BansheeEngine
 			addPlainField("mIdentifiers", 2, &StringTableRTTI::getIdentifiers, &StringTableRTTI::setIdentifiers);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			StringTable* stringTable = static_cast<StringTable*>(obj);
 			stringTable->setActiveLanguage(stringTable->mActiveLanguage);

+ 1 - 1
Source/BansheeCore/Include/BsTechniqueRTTI.h

@@ -37,7 +37,7 @@ namespace BansheeEngine
 			addReflectablePtrArrayField("mPasses", 2, &TechniqueRTTI::getPass, &TechniqueRTTI::getPassArraySize, &TechniqueRTTI::setPass, &TechniqueRTTI::setPassArraySize);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Technique* technique = static_cast<Technique*>(obj);
 			technique->initialize();

+ 2 - 2
Source/BansheeCore/Include/BsTextureRTTI.h

@@ -113,14 +113,14 @@ namespace BansheeEngine
 				&TextureRTTI::setPixelData, &TextureRTTI::setPixelDataArraySize, RTTI_Flag_SkipInReferenceSearch);
 		}
 
-		void onDeserializationStarted(IReflectable* obj) override
+		void onDeserializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Texture* texture = static_cast<Texture*>(obj);
 
 			texture->mRTTIData = bs_new<Vector<SPtr<PixelData>>>();
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Texture* texture = static_cast<Texture*>(obj);
 

+ 1 - 1
Source/BansheeCore/Include/BsViewportRTTI.h

@@ -50,7 +50,7 @@ namespace BansheeEngine
 			addPlainField("mStencilClearValue", 6, &ViewportRTTI::getStencilClearValue, &ViewportRTTI::setStencilClearValue);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			Viewport* viewport = static_cast<Viewport*>(obj);
 			viewport->initialize();

+ 3 - 3
Source/BansheeCore/Source/BsMaterialRTTI.cpp

@@ -6,7 +6,7 @@
 
 namespace BansheeEngine
 {
-	void MaterialRTTI::onDeserializationEnded(IReflectable* obj)
+	void MaterialRTTI::onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params)
 	{
 		Material* material = static_cast<Material*>(obj);
 		material->initialize();
@@ -16,8 +16,8 @@ namespace BansheeEngine
 
 		material->initBestTechnique();
 
-		SPtr<MaterialParams> params = any_cast<SPtr<MaterialParams>>(material->mRTTIData);
-		material->setParams(params);
+		SPtr<MaterialParams> matParams = any_cast<SPtr<MaterialParams>>(material->mRTTIData);
+		material->setParams(matParams);
 
 		material->mRTTIData = nullptr; // Delete temporary data
 	}

+ 4 - 2
Source/BansheeCore/Source/BsUtility.cpp

@@ -38,8 +38,10 @@ namespace BansheeEngine
 
 	void Utility::findResourceDependenciesInternal(IReflectable& obj, bool recursive, Map<String, ResourceDependency>& dependencies)
 	{
+		static const UnorderedMap<String, UINT64> dummyParams;
+
 		RTTITypeBase* rtti = obj.getRTTI();
-		rtti->onSerializationStarted(&obj);
+		rtti->onSerializationStarted(&obj, dummyParams);
 
 		UINT32 numFields = rtti->getNumFields();
 		for (UINT32 i = 0; i < numFields; i++)
@@ -132,7 +134,7 @@ namespace BansheeEngine
 			}
 		}
 
-		rtti->onSerializationEnded(&obj);
+		rtti->onSerializationEnded(&obj, dummyParams);
 	}
 
 	bool Utility::hasReflectableChildren(RTTITypeBase* type)

+ 1 - 1
Source/BansheeEditor/Include/BsDockManagerLayoutRTTI.h

@@ -33,7 +33,7 @@ namespace BansheeEngine
 			addPlainField("mMaximizedWidgetNames", 2, &DockManagerLayoutRTTI::getMaximizedWidgetNames, &DockManagerLayoutRTTI::setMaximizedWidgetNames);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			DockManagerLayout* layout = static_cast<DockManagerLayout*>(obj);
 

+ 5 - 5
Source/BansheeEditor/Include/BsSettings.h

@@ -57,10 +57,10 @@ namespace BansheeEngine
 		/**	Marks the object as dirty so that outside objects know when to update. */
 		void markAsDirty() const { mHash++; }
 
-		Map<String, float> mFloatProperties;
-		Map<String, INT32> mIntProperties;
-		Map<String, bool> mBoolProperties;
-		Map<String, WString> mStringProperties;
+		UnorderedMap<String, float> mFloatProperties;
+		UnorderedMap<String, INT32> mIntProperties;
+		UnorderedMap<String, bool> mBoolProperties;
+		UnorderedMap<String, WString> mStringProperties;
 
 		mutable UINT32 mHash;
 
@@ -70,7 +70,7 @@ namespace BansheeEngine
 	public:
 		friend class SettingsRTTI;
 		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
+		RTTITypeBase* getRTTI() const override;
 	};
 
 	/** @} */

+ 1 - 1
Source/BansheeEngine/Include/BsCameraRTTI.h

@@ -117,7 +117,7 @@ namespace BansheeEngine
 			addPlainField("mPPSettings", 24, &CameraRTTI::getPostProcessSettings, &CameraRTTI::setPostProcessSettings);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
 			// but since this specific type is used in Components we delay initialization until Component

+ 2 - 2
Source/BansheeEngine/Include/BsGUISkinRTTI.h

@@ -82,7 +82,7 @@ namespace BansheeEngine
 				&GUISkinRTTI::setStyle, &GUISkinRTTI::setStyleArraySize);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			GUISkin* skin = static_cast<GUISkin*>(obj);
 			Vector<GUISkinEntry> entries;
@@ -95,7 +95,7 @@ namespace BansheeEngine
 			skin->mRTTIData = entries;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			GUISkin* skin = static_cast<GUISkin*>(obj);
 

+ 1 - 1
Source/BansheeEngine/Include/BsLightRTTI.h

@@ -60,7 +60,7 @@ namespace BansheeEngine
 			addPlainField("mPhysCorrectAtten", 9, &LightRTTI::getPhysCorrectAtten, &LightRTTI::setPhysCorrectAtten);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
 			// but since this specific type is used in Components we delay initialization until Component

+ 1 - 1
Source/BansheeEngine/Include/BsRenderableRTTI.h

@@ -36,7 +36,7 @@ namespace BansheeEngine
 				&RenderableRTTI::getNumMaterials, &RenderableRTTI::setMaterial, &RenderableRTTI::setNumMaterials);
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
 			// but since this specific type is used in Components we delay initialization until Component

+ 13 - 13
Source/BansheePhysX/Include/BsPhysXMeshRTTI.h

@@ -17,19 +17,19 @@ namespace BansheeEngine
 	class BS_PHYSX_EXPORT FPhysXMeshRTTI : public RTTIType<FPhysXMesh, FPhysicsMesh, FPhysXMeshRTTI>
 	{
 	private:
-		SPtr<DataStream> getCookedData(FPhysXMesh* obj, UINT32& size)
-		{
-			size = obj->mCookedDataSize;
-
-			return bs_shared_ptr_new<MemoryDataStream>(obj->mCookedData, obj->mCookedDataSize, false);
-		}
-
-		void setCookedData(FPhysXMesh* obj, const SPtr<DataStream>& value, UINT32 size)
-		{
+		SPtr<DataStream> getCookedData(FPhysXMesh* obj, UINT32& size)
+		{
+			size = obj->mCookedDataSize;
+
+			return bs_shared_ptr_new<MemoryDataStream>(obj->mCookedData, obj->mCookedDataSize, false);
+		}
+
+		void setCookedData(FPhysXMesh* obj, const SPtr<DataStream>& value, UINT32 size)
+		{
 			obj->mCookedData = (UINT8*)bs_alloc(size);
-			obj->mCookedDataSize = size;
-
-			value->read(obj->mCookedData, size);
+			obj->mCookedDataSize = size;
+
+			value->read(obj->mCookedData, size);
 		}
 
 	public:
@@ -39,7 +39,7 @@ namespace BansheeEngine
 		}
 
 		/** @copydoc IReflectable::onDeserializationEnded */
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			FPhysXMesh* mesh = static_cast<FPhysXMesh*>(obj);
 			mesh->initialize();

+ 9 - 2
Source/BansheeUtility/Include/BsBinarySerializer.h

@@ -59,18 +59,23 @@ namespace BansheeEngine
 		 * @param[in]	shallow					Determines how to handle referenced objects. If true then references will 
 		 *										not be encoded and will be set to null. If false then references will be 
 		 *										encoded as well and restored upon decoding.
+		 * @param[in]	params					Optional parameters to be passed to the serialization callbacks on the
+		 *										objects being serialized.
 		 */
 		void encode(IReflectable* object, UINT8* buffer, UINT32 bufferLength, UINT32* bytesWritten,
 			std::function<UINT8*(UINT8* buffer, UINT32 bytesWritten, UINT32& newBufferSize)> flushBufferCallback,
-			bool shallow = false);
+			bool shallow = false, const UnorderedMap<String, UINT64>& params = UnorderedMap<String, UINT64>());
 
 		/**
 		 * Decodes an object from binary data.
 		 *
 		 * @param[in]	data  		Binary data to decode.
 		 * @param[in]	dataLength	Length of the data in bytes.
+		 * @param[in]	params		Optional parameters to be passed to the serialization callbacks on the objects being
+		 *							serialized.
 		 */
-		SPtr<IReflectable> decode(const SPtr<DataStream>& data, UINT32 dataLength);
+		SPtr<IReflectable> decode(const SPtr<DataStream>& data, UINT32 dataLength, 
+			const UnorderedMap<String, UINT64>& params = UnorderedMap<String, UINT64>());
 
 		/** @name Internal 
 		 *  @{
@@ -196,6 +201,8 @@ namespace BansheeEngine
 		UnorderedMap<SPtr<SerializedObject>, ObjectToDecode> mObjectMap;
 		UnorderedMap<UINT32, SPtr<SerializedObject>> mInterimObjectMap;
 
+		UnorderedMap<String, UINT64> mParams;
+
 		static const int META_SIZE = 4; // Meta field size
 		static const int NUM_ELEM_FIELD_SIZE = 4; // Size of the field storing number of array elements
 		static const int COMPLEX_TYPE_FIELD_SIZE = 4; // Size of the field storing the size of a child complex type

+ 11 - 3
Source/BansheeUtility/Include/BsFileSerializer.h

@@ -23,8 +23,11 @@ namespace BansheeEngine
 		/**
 		 * Parses the provided object, serializes all of its data as specified by its RTTIType and saves the serialized 
 		 * data to the provided file location.
+		 *
+		 * @param[in]	params		Optional parameters to be passed to the serialization callbacks on the objects being
+		 *							serialized.
 		 */
-		void encode(IReflectable* object);
+		void encode(IReflectable* object, const UnorderedMap<String, UINT64>& params = UnorderedMap<String, UINT64>());
 
 	private:
 		/** Called by the binary serializer whenever the buffer gets full. */
@@ -42,8 +45,13 @@ namespace BansheeEngine
 	public:
 		FileDecoder(const Path& fileLocation);
 
-		/**	Deserializes an IReflectable object by reading the binary data at the provided file location. */
-		SPtr<IReflectable> decode();
+		/**	
+		 * Deserializes an IReflectable object by reading the binary data at the provided file location. 
+		 *
+		 * @param[in]	params		Optional parameters to be passed to the serialization callbacks on the objects being
+		 *							serialized.
+		 */
+		SPtr<IReflectable> decode(const UnorderedMap<String, UINT64>& params = UnorderedMap<String, UINT64>());
 
 		/** Skips over than object in the file. Calling decode() will decode the next object. */
 		void skip();

+ 11 - 3
Source/BansheeUtility/Include/BsMemorySerializer.h

@@ -33,15 +33,23 @@ namespace BansheeEngine
 		 * @param[in]	shallow			Determines how to handle referenced objects. If true then references will not be 
 		 *								encoded and will be set to null. If false then references will be encoded as well 
 		 *								and restored upon decoding.
+		 * @param[in]	params			Optional parameters to be passed to the serialization callbacks on the objects being
+		 *								serialized.
 		 *
 		 * @return						A buffer containing the encoded object. It is up to the user to release the buffer 
 		 *								memory when no longer needed.
 		 */
 		UINT8* encode(IReflectable* object, UINT32& bytesWritten, std::function<void*(UINT32)> allocator = nullptr, 
-			bool shallow = false);
+			bool shallow = false, const UnorderedMap<String, UINT64>& params = UnorderedMap<String, UINT64>());
 
-		/** Deserializes an IReflectable object by reading the binary data from the provided memory location. */
-		SPtr<IReflectable> decode(UINT8* buffer, UINT32 bufferSize);
+		/** 
+		 * Deserializes an IReflectable object by reading the binary data from the provided memory location. 
+		 *
+		 * @param[in]	params		Optional parameters to be passed to the serialization callbacks on the objects being
+		 *							serialized.
+		 */
+		SPtr<IReflectable> decode(UINT8* buffer, UINT32 bufferSize, 
+			const UnorderedMap<String, UINT64>& params = UnorderedMap<String, UINT64>());
 
 	private:
 		Vector<BufferPiece> mBufferPieces;

+ 4 - 4
Source/BansheeUtility/Include/BsRTTIType.h

@@ -265,19 +265,19 @@ namespace BansheeEngine
 		 * Called by the serializers when serialization for this object has started. Use this to do any preprocessing on 
 		 * data you might need during serialization itself.
 		 */
-		virtual void onSerializationStarted(IReflectable* obj) {}
+		virtual void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) {}
 
 		/**
 		 * Called by the serializers when serialization for this object has ended. After serialization has ended you can 
 		 * be sure that the type has been fully serialized, and you may clean up any temporary data.
 		 */
-		virtual void onSerializationEnded(IReflectable* obj) {}
+		virtual void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) {}
 
 		/**
 		 * Called by the serializers when deserialization for this object has started. Use this to do any preprocessing 
 		 * on data you might need during deserialization itself.
 		 */
-		virtual void onDeserializationStarted(IReflectable* obj) {}
+		virtual void onDeserializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) {}
 
 		/**
 		 * Called by the serializers when deserialization for this object has ended. At this point you can be sure the 
@@ -286,7 +286,7 @@ namespace BansheeEngine
 		 * One exception being are fields you marked with RTTI_Flag_WeakRef, as they might be resolved only after 
 		 * deserialization has fully completed for all objects.
 		 */
-		virtual void onDeserializationEnded(IReflectable* obj) {}
+		virtual void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) {}
 
 		/**
 		 * Returns a handler that determines how are "diffs" generated and applied when it comes to objects of this RTTI 

+ 4 - 4
Source/BansheeUtility/Include/BsSerializedObjectRTTI.h

@@ -211,7 +211,7 @@ namespace BansheeEngine
 				&SerializedArrayRTTI::setEntry, &SerializedArrayRTTI::setNumEntries);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			SerializedArray* serializedArray = static_cast<SerializedArray*>(obj);
 
@@ -222,7 +222,7 @@ namespace BansheeEngine
 			serializedArray->mRTTIData = sequentialData;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			SerializedArray* serializedArray = static_cast<SerializedArray*>(obj);
 			serializedArray->mRTTIData = nullptr;
@@ -287,7 +287,7 @@ namespace BansheeEngine
 				&SerializedSubObjectRTTI::setEntry, &SerializedSubObjectRTTI::setNumEntries);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			SerializedSubObject* serializableObject = static_cast<SerializedSubObject*>(obj);
 
@@ -298,7 +298,7 @@ namespace BansheeEngine
 			serializableObject->mRTTIData = sequentialData;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			SerializedSubObject* serializableObject = static_cast<SerializedSubObject*>(obj);
 			serializableObject->mRTTIData = nullptr;

+ 10 - 6
Source/BansheeUtility/Source/BsBinaryCloner.cpp

@@ -37,6 +37,8 @@ namespace BansheeEngine
 
 	void BinaryCloner::gatherReferences(IReflectable* object, ObjectReferenceData& referenceData)
 	{
+		static const UnorderedMap<String, UINT64> dummyParams;
+
 		if (object == nullptr)
 			return;
 
@@ -44,7 +46,7 @@ namespace BansheeEngine
 		Stack<RTTITypeBase*> rttiTypes;
 		while (rtti != nullptr)
 		{
-			rtti->onSerializationStarted(object);
+			rtti->onSerializationStarted(object, dummyParams);
 			SubObjectReferenceData* subObjectData = nullptr;
 
 			UINT32 numFields = rtti->getNumFields();
@@ -155,17 +157,19 @@ namespace BansheeEngine
 			rtti = rttiTypes.top();
 			rttiTypes.pop();
 
-			rtti->onSerializationEnded(object);
+			rtti->onSerializationEnded(object, dummyParams);
 		}
 	}
 
 	void BinaryCloner::restoreReferences(IReflectable* object, const ObjectReferenceData& referenceData)
 	{
+		static const UnorderedMap<String, UINT64> dummyParams;
+
 		for (auto& subObject : referenceData.subObjectData)
 		{
 			if (subObject.references.size() > 0)
 			{
-				subObject.rtti->onDeserializationStarted(object);
+				subObject.rtti->onDeserializationStarted(object, dummyParams);
 
 				for (auto& reference : subObject.references)
 				{
@@ -177,12 +181,12 @@ namespace BansheeEngine
 						curField->setValue(object, reference.object);
 				}
 
-				subObject.rtti->onDeserializationEnded(object);
+				subObject.rtti->onDeserializationEnded(object, dummyParams);
 			}
 
 			if (subObject.children.size() > 0)
 			{
-				subObject.rtti->onSerializationStarted(object);
+				subObject.rtti->onSerializationStarted(object, dummyParams);
 
 				for (auto& childObjectData : subObject.children)
 				{
@@ -197,7 +201,7 @@ namespace BansheeEngine
 					restoreReferences(childObj, childObjectData);
 				}
 
-				subObject.rtti->onSerializationEnded(object);
+				subObject.rtti->onSerializationEnded(object, dummyParams);
 			}
 		}
 	}

+ 8 - 4
Source/BansheeUtility/Source/BsBinaryDiff.cpp

@@ -118,6 +118,8 @@ namespace BansheeEngine
 
 	void IDiff::applyDiff(const SPtr<IReflectable>& object, const SPtr<SerializedObject>& diff)
 	{
+		static const UnorderedMap<String, UINT64> dummyParams;
+
 		Vector<DiffCommand> commands;
 
 		DiffObjectMap objectMap;
@@ -144,7 +146,7 @@ namespace BansheeEngine
 				RTTITypeBase* curRtti = destObject->getRTTI();
 				while (curRtti != nullptr)
 				{
-					curRtti->onDeserializationStarted(destObject);
+					curRtti->onDeserializationStarted(destObject, dummyParams);
 					curRtti = curRtti->getBaseClass();
 				}
 			}
@@ -161,7 +163,7 @@ namespace BansheeEngine
 
 				while (!rttiTypes.empty())
 				{
-					rttiTypes.top()->onDeserializationEnded(destObject);
+					rttiTypes.top()->onDeserializationEnded(destObject, dummyParams);
 					rttiTypes.pop();
 				}
 
@@ -389,6 +391,8 @@ namespace BansheeEngine
 	void BinaryDiff::applyDiff(const SPtr<IReflectable>& object, const SPtr<SerializedObject>& diff,
 		DiffObjectMap& objectMap, Vector<DiffCommand>& diffCommands)
 	{
+		static const UnorderedMap<String, UINT64> dummyParams;
+
 		if (object == nullptr || diff == nullptr || object->getTypeId() != diff->getRootTypeId())
 			return;
 
@@ -411,7 +415,7 @@ namespace BansheeEngine
 				if (!object->isDerivedFrom(rtti))
 					continue;
 
-				rtti->onSerializationStarted(object.get());
+				rtti->onSerializationStarted(object.get(), dummyParams);
 				rttiTypes.push(rtti);
 
 				RTTIField* genericField = rtti->findField(diffEntry.first);
@@ -677,7 +681,7 @@ namespace BansheeEngine
 
 		while (!rttiTypes.empty())
 		{
-			rttiTypes.top()->onSerializationEnded(object.get());
+			rttiTypes.top()->onSerializationEnded(object.get(), dummyParams);
 			rttiTypes.pop();
 		}
 	}

+ 17 - 12
Source/BansheeUtility/Source/BsBinarySerializer.cpp

@@ -45,14 +45,16 @@ namespace BansheeEngine
 	{
 	}
 
-	void BinarySerializer::encode(IReflectable* object, UINT8* buffer, UINT32 bufferLength, 
-		UINT32* bytesWritten, std::function<UINT8*(UINT8*, UINT32, UINT32&)> flushBufferCallback, bool shallow)
+	void BinarySerializer::encode(IReflectable* object, UINT8* buffer, UINT32 bufferLength, UINT32* bytesWritten, 
+		std::function<UINT8*(UINT8*, UINT32, UINT32&)> flushBufferCallback, bool shallow, 
+		const UnorderedMap<String, UINT64>& params)
 	{
 		mObjectsToEncode.clear();
 		mObjectAddrToId.clear();
 		mLastUsedObjectId = 1;
 		*bytesWritten = 0;
 		mTotalBytesWritten = 0;
+		mParams = params;
 
 		Vector<SPtr<IReflectable>> encodedObjects;
 		UINT32 objectId = findOrCreatePersistentId(object);
@@ -119,8 +121,11 @@ namespace BansheeEngine
 		mObjectAddrToId.clear();
 	}
 
-	SPtr<IReflectable> BinarySerializer::decode(const SPtr<DataStream>& data, UINT32 dataLength)
+	SPtr<IReflectable> BinarySerializer::decode(const SPtr<DataStream>& data, UINT32 dataLength, 
+		const UnorderedMap<String, UINT64>& params)
 	{
+		mParams = params;
+
 		if (dataLength == 0)
 			return nullptr;
 
@@ -219,7 +224,7 @@ namespace BansheeEngine
 		// If an object has base classes, we need to iterate through all of them
 		do
 		{
-			si->onSerializationStarted(object);
+			si->onSerializationStarted(object, mParams);
 
 			// Encode object ID & type
 			ObjectMetaData objectMetaData = encodeObjectMetaData(objectId, si->getRTTIId(), isBaseClass);
@@ -273,7 +278,7 @@ namespace BansheeEngine
 									bytesWritten, flushBufferCallback, shallow);
 								if(buffer == nullptr)
 								{
-									si->onSerializationEnded(object);
+									si->onSerializationEnded(object, mParams);
 									return nullptr;
 								}
 							}
@@ -302,7 +307,7 @@ namespace BansheeEngine
 
 									if (buffer == nullptr || bufferLength == 0)
 									{
-										si->onSerializationEnded(object);
+										si->onSerializationEnded(object, mParams);
 										return nullptr;
 									}
 								}
@@ -348,7 +353,7 @@ namespace BansheeEngine
 								bytesWritten, flushBufferCallback, shallow);
 							if(buffer == nullptr)
 							{
-								si->onSerializationEnded(object);
+								si->onSerializationEnded(object, mParams);
 								return nullptr;
 							}
 
@@ -374,7 +379,7 @@ namespace BansheeEngine
 
 								if (buffer == nullptr || bufferLength == 0)
 								{
-									si->onSerializationEnded(object);
+									si->onSerializationEnded(object, mParams);
 									return nullptr;
 								}
 							}
@@ -406,7 +411,7 @@ namespace BansheeEngine
 
 							if (buffer == nullptr || bufferLength == 0)
 							{
-								si->onSerializationEnded(object);
+								si->onSerializationEnded(object, mParams);
 								return nullptr;
 							}
 
@@ -420,7 +425,7 @@ namespace BansheeEngine
 				}
 			}
 
-			si->onSerializationEnded(object);
+			si->onSerializationEnded(object, mParams);
 
 			si = si->getBaseClass();
 			isBaseClass = true;
@@ -889,7 +894,7 @@ namespace BansheeEngine
 			if (rtti == nullptr)
 				continue;
 
-			rtti->onDeserializationStarted(object.get());
+			rtti->onDeserializationStarted(object.get(), mParams);
 			rttiTypes.push_back(rtti);
 
 			UINT32 numFields = rtti->getNumFields();
@@ -1104,7 +1109,7 @@ namespace BansheeEngine
 
 		for (auto iterFind = rttiTypes.rbegin(); iterFind != rttiTypes.rend(); ++iterFind)
 		{
-			(*iterFind)->onDeserializationEnded(object.get());
+			(*iterFind)->onDeserializationEnded(object.get(), mParams);
 		}
 	}
 

+ 5 - 4
Source/BansheeUtility/Source/BsFileSerializer.cpp

@@ -38,7 +38,7 @@ namespace BansheeEngine
 		mOutputStream.clear();
 	}
 
-	void FileEncoder::encode(IReflectable* object)
+	void FileEncoder::encode(IReflectable* object, const UnorderedMap<String, UINT64>& params)
 	{
 		if (object == nullptr)
 			return;
@@ -48,7 +48,8 @@ namespace BansheeEngine
 
 		BinarySerializer bs;
 		UINT32 totalBytesWritten = 0;
-		bs.encode(object, mWriteBuffer, WRITE_BUFFER_SIZE, &totalBytesWritten, std::bind(&FileEncoder::flushBuffer, this, _1, _2, _3));
+		bs.encode(object, mWriteBuffer, WRITE_BUFFER_SIZE, &totalBytesWritten, 
+			std::bind(&FileEncoder::flushBuffer, this, _1, _2, _3), false, params);
 
 		mOutputStream.seekp(curPos);
 		mOutputStream.write((char*)&totalBytesWritten, sizeof(totalBytesWritten));
@@ -76,7 +77,7 @@ namespace BansheeEngine
 		}
 	}
 
-	SPtr<IReflectable> FileDecoder::decode()
+	SPtr<IReflectable> FileDecoder::decode(const UnorderedMap<String, UINT64>& params)
 	{
 		if (mInputStream->eof())
 			return nullptr;
@@ -85,7 +86,7 @@ namespace BansheeEngine
 		mInputStream->read(&objectSize, sizeof(objectSize));
 
 		BinarySerializer bs;
-		SPtr<IReflectable> object = bs.decode(mInputStream, objectSize);
+		SPtr<IReflectable> object = bs.decode(mInputStream, objectSize, params);
 
 		return object;
 	}

+ 4 - 4
Source/BansheeUtility/Source/BsMemorySerializer.cpp

@@ -18,7 +18,7 @@ namespace BansheeEngine
 	{ }
 
 	UINT8* MemorySerializer::encode(IReflectable* object, UINT32& bytesWritten, 
-		std::function<void*(UINT32)> allocator, bool shallow)
+		std::function<void*(UINT32)> allocator, bool shallow, const UnorderedMap<String, UINT64>& params)
 	{
 		using namespace std::placeholders;
 
@@ -31,7 +31,7 @@ namespace BansheeEngine
 		mBufferPieces.push_back(piece);
 
 		bs.encode(object, piece.buffer, WRITE_BUFFER_SIZE, &bytesWritten, 
-			std::bind(&MemorySerializer::flushBuffer, this, _1, _2, _3), shallow);
+			std::bind(&MemorySerializer::flushBuffer, this, _1, _2, _3), shallow, params);
 
 		UINT8* resultBuffer;
 		if(allocator != nullptr)
@@ -59,12 +59,12 @@ namespace BansheeEngine
 		return resultBuffer;
 	}
 
-	SPtr<IReflectable> MemorySerializer::decode(UINT8* buffer, UINT32 bufferSize)
+	SPtr<IReflectable> MemorySerializer::decode(UINT8* buffer, UINT32 bufferSize, const UnorderedMap<String, UINT64>& params)
 	{
 		SPtr<MemoryDataStream> stream = bs_shared_ptr_new<MemoryDataStream>(buffer, bufferSize, false);
 
 		BinarySerializer bs;
-		SPtr<IReflectable> object = bs.decode(stream, (UINT32)bufferSize);
+		SPtr<IReflectable> object = bs.decode(stream, (UINT32)bufferSize, params);
 
 		return object;
 	}

+ 2 - 2
Source/SBansheeEngine/Include/BsManagedComponentRTTI.h

@@ -70,7 +70,7 @@ namespace BansheeEngine
 			addPlainField("mMissingType", 3, &ManagedComponentRTTI::getMissingType, &ManagedComponentRTTI::setMissingType);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedComponent* mc = static_cast<ManagedComponent*>(obj);
 			MonoObject* managedInstance = mc->getManagedInstance();
@@ -81,7 +81,7 @@ namespace BansheeEngine
 				mc->mRTTIData = mc->mSerializedObjectData;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedComponent* mc = static_cast<ManagedComponent*>(obj);
 			mc->mRTTIData = nullptr;

+ 2 - 2
Source/SBansheeEngine/Include/BsManagedResourceRTTI.h

@@ -36,14 +36,14 @@ namespace BansheeEngine
 			addReflectablePtrField("mObjectData", 0, &ManagedResourceRTTI::getObjectData, &ManagedResourceRTTI::setObjectData);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedResource* mc = static_cast<ManagedResource*>(obj);
 
 			mc->mRTTIData = ManagedSerializableObject::createFromExisting(mc->getManagedInstance());
 		}
 
-		void onDeserializationEnded(IReflectable* obj) override
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedResource* mr = static_cast<ManagedResource*>(obj);
 			SPtr<ManagedSerializableObject> serializableObject = any_cast<SPtr<ManagedSerializableObject>>(mr->mRTTIData);

+ 2 - 2
Source/SBansheeEngine/Include/BsManagedSerializableDictionaryRTTI.h

@@ -99,7 +99,7 @@ namespace BansheeEngine
 				&ManagedSerializableDictionaryRTTI::setEntry, &ManagedSerializableDictionaryRTTI::setNumEntries);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedSerializableDictionary* serializableObject = static_cast<ManagedSerializableDictionary*>(obj);
 
@@ -112,7 +112,7 @@ namespace BansheeEngine
 			serializableObject->mRTTIData = sequentialData;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedSerializableDictionary* serializableObject = static_cast<ManagedSerializableDictionary*>(obj);
 			serializableObject->mRTTIData = nullptr;

+ 2 - 2
Source/SBansheeEngine/Include/BsManagedSerializableObjectRTTI.h

@@ -68,7 +68,7 @@ namespace BansheeEngine
 				&ManagedSerializableObjectRTTI::setFieldsEntry, &ManagedSerializableObjectRTTI::setNumFieldEntries);
 		}
 
-		void onSerializationStarted(IReflectable* obj) override
+		void onSerializationStarted(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedSerializableObject* castObj = static_cast<ManagedSerializableObject*>(obj);
 
@@ -88,7 +88,7 @@ namespace BansheeEngine
 			castObj->mRTTIData = sequentialFields;
 		}
 
-		void onSerializationEnded(IReflectable* obj) override
+		void onSerializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
 		{
 			ManagedSerializableObject* castObj = static_cast<ManagedSerializableObject*>(obj);
 			castObj->mRTTIData = nullptr;