فهرست منبع

Replaced boost::any with BansheeEngine::Any

Marko Pintera 11 سال پیش
والد
کامیت
e9202db0e5

+ 1 - 1
CamelotCore/Include/CmBlendStateRTTI.h

@@ -68,7 +68,7 @@ namespace BansheeEngine
 			BlendState* blendState = static_cast<BlendState*>(obj);
 			if(!blendState->mRTTIData.empty())
 			{
-				BLEND_STATE_DESC desc = boost::any_cast<BLEND_STATE_DESC>(blendState->mRTTIData);
+				BLEND_STATE_DESC desc = any_cast<BLEND_STATE_DESC>(blendState->mRTTIData);
 
 				blendState->initialize(desc);
 			}

+ 1 - 1
CamelotCore/Include/CmDepthStencilStateRTTI.h

@@ -27,7 +27,7 @@ namespace BansheeEngine
 			DepthStencilState* depthStencilState = static_cast<DepthStencilState*>(obj);
 			if(!depthStencilState->mRTTIData.empty())
 			{
-				DEPTH_STENCIL_STATE_DESC desc = boost::any_cast<DEPTH_STENCIL_STATE_DESC>(depthStencilState->mRTTIData);
+				DEPTH_STENCIL_STATE_DESC desc = any_cast<DEPTH_STENCIL_STATE_DESC>(depthStencilState->mRTTIData);
 
 				depthStencilState->initialize(desc);
 			}

+ 3 - 3
CamelotCore/Include/CmFontRTTI.h

@@ -98,7 +98,7 @@ namespace BansheeEngine
 
 		void setFontData(Font* obj, UINT32 idx, FontData& value)
 		{
-			FontInitData* initData = boost::any_cast<FontInitData*>(obj->mRTTIData);
+			FontInitData* initData = any_cast<FontInitData*>(obj->mRTTIData);
 
 			initData->fontDataPerSize[idx] = value;
 		}
@@ -110,7 +110,7 @@ namespace BansheeEngine
 
 		void setNumFontData(Font* obj, UINT32 size)
 		{
-			FontInitData* initData = boost::any_cast<FontInitData*>(obj->mRTTIData);
+			FontInitData* initData = any_cast<FontInitData*>(obj->mRTTIData);
 
 			initData->fontDataPerSize.resize(size);
 		}
@@ -149,7 +149,7 @@ namespace BansheeEngine
 		virtual void onDeserializationEnded(IReflectable* obj)
 		{
 			Font* font = static_cast<Font*>(obj);
-			FontInitData* initData = boost::any_cast<FontInitData*>(font->mRTTIData);
+			FontInitData* initData = any_cast<FontInitData*>(font->mRTTIData);
 
 			font->initialize(initData->fontDataPerSize);
 

+ 1 - 1
CamelotCore/Include/CmMaterialRTTI.h

@@ -556,7 +556,7 @@ namespace BansheeEngine
 			if(obj->mRTTIData.empty())
 				return nullptr;
 
-			return boost::any_cast<std::shared_ptr<MaterialParams>>(obj->mRTTIData);
+			return any_cast<std::shared_ptr<MaterialParams>>(obj->mRTTIData);
 		}
 
 		void setMaterialParams(Material* obj, std::shared_ptr<MaterialParams> value)

+ 1 - 1
CamelotCore/Include/CmRasterizerStateRTTI.h

@@ -29,7 +29,7 @@ namespace BansheeEngine
 			RasterizerState* rasterizerState = static_cast<RasterizerState*>(obj);
 			if(!rasterizerState->mRTTIData.empty())
 			{
-				RASTERIZER_STATE_DESC desc = boost::any_cast<RASTERIZER_STATE_DESC>(rasterizerState->mRTTIData);
+				RASTERIZER_STATE_DESC desc = any_cast<RASTERIZER_STATE_DESC>(rasterizerState->mRTTIData);
 
 				rasterizerState->initialize(desc);
 			}

+ 1 - 1
CamelotCore/Include/CmSamplerStateRTTI.h

@@ -29,7 +29,7 @@ namespace BansheeEngine
 			SamplerState* samplerState = static_cast<SamplerState*>(obj);
 			if(!samplerState->mRTTIData.empty())
 			{
-				SAMPLER_STATE_DESC desc = boost::any_cast<SAMPLER_STATE_DESC>(samplerState->mRTTIData);
+				SAMPLER_STATE_DESC desc = any_cast<SAMPLER_STATE_DESC>(samplerState->mRTTIData);
 
 				samplerState->initialize(desc);
 			}

+ 3 - 3
CamelotCore/Include/CmTextureRTTI.h

@@ -49,7 +49,7 @@ namespace BansheeEngine
 
 		void setPixelData(Texture* obj, UINT32 idx, PixelDataPtr data)
 		{
-			Vector<PixelDataPtr>::type* pixelData = boost::any_cast<Vector<PixelDataPtr>::type*>(obj->mRTTIData);
+			Vector<PixelDataPtr>::type* pixelData = any_cast<Vector<PixelDataPtr>::type*>(obj->mRTTIData);
 
 			(*pixelData)[idx] = data;
 		}
@@ -61,7 +61,7 @@ namespace BansheeEngine
 
 		void setPixelDataArraySize(Texture* obj, UINT32 size)
 		{
-			Vector<PixelDataPtr>::type* pixelData = boost::any_cast<Vector<PixelDataPtr>::type*>(obj->mRTTIData);
+			Vector<PixelDataPtr>::type* pixelData = any_cast<Vector<PixelDataPtr>::type*>(obj->mRTTIData);
 
 			pixelData->resize(size);
 		}
@@ -105,7 +105,7 @@ namespace BansheeEngine
 				texture->getNumMipmaps(), texture->getFormat(), texture->getUsage(), texture->isHardwareGammaEnabled(), 
 				texture->getFSAA(), texture->getFSAAHint());
 
-			Vector<PixelDataPtr>::type* pixelData = boost::any_cast<Vector<PixelDataPtr>::type*>(texture->mRTTIData);
+			Vector<PixelDataPtr>::type* pixelData = any_cast<Vector<PixelDataPtr>::type*>(texture->mRTTIData);
 			for(size_t i = 0; i < pixelData->size(); i++)
 			{
 				UINT32 face = (size_t)Math::floor(i / (float)(texture->getNumMipmaps() + 1));

+ 1 - 1
CamelotCore/Source/CmMaterialRTTI.cpp

@@ -208,7 +208,7 @@ namespace BansheeEngine
 
 		material->initBestTechnique();
 
-		std::shared_ptr<MaterialParams> params = boost::any_cast<std::shared_ptr<MaterialParams>>(material->mRTTIData);
+		std::shared_ptr<MaterialParams> params = any_cast<std::shared_ptr<MaterialParams>>(material->mRTTIData);
 
 		ShaderPtr shader = material->getShader();
 		if(shader != nullptr)

+ 8 - 2
CamelotUtility/Include/BsAny.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include "CmPrerequisitesUtil.h"
+#include "CmException.h"
 #include <algorithm>
 #include <typeinfo>
 
@@ -9,6 +10,10 @@ namespace BansheeEngine
 	/**
 	 * @brief	Class capable of storing any general type, and safely extracting 
 	 *			the proper type from the internal data.
+	 *
+	 * @note	Requires C++ RTTI to be active in the compiler. If you don't want to
+	 *			activate RTTI you may remove "typeid" type checks, in which case the
+	 *			container functionality will remain but casting will no longer be type safe.
 	 */
 	class Any
 	{
@@ -46,7 +51,7 @@ namespace BansheeEngine
 
 	public:
 		Any() 
-			:mData(0)
+			:mData(nullptr)
 		{ }
 
 		template <typename ValueType>
@@ -60,7 +65,8 @@ namespace BansheeEngine
 
 		~Any()
 		{
-			cm_delete(mData);
+			if (mData != nullptr)
+				cm_delete(mData);
 		}
 
 		/**

+ 4 - 5
CamelotUtility/Include/BsEvent.h

@@ -63,24 +63,23 @@ namespace BansheeEngine
 		{
 			SpinLock lock;
 
-			// TODO - This isn't correct as iterator isn't locked while function is executing
+			// TODO - This is TERRIBLE as the spin lock might lock for a long while while
+			// the called method is executing. But there is no reason to lock while method is executing.
+			// Fix by copying list of connections temporarily.
 
 			// Fix by:
 			//  - Using stack alloc allocate N std::function objects
 			//  - Create std::function objects using a stack allocator internally
 
-
 			lock.lock();
 
 			for(auto& connection : mConnections)
 			{
 				std::function<RetType(P0)> func = connection->func;
-				lock.unlock();
 
 				func(args);
-
-				lock.lock();
 			}
+
 			lock.unlock();
 		}
 

+ 5 - 5
CamelotUtility/Include/CmAsyncOp.h

@@ -2,7 +2,7 @@
 
 #include "CmPrerequisitesUtil.h"
 #include "CmException.h"
-#include "boost/any.hpp"
+#include "BsAny.h"
 
 namespace BansheeEngine
 {
@@ -25,7 +25,7 @@ namespace BansheeEngine
 				:mIsCompleted(false)
 			{ }
 
-			boost::any mReturnValue;
+			Any mReturnValue;
 			volatile bool mIsCompleted;
 		};
 
@@ -46,7 +46,7 @@ namespace BansheeEngine
 		/**
 		 * @brief	Internal method. Mark the async operation as completed.
 		 */
-		void _completeOperation(boost::any returnValue);
+		void _completeOperation(Any returnValue);
 
 		/**
 		 * @brief	Internal method. Mark the async operation as completed, without setting a return value.
@@ -64,9 +64,9 @@ namespace BansheeEngine
 			if(!hasCompleted())
 				CM_EXCEPT(InternalErrorException, "Trying to get AsyncOp return value but the operation hasn't completed.");
 #endif
-			// Be careful if boost returns bad_any_cast. It doesn't support casting of polymorphic types. Provided and returned
+			// Be careful if cast throws an exception. It doesn't support casting of polymorphic types. Provided and returned
 			// types must be EXACT. (You'll have to cast the data yourself when completing the operation)
-			return boost::any_cast<T>(mData->mReturnValue);
+			return any_cast<T>(mData->mReturnValue);
 		}
 
 	private:

+ 3 - 3
CamelotUtility/Include/CmIReflectable.h

@@ -1,7 +1,7 @@
 #pragma once
 
 #include "CmPrerequisitesUtil.h"
-#include <boost/any.hpp>
+#include "BsAny.h"
 
 namespace BansheeEngine
 {
@@ -74,7 +74,7 @@ namespace BansheeEngine
 		static bool _isTypeIdDuplicate(UINT32 typeId);
 
 	protected:
-		boost::any mRTTIData; // Temporary per-instance data storage used during various RTTI operations.
-							  // Needed since there is one RTTI class instance per type and sometimes we need per-instance data.
+		Any mRTTIData; // Temporary per-instance data storage used during various RTTI operations.
+					   // Needed since there is one RTTI class instance per type and sometimes we need per-instance data.
 	};
 }

+ 6 - 6
CamelotUtility/Include/CmRTTIField.h

@@ -2,13 +2,13 @@
 
 #include <string>
 
-#include <boost/any.hpp>
 #include <type_traits>
 
 #include "CmPrerequisitesUtil.h"
 #include "CmIReflectable.h"
 #include "CmManagedDataBlock.h"
 #include "CmException.h"
+#include "BsAny.h"
 
 namespace BansheeEngine
 {
@@ -73,11 +73,11 @@ namespace BansheeEngine
 	 */
 	struct CM_UTILITY_EXPORT RTTIField
 	{
-		boost::any valueGetter;
-		boost::any valueSetter;
+		Any valueGetter;
+		Any valueSetter;
 
-		boost::any arraySizeGetter;
-		boost::any arraySizeSetter;
+		Any arraySizeGetter;
+		Any arraySizeSetter;
 
 		String mName;
 		UINT16 mUniqueId;
@@ -162,7 +162,7 @@ namespace BansheeEngine
 		void checkIsDataBlock();
 
 	protected:
-		void initAll(boost::any valueGetter, boost::any valueSetter, boost::any arraySizeGetter, boost::any arraySizeSetter,
+		void initAll(Any valueGetter, Any valueSetter, Any arraySizeGetter, Any arraySizeSetter,
 			String mName, UINT16 mUniqueId, bool mIsVectorType, SerializableFieldType type, UINT64 flags)
 		{
 			this->valueGetter = valueGetter;

+ 5 - 5
CamelotUtility/Include/CmRTTIManagedDataBlockField.h

@@ -15,7 +15,7 @@ namespace BansheeEngine
 	 */
 	struct RTTIManagedDataBlockFieldBase : public RTTIField
 	{
-		boost::any mCustomAllocator;
+		Any mCustomAllocator;
 
 		/**
 		 * @brief	Retrieves a managed data block from the specified instance.
@@ -53,7 +53,7 @@ namespace BansheeEngine
 		 * @param	flags		Various flags you can use to specialize how systems handle this field. See "RTTIFieldFlag".
 		 * @param	customAllocator (optional) Custom allocator that will be used when de-serializing DataBlock memory.
 		 */
-		void initSingle(const String& name, UINT16 uniqueId, boost::any getter, boost::any setter, UINT64 flags, boost::any customAllocator = boost::any())
+		void initSingle(const String& name, UINT16 uniqueId, Any getter, Any setter, UINT64 flags, Any customAllocator = Any())
 		{
 			initAll(getter, setter, nullptr, nullptr, name, uniqueId, false, SerializableFT_DataBlock, flags);
 			mCustomAllocator = customAllocator;
@@ -99,7 +99,7 @@ namespace BansheeEngine
 		virtual ManagedDataBlock getValue(void* object)
 		{
 			ObjectType* castObj = static_cast<ObjectType*>(object);
-			std::function<ManagedDataBlock(ObjectType*)> f = boost::any_cast<std::function<ManagedDataBlock(ObjectType*)>>(valueGetter);
+			std::function<ManagedDataBlock(ObjectType*)> f = any_cast<std::function<ManagedDataBlock(ObjectType*)>>(valueGetter);
 			return f(castObj);
 		}
 
@@ -109,7 +109,7 @@ namespace BansheeEngine
 		virtual void setValue(void* object, ManagedDataBlock value)
 		{
 			ObjectType* castObj = static_cast<ObjectType*>(object);
-			std::function<void(ObjectType*, ManagedDataBlock)> f = boost::any_cast<std::function<void(ObjectType*, ManagedDataBlock)>>(valueSetter);
+			std::function<void(ObjectType*, ManagedDataBlock)> f = any_cast<std::function<void(ObjectType*, ManagedDataBlock)>>(valueSetter);
 			f(castObj, value);
 		}
 
@@ -123,7 +123,7 @@ namespace BansheeEngine
 			else
 			{
 				ObjectType* castObj = static_cast<ObjectType*>(object);
-				std::function<UINT8*(ObjectType*, UINT32)> f = boost::any_cast<std::function<UINT8*(ObjectType*, UINT32)>>(mCustomAllocator);
+				std::function<UINT8*(ObjectType*, UINT32)> f = any_cast<std::function<UINT8*(ObjectType*, UINT32)>>(mCustomAllocator);
 				return f(castObj, bytes);
 			}
 		}

+ 11 - 11
CamelotUtility/Include/CmRTTIPlainField.h

@@ -112,7 +112,7 @@ namespace BansheeEngine
 		 * @param	setter  	The setter method for the field. Must be a specific signature: void(ObjectType*, DataType)
 		 * @param	flags		Various flags you can use to specialize how outside systems handle this field. See "RTTIFieldFlag".
 		 */
-		void initSingle(const String& name, UINT16 uniqueId, boost::any getter, boost::any setter, UINT64 flags)
+		void initSingle(const String& name, UINT16 uniqueId, Any getter, Any setter, UINT64 flags)
 		{
 			int typeId = RTTIPlainType<DataType>::id; // Just making sure provided type has a type ID
 
@@ -137,8 +137,8 @@ namespace BansheeEngine
 		 * @param	setSize 	Setter method that allows you to resize an array. Can be null. Must be a specific signature: void(ObjectType*, UINT32)
 		 * @param	flags		Various flags you can use to specialize how outside systems handle this field. See "RTTIFieldFlag".
 		 */
-		void initArray(const String& name, UINT16 uniqueId, boost::any getter, 
-			boost::any getSize, boost::any setter, boost::any setSize, UINT64 flags)
+		void initArray(const String& name, UINT16 uniqueId, Any getter,
+			Any getSize, Any setter, Any setSize, UINT64 flags)
 		{
 			int typeId = RTTIPlainType<DataType>::id; // Just making sure provided type has a type ID
 
@@ -183,7 +183,7 @@ namespace BansheeEngine
 
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 
-			std::function<DataType&(ObjectType*)> f = boost::any_cast<std::function<DataType&(ObjectType*)>>(valueGetter);
+			std::function<DataType&(ObjectType*)> f = any_cast<std::function<DataType&(ObjectType*)>>(valueGetter);
 			DataType value = f(castObject);
 
 			return RTTIPlainType<DataType>::getDynamicSize(value);
@@ -199,7 +199,7 @@ namespace BansheeEngine
 
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 
-			std::function<DataType&(ObjectType*, UINT32)> f = boost::any_cast<std::function<DataType&(ObjectType*, UINT32)>>(valueGetter);
+			std::function<DataType&(ObjectType*, UINT32)> f = any_cast<std::function<DataType&(ObjectType*, UINT32)>>(valueGetter);
 			DataType value = f(castObject, index);
 
 			return RTTIPlainType<DataType>::getDynamicSize(value);
@@ -212,7 +212,7 @@ namespace BansheeEngine
 		{
 			checkIsArray(true);
 
-			std::function<UINT32(ObjectType*)> f = boost::any_cast<std::function<UINT32(ObjectType*)>>(arraySizeGetter);
+			std::function<UINT32(ObjectType*)> f = any_cast<std::function<UINT32(ObjectType*)>>(arraySizeGetter);
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 			return f(castObject);
 		}
@@ -230,7 +230,7 @@ namespace BansheeEngine
 					"Specified field (" + mName + ") has no array size setter.");
 			}
 
-			std::function<void(ObjectType*, UINT32)> f = boost::any_cast<std::function<void(ObjectType*, UINT32)>>(arraySizeSetter);
+			std::function<void(ObjectType*, UINT32)> f = any_cast<std::function<void(ObjectType*, UINT32)>>(arraySizeSetter);
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 			f(castObject, size);
 		}
@@ -245,7 +245,7 @@ namespace BansheeEngine
 
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 
-			std::function<DataType&(ObjectType*)> f = boost::any_cast<std::function<DataType&(ObjectType*)>>(valueGetter);
+			std::function<DataType&(ObjectType*)> f = any_cast<std::function<DataType&(ObjectType*)>>(valueGetter);
 			DataType value = f(castObject);
 
 			RTTIPlainType<DataType>::toMemory(value, (char*)buffer);
@@ -261,7 +261,7 @@ namespace BansheeEngine
 
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 
-			std::function<DataType&(ObjectType*, UINT32)> f = boost::any_cast<std::function<DataType&(ObjectType*, UINT32)>>(valueGetter);
+			std::function<DataType&(ObjectType*, UINT32)> f = any_cast<std::function<DataType&(ObjectType*, UINT32)>>(valueGetter);
 			DataType value = f(castObject, index);
 
 			RTTIPlainType<DataType>::toMemory(value, (char*)buffer);
@@ -286,7 +286,7 @@ namespace BansheeEngine
 					"Specified field (" + mName + ") has no setter.");
 			}
 
-			std::function<void(ObjectType*, DataType&)> f = boost::any_cast<std::function<void(ObjectType*, DataType&)>>(valueSetter);
+			std::function<void(ObjectType*, DataType&)> f = any_cast<std::function<void(ObjectType*, DataType&)>>(valueSetter);
 			f(castObject, value);
 		}
 
@@ -309,7 +309,7 @@ namespace BansheeEngine
 					"Specified field (" + mName + ") has no setter.");
 			}
 
-			std::function<void(ObjectType*, UINT32, DataType&)> f = boost::any_cast<std::function<void(ObjectType*, UINT32, DataType&)>>(valueSetter);
+			std::function<void(ObjectType*, UINT32, DataType&)> f = any_cast<std::function<void(ObjectType*, UINT32, DataType&)>>(valueSetter);
 			f(castObject, index, value);
 		}
 	};

+ 9 - 9
CamelotUtility/Include/CmRTTIReflectableField.h

@@ -74,7 +74,7 @@ namespace BansheeEngine
 		 * @param	setter  	The setter method for the field. Must be a specific signature: void(ObjectType*, DataType)
 		 * @param	flags		Various flags you can use to specialize how systems handle this field. See "RTTIFieldFlag".
 		 */
-		void initSingle(const String& name, UINT16 uniqueId, boost::any getter, boost::any setter, UINT64 flags)
+		void initSingle(const String& name, UINT16 uniqueId, Any getter, Any setter, UINT64 flags)
 		{
 			initAll(getter, setter, nullptr, nullptr, name, uniqueId, false, SerializableFT_Reflectable, flags);
 		}
@@ -93,8 +93,8 @@ namespace BansheeEngine
 		 * @param	setSize 	Setter method that allows you to resize an array. Must be a specific signature: void(ObjectType*, UINT32)
 		 * @param	flags		Various flags you can use to specialize how systems handle this field. See "RTTIFieldFlag".
 		 */
-		void initArray(const String& name, UINT16 uniqueId, boost::any getter, 
-			boost::any getSize, boost::any setter, boost::any setSize, UINT64 flags)
+		void initArray(const String& name, UINT16 uniqueId, Any getter,
+			Any getSize, Any setter, Any setSize, UINT64 flags)
 		{
 			initAll(getter, setter, getSize, setSize, name, uniqueId, true, SerializableFT_Reflectable, flags);
 		}
@@ -115,7 +115,7 @@ namespace BansheeEngine
 			checkIsArray(false);
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
-			std::function<DataType&(ObjectType*)> f = boost::any_cast<std::function<DataType&(ObjectType*)>>(valueGetter);
+			std::function<DataType&(ObjectType*)> f = any_cast<std::function<DataType&(ObjectType*)>>(valueGetter);
 			IReflectable& castDataType = f(castObjType);
 
 			return castDataType;
@@ -129,7 +129,7 @@ namespace BansheeEngine
 			checkIsArray(true);
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
-			std::function<DataType&(ObjectType*, UINT32)> f = boost::any_cast<std::function<DataType&(ObjectType*, UINT32)>>(valueGetter);
+			std::function<DataType&(ObjectType*, UINT32)> f = any_cast<std::function<DataType&(ObjectType*, UINT32)>>(valueGetter);
 
 			IReflectable& castDataType = f(castObjType, index);
 			return castDataType;
@@ -150,7 +150,7 @@ namespace BansheeEngine
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
 			DataType& castDataObj = static_cast<DataType&>(value);
-			std::function<void(ObjectType*, DataType&)> f = boost::any_cast<std::function<void(ObjectType*, DataType&)>>(valueSetter);
+			std::function<void(ObjectType*, DataType&)> f = any_cast<std::function<void(ObjectType*, DataType&)>>(valueSetter);
 			f(castObjType, castDataObj);
 		}
 
@@ -169,7 +169,7 @@ namespace BansheeEngine
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
 			DataType& castDataObj = static_cast<DataType&>(value);
-			std::function<void(ObjectType*, UINT32, DataType&)> f = boost::any_cast<std::function<void(ObjectType*, UINT32, DataType&)>>(valueSetter);
+			std::function<void(ObjectType*, UINT32, DataType&)> f = any_cast<std::function<void(ObjectType*, UINT32, DataType&)>>(valueSetter);
 			f(castObjType, index, castDataObj);
 		}
 
@@ -180,7 +180,7 @@ namespace BansheeEngine
 		{
 			checkIsArray(true);
 
-			std::function<UINT32(ObjectType*)> f = boost::any_cast<std::function<UINT32(ObjectType*)>>(arraySizeGetter);
+			std::function<UINT32(ObjectType*)> f = any_cast<std::function<UINT32(ObjectType*)>>(arraySizeGetter);
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 			return f(castObject);
 		}
@@ -198,7 +198,7 @@ namespace BansheeEngine
 					"Specified field (" + mName + ") has no array size setter.");
 			}
 
-			std::function<void(ObjectType*, UINT32)> f = boost::any_cast<std::function<void(ObjectType*, UINT32)>>(arraySizeSetter);
+			std::function<void(ObjectType*, UINT32)> f = any_cast<std::function<void(ObjectType*, UINT32)>>(arraySizeSetter);
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 			f(castObject, size);
 		}

+ 9 - 9
CamelotUtility/Include/CmRTTIReflectablePtrField.h

@@ -88,7 +88,7 @@ namespace BansheeEngine
 		 * @param	setter  	The setter method for the field. Must be a specific signature: void(ObjectType*, DataType*)
 		 * @param	flags		Various flags you can use to specialize how systems handle this field. See "RTTIFieldFlag".
 		 */
-		void initSingle(const String& name, UINT16 uniqueId, boost::any getter, boost::any setter, UINT64 flags)
+		void initSingle(const String& name, UINT16 uniqueId, Any getter, Any setter, UINT64 flags)
 		{
 			initAll(getter, setter, nullptr, nullptr, name, uniqueId, false, SerializableFT_ReflectablePtr, flags);
 		}
@@ -107,8 +107,8 @@ namespace BansheeEngine
 		 * @param	setSize 	Setter method that allows you to resize an array. Can be null. Must be a specific signature: void(ObjectType*, UINT32)
 		 * @param	flags		Various flags you can use to specialize how systems handle this field. See "RTTIFieldFlag".
 		 */
-		void initArray(const String& name, UINT16 uniqueId, boost::any getter, 
-			boost::any getSize, boost::any setter, boost::any setSize, UINT64 flags)
+		void initArray(const String& name, UINT16 uniqueId, Any getter,
+			Any getSize, Any setter, Any setSize, UINT64 flags)
 		{
 			initAll(getter, setter, getSize, setSize, name, uniqueId, true, SerializableFT_ReflectablePtr, flags);
 		}
@@ -129,7 +129,7 @@ namespace BansheeEngine
 			checkIsArray(false);
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
-			std::function<std::shared_ptr<DataType>(ObjectType*)> f = boost::any_cast<std::function<std::shared_ptr<DataType>(ObjectType*)>>(valueGetter);
+			std::function<std::shared_ptr<DataType>(ObjectType*)> f = any_cast<std::function<std::shared_ptr<DataType>(ObjectType*)>>(valueGetter);
 			std::shared_ptr<IReflectable> castDataType = f(castObjType);
 
 			return castDataType;
@@ -143,7 +143,7 @@ namespace BansheeEngine
 			checkIsArray(true);
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
-			std::function<std::shared_ptr<DataType>(ObjectType*, UINT32)> f = boost::any_cast<std::function<std::shared_ptr<DataType>(ObjectType*, UINT32)>>(valueGetter);
+			std::function<std::shared_ptr<DataType>(ObjectType*, UINT32)> f = any_cast<std::function<std::shared_ptr<DataType>(ObjectType*, UINT32)>>(valueGetter);
 
 			std::shared_ptr<IReflectable> castDataType = f(castObjType, index);
 			return castDataType;
@@ -164,7 +164,7 @@ namespace BansheeEngine
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
 			std::shared_ptr<DataType> castDataObj = std::static_pointer_cast<DataType>(value);
-			std::function<void(ObjectType*, std::shared_ptr<DataType>)> f = boost::any_cast<std::function<void(ObjectType*, std::shared_ptr<DataType>)>>(valueSetter);
+			std::function<void(ObjectType*, std::shared_ptr<DataType>)> f = any_cast<std::function<void(ObjectType*, std::shared_ptr<DataType>)>>(valueSetter);
 			f(castObjType, castDataObj);
 		}
 
@@ -183,7 +183,7 @@ namespace BansheeEngine
 
 			ObjectType* castObjType = static_cast<ObjectType*>(object);
 			std::shared_ptr<DataType> castDataObj = std::static_pointer_cast<DataType>(value);
-			std::function<void(ObjectType*, UINT32, std::shared_ptr<DataType>)> f = boost::any_cast<std::function<void(ObjectType*, UINT32, std::shared_ptr<DataType>)>>(valueSetter);
+			std::function<void(ObjectType*, UINT32, std::shared_ptr<DataType>)> f = any_cast<std::function<void(ObjectType*, UINT32, std::shared_ptr<DataType>)>>(valueSetter);
 			f(castObjType, index, castDataObj);
 		}
 
@@ -194,7 +194,7 @@ namespace BansheeEngine
 		{
 			checkIsArray(true);
 
-			std::function<UINT32(ObjectType*)> f = boost::any_cast<std::function<UINT32(ObjectType*)>>(arraySizeGetter);
+			std::function<UINT32(ObjectType*)> f = any_cast<std::function<UINT32(ObjectType*)>>(arraySizeGetter);
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 			return f(castObject);
 		}
@@ -212,7 +212,7 @@ namespace BansheeEngine
 					"Specified field (" + mName + ") has no array size setter.");
 			}
 
-			std::function<void(ObjectType*, UINT32)> f = boost::any_cast<std::function<void(ObjectType*, UINT32)>>(arraySizeSetter);
+			std::function<void(ObjectType*, UINT32)> f = any_cast<std::function<void(ObjectType*, UINT32)>>(arraySizeSetter);
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 			f(castObject, size);
 		}

+ 11 - 12
CamelotUtility/Include/CmRTTIType.h

@@ -4,8 +4,6 @@
 #include <algorithm>
 #include <unordered_map>
 
-#include <boost/preprocessor/punctuation/comma.hpp>
-
 #include "CmPrerequisitesUtil.h"
 #include "CmManagedDataBlock.h"
 #include "CmRTTIField.h"
@@ -901,7 +899,7 @@ namespace BansheeEngine
 
 	private:
 		template<class ObjectType, class DataType>
-		void addPlainField(const String& name, UINT32 uniqueId, boost::any getter, boost::any setter, UINT64 flags)
+		void addPlainField(const String& name, UINT32 uniqueId, Any getter, Any setter, UINT64 flags)
 		{
 			RTTIPlainField<DataType, ObjectType>* newField = 
 				cm_new<RTTIPlainField<DataType, ObjectType>>();
@@ -910,7 +908,7 @@ namespace BansheeEngine
 		}
 		
 		template<class ObjectType, class DataType>
-		void addReflectableField(const String& name, UINT32 uniqueId, boost::any getter, boost::any setter, UINT64 flags)
+		void addReflectableField(const String& name, UINT32 uniqueId, Any getter, Any setter, UINT64 flags)
 		{
 			static_assert((std::is_base_of<BansheeEngine::IReflectable, DataType>::value), 
 				"Invalid data type for complex field. It needs to derive from BansheeEngine::IReflectable.");
@@ -922,7 +920,7 @@ namespace BansheeEngine
 		}
 
 		template<class ObjectType, class DataType>
-		void addReflectablePtrField(const String& name, UINT32 uniqueId, boost::any getter, boost::any setter, UINT64 flags)
+		void addReflectablePtrField(const String& name, UINT32 uniqueId, Any getter, Any setter, UINT64 flags)
 		{
 			static_assert((std::is_base_of<BansheeEngine::IReflectable, DataType>::value), 
 				"Invalid data type for complex field. It needs to derive from BansheeEngine::IReflectable.");
@@ -937,8 +935,8 @@ namespace BansheeEngine
 		}
 
 		template<class ObjectType, class DataType>
-		void addPlainArrayField(const String& name, UINT32 uniqueId, boost::any getter, boost::any getSize, 
-			boost::any setter, boost::any setSize, UINT64 flags)
+		void addPlainArrayField(const String& name, UINT32 uniqueId, Any getter, Any getSize,
+			Any setter, Any setSize, UINT64 flags)
 		{
 			RTTIPlainField<DataType, ObjectType>* newField = 
 				cm_new<RTTIPlainField<DataType, ObjectType>>();
@@ -947,8 +945,8 @@ namespace BansheeEngine
 		}	
 
 		template<class ObjectType, class DataType>
-		void addReflectableArrayField(const String& name, UINT32 uniqueId, boost::any getter, boost::any getSize, 
-			boost::any setter, boost::any setSize, UINT64 flags)
+		void addReflectableArrayField(const String& name, UINT32 uniqueId, Any getter, Any getSize,
+			Any setter, Any setSize, UINT64 flags)
 		{
 			static_assert((std::is_base_of<BansheeEngine::IReflectable, DataType>::value), 
 				"Invalid data type for complex field. It needs to derive from BansheeEngine::IReflectable.");
@@ -960,8 +958,8 @@ namespace BansheeEngine
 		}
 
 		template<class ObjectType, class DataType>
-		void addReflectablePtrArrayField(const String& name, UINT32 uniqueId, boost::any getter, boost::any getSize, 
-			boost::any setter, boost::any setSize, UINT64 flags)
+		void addReflectablePtrArrayField(const String& name, UINT32 uniqueId, Any getter, Any getSize,
+			Any setter, Any setSize, UINT64 flags)
 		{
 			static_assert((std::is_base_of<BansheeEngine::IReflectable, DataType>::value), 
 				"Invalid data type for complex field. It needs to derive from BansheeEngine::IReflectable.");
@@ -976,7 +974,8 @@ namespace BansheeEngine
 		}
 
 		template<class ObjectType>
-		void addDataBlockField(const String& name, UINT32 uniqueId, boost::any getter, boost::any setter, UINT64 flags, boost::any customAllocator = boost::any())
+		void addDataBlockField(const String& name, UINT32 uniqueId, Any getter, Any setter, UINT64 flags, 
+			Any customAllocator = Any())
 		{
 			RTTIManagedDataBlockField<ManagedDataBlock, ObjectType>* newField = 
 				cm_new<RTTIManagedDataBlockField<ManagedDataBlock, ObjectType>>();

+ 1 - 1
CamelotUtility/Source/CmAsyncOp.cpp

@@ -2,7 +2,7 @@
 
 namespace BansheeEngine
 {
-	void AsyncOp::_completeOperation(boost::any returnValue) 
+	void AsyncOp::_completeOperation(Any returnValue) 
 	{ 
 		mData->mReturnValue = returnValue; 
 		mData->mIsCompleted = true; 

+ 2 - 2
SBansheeEngine/Include/BsManagedComponentRTTI.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 
 		ManagedSerializableObjectPtr getObjectData(ManagedComponent* obj)
 		{
-			return boost::any_cast<ManagedSerializableObjectPtr>(obj->mRTTIData);
+			return any_cast<ManagedSerializableObjectPtr>(obj->mRTTIData);
 		}
 
 		void setObjectData(ManagedComponent* obj, ManagedSerializableObjectPtr val)
@@ -67,7 +67,7 @@ namespace BansheeEngine
 
 		static void finalizeDeserialization(ManagedComponent* mc)
 		{
-			ManagedSerializableObjectPtr serializableObject = boost::any_cast<ManagedSerializableObjectPtr>(mc->mRTTIData);
+			ManagedSerializableObjectPtr serializableObject = any_cast<ManagedSerializableObjectPtr>(mc->mRTTIData);
 
 			::MonoClass* monoClass = mono_object_get_class(serializableObject->getManagedInstance());
 			MonoType* monoType = mono_class_get_type(monoClass);