Преглед изворни кода

More fixes in order to get everything to compile with Clang

BearishSun пре 9 година
родитељ
комит
855b052658
100 измењених фајлова са 754 додато и 715 уклоњено
  1. 2 2
      Source/BansheeCore/Include/BsParamBlocks.h
  2. 11 11
      Source/BansheeCore/Source/BsProfilerCPU.cpp
  3. 1 1
      Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderAPIFactory.h
  4. 2 0
      Source/BansheeD3D11RenderAPI/Source/BsD3D11RenderAPIFactory.cpp
  5. 1 1
      Source/BansheeD3D9RenderAPI/Include/BsD3D9RenderAPIFactory.h
  6. 2 0
      Source/BansheeD3D9RenderAPI/Source/BsD3D9RenderAPIFactory.cpp
  7. 366 366
      Source/BansheeEditor/Source/Win32/BsVSCodeEditor.cpp
  8. 1 1
      Source/BansheeEngine/Source/BsGUIInputTool.cpp
  9. 2 0
      Source/BansheeEngine/Source/BsLight.cpp
  10. 2 3
      Source/BansheeFBXImporter/Source/BsFBXImporter.cpp
  11. 0 1
      Source/BansheeFreeImgImporter/Source/BsFreeImgImporter.cpp
  12. 78 52
      Source/BansheeMono/Include/BsMonoArray.h
  13. 2 3
      Source/BansheeMono/Include/BsMonoAssembly.h
  14. 2 2
      Source/BansheeMono/Include/BsMonoClass.h
  15. 35 32
      Source/BansheeMono/Source/BsMonoArray.cpp
  16. 4 4
      Source/BansheeMono/Source/BsMonoAssembly.cpp
  17. 4 4
      Source/BansheeMono/Source/BsMonoClass.cpp
  18. 4 2
      Source/BansheeMono/Source/BsMonoManager.cpp
  19. 1 1
      Source/BansheeMono/Source/BsScriptMeta.cpp
  20. 4 11
      Source/BansheeOISInput/Source/BsInputHandlerOIS.cpp
  21. 1 1
      Source/BansheeSL/Include/BsSLPrerequisites.h
  22. 0 2
      Source/BansheeSL/Source/BsASTFX.c
  23. 2 0
      Source/BansheeSL/Source/BsSLPlugin.cpp
  24. 1 1
      Source/RenderBeast/Include/BsRenderBeastFactory.h
  25. 2 0
      Source/RenderBeast/Include/BsRenderBeastOptions.h
  26. 2 5
      Source/RenderBeast/Source/BsRenderBeast.cpp
  27. 4 1
      Source/RenderBeast/Source/BsRenderBeastFactory.cpp
  28. 1 1
      Source/RenderBeast/Source/BsRenderTargets.cpp
  29. 1 1
      Source/RenderBeast/Source/BsRenderTexturePool.cpp
  30. 0 1
      Source/SBansheeEditor/Include/BsScriptGUIColorField.h
  31. 1 7
      Source/SBansheeEditor/Source/BsScriptGUIColorField.cpp
  32. 1 1
      Source/SBansheeEditor/Source/BsScriptGUIEnumField.cpp
  33. 1 7
      Source/SBansheeEditor/Source/BsScriptGUIFloatField.cpp
  34. 2 10
      Source/SBansheeEditor/Source/BsScriptGUIGameObjectField.cpp
  35. 1 7
      Source/SBansheeEditor/Source/BsScriptGUIIntField.cpp
  36. 1 2
      Source/SBansheeEditor/Source/BsScriptGUIListBoxField.cpp
  37. 0 6
      Source/SBansheeEditor/Source/BsScriptGUIResourceField.cpp
  38. 26 0
      Source/SBansheeEngine/Include/BsManagedSerializableField.h
  39. 2 0
      Source/SBansheeEngine/Include/BsManagedSerializableObjectInfoRTTI.h
  40. 2 2
      Source/SBansheeEngine/Include/BsScriptCollider.h
  41. 2 0
      Source/SBansheeEngine/Include/BsScriptEnginePrerequisites.h
  42. 2 3
      Source/SBansheeEngine/Include/BsScriptFont.h
  43. 4 4
      Source/SBansheeEngine/Include/BsScriptGUIElement.h
  44. 0 3
      Source/SBansheeEngine/Include/BsScriptGUIElementStyle.h
  45. 3 3
      Source/SBansheeEngine/Include/BsScriptGUISkin.h
  46. 2 2
      Source/SBansheeEngine/Include/BsScriptJoint.h
  47. 3 3
      Source/SBansheeEngine/Include/BsScriptManagedResource.h
  48. 3 3
      Source/SBansheeEngine/Include/BsScriptMaterial.h
  49. 3 3
      Source/SBansheeEngine/Include/BsScriptMesh.h
  50. 11 13
      Source/SBansheeEngine/Include/BsScriptObject.h
  51. 3 3
      Source/SBansheeEngine/Include/BsScriptPhysicsMaterial.h
  52. 3 3
      Source/SBansheeEngine/Include/BsScriptPhysicsMesh.h
  53. 3 3
      Source/SBansheeEngine/Include/BsScriptPlainText.h
  54. 3 3
      Source/SBansheeEngine/Include/BsScriptPrefab.h
  55. 4 4
      Source/SBansheeEngine/Include/BsScriptResource.h
  56. 38 25
      Source/SBansheeEngine/Include/BsScriptResourceManager.h
  57. 3 3
      Source/SBansheeEngine/Include/BsScriptScriptCode.h
  58. 3 3
      Source/SBansheeEngine/Include/BsScriptShader.h
  59. 3 3
      Source/SBansheeEngine/Include/BsScriptShaderInclude.h
  60. 3 3
      Source/SBansheeEngine/Include/BsScriptSpriteTexture.h
  61. 3 3
      Source/SBansheeEngine/Include/BsScriptStringTable.h
  62. 3 3
      Source/SBansheeEngine/Include/BsScriptTexture2D.h
  63. 3 3
      Source/SBansheeEngine/Include/BsScriptTexture3D.h
  64. 3 3
      Source/SBansheeEngine/Include/BsScriptTextureCube.h
  65. 9 8
      Source/SBansheeEngine/Source/BsManagedComponent.cpp
  66. 4 3
      Source/SBansheeEngine/Source/BsManagedSerializableArray.cpp
  67. 7 5
      Source/SBansheeEngine/Source/BsManagedSerializableDictionary.cpp
  68. 2 2
      Source/SBansheeEngine/Source/BsManagedSerializableField.cpp
  69. 4 4
      Source/SBansheeEngine/Source/BsManagedSerializableList.cpp
  70. 1 1
      Source/SBansheeEngine/Source/BsManagedSerializableObject.cpp
  71. 3 1
      Source/SBansheeEngine/Source/BsManagedSerializableObjectInfo.cpp
  72. 2 0
      Source/SBansheeEngine/Source/BsPlayInEditorManager.cpp
  73. 4 4
      Source/SBansheeEngine/Source/BsScriptAssemblyManager.cpp
  74. 1 1
      Source/SBansheeEngine/Source/BsScriptAsyncOp.cpp
  75. 1 1
      Source/SBansheeEngine/Source/BsScriptBoxCollider.cpp
  76. 1 1
      Source/SBansheeEngine/Source/BsScriptCamera.cpp
  77. 1 1
      Source/SBansheeEngine/Source/BsScriptCapsuleCollider.cpp
  78. 1 2
      Source/SBansheeEngine/Source/BsScriptCharacterController.cpp
  79. 1 1
      Source/SBansheeEngine/Source/BsScriptComponent.cpp
  80. 1 1
      Source/SBansheeEngine/Source/BsScriptContextMenu.cpp
  81. 1 1
      Source/SBansheeEngine/Source/BsScriptD6Joint.cpp
  82. 1 1
      Source/SBansheeEngine/Source/BsScriptDistanceJoint.cpp
  83. 1 1
      Source/SBansheeEngine/Source/BsScriptFixedJoint.cpp
  84. 1 1
      Source/SBansheeEngine/Source/BsScriptFontBitmap.cpp
  85. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIButton.cpp
  86. 2 2
      Source/SBansheeEngine/Source/BsScriptGUIElementStyle.cpp
  87. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIFixedSpace.cpp
  88. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIFlexibleSpace.cpp
  89. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIInputBox.cpp
  90. 1 1
      Source/SBansheeEngine/Source/BsScriptGUILabel.cpp
  91. 4 4
      Source/SBansheeEngine/Source/BsScriptGUILayout.cpp
  92. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIListBox.cpp
  93. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIProgressBar.cpp
  94. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIRenderTexture.cpp
  95. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIScrollArea.cpp
  96. 2 2
      Source/SBansheeEngine/Source/BsScriptGUISlider.cpp
  97. 1 1
      Source/SBansheeEngine/Source/BsScriptGUITexture.cpp
  98. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIToggle.cpp
  99. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIToggleGroup.cpp
  100. 1 1
      Source/SBansheeEngine/Source/BsScriptGUIWidget.cpp

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

@@ -60,7 +60,7 @@ namespace BansheeEngine
 		struct META_NextEntry_##Name {};																					\
 		static void META_GetPrevEntries(Vector<GpuParamDataDesc>& params, META_NextEntry_##Name id)							\
 		{																													\
-			META_GetPrevEntries(params, META_Entry_##Name##());																\
+			META_GetPrevEntries(params, META_Entry_##Name());																\
 																															\
 			params.push_back(GpuParamDataDesc());																			\
 			GpuParamDataDesc& newEntry = params.back();																		\
@@ -71,7 +71,7 @@ namespace BansheeEngine
 																															\
 		void META_InitPrevEntry(const SPtr<GpuParamsCore>& params, META_NextEntry_##Name id)								\
 		{																													\
-			META_InitPrevEntry(params, META_Entry_##Name##());																\
+			META_InitPrevEntry(params, META_Entry_##Name());																\
 			params->getParam(#Name, Name);																					\
 		}																													\
 																															\

+ 11 - 11
Source/BansheeCore/Source/BsProfilerCPU.cpp

@@ -4,13 +4,13 @@
 #include "BsDebug.h"
 #include "BsPlatform.h"
 
-//#if BS_COMPILER == BS_COMPILER_GNUC || BS_COMPILER == BS_COMPILER_CLANG
-//	#include "cpuid.h"
-//#endif
-//
-//#if BS_COMPILER == BS_COMPILER_CLANG
-//	#include "intrin.h"
-//#endif
+#if BS_COMPILER == BS_COMPILER_GNUC || BS_COMPILER == BS_COMPILER_CLANG
+	#include "cpuid.h"
+#endif
+
+#if BS_COMPILER == BS_COMPILER_CLANG
+	#include "intrin.h"
+#endif
 
 namespace BansheeEngine
 {
@@ -76,10 +76,10 @@ namespace BansheeEngine
 		return x;
 #endif
 #elif BS_COMPILER == BS_COMPILER_CLANG
-		//UINT32 a = 0;
-		//UINT32 b[4];
-		//__get_cpuid(a, &b[0], &b[1], &b[2], &b[3]);
-		return 0; // __rdtsc();
+		UINT32 a = 0;
+		UINT32 b[4];
+		__get_cpuid(a, &b[0], &b[1], &b[2], &b[3]);
+		return __rdtsc();
 #elif BS_COMPILER == BS_COMPILER_MSVC
 		int a[4];
 		int b = 0;

+ 1 - 1
Source/BansheeD3D11RenderAPI/Include/BsD3D11RenderAPIFactory.h

@@ -13,7 +13,7 @@ namespace BansheeEngine
 	 *  @{
 	 */
 
-	const char* SystemName = "BansheeD3D11RenderSystem";
+	extern const char* SystemName;
 
 	/**	Handles creation of the DX11 render system. */
 	class D3D11RenderAPIFactory : public RenderAPIFactory

+ 2 - 0
Source/BansheeD3D11RenderAPI/Source/BsD3D11RenderAPIFactory.cpp

@@ -5,6 +5,8 @@
 
 namespace BansheeEngine
 {
+	const char* SystemName = "BansheeD3D11RenderSystem";
+
 	void D3D11RenderAPIFactory::create()
 	{
 		RenderAPICore::startUp<D3D11RenderAPI>();

+ 1 - 1
Source/BansheeD3D9RenderAPI/Include/BsD3D9RenderAPIFactory.h

@@ -13,7 +13,7 @@ namespace BansheeEngine
 	 *  @{
 	 */
 
-	const char* SystemName = "BansheeD3D9RenderSystem";
+	extern const char* SystemName;
 
 	/**	Handles creation of the DX9 render system. */
 	class D3D9RenderAPIFactory : public RenderAPIFactory

+ 2 - 0
Source/BansheeD3D9RenderAPI/Source/BsD3D9RenderAPIFactory.cpp

@@ -5,6 +5,8 @@
 
 namespace BansheeEngine
 {
+	const char* SystemName = "BansheeD3D9RenderSystem";
+
 	void D3D9RenderAPIFactory::create()
 	{
 	#ifdef BS_STATIC_LIB

+ 366 - 366
Source/BansheeEditor/Source/Win32/BsVSCodeEditor.cpp

@@ -7,9 +7,9 @@
 #include "BsDataStream.h"
 
 // Import EnvDTE
-//#pragma warning(disable: 4278)
-//#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("8.0") lcid("0") raw_interfaces_only named_guids
-//#pragma warning(default: 4278)
+#pragma warning(disable: 4278)
+#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("8.0") lcid("0") raw_interfaces_only named_guids
+#pragma warning(default: 4278)
 
 namespace BansheeEngine
 {
@@ -46,366 +46,366 @@ namespace BansheeEngine
 	 * Handles retrying of calls that fail to access Visual Studio. This is due to the weird nature of VS when calling its
 	 * methods from external code. If this message filter isn't registered some calls will just fail silently.
 	 */
-	//class VSMessageFilter : public IMessageFilter
-	//{
-	//	DWORD __stdcall HandleInComingCall(DWORD dwCallType, HTASK htaskCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo) override
-	//	{
-	//		return SERVERCALL_ISHANDLED;
-	//	}
-
-	//	DWORD __stdcall RetryRejectedCall(HTASK htaskCallee, DWORD dwTickCount, DWORD dwRejectType) override
-	//	{
-	//		if (dwRejectType == SERVERCALL_RETRYLATER)
-	//		{
-	//			// Retry immediatey
-	//			return 99;
-	//		}
-	//		// Cancel the call
-	//		return -1;
-	//	}
-
-	//	DWORD __stdcall MessagePending(HTASK htaskCallee, DWORD dwTickCount, DWORD dwPendingType) override
-	//	{
-	//		return PENDINGMSG_WAITDEFPROCESS;
-	//	}
-
-	//	/**	COM requirement. Returns instance of an interface of provided type. */
-	//	HRESULT __stdcall QueryInterface(REFIID iid, void** ppvObject) override
-	//	{
-	//		if(iid == IID_IDropTarget || iid == IID_IUnknown)
-	//		{
-	//			AddRef();
-	//			*ppvObject = this;
-	//			return S_OK;
-	//		}
-	//		else
-	//		{
-	//			*ppvObject = nullptr;
-	//			return E_NOINTERFACE;
-	//		}
-	//	}
-
-	//	/** COM requirement. Increments objects reference count. */
-	//	ULONG __stdcall AddRef() override
-	//	{
-	//		return InterlockedIncrement(&mRefCount);
-	//	} 
-
-	//	/**	COM requirement. Decreases the objects reference count and deletes the object if its zero. */
-	//	ULONG __stdcall Release() override
-	//	{
-	//		LONG count = InterlockedDecrement(&mRefCount);
-
-	//		if(count == 0)
-	//		{
-	//			bs_delete(this);
-	//			return 0;
-	//		}
-	//		else
-	//		{
-	//			return count;
-	//		}
-	//	} 
-
-	//private:
-	//	LONG mRefCount;
-	//};
+	class VSMessageFilter : public IMessageFilter
+	{
+		DWORD __stdcall HandleInComingCall(DWORD dwCallType, HTASK htaskCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo) override
+		{
+			return SERVERCALL_ISHANDLED;
+		}
+
+		DWORD __stdcall RetryRejectedCall(HTASK htaskCallee, DWORD dwTickCount, DWORD dwRejectType) override
+		{
+			if (dwRejectType == SERVERCALL_RETRYLATER)
+			{
+				// Retry immediatey
+				return 99;
+			}
+			// Cancel the call
+			return -1;
+		}
+
+		DWORD __stdcall MessagePending(HTASK htaskCallee, DWORD dwTickCount, DWORD dwPendingType) override
+		{
+			return PENDINGMSG_WAITDEFPROCESS;
+		}
+
+		/**	COM requirement. Returns instance of an interface of provided type. */
+		HRESULT __stdcall QueryInterface(REFIID iid, void** ppvObject) override
+		{
+			if(iid == IID_IDropTarget || iid == IID_IUnknown)
+			{
+				AddRef();
+				*ppvObject = this;
+				return S_OK;
+			}
+			else
+			{
+				*ppvObject = nullptr;
+				return E_NOINTERFACE;
+			}
+		}
+
+		/** COM requirement. Increments objects reference count. */
+		ULONG __stdcall AddRef() override
+		{
+			return InterlockedIncrement(&mRefCount);
+		} 
+
+		/**	COM requirement. Decreases the objects reference count and deletes the object if its zero. */
+		ULONG __stdcall Release() override
+		{
+			LONG count = InterlockedDecrement(&mRefCount);
+
+			if(count == 0)
+			{
+				bs_delete(this);
+				return 0;
+			}
+			else
+			{
+				return count;
+			}
+		} 
+
+	private:
+		LONG mRefCount;
+	};
 
 	/** Contains various helper classes for interacting with a Visual Studio instance running on this machine. */
-	//class VisualStudio
-	//{
-	//private:
-	//	static const String SLN_TEMPLATE; /**< Template text used for a solution file. */
-	//	static const String PROJ_ENTRY_TEMPLATE; /**< Template text used for a project entry in a solution file. */
-	//	static const String PROJ_PLATFORM_TEMPLATE; /**< Template text used for platform specific information for a project entry in a solution file. */
-
-	//	static const String PROJ_TEMPLATE; /**< Template XML used for a project file. */
-	//	static const String REFERENCE_ENTRY_TEMPLATE; /**< Template XML used for a reference to another assembly entry by name. */
-	//	static const String REFERENCE_PROJECT_ENTRY_TEMPLATE; /**< Template XML used for a reference to another project entry. */
-	//	static const String REFERENCE_PATH_ENTRY_TEMPLATE; /**< Template XML used for a reference to another assembly entry by name and path. */
-	//	static const String CODE_ENTRY_TEMPLATE; /**< Template XML used for a single code file entry in a project. */
-	//	static const String NON_CODE_ENTRY_TEMPLATE; /**< Template XML used for a single non-code file entry in a project. */
-
-	//public:
-	//	/**
-	//	 * Scans the running processes to find a running Visual Studio instance with the specified version and open solution.
-	//	 *
-	//	 * @param[in]	clsID			Class ID of the specific Visual Studio version we are looking for.
-	//	 * @param[in]	solutionPath	Path to the solution the instance needs to have open.
-	//	 * @return						DTE object that may be used to interact with the Visual Studio instance, or null if
-	//	 *								not found.
-	//	 */
-	//	static CComPtr<EnvDTE::_DTE> findRunningInstance(const CLSID& clsID, const Path& solutionPath)
-	//	{
-	//		CComPtr<IRunningObjectTable> runningObjectTable = nullptr;
-	//		if (FAILED(GetRunningObjectTable(0, &runningObjectTable)))
-	//			return nullptr;
-
-	//		CComPtr<IEnumMoniker> enumMoniker = nullptr;
-	//		if (FAILED(runningObjectTable->EnumRunning(&enumMoniker)))
-	//			return nullptr;
-
-	//		CComPtr<IMoniker> dteMoniker = nullptr;
-	//		if (FAILED(CreateClassMoniker(clsID, &dteMoniker)))
-	//			return nullptr;
-
-	//		CComBSTR bstrSolution(solutionPath.toWString(Path::PathType::Windows).c_str());
-	//		CComPtr<IMoniker> moniker;
-	//		ULONG count = 0;
-	//		while (enumMoniker->Next(1, &moniker, &count) == S_OK)
-	//		{
-	//			if (moniker->IsEqual(dteMoniker))
-	//			{
-	//				CComPtr<IUnknown> curObject = nullptr;
-	//				HRESULT result = runningObjectTable->GetObject(moniker, &curObject);
-	//				moniker = nullptr;
-
-	//				if (result != S_OK)
-	//					continue;
-
-	//				CComPtr<EnvDTE::_DTE> dte;
-	//				curObject->QueryInterface(__uuidof(EnvDTE::_DTE), (void**)&dte);
-
-	//				if (dte == nullptr)
-	//					continue;
-
-	//				CComPtr<EnvDTE::_Solution> solution;
-	//				if (FAILED(dte->get_Solution(&solution)))
-	//					continue;
-
-	//				CComBSTR fullName;
-	//				if (FAILED(solution->get_FullName(&fullName)))
-	//					continue;
-
-	//				if (fullName == bstrSolution)
-	//					return dte;
-	//			}
-	//		}
-
-	//		return nullptr;
-	//	}
-
-	//	/**
-	//	 * Opens a new Visual Studio instance of the specified version with the provided solution.
-	//	 *
-	//	 * @param[in]	clsID			Class ID of the specific Visual Studio version to start.
-	//	 * @param[in]	solutionPath	Path to the solution the instance needs to open.
-	//	 */
-	//	static CComPtr<EnvDTE::_DTE> openInstance(const CLSID& clsid, const Path& solutionPath)
-	//	{
-	//		CComPtr<IUnknown> newInstance = nullptr;
-	//		if (FAILED(::CoCreateInstance(clsid, nullptr, CLSCTX_LOCAL_SERVER, EnvDTE::IID__DTE, (LPVOID*)&newInstance)))
-	//			return nullptr;
-
-	//		CComPtr<EnvDTE::_DTE> dte;
-	//		newInstance->QueryInterface(__uuidof(EnvDTE::_DTE), (void**)&dte);
-
-	//		if (dte == nullptr)
-	//			return nullptr;
-
-	//		dte->put_UserControl(TRUE);
-
-	//		CComPtr<EnvDTE::_Solution> solution;
-	//		if (FAILED(dte->get_Solution(&solution)))
-	//			return nullptr;
-
-	//		CComBSTR bstrSolution(solutionPath.toWString(Path::PathType::Windows).c_str());
-	//		if (FAILED(solution->Open(bstrSolution)))
-	//			return nullptr;
-
-	//		// Wait until VS opens
-	//		UINT32 elapsed = 0;
-	//		while (elapsed < 10000)
-	//		{
-	//			EnvDTE::Window* window = nullptr;
-	//			if (SUCCEEDED(dte->get_MainWindow(&window)))
-	//				return dte;
-
-	//			Sleep(100);
-	//			elapsed += 100;
-	//		}
-
-	//		return nullptr;
-	//	}
-
-	//	/**
-	//	 * Opens a file on a specific line in a running Visual Studio instance.
-	//	 *
-	//	 * @param[in]	dte			DTE object retrieved from findRunningInstance() or openInstance().
-	//	 * @param[in]	filePath	Path of the file to open. File should be a part of the VS solution.
-	//	 * @param[in]	line		Line on which to focus Visual Studio after the file is open.
-	//	 */
-	//	static bool openFile(CComPtr<EnvDTE::_DTE> dte, const Path& filePath, UINT32 line)
-	//	{
-	//		// Open file
-	//		CComPtr<EnvDTE::ItemOperations> itemOperations;
-	//		if (FAILED(dte->get_ItemOperations(&itemOperations)))
-	//			return false;
-
-	//		CComBSTR bstrFilePath(filePath.toWString(Path::PathType::Windows).c_str());
-	//		CComBSTR bstrKind(EnvDTE::vsViewKindPrimary);
-	//		CComPtr<EnvDTE::Window> window = nullptr;
-	//		if (FAILED(itemOperations->OpenFile(bstrFilePath, bstrKind, &window)))
-	//			return false;
-
-	//		// Scroll to line
-	//		CComPtr<EnvDTE::Document> activeDocument;
-	//		if (SUCCEEDED(dte->get_ActiveDocument(&activeDocument)))
-	//		{
-	//			CComPtr<IDispatch> selection;
-	//			if (SUCCEEDED(activeDocument->get_Selection(&selection)))
-	//			{
-	//				CComPtr<EnvDTE::TextSelection> textSelection;
-	//				if (SUCCEEDED(selection->QueryInterface(&textSelection)))
-	//				{
-	//					textSelection->GotoLine(line, TRUE);
-	//				}
-	//			}
-	//		}
-
-	//		// Bring the window in focus
-	//		window = nullptr;
-	//		if (SUCCEEDED(dte->get_MainWindow(&window)))
-	//		{
-	//			window->Activate();
-
-	//			HWND hWnd;
-	//			window->get_HWnd((LONG*)&hWnd);
-	//			SetForegroundWindow(hWnd);
-	//		}
-
-	//		return true;
-	//	}
-
-	//	/**	Generates a Visual Studio project GUID from the project name. */
-	//	static String getProjectGUID(const WString& projectName)
-	//	{
-	//		static const String guidTemplate = "{0}-{1}-{2}-{3}-{4}";
-	//		String hash = md5(projectName);
-
-	//		String output = StringUtil::format(guidTemplate, hash.substr(0, 8),
-	//			hash.substr(8, 4), hash.substr(12, 4), hash.substr(16, 4), hash.substr(20, 12));
-	//		StringUtil::toUpperCase(output);
-
-	//		return output;
-	//	}
-
-	//	/**
-	//	 * Builds the Visual Studio solution text (.sln) for the provided version, using the provided solution data.
-	//	 *
-	//	 * @param[in]	version	Visual Studio version for which we're generating the solution file.
-	//	 * @param[in]	data	Data containing a list of projects and other information required to build the solution text.
-	//	 * @return				Generated text of the solution file.
-	//	 */
-	//	static String writeSolution(VisualStudioVersion version, const CodeSolutionData& data)
-	//	{
-	//		struct VersionData
-	//		{
-	//			String formatVersion;
-	//		};
-
-	//		Map<VisualStudioVersion, VersionData> versionData =
-	//		{
-	//			{ VisualStudioVersion::VS2008, { "10.00" } },
-	//			{ VisualStudioVersion::VS2010, { "11.00" } },
-	//			{ VisualStudioVersion::VS2012, { "12.00" } },
-	//			{ VisualStudioVersion::VS2013, { "12.00" } },
-	//			{ VisualStudioVersion::VS2015, { "12.00" } }
-	//		};
-
-	//		StringStream projectEntriesStream;
-	//		StringStream projectPlatformsStream;
-	//		for (auto& project : data.projects)
-	//		{
-	//			String guid = getProjectGUID(project.name);
-	//			String projectName = toString(project.name);
-
-	//			projectEntriesStream << StringUtil::format(PROJ_ENTRY_TEMPLATE, projectName, projectName + ".csproj", guid);
-	//			projectPlatformsStream << StringUtil::format(PROJ_PLATFORM_TEMPLATE, guid);
-	//		}
-
-	//		String projectEntries = projectEntriesStream.str();
-	//		String projectPlatforms = projectPlatformsStream.str();
-
-	//		return StringUtil::format(SLN_TEMPLATE, versionData[version].formatVersion, projectEntries, projectPlatforms);
-	//	}
-
-	//	/**
-	//	 * Builds the Visual Studio project text (.csproj) for the provided version, using the provided project data.
-	//	 *
-	//	 * @param[in]	version		Visual Studio version for which we're generating the project file.
-	//	 * @param[in]	projectData	Data containing a list of files, references and other information required to 
-	//	 *							build the project text.
-	//	 * @return					Generated text of the project file.
-	//	 */
-	//	static String writeProject(VisualStudioVersion version, const CodeProjectData& projectData)
-	//	{
-	//		struct VersionData
-	//		{
-	//			String toolsVersion;
-	//		};
-
-	//		Map<VisualStudioVersion, VersionData> versionData =
-	//		{
-	//			{ VisualStudioVersion::VS2008, { "3.5" } },
-	//			{ VisualStudioVersion::VS2010, { "4.0" } },
-	//			{ VisualStudioVersion::VS2012, { "4.0" } },
-	//			{ VisualStudioVersion::VS2013, { "12.0" } },
-	//			{ VisualStudioVersion::VS2015, { "13.0" } }
-	//		};
-
-	//		StringStream tempStream;
-	//		for (auto& codeEntry : projectData.codeFiles)
-	//			tempStream << StringUtil::format(CODE_ENTRY_TEMPLATE, codeEntry.toString());
-
-	//		String codeEntries = tempStream.str();
-	//		tempStream.str("");
-	//		tempStream.clear();
-
-	//		for (auto& nonCodeEntry : projectData.nonCodeFiles)
-	//			tempStream << StringUtil::format(NON_CODE_ENTRY_TEMPLATE, nonCodeEntry.toString());
-
-	//		String nonCodeEntries = tempStream.str();
-	//		tempStream.str("");
-	//		tempStream.clear();
-
-	//		for (auto& referenceEntry : projectData.assemblyReferences)
-	//		{
-	//			String referenceName = toString(referenceEntry.name);
-
-	//			if (referenceEntry.path.isEmpty())
-	//				tempStream << StringUtil::format(REFERENCE_ENTRY_TEMPLATE, referenceName);
-	//			else
-	//				tempStream << StringUtil::format(REFERENCE_PATH_ENTRY_TEMPLATE, referenceName, referenceEntry.path.toString());
-	//		}
-
-	//		String referenceEntries = tempStream.str();
-	//		tempStream.str("");
-	//		tempStream.clear();
-
-	//		for (auto& referenceEntry : projectData.projectReferences)
-	//		{
-	//			String referenceName = toString(referenceEntry.name);
-	//			String projectGUID = getProjectGUID(referenceEntry.name);
-
-	//			tempStream << StringUtil::format(REFERENCE_PROJECT_ENTRY_TEMPLATE, referenceName, projectGUID);
-	//		}
-
-	//		String projectReferenceEntries = tempStream.str();
-	//		tempStream.str("");
-	//		tempStream.clear();
-
-	//		tempStream << toString(projectData.defines);
-
-	//		String defines = tempStream.str();
-	//		String projectGUID = getProjectGUID(projectData.name);
-
-	//		return StringUtil::format(PROJ_TEMPLATE, versionData[version].toolsVersion, projectGUID, 
-	//			toString(projectData.name), defines, referenceEntries, projectReferenceEntries, codeEntries, nonCodeEntries);
-	//	}
-	//};
-
-	/*const String VisualStudio::SLN_TEMPLATE =
+	class VisualStudio
+	{
+	private:
+		static const String SLN_TEMPLATE; /**< Template text used for a solution file. */
+		static const String PROJ_ENTRY_TEMPLATE; /**< Template text used for a project entry in a solution file. */
+		static const String PROJ_PLATFORM_TEMPLATE; /**< Template text used for platform specific information for a project entry in a solution file. */
+
+		static const String PROJ_TEMPLATE; /**< Template XML used for a project file. */
+		static const String REFERENCE_ENTRY_TEMPLATE; /**< Template XML used for a reference to another assembly entry by name. */
+		static const String REFERENCE_PROJECT_ENTRY_TEMPLATE; /**< Template XML used for a reference to another project entry. */
+		static const String REFERENCE_PATH_ENTRY_TEMPLATE; /**< Template XML used for a reference to another assembly entry by name and path. */
+		static const String CODE_ENTRY_TEMPLATE; /**< Template XML used for a single code file entry in a project. */
+		static const String NON_CODE_ENTRY_TEMPLATE; /**< Template XML used for a single non-code file entry in a project. */
+
+	public:
+		/**
+		 * Scans the running processes to find a running Visual Studio instance with the specified version and open solution.
+		 *
+		 * @param[in]	clsID			Class ID of the specific Visual Studio version we are looking for.
+		 * @param[in]	solutionPath	Path to the solution the instance needs to have open.
+		 * @return						DTE object that may be used to interact with the Visual Studio instance, or null if
+		 *								not found.
+		 */
+		static CComPtr<EnvDTE::_DTE> findRunningInstance(const CLSID& clsID, const Path& solutionPath)
+		{
+			CComPtr<IRunningObjectTable> runningObjectTable = nullptr;
+			if (FAILED(GetRunningObjectTable(0, &runningObjectTable)))
+				return nullptr;
+
+			CComPtr<IEnumMoniker> enumMoniker = nullptr;
+			if (FAILED(runningObjectTable->EnumRunning(&enumMoniker)))
+				return nullptr;
+
+			CComPtr<IMoniker> dteMoniker = nullptr;
+			if (FAILED(CreateClassMoniker(clsID, &dteMoniker)))
+				return nullptr;
+
+			CComBSTR bstrSolution(solutionPath.toWString(Path::PathType::Windows).c_str());
+			CComPtr<IMoniker> moniker;
+			ULONG count = 0;
+			while (enumMoniker->Next(1, &moniker, &count) == S_OK)
+			{
+				if (moniker->IsEqual(dteMoniker))
+				{
+					CComPtr<IUnknown> curObject = nullptr;
+					HRESULT result = runningObjectTable->GetObject(moniker, &curObject);
+					moniker = nullptr;
+
+					if (result != S_OK)
+						continue;
+
+					CComPtr<EnvDTE::_DTE> dte;
+					curObject->QueryInterface(__uuidof(EnvDTE::_DTE), (void**)&dte);
+
+					if (dte == nullptr)
+						continue;
+
+					CComPtr<EnvDTE::_Solution> solution;
+					if (FAILED(dte->get_Solution(&solution)))
+						continue;
+
+					CComBSTR fullName;
+					if (FAILED(solution->get_FullName(&fullName)))
+						continue;
+
+					if (fullName == bstrSolution)
+						return dte;
+				}
+			}
+
+			return nullptr;
+		}
+
+		/**
+		 * Opens a new Visual Studio instance of the specified version with the provided solution.
+		 *
+		 * @param[in]	clsID			Class ID of the specific Visual Studio version to start.
+		 * @param[in]	solutionPath	Path to the solution the instance needs to open.
+		 */
+		static CComPtr<EnvDTE::_DTE> openInstance(const CLSID& clsid, const Path& solutionPath)
+		{
+			CComPtr<IUnknown> newInstance = nullptr;
+			if (FAILED(::CoCreateInstance(clsid, nullptr, CLSCTX_LOCAL_SERVER, EnvDTE::IID__DTE, (LPVOID*)&newInstance)))
+				return nullptr;
+
+			CComPtr<EnvDTE::_DTE> dte;
+			newInstance->QueryInterface(__uuidof(EnvDTE::_DTE), (void**)&dte);
+
+			if (dte == nullptr)
+				return nullptr;
+
+			dte->put_UserControl(TRUE);
+
+			CComPtr<EnvDTE::_Solution> solution;
+			if (FAILED(dte->get_Solution(&solution)))
+				return nullptr;
+
+			CComBSTR bstrSolution(solutionPath.toWString(Path::PathType::Windows).c_str());
+			if (FAILED(solution->Open(bstrSolution)))
+				return nullptr;
+
+			// Wait until VS opens
+			UINT32 elapsed = 0;
+			while (elapsed < 10000)
+			{
+				EnvDTE::Window* window = nullptr;
+				if (SUCCEEDED(dte->get_MainWindow(&window)))
+					return dte;
+
+				Sleep(100);
+				elapsed += 100;
+			}
+
+			return nullptr;
+		}
+
+		/**
+		 * Opens a file on a specific line in a running Visual Studio instance.
+		 *
+		 * @param[in]	dte			DTE object retrieved from findRunningInstance() or openInstance().
+		 * @param[in]	filePath	Path of the file to open. File should be a part of the VS solution.
+		 * @param[in]	line		Line on which to focus Visual Studio after the file is open.
+		 */
+		static bool openFile(CComPtr<EnvDTE::_DTE> dte, const Path& filePath, UINT32 line)
+		{
+			// Open file
+			CComPtr<EnvDTE::ItemOperations> itemOperations;
+			if (FAILED(dte->get_ItemOperations(&itemOperations)))
+				return false;
+
+			CComBSTR bstrFilePath(filePath.toWString(Path::PathType::Windows).c_str());
+			CComBSTR bstrKind(EnvDTE::vsViewKindPrimary);
+			CComPtr<EnvDTE::Window> window = nullptr;
+			if (FAILED(itemOperations->OpenFile(bstrFilePath, bstrKind, &window)))
+				return false;
+
+			// Scroll to line
+			CComPtr<EnvDTE::Document> activeDocument;
+			if (SUCCEEDED(dte->get_ActiveDocument(&activeDocument)))
+			{
+				CComPtr<IDispatch> selection;
+				if (SUCCEEDED(activeDocument->get_Selection(&selection)))
+				{
+					CComPtr<EnvDTE::TextSelection> textSelection;
+					if (SUCCEEDED(selection->QueryInterface(&textSelection)))
+					{
+						textSelection->GotoLine(line, TRUE);
+					}
+				}
+			}
+
+			// Bring the window in focus
+			window = nullptr;
+			if (SUCCEEDED(dte->get_MainWindow(&window)))
+			{
+				window->Activate();
+
+				HWND hWnd;
+				window->get_HWnd((LONG*)&hWnd);
+				SetForegroundWindow(hWnd);
+			}
+
+			return true;
+		}
+
+		/**	Generates a Visual Studio project GUID from the project name. */
+		static String getProjectGUID(const WString& projectName)
+		{
+			static const String guidTemplate = "{0}-{1}-{2}-{3}-{4}";
+			String hash = md5(projectName);
+
+			String output = StringUtil::format(guidTemplate, hash.substr(0, 8),
+				hash.substr(8, 4), hash.substr(12, 4), hash.substr(16, 4), hash.substr(20, 12));
+			StringUtil::toUpperCase(output);
+
+			return output;
+		}
+
+		/**
+		 * Builds the Visual Studio solution text (.sln) for the provided version, using the provided solution data.
+		 *
+		 * @param[in]	version	Visual Studio version for which we're generating the solution file.
+		 * @param[in]	data	Data containing a list of projects and other information required to build the solution text.
+		 * @return				Generated text of the solution file.
+		 */
+		static String writeSolution(VisualStudioVersion version, const CodeSolutionData& data)
+		{
+			struct VersionData
+			{
+				String formatVersion;
+			};
+
+			Map<VisualStudioVersion, VersionData> versionData =
+			{
+				{ VisualStudioVersion::VS2008, { "10.00" } },
+				{ VisualStudioVersion::VS2010, { "11.00" } },
+				{ VisualStudioVersion::VS2012, { "12.00" } },
+				{ VisualStudioVersion::VS2013, { "12.00" } },
+				{ VisualStudioVersion::VS2015, { "12.00" } }
+			};
+
+			StringStream projectEntriesStream;
+			StringStream projectPlatformsStream;
+			for (auto& project : data.projects)
+			{
+				String guid = getProjectGUID(project.name);
+				String projectName = toString(project.name);
+
+				projectEntriesStream << StringUtil::format(PROJ_ENTRY_TEMPLATE, projectName, projectName + ".csproj", guid);
+				projectPlatformsStream << StringUtil::format(PROJ_PLATFORM_TEMPLATE, guid);
+			}
+
+			String projectEntries = projectEntriesStream.str();
+			String projectPlatforms = projectPlatformsStream.str();
+
+			return StringUtil::format(SLN_TEMPLATE, versionData[version].formatVersion, projectEntries, projectPlatforms);
+		}
+
+		/**
+		 * Builds the Visual Studio project text (.csproj) for the provided version, using the provided project data.
+		 *
+		 * @param[in]	version		Visual Studio version for which we're generating the project file.
+		 * @param[in]	projectData	Data containing a list of files, references and other information required to 
+		 *							build the project text.
+		 * @return					Generated text of the project file.
+		 */
+		static String writeProject(VisualStudioVersion version, const CodeProjectData& projectData)
+		{
+			struct VersionData
+			{
+				String toolsVersion;
+			};
+
+			Map<VisualStudioVersion, VersionData> versionData =
+			{
+				{ VisualStudioVersion::VS2008, { "3.5" } },
+				{ VisualStudioVersion::VS2010, { "4.0" } },
+				{ VisualStudioVersion::VS2012, { "4.0" } },
+				{ VisualStudioVersion::VS2013, { "12.0" } },
+				{ VisualStudioVersion::VS2015, { "13.0" } }
+			};
+
+			StringStream tempStream;
+			for (auto& codeEntry : projectData.codeFiles)
+				tempStream << StringUtil::format(CODE_ENTRY_TEMPLATE, codeEntry.toString());
+
+			String codeEntries = tempStream.str();
+			tempStream.str("");
+			tempStream.clear();
+
+			for (auto& nonCodeEntry : projectData.nonCodeFiles)
+				tempStream << StringUtil::format(NON_CODE_ENTRY_TEMPLATE, nonCodeEntry.toString());
+
+			String nonCodeEntries = tempStream.str();
+			tempStream.str("");
+			tempStream.clear();
+
+			for (auto& referenceEntry : projectData.assemblyReferences)
+			{
+				String referenceName = toString(referenceEntry.name);
+
+				if (referenceEntry.path.isEmpty())
+					tempStream << StringUtil::format(REFERENCE_ENTRY_TEMPLATE, referenceName);
+				else
+					tempStream << StringUtil::format(REFERENCE_PATH_ENTRY_TEMPLATE, referenceName, referenceEntry.path.toString());
+			}
+
+			String referenceEntries = tempStream.str();
+			tempStream.str("");
+			tempStream.clear();
+
+			for (auto& referenceEntry : projectData.projectReferences)
+			{
+				String referenceName = toString(referenceEntry.name);
+				String projectGUID = getProjectGUID(referenceEntry.name);
+
+				tempStream << StringUtil::format(REFERENCE_PROJECT_ENTRY_TEMPLATE, referenceName, projectGUID);
+			}
+
+			String projectReferenceEntries = tempStream.str();
+			tempStream.str("");
+			tempStream.clear();
+
+			tempStream << toString(projectData.defines);
+
+			String defines = tempStream.str();
+			String projectGUID = getProjectGUID(projectData.name);
+
+			return StringUtil::format(PROJ_TEMPLATE, versionData[version].toolsVersion, projectGUID, 
+				toString(projectData.name), defines, referenceEntries, projectReferenceEntries, codeEntries, nonCodeEntries);
+		}
+	};
+
+	const String VisualStudio::SLN_TEMPLATE =
 		R"(Microsoft Visual Studio Solution File, Format Version {0}
 # Visual Studio 2013
 VisualStudioVersion = 12.0.30723.0
@@ -505,7 +505,7 @@ EndProject)";
 
 	const String VisualStudio::NON_CODE_ENTRY_TEMPLATE =
 		R"(
-    <None Include="{0}"/>)";*/
+    <None Include="{0}"/>)";
 
 	VSCodeEditor::VSCodeEditor(VisualStudioVersion version, const Path& execPath, const WString& CLSID)
 		:mVersion(version), mExecPath(execPath), mCLSID(CLSID)
@@ -515,7 +515,7 @@ EndProject)";
 
 	void VSCodeEditor::openFile(const Path& solutionPath, const Path& filePath, UINT32 lineNumber) const
 	{
-		/*CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
+		CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
 
 		CLSID clsID;
 		if (FAILED(CLSIDFromString(mCLSID.c_str(), &clsID)))
@@ -545,12 +545,12 @@ EndProject)";
 		VisualStudio::openFile(dte, filePath, lineNumber);
 		CoRegisterMessageFilter(oldFilter, nullptr);
 
-		CoUninitialize();*/
+		CoUninitialize();
 	}
 
 	void VSCodeEditor::syncSolution(const CodeSolutionData& data, const Path& outputPath) const
 	{
-		/*String solutionString = VisualStudio::writeSolution(mVersion, data);
+		String solutionString = VisualStudio::writeSolution(mVersion, data);
 		solutionString = StringUtil::replaceAll(solutionString, "\n", "\r\n");
 		Path solutionPath = outputPath;
 		solutionPath.append(data.name + L".sln");
@@ -570,7 +570,7 @@ EndProject)";
 
 		SPtr<DataStream> solutionStream = FileSystem::createAndOpenFile(solutionPath);
 		solutionStream->write(solutionString.c_str(), solutionString.size() * sizeof(String::value_type));
-		solutionStream->close();*/
+		solutionStream->close();
 	}
 
 	VSCodeEditorFactory::VSCodeEditorFactory()

+ 1 - 1
Source/BansheeEngine/Source/BsGUIInputTool.cpp

@@ -106,7 +106,7 @@ namespace BansheeEngine
 			numNewlineChars += (getLineDesc(i).hasNewlineChar() ? 1 : 0);
 
 		INT32 quadIdx = (INT32)(charIdx - numNewlineChars);
-		if(quadIdx >= 0 && quadIdx < mNumQuads)
+		if(quadIdx >= 0 && quadIdx < (INT32)mNumQuads)
 		{
 			UINT32 vertIdx = quadIdx * 4;
 

+ 2 - 0
Source/BansheeEngine/Source/BsLight.cpp

@@ -70,6 +70,8 @@ namespace BansheeEngine
 		}
 		case LightType::Directional:
 			return mIntensity;
+		default:
+			return 0.0f;
 		}
 	}
 

+ 2 - 3
Source/BansheeFBXImporter/Source/BsFBXImporter.cpp

@@ -299,8 +299,6 @@ namespace BansheeEngine
 			FBXImportNode* curImportNode = outputScene.nodeMap[curNode];
 			todo.pop();
 
-			const char* name = curNode->GetName();
-
 			FbxNodeAttribute* attrib = curNode->GetNodeAttribute();
 			if(attrib != nullptr)
 			{
@@ -340,6 +338,8 @@ namespace BansheeEngine
 						parseMesh(mesh, curImportNode, options, outputScene);
 					}
 					break;
+				default:
+					break;
 				}
 			}
 
@@ -456,7 +456,6 @@ namespace BansheeEngine
 				}
 			}
 
-			int UVIdx = 0;
 			for (UINT32 i = 0; i < FBX_IMPORT_MAX_UV_LAYERS; i++)
 			{
 				if (mesh->UV[i].size() == numVertices)

+ 0 - 1
Source/BansheeFreeImgImporter/Source/BsFreeImgImporter.cpp

@@ -337,7 +337,6 @@ namespace BansheeEngine
 
 		// Final data - invert image and trim pitch at the same time
 		UINT32 dstPitch = width * PixelUtil::getNumElemBytes(format);
-		UINT32 size = dstPitch * height;
 
 		// Bind output buffer
 		SPtr<PixelData> texData = bs_shared_ptr_new<PixelData>(width, height, 1, format);

+ 78 - 52
Source/BansheeMono/Include/BsMonoArray.h

@@ -26,33 +26,11 @@ namespace BansheeEngine
 
 		/** Retrieves an entry from the array at the specified index. */
 		template<class T>
-		T get(UINT32 idx)
-		{
-			return mono_array_get(mInternal, T, idx);
-		}
+		T get(UINT32 idx);
 
 		/** Sets an entry from the array at the specified index. */
 		template<class T>
-		void set(UINT32 idx, const T& value)
-		{
-			mono_array_set(mInternal, T, idx, value);
-		}
-
-		/** Retrieves an entry as a native string from the array at the specified index. */
-		template<>
-		String get(UINT32 idx);
-
-		/** Retrieves an entry as a native string from the array at the specified index. */
-		template<>
-		WString get(UINT32 idx);
-
-		/** Sets a native string entry from the array at the specified index. */
-		template<>
-		void set<String>(UINT32 idx, const String& value);
-
-		/** Sets a native string entry from the array at the specified index. */
-		template<>
-		void set<WString>(UINT32 idx, const WString& value);
+		void set(UINT32 idx, const T& value);
 
 		/** Returns the raw object from the array at the specified index. */
 		template<class T>
@@ -84,79 +62,127 @@ namespace BansheeEngine
 		 * @tparam	T	ScriptObject wrapper for the specified managed type.
 		 */
 		template<class T>
-		static ScriptArray create(UINT32 size)
+		static ScriptArray create(UINT32 size);
+
+		/** Returns number of elements in the array. */
+		UINT32 size() const;
+
+		/** Returns the size of an individual element in the array, in bytes. */
+		UINT32 elementSize() const;
+
+		/** Returns the managed object representing this array. */
+		MonoArray* getInternal() const { return mInternal; }
+
+	private:
+		MonoArray* mInternal;
+	};
+
+	/** @} */
+
+	/** @addtogroup Implementation
+	 *  @{
+	 */
+	namespace Detail
+	{
+		// A layer of indirection for all methods specialized by ScriptArray. */
+
+		template<class T>
+		T ScriptArray_get(MonoArray* array, UINT32 idx)
+		{
+			return mono_array_get(array, T, idx);
+		}
+
+		template<class T>
+		void ScriptArray_set(MonoArray* array, UINT32 idx, const T& value)
+		{
+			mono_array_set(array, T, idx, value);
+		}
+
+		template<>
+		BS_MONO_EXPORT String ScriptArray_get(MonoArray* array, UINT32 idx);
+
+		template<>
+		BS_MONO_EXPORT WString ScriptArray_get(MonoArray* array, UINT32 idx);
+
+		template<>
+		BS_MONO_EXPORT void ScriptArray_set<String>(MonoArray* array, UINT32 idx, const String& value);
+
+		template<>
+		BS_MONO_EXPORT void ScriptArray_set<WString>(MonoArray* array, UINT32 idx, const WString& value);
+
+		template<class T>
+		inline ScriptArray ScriptArray_create(UINT32 size)
 		{
 			return ScriptArray(*T::getMetaData()->scriptClass, size);
 		}
 
-		/** Creates a new array of integers. */
 		template<>
-		static ScriptArray create<UINT32>(UINT32 size)
+		inline ScriptArray ScriptArray_create<UINT32>(UINT32 size)
 		{
 			return ScriptArray(mono_get_uint32_class(), size);
 		}
 
-		/** Creates a new array of integers. */
 		template<>
-		static ScriptArray create<INT32>(UINT32 size)
+		inline ScriptArray ScriptArray_create<INT32>(UINT32 size)
 		{
 			return ScriptArray(mono_get_int32_class(), size);
 		}
 
-		/** Creates a new array of integers. */
 		template<>
-		static ScriptArray create<UINT64>(UINT32 size)
+		inline ScriptArray ScriptArray_create<UINT64>(UINT32 size)
 		{
 			return ScriptArray(mono_get_uint64_class(), size);
 		}
 
-		/** Creates a new array of integers. */
 		template<>
-		static ScriptArray create<INT64>(UINT32 size)
+		inline ScriptArray ScriptArray_create<INT64>(UINT32 size)
 		{
 			return ScriptArray(mono_get_int64_class(), size);
 		}
 
-		/** Creates a new array of strings. */
 		template<>
-		static ScriptArray create<WString>(UINT32 size)
+		inline ScriptArray ScriptArray_create<WString>(UINT32 size)
 		{
 			return ScriptArray(mono_get_string_class(), size);
 		}
 
-		/** Creates a new array of strings. */
 		template<>
-		static ScriptArray create<String>(UINT32 size)
+		inline ScriptArray ScriptArray_create<String>(UINT32 size)
 		{
 			return ScriptArray(mono_get_string_class(), size);
 		}
 
-		/** Creates a new array of floats. */
 		template<>
-		static ScriptArray create<float>(UINT32 size)
+		inline ScriptArray ScriptArray_create<float>(UINT32 size)
 		{
 			return ScriptArray(mono_get_single_class(), size);
 		}
 
-		/** Creates a new array of booleans. */
 		template<>
-		static ScriptArray create<bool>(UINT32 size)
+		inline ScriptArray ScriptArray_create<bool>(UINT32 size)
 		{
 			return ScriptArray(mono_get_boolean_class(), size);
 		}
+	}
 
-		/** Returns number of elements in the array. */
-		UINT32 size() const;
-
-		/** Returns the size of an individual element in the array, in bytes. */
-		UINT32 elementSize() const;
+	/** @} */
 
-		/** Returns the managed object representing this array. */
-		MonoArray* getInternal() const { return mInternal; }
+	template<class T>
+	T ScriptArray::get(UINT32 idx)
+	{
+		return Detail::ScriptArray_get<T>(mInternal, idx);
+	}
 
-	private:
-		MonoArray* mInternal;
-	};
+	/** Sets an entry from the array at the specified index. */
+	template<class T>
+	void ScriptArray::set(UINT32 idx, const T& value)
+	{
+		Detail::ScriptArray_set<T>(mInternal, idx, value);
+	}
 
-	/** @} */
+	template<class T>
+	ScriptArray ScriptArray::create(UINT32 size)
+	{
+		return Detail::ScriptArray_create<T>(size);
+	}
 }

+ 2 - 3
Source/BansheeMono/Include/BsMonoAssembly.h

@@ -22,15 +22,14 @@ namespace BansheeEngine
 		{
 			struct Hash
 			{
-				inline size_t operator()(const ClassId& v) const;
+				size_t operator()(const ClassId& v) const;
 			};
 
 			struct Equals
 			{
-				inline bool operator()(const ClassId &a, const ClassId &b) const;
+				bool operator()(const ClassId &a, const ClassId &b) const;
 			};
 
-			ClassId();
 			ClassId(const String& namespaceName, String name, ::MonoClass* genericInstance = nullptr);
 
 			String namespaceName;

+ 2 - 2
Source/BansheeMono/Include/BsMonoClass.h

@@ -21,12 +21,12 @@ namespace BansheeEngine
 		{
 			struct Hash
 			{
-				inline size_t operator()(const MethodId& v) const;
+				size_t operator()(const MethodId& v) const;
 			};
 			
 			struct Equals
 			{
-				inline bool operator()(const MethodId &a, const MethodId &b) const;
+				bool operator()(const MethodId& a, const MethodId& b) const;
 			};
 
 			MethodId(const String& name, UINT32 numParams);

+ 35 - 32
Source/BansheeMono/Source/BsMonoArray.cpp

@@ -7,6 +7,41 @@
 
 namespace BansheeEngine
 {
+	namespace Detail
+	{
+		template<>
+		String ScriptArray_get<String>(MonoArray* array, UINT32 idx)
+		{
+			return MonoUtil::monoToString(mono_array_get(array, MonoString*, idx));
+		}
+
+		template<>
+		WString ScriptArray_get<WString>(MonoArray* array, UINT32 idx)
+		{
+			return MonoUtil::monoToWString(mono_array_get(array, MonoString*, idx));
+		}
+
+		template<>
+		void ScriptArray_set<String>(MonoArray* array, UINT32 idx, const String& value)
+		{
+			MonoString* monoString = MonoUtil::stringToMono(value);
+			mono_array_set(array, MonoString*, idx, monoString);
+		}
+
+		template<>
+		void ScriptArray_set<WString>(MonoArray* array, UINT32 idx, const WString& value)
+		{
+			MonoString* monoString = MonoUtil::wstringToMono(value);
+			mono_array_set(array, MonoString*, idx, monoString);
+		}
+
+		template String ScriptArray_get(MonoArray* array, UINT32 idx);
+		template WString ScriptArray_get(MonoArray* array, UINT32 idx);
+
+		template void ScriptArray_set(MonoArray* array, UINT32 idx, const String& value);
+		template void ScriptArray_set(MonoArray* array, UINT32 idx, const WString& value);
+	}
+
 	ScriptArray::ScriptArray(MonoArray* existingArray)
 		:mInternal(existingArray)
 	{
@@ -25,32 +60,6 @@ namespace BansheeEngine
 		mInternal = mono_array_new(MonoManager::instance().getDomain(), klass, size);
 	}
 
-	template<>
-	String ScriptArray::get<String>(UINT32 idx)
-	{
-		return MonoUtil::monoToString(mono_array_get(mInternal, MonoString*, idx));
-	}
-
-	template<>
-	WString ScriptArray::get<WString>(UINT32 idx)
-	{
-		return MonoUtil::monoToWString(mono_array_get(mInternal, MonoString*, idx));
-	}
-
-	template<>
-	void ScriptArray::set<String>(UINT32 idx, const String& value)
-	{
-		MonoString* monoString = MonoUtil::stringToMono(value);
-		mono_array_set(mInternal, MonoString*, idx, monoString);
-	}
-
-	template<>
-	void ScriptArray::set<WString>(UINT32 idx, const WString& value)
-	{
-		MonoString* monoString = MonoUtil::wstringToMono(value);
-		mono_array_set(mInternal, MonoString*, idx, monoString);
-	}
-
 	UINT32 ScriptArray::size() const
 	{
 		return (UINT32)mono_array_length(mInternal);
@@ -63,10 +72,4 @@ namespace BansheeEngine
 
 		return (UINT32)mono_class_array_element_size(elementClass);
 	}
-
-	template BS_MONO_EXPORT String ScriptArray::get(UINT32 idx);
-	template BS_MONO_EXPORT WString ScriptArray::get(UINT32 idx);
-
-	template BS_MONO_EXPORT void ScriptArray::set(UINT32 idx, const String& value);
-	template BS_MONO_EXPORT void ScriptArray::set(UINT32 idx, const WString& value);
 }

+ 4 - 4
Source/BansheeMono/Source/BsMonoAssembly.cpp

@@ -14,7 +14,7 @@
 
 namespace BansheeEngine
 {
-	inline size_t MonoAssembly::ClassId::Hash::operator()(const MonoAssembly::ClassId& v) const
+	size_t MonoAssembly::ClassId::Hash::operator()(const MonoAssembly::ClassId& v) const
 	{
 		size_t genInstanceAddr = (size_t)v.genericInstance;
 
@@ -26,7 +26,7 @@ namespace BansheeEngine
 		return seed;
 	}
 
-	inline bool MonoAssembly::ClassId::Equals::operator()(const MonoAssembly::ClassId& a, const MonoAssembly::ClassId& b) const
+	bool MonoAssembly::ClassId::Equals::operator()(const MonoAssembly::ClassId& a, const MonoAssembly::ClassId& b) const
 	{
 		return a.name == b.name && a.namespaceName == b.namespaceName && a.genericInstance == b.genericInstance;
 	}
@@ -38,8 +38,8 @@ namespace BansheeEngine
 	}
 
 	MonoAssembly::MonoAssembly(const String& path, const String& name)
-		:mIsLoaded(false), mMonoImage(nullptr), mMonoAssembly(nullptr), mIsDependency(false), mHaveCachedClassList(false),
-		mPath(path), mName(name)
+		: mName(name), mPath(path), mMonoImage(nullptr), mMonoAssembly(nullptr), mIsLoaded(false), mIsDependency(false)
+		, mHaveCachedClassList(false)
 	{
 
 	}

+ 4 - 4
Source/BansheeMono/Source/BsMonoClass.cpp

@@ -13,7 +13,7 @@
 
 namespace BansheeEngine
 {
-	inline size_t MonoClass::MethodId::Hash::operator()(const MonoClass::MethodId& v) const
+	size_t MonoClass::MethodId::Hash::operator()(const MonoClass::MethodId& v) const
 	{
 		size_t seed = 0;
 		hash_combine(seed, v.name);
@@ -21,7 +21,7 @@ namespace BansheeEngine
 		return seed;
 	}
 
-	inline bool MonoClass::MethodId::Equals::operator()(const MonoClass::MethodId &a, const MonoClass::MethodId &b) const
+	bool MonoClass::MethodId::Equals::operator()(const MonoClass::MethodId& a, const MonoClass::MethodId& b) const
 	{
 		return a.name == b.name && a.numParams == b.numParams;
 	}
@@ -33,8 +33,8 @@ namespace BansheeEngine
 	}
 
 	MonoClass::MonoClass(const String& ns, const String& type, ::MonoClass* monoClass, const MonoAssembly* parentAssembly)
-		:mNamespace(ns), mTypeName(type), mClass(monoClass), mParentAssembly(parentAssembly), mHasCachedFields(false),
-		mHasCachedMethods(false)
+		: mParentAssembly(parentAssembly), mClass(monoClass), mNamespace(ns), mTypeName(type), mHasCachedFields(false)
+		, mHasCachedMethods(false)
 	{
 		mFullName = ns + "." + type;
 	}

+ 4 - 2
Source/BansheeMono/Source/BsMonoManager.cpp

@@ -33,7 +33,7 @@ namespace BansheeEngine
 	};
 
 	MonoManager::MonoManager()
-		:mRootDomain(nullptr), mScriptDomain(nullptr), mIsCoreLoaded(false)
+		:mScriptDomain(nullptr), mRootDomain(nullptr), mIsCoreLoaded(false)
 	{
 		Path libDir = Paths::findPath(MONO_LIB_DIR);
 		Path etcDir = getMonoEtcFolder();
@@ -231,7 +231,9 @@ namespace BansheeEngine
 
 		if (mScriptDomain == nullptr)
 		{
-			mScriptDomain = mono_domain_create_appdomain("ScriptDomain", nullptr);
+			char domainName[] = "ScriptDomain";
+
+			mScriptDomain = mono_domain_create_appdomain(domainName, nullptr);
 			mono_domain_set(mScriptDomain, false);
 
 			if (mScriptDomain == nullptr)

+ 1 - 1
Source/BansheeMono/Source/BsScriptMeta.cpp

@@ -14,7 +14,7 @@ namespace BansheeEngine
 	}
 
 	ScriptMeta::ScriptMeta(const String& assembly, const String& ns, const String& name, std::function<void()> initCallback)
-		:assembly(assembly), ns(ns), name(name), initCallback(initCallback)
+		:ns(ns), name(name), assembly(assembly), initCallback(initCallback), scriptClass(nullptr), thisPtrField(nullptr)
 	{
 
 	}

+ 4 - 11
Source/BansheeOISInput/Source/BsInputHandlerOIS.cpp

@@ -11,7 +11,7 @@
 namespace BansheeEngine
 {
 	GamepadEventListener::GamepadEventListener(InputHandlerOIS* parentHandler, UINT32 joystickIdx)
-		:mParentHandler(parentHandler), mGamepadIdx(joystickIdx)
+		:mGamepadIdx(joystickIdx), mParentHandler(parentHandler)
 	{ }
 
 	bool GamepadEventListener::buttonPressed(const OIS::JoyStickEvent& arg, int button)
@@ -50,8 +50,7 @@ namespace BansheeEngine
 	}
 
 	InputHandlerOIS::InputHandlerOIS(unsigned int hWnd)
-		:mInputManager(nullptr), mKeyboard(nullptr), mMouse(nullptr), mTimestampClockOffset(0),
-		mLastMouseUpdateFrame(0)
+		:mInputManager(nullptr), mMouse(nullptr), mKeyboard(nullptr), mLastMouseUpdateFrame(0), mTimestampClockOffset(0)
 	{
 		mMouseSampleAccumulator[0] = 0;
 		mMouseSampleAccumulator[1] = 0;
@@ -80,14 +79,8 @@ namespace BansheeEngine
 		pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
 		pl.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
 #endif
-		try
-		{
-			mInputManager = OIS::InputManager::createInputSystem(pl);
-		}
-		catch(OIS::Exception &e)
-		{
-			std::cout << e.eText << std::endl;
-		}
+
+		mInputManager = OIS::InputManager::createInputSystem(pl);
 
 		if (mInputManager->getNumberOfDevices(OIS::OISKeyboard) > 0)
 		{

+ 1 - 1
Source/BansheeSL/Include/BsSLPrerequisites.h

@@ -32,5 +32,5 @@
 
 namespace BansheeEngine
 {
-	const char* SystemName = "BansheeSL";
+	extern const char* SystemName;
 }

+ 0 - 2
Source/BansheeSL/Source/BsASTFX.c

@@ -117,8 +117,6 @@ void nodeOptionsResize(void* context, NodeOptions* options, int size)
 {
 	NodeOption* originalEntries = options->entries;
 	int originalSize = options->bufferSize;
-	int originalCount = options->count;
-	int i = 0;
 	int elementsToCopy = originalSize;
 	int sizeToCopy = 0;
 

+ 2 - 0
Source/BansheeSL/Source/BsSLPlugin.cpp

@@ -6,6 +6,8 @@
 
 namespace BansheeEngine
 {
+	const char* SystemName = "BansheeSL";
+
 	/**	Returns a name of the plugin. */
 	extern "C" BS_SL_EXPORT const char* getPluginName()
 	{

+ 1 - 1
Source/RenderBeast/Include/BsRenderBeastFactory.h

@@ -11,7 +11,7 @@ namespace BansheeEngine
 	 *  @{
 	 */
 
-	const char* SystemName = "RenderBeast";
+	extern const char* SystemName;
 
 	/**
 	 * Renderer factory implementation that creates and initializes the default Banshee renderer. Used by the 

+ 2 - 0
Source/RenderBeast/Include/BsRenderBeastOptions.h

@@ -23,6 +23,8 @@ namespace BansheeEngine
 	/** A set of options used for controlling the rendering of the RenderBeast renderer. */
 	struct BS_BSRND_EXPORT RenderBeastOptions : public CoreRendererOptions
 	{
+		RenderBeastOptions() { }
+
 		/**	Type of filtering to use for all textures on scene elements. */
 		RenderBeastFiltering filtering = RenderBeastFiltering::Anisotropic;
 

+ 2 - 5
Source/RenderBeast/Source/BsRenderBeast.cpp

@@ -36,8 +36,8 @@ using namespace std::placeholders;
 namespace BansheeEngine
 {
 	RenderBeast::RenderBeast()
-		:mOptions(bs_shared_ptr_new<RenderBeastOptions>()), mOptionsDirty(true), mStaticHandler(nullptr),
-		mDefaultMaterial(nullptr), mPointLightInMat(nullptr), mPointLightOutMat(nullptr), mDirLightMat(nullptr)
+		: mDefaultMaterial(nullptr), mPointLightInMat(nullptr), mPointLightOutMat(nullptr), mDirLightMat(nullptr)
+		, mStaticHandler(nullptr), mOptions(bs_shared_ptr_new<RenderBeastOptions>()), mOptionsDirty(true)
 	{
 
 	}
@@ -230,7 +230,6 @@ namespace BansheeEngine
 
 			lastRenerable->setRendererId(renderableId);
 
-			Vector<BeastRenderableElement>& lastRenderableElements = mRenderables[renderableId].elements;
 			for (auto& element : elements)
 				element.renderableId = renderableId;
 		}
@@ -769,8 +768,6 @@ namespace BansheeEngine
 		for (auto& renderableData : mRenderables)
 		{
 			RenderableCore* renderable = renderableData.renderable;
-			RenderableHandler* controller = renderableData.controller;
-			UINT32 renderableType = renderable->getRenderableType();
 			UINT32 rendererId = renderable->getRendererId();
 
 			if ((renderable->getLayer() & cameraLayers) == 0)

+ 4 - 1
Source/RenderBeast/Source/BsRenderBeastFactory.cpp

@@ -6,6 +6,8 @@
 
 namespace BansheeEngine
 {
+	const char* SystemName = "RenderBeast";
+
 	SPtr<CoreRenderer> RenderBeastFactory::create()
 	{
 		return bs_shared_ptr_new<RenderBeast>();
@@ -13,6 +15,7 @@ namespace BansheeEngine
 
 	const String& RenderBeastFactory::name() const
 	{
-		return SystemName;
+		static String StrSystemName = SystemName;
+		return StrSystemName;
 	}
 }

+ 1 - 1
Source/RenderBeast/Source/BsRenderTargets.cpp

@@ -10,7 +10,7 @@
 namespace BansheeEngine
 {
 	RenderTargets::RenderTargets(const SPtr<ViewportCore>& viewport, bool hdr, UINT32 numSamples)
-		:mNumSamples(numSamples), mHDR(hdr), mViewport(viewport)
+		:mViewport(viewport), mNumSamples(numSamples), mHDR(hdr)
 	{
 		if (hdr)
 			mDiffuseFormat = PF_FLOAT_R11G11B10;

+ 1 - 1
Source/RenderBeast/Source/BsRenderTexturePool.cpp

@@ -8,7 +8,7 @@
 namespace BansheeEngine
 {
 	PooledRenderTexture::PooledRenderTexture(RenderTexturePool* pool)
-		:mIsFree(false), mPool(pool)
+		:mPool(pool), mIsFree(false)
 	{ }
 
 	PooledRenderTexture::~PooledRenderTexture()

+ 0 - 1
Source/SBansheeEditor/Include/BsScriptGUIColorField.h

@@ -4,7 +4,6 @@
 
 #include "BsScriptEditorPrerequisites.h"
 #include "BsScriptGUIElement.h"
-#include "BsColor.h"
 
 namespace BansheeEngine
 {

+ 1 - 7
Source/SBansheeEditor/Source/BsScriptGUIColorField.cpp

@@ -2,19 +2,13 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsScriptGUIColorField.h"
 #include "BsScriptMeta.h"
-#include "BsMonoField.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 #include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
 #include "BsMonoUtil.h"
-#include "BsGUILayout.h"
 #include "BsGUIColorField.h"
 #include "BsGUIOptions.h"
 #include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
 #include "BsScriptGUIContent.h"
 
 using namespace std::placeholders;
@@ -63,7 +57,7 @@ namespace BansheeEngine
 
 		guiField->onClicked.connect(std::bind(&ScriptGUIColorField::onClicked, instance));
 
-		ScriptGUIColorField* nativeInstance = new (bs_alloc<ScriptGUIColorField>()) ScriptGUIColorField(instance, guiField);
+		new (bs_alloc<ScriptGUIColorField>()) ScriptGUIColorField(instance, guiField);
 	}
 
 	void ScriptGUIColorField::internal_getValue(ScriptGUIColorField* nativeInstance, Color* output)

+ 1 - 1
Source/SBansheeEditor/Source/BsScriptGUIEnumField.cpp

@@ -110,7 +110,7 @@ namespace BansheeEngine
 		}
 			
 
-		ScriptGUIEnumField* nativeInstance = new (bs_alloc<ScriptGUIEnumField>()) ScriptGUIEnumField(instance, guiField, nativeValues);
+		new (bs_alloc<ScriptGUIEnumField>()) ScriptGUIEnumField(instance, guiField, nativeValues);
 	}
 
 	UINT64 ScriptGUIEnumField::internal_getValue(ScriptGUIEnumField* nativeInstance)

+ 1 - 7
Source/SBansheeEditor/Source/BsScriptGUIFloatField.cpp

@@ -2,19 +2,13 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsScriptGUIFloatField.h"
 #include "BsScriptMeta.h"
-#include "BsMonoField.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 #include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
 #include "BsMonoUtil.h"
-#include "BsGUILayout.h"
 #include "BsGUIFloatField.h"
 #include "BsGUIOptions.h"
 #include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
 #include "BsScriptGUIContent.h"
 
 using namespace std::placeholders;
@@ -68,7 +62,7 @@ namespace BansheeEngine
 		guiFloatField->onValueChanged.connect(std::bind(&ScriptGUIFloatField::onChanged, instance, _1));
 		guiFloatField->onConfirm.connect(std::bind(&ScriptGUIFloatField::onConfirmed, instance));
 
-		ScriptGUIFloatField* nativeInstance = new (bs_alloc<ScriptGUIFloatField>()) ScriptGUIFloatField(instance, guiFloatField);
+		new (bs_alloc<ScriptGUIFloatField>()) ScriptGUIFloatField(instance, guiFloatField);
 	}
 
 	void ScriptGUIFloatField::internal_getValue(ScriptGUIFloatField* nativeInstance, float* output)

+ 2 - 10
Source/SBansheeEditor/Source/BsScriptGUIGameObjectField.cpp

@@ -1,24 +1,16 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsScriptGUIGameObjectField.h"
-#include "BsScriptMeta.h"
-#include "BsMonoField.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 #include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
 #include "BsMonoUtil.h"
-#include "BsGUILayout.h"
 #include "BsGUIGameObjectField.h"
 #include "BsGUIOptions.h"
 #include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
 #include "BsScriptGUIContent.h"
 #include "BsScriptGameObject.h"
 #include "BsScriptGameObjectManager.h"
-#include "BsMonoUtil.h"
 
 using namespace std::placeholders;
 
@@ -73,7 +65,7 @@ namespace BansheeEngine
 
 		guiGameObjectField->onValueChanged.connect(std::bind(&ScriptGUIGameObjectField::onChanged, instance, _1));
 
-		ScriptGUIGameObjectField* nativeInstance = new (bs_alloc<ScriptGUIGameObjectField>()) ScriptGUIGameObjectField(instance, guiGameObjectField);
+		new (bs_alloc<ScriptGUIGameObjectField>()) ScriptGUIGameObjectField(instance, guiGameObjectField);
 	}
 
 	void ScriptGUIGameObjectField::internal_getValue(ScriptGUIGameObjectField* nativeInstance, MonoObject** output)
@@ -92,7 +84,7 @@ namespace BansheeEngine
 			gameObjectField->setValue(HGameObject());
 		else
 		{
-			ScriptGameObjectBase* scriptGO = ScriptGameObject::toNative(value);
+			ScriptGameObject* scriptGO = ScriptGameObject::toNative(value);
 			gameObjectField->setValue(scriptGO->getNativeHandle());
 		}
 	}

+ 1 - 7
Source/SBansheeEditor/Source/BsScriptGUIIntField.cpp

@@ -2,19 +2,13 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsScriptGUIIntField.h"
 #include "BsScriptMeta.h"
-#include "BsMonoField.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 #include "BsMonoMethod.h"
-#include "BsSpriteTexture.h"
 #include "BsMonoUtil.h"
-#include "BsGUILayout.h"
 #include "BsGUIIntField.h"
 #include "BsGUIOptions.h"
 #include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
 #include "BsScriptGUIContent.h"
 
 using namespace std::placeholders;
@@ -68,7 +62,7 @@ namespace BansheeEngine
 		guiIntField->onValueChanged.connect(std::bind(&ScriptGUIIntField::onChanged, instance, _1));
 		guiIntField->onConfirm.connect(std::bind(&ScriptGUIIntField::onConfirmed, instance));
 
-		ScriptGUIIntField* nativeInstance = new (bs_alloc<ScriptGUIIntField>()) ScriptGUIIntField(instance, guiIntField);
+		new (bs_alloc<ScriptGUIIntField>()) ScriptGUIIntField(instance, guiIntField);
 	}
 
 	void ScriptGUIIntField::internal_getValue(ScriptGUIIntField* nativeInstance, INT32* output)

+ 1 - 2
Source/SBansheeEditor/Source/BsScriptGUIListBoxField.cpp

@@ -2,7 +2,6 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsScriptGUIListBoxField.h"
 #include "BsScriptMeta.h"
-#include "BsMonoField.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 #include "BsMonoMethod.h"
@@ -79,7 +78,7 @@ namespace BansheeEngine
 
 		guiField->onSelectionChanged.connect(std::bind(&ScriptGUIListBoxField::onSelectionChanged, instance, _1));
 
-		ScriptGUIListBoxField* nativeInstance = new (bs_alloc<ScriptGUIListBoxField>()) ScriptGUIListBoxField(instance, guiField);
+		new (bs_alloc<ScriptGUIListBoxField>()) ScriptGUIListBoxField(instance, guiField);
 	}
 
 	UINT32 ScriptGUIListBoxField::internal_getValue(ScriptGUIListBoxField* nativeInstance)

+ 0 - 6
Source/SBansheeEditor/Source/BsScriptGUIResourceField.cpp

@@ -2,24 +2,18 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsScriptGUIResourceField.h"
 #include "BsScriptMeta.h"
-#include "BsMonoField.h"
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 #include "BsMonoMethod.h"
 #include "BsSpriteTexture.h"
 #include "BsMonoUtil.h"
-#include "BsGUILayout.h"
 #include "BsGUIResourceField.h"
 #include "BsGUIOptions.h"
 #include "BsGUIContent.h"
-#include "BsScriptGUIElementStyle.h"
-#include "BsScriptGUILayout.h"
-#include "BsScriptHString.h"
 #include "BsScriptGUIContent.h"
 #include "BsScriptResource.h"
 #include "BsScriptResourceManager.h"
 #include "BsScriptResourceRef.h"
-#include "BsResources.h"
 
 using namespace std::placeholders;
 

+ 26 - 0
Source/SBansheeEngine/Include/BsManagedSerializableField.h

@@ -167,6 +167,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataBool : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataBool() { }
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -199,6 +201,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataChar : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataChar() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -231,6 +235,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI8 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataI8() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -263,6 +269,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU8 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataU8() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -295,6 +303,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI16 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataI16() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -327,6 +337,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU16 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataU16() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -359,6 +371,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI32 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataI32() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -391,6 +405,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU32 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataU32() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -423,6 +439,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataI64 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataI64() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -455,6 +473,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataU64 : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataU64() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -487,6 +507,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataFloat : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataFloat() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -519,6 +541,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataDouble : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataDouble() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 
@@ -551,6 +575,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableFieldDataString : public ManagedSerializableFieldData
 	{
 	public:
+		ManagedSerializableFieldDataString() {}
+
 		/** @copydoc ManagedSerializableFieldData::getValue */
 		void* getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo) override;
 

+ 2 - 0
Source/SBansheeEngine/Include/BsManagedSerializableObjectInfoRTTI.h

@@ -74,6 +74,8 @@ namespace BansheeEngine
 	class BS_SCR_BE_EXPORT ManagedSerializableObjectInfoRTTI : public RTTIType<ManagedSerializableObjectInfo, IReflectable, ManagedSerializableObjectInfoRTTI>
 	{
 	private:
+		using RTTIType<ManagedSerializableObjectInfo, IReflectable, ManagedSerializableObjectInfoRTTI>::getBaseClass;
+
 		SPtr<ManagedSerializableTypeInfoObject> getTypeInfo(ManagedSerializableObjectInfo* obj)
 		{
 			return obj->mTypeInfo;

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

@@ -44,9 +44,9 @@ namespace BansheeEngine
 
 	protected:
 		TScriptCollider(MonoObject* instance, const SPtr<Collider>& collider)
-			:ScriptObject(instance)
+			:ScriptObject<Type, ScriptColliderBase>(instance)
 		{
-			initialize(collider);
+			this->initialize(collider);
 		}
 	};
 

+ 2 - 0
Source/SBansheeEngine/Include/BsScriptEnginePrerequisites.h

@@ -73,6 +73,7 @@ namespace BansheeEngine
 	class ScriptRenderTarget;
 	class ScriptRenderTexture2D;
 	class ScriptCamera;
+	class ScriptTextureBase;
 	class ScriptMeshData;
 	class ManagedComponent;
 	class ManagedSerializableFieldData;
@@ -104,6 +105,7 @@ namespace BansheeEngine
 	class ScriptPhysicsMaterial;
 	class ScriptPhysicsMesh;
 	class ScriptRigidbody;
+	class ScriptColliderBase;
 
 	typedef GameObjectHandle<ManagedComponent> HManagedComponent;
 	typedef ResourceHandle<ManagedResource> HManagedResource;

+ 2 - 3
Source/SBansheeEngine/Include/BsScriptFont.h

@@ -19,14 +19,13 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Font")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptFont(MonoObject* instance, const HFont& font);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 4 - 4
Source/SBansheeEngine/Include/BsScriptGUIElement.h

@@ -65,9 +65,9 @@ namespace BansheeEngine
 
 	protected:
 		TScriptGUIElementBase(MonoObject* instance, GUIElementBase* element)
-			:ScriptObject(instance)
+			:ScriptObject<Type, ScriptGUIElementBaseTBase>(instance)
 		{ 
-			initialize(element);
+			this->initialize(element);
 		}
 	};
 
@@ -94,9 +94,9 @@ namespace BansheeEngine
 
 	protected:
 		TScriptGUIElement(MonoObject* instance, GUIElementBase* element)
-			:ScriptObject(instance)
+			:ScriptObject<Type, ScriptGUIElementTBase>(instance)
 		{
-			initialize(element);
+			this->initialize(element);
 		}
 	};
 

+ 0 - 3
Source/SBansheeEngine/Include/BsScriptGUIElementStyle.h

@@ -4,10 +4,7 @@
 
 #include "BsScriptEnginePrerequisites.h"
 #include "BsScriptObject.h"
-#include "BsGUIElementStyle.h"
-#include "BsMonoClass.h"
 #include "BsScriptGUIElementStateStyle.h"
-#include "BsScriptFont.h"
 
 namespace BansheeEngine
 {

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

@@ -17,6 +17,9 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "GUISkin")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
@@ -25,9 +28,6 @@ namespace BansheeEngine
 		/** @copydoc ScriptObjectBase::_createManagedInstance */
 		MonoObject* _createManagedInstance(bool construct) override;
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

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

@@ -44,9 +44,9 @@ namespace BansheeEngine
 
 	protected:
 		TScriptJoint(MonoObject* instance, const SPtr<Joint>& joint)
-			:ScriptObject(instance)
+			:ScriptObject<Type, ScriptJointBase>(instance)
 		{
-			initialize(joint);
+			this->initialize(joint);
 		}
 	};
 

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptManagedResource.h

@@ -28,6 +28,9 @@ namespace BansheeEngine
 
 		/**	Returns a handle to the internal wrapped resource. */
 		const HManagedResource& getHandle() const { return mResource; }
+
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
 	private:
 		friend class ScriptResourceManager;
 
@@ -43,9 +46,6 @@ namespace BansheeEngine
 		/** @copydoc ScriptObjectBase::_onManagedInstanceDeleted */
 		void _onManagedInstanceDeleted() override;
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		HManagedResource mResource;
 		String mNamespace;
 		String mType;

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptMaterial.h

@@ -24,6 +24,9 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Material")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
@@ -32,9 +35,6 @@ namespace BansheeEngine
 		/** @copydoc ScriptObjectBase::_createManagedInstance */
 		MonoObject* _createManagedInstance(bool construct) override;
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptMesh.h

@@ -58,6 +58,9 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Mesh")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
@@ -72,9 +75,6 @@ namespace BansheeEngine
 		/** Converts a managed array of SubMeshData%es into an array of SubMesh%es used by engine internals. */
 		static Vector<SubMesh> monoToNativeSubMeshes(MonoArray* subMeshes);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 11 - 13
Source/SBansheeEngine/Include/BsScriptObject.h

@@ -16,7 +16,11 @@ namespace BansheeEngine
 	 *  @{
 	 */
 
-	struct ScriptObjectBackup;
+	/**	Contains backed up interop object data. */
+	struct ScriptObjectBackup
+	{
+		Any data;
+	};
 
 	/** Helper class to initialize all script interop objects as soon as the library is loaded. */
 	template <class Type, class Base>
@@ -106,21 +110,21 @@ namespace BansheeEngine
 		 */
 		void _clearManagedInstance()
 		{
-			if (metaData.thisPtrField != nullptr && mManagedInstance != nullptr)
-				metaData.thisPtrField->setValue(mManagedInstance, nullptr);
+			if (metaData.thisPtrField != nullptr && this->mManagedInstance != nullptr)
+				metaData.thisPtrField->setValue(this->mManagedInstance, nullptr);
 
-			mManagedInstance = nullptr;
+			this->mManagedInstance = nullptr;
 		}
 
 		/**	Allows persistent objects to restore their managed instances after assembly reload. */
 		void _restoreManagedInstance()
 		{
-			mManagedInstance = _createManagedInstance(true);
+			this->mManagedInstance = _createManagedInstance(true);
 
 			Type* param = (Type*)(Base*)this; // Needed due to multiple inheritance. Safe since Type must point to an class derived from this one.
 
-			if (metaData.thisPtrField != nullptr && mManagedInstance != nullptr)
-				metaData.thisPtrField->setValue(mManagedInstance, &param);
+			if (metaData.thisPtrField != nullptr && this->mManagedInstance != nullptr)
+				metaData.thisPtrField->setValue(this->mManagedInstance, &param);
 		}
 
 		/**	Creates a new managed instance of the type wrapped by this interop object. */
@@ -170,12 +174,6 @@ namespace BansheeEngine
 	template <typename Type, typename Base>
 	ScriptMeta ScriptObject<Type, Base>::metaData;
 
-	/**	Contains backed up interop object data. */
-	struct ScriptObjectBackup
-	{
-		Any data;
-	};
-
 /** Helper macro to use with script interop objects that form a link between C++ and CLR. */
 #define SCRIPT_OBJ(assembly, namespace, name)		\
 	static String getAssemblyName() { return assembly; }	\

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptPhysicsMaterial.h

@@ -18,14 +18,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "PhysicsMaterial")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptPhysicsMaterial(MonoObject* instance, const HPhysicsMaterial& material);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptPhysicsMesh.h

@@ -18,14 +18,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "PhysicsMesh")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptPhysicsMesh(MonoObject* instance, const HPhysicsMesh& mesh);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptPlainText.h

@@ -19,14 +19,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "PlainText")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptPlainText(MonoObject* instance, const HPlainText& plainText);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptPrefab.h

@@ -18,14 +18,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Prefab")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptPrefab(MonoObject* instance, const HPrefab& prefab);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 4 - 4
Source/SBansheeEngine/Include/BsScriptResource.h

@@ -69,7 +69,7 @@ namespace BansheeEngine
 		friend class ScriptResourceManager;
 
 		TScriptResource(MonoObject* instance, const ResourceHandle<ResType>& resource)
-			:ScriptObject(instance), mResource(resource)
+			:ScriptObject<ScriptClass, ScriptResourceBase>(instance), mResource(resource)
 		{
 			mManagedHandle = mono_gchandle_new(instance, false);
 
@@ -85,9 +85,9 @@ namespace BansheeEngine
 		virtual void endRefresh(const ScriptObjectBackup& backupData) override
 		{
 			BS_ASSERT(!mHandleValid);
-			mManagedHandle = mono_gchandle_new(mManagedInstance, false);
+			mManagedHandle = mono_gchandle_new(this->mManagedInstance, false);
 
-			ScriptObject::endRefresh(backupData);
+			ScriptObject<ScriptClass, ScriptResourceBase>::endRefresh(backupData);
 		}
 
 		/**	
@@ -105,7 +105,7 @@ namespace BansheeEngine
 			mono_gchandle_free(mManagedHandle);
 			BS_DEBUG_ONLY(mHandleValid = false);
 
-			destroy();
+			this->destroy();
 		}
 
 		ResourceHandle<ResType> mResource;

+ 38 - 25
Source/SBansheeEngine/Include/BsScriptResourceManager.h

@@ -8,6 +8,8 @@
 
 namespace BansheeEngine
 {
+	namespace Detail { }
+
 	/** @addtogroup SBansheeEngine
 	 *  @{
 	 */
@@ -58,28 +60,6 @@ namespace BansheeEngine
 		template<class RetType, class InType>
 		void getScriptResource(const ResourceHandle<InType>& resourceHandle, RetType** out, bool create = false);
 
-		/**
-		 * Creates a new managed instance and interop object for the specified string table.
-		 *
-		 * @param[in]	resourceHandle	Native string table resource to wrap in a managed instance.
-		 * @param[out]	out				Output string table interop object corresponding to the new managed instance.
-		 *
-		 * @note	Throws an exception if a managed instance for the provided resource already exists.
-		 */
-		template<>
-		void createScriptResource(const ResourceHandle<StringTable>& resourceHandle, ScriptStringTable** out);
-
-		/**
-		 * Creates a new managed instance and interop object for the specified resource.
-		 *
-		 * @param[in]	resourceHandle	Native resource to wrap in a managed instance.
-		 * @param[out]	out				Output interop object corresponding to the new managed instance.
-		 *
-		 * @note	Throws an exception if a managed instance for the provided resource already exists.
-		 */
-		template<>
-		void createScriptResource(const HResource& resourceHandle, ScriptResourceBase** out);
-
 		/**
 		 * Attempts to find a resource interop object for a resource with the specified UUID. Returns null if the object
 		 * cannot be found.
@@ -91,16 +71,49 @@ namespace BansheeEngine
 		 */
 		void destroyScriptResource(ScriptResourceBase* resource);
 
+		/**	Throws an exception if the provided UUID already exists in the interop object lookup table. */
+		void _throwExceptionIfInvalidOrDuplicate(const String& uuid) const;
+
 	private:
 		/**	Triggered when the native resource has been unloaded and therefore destroyed. */
 		void onResourceDestroyed(const String& UUID);
 
-		/**	Throws an exception if the provided UUID already exists in the interop object lookup table. */
-		void throwExceptionIfInvalidOrDuplicate(const String& uuid) const;
-
 		UnorderedMap<String, ScriptResourceBase*> mScriptResources;
 		HEvent mResourceDestroyedConn;
 	};
 
 	/** @} */
+
+	/** @addtogroup Implementation 
+	 *  @{
+	 */
+
+	namespace Detail
+	{
+		/** Another layer of indirection for specialized ScriptResourceManager methods. */
+
+		template<class RetType, class InType>
+		void BS_SCR_BE_EXPORT ScriptResourceManager_createScriptResource(ScriptResourceManager* thisPtr,
+			const ResourceHandle<InType>& resourceHandle, RetType** out);
+
+		template<>
+		void BS_SCR_BE_EXPORT ScriptResourceManager_createScriptResource(ScriptResourceManager* thisPtr,
+			const ResourceHandle<StringTable>& resourceHandle, ScriptStringTable** out);
+
+		template<>
+		void BS_SCR_BE_EXPORT ScriptResourceManager_createScriptResource(ScriptResourceManager* thisPtr,
+			const ResourceHandle<Texture>& resourceHandle, ScriptTextureBase** out);
+
+		template<>
+		void BS_SCR_BE_EXPORT ScriptResourceManager_createScriptResource(ScriptResourceManager* thisPtr,
+			const HResource& resourceHandle, ScriptResourceBase** out);
+	}
+
+	/** @} */
+
+	template<class RetType, class InType>
+	void ScriptResourceManager::createScriptResource(const ResourceHandle<InType>& resourceHandle, RetType** out)
+	{
+		Detail::ScriptResourceManager_createScriptResource<RetType, InType>(this, resourceHandle, out);
+	}
 }

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptScriptCode.h

@@ -19,6 +19,9 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ScriptCode")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 		typedef std::pair<WString, WString> FullTypeName;
@@ -28,9 +31,6 @@ namespace BansheeEngine
 		/** Parses the provided C# code and finds a list of all classes and their namespaces. Nested classes are ignored. */
 		static Vector<FullTypeName> parseTypes(const WString& code);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptShader.h

@@ -18,14 +18,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Shader")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptShader(MonoObject* instance, const HShader& shader);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptShaderInclude.h

@@ -18,13 +18,13 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "ShaderInclude")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptShaderInclude(MonoObject* instance, const HShaderInclude& shaderInclude);
-
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
 	};
 
 	/** @} */

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptSpriteTexture.h

@@ -18,6 +18,9 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "SpriteTexture")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 		/**	Returns the native internal sprite texture resource. */
 		static MonoObject* toManaged(const HSpriteTexture& texture);
 
@@ -26,9 +29,6 @@ namespace BansheeEngine
 
 		ScriptSpriteTexture(MonoObject* instance, const HSpriteTexture& texture);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptStringTable.h

@@ -18,6 +18,9 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "StringTable")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
@@ -26,9 +29,6 @@ namespace BansheeEngine
 		/** @copydoc ScriptObjectBase::_createManagedInstance */
 		MonoObject* _createManagedInstance(bool construct) override;
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptTexture2D.h

@@ -19,14 +19,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Texture2D")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptTexture2D(MonoObject* instance, const HTexture& texture);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptTexture3D.h

@@ -19,14 +19,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "Texture3D")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptTexture3D(MonoObject* instance, const HTexture& texture);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 3 - 3
Source/SBansheeEngine/Include/BsScriptTextureCube.h

@@ -19,14 +19,14 @@ namespace BansheeEngine
 	public:
 		SCRIPT_OBJ(ENGINE_ASSEMBLY, "BansheeEngine", "TextureCube")
 
+		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
+		static MonoObject* createInstance();
+
 	private:
 		friend class ScriptResourceManager;
 
 		ScriptTextureCube(MonoObject* instance, const HTexture& texture);
 
-		/**	Creates an empty, uninitialized managed instance of the resource interop object. */
-		static MonoObject* createInstance();
-
 		/************************************************************************/
 		/* 								CLR HOOKS						   		*/
 		/************************************************************************/

+ 9 - 8
Source/SBansheeEngine/Source/BsManagedComponent.cpp

@@ -17,16 +17,17 @@
 namespace BansheeEngine
 {
 	ManagedComponent::ManagedComponent()
-		:mManagedInstance(nullptr), mOnUpdateThunk(nullptr), mOnDestroyThunk(nullptr), mOnInitializedThunk(nullptr), 
-		mOnResetThunk(nullptr), mMissingType(false), mRequiresReset(true), mOnEnabledThunk(nullptr), mOnDisabledThunk(nullptr),
-		mOnTransformChangedThunk(nullptr), mCalculateBoundsMethod(nullptr), mRunInEditor(false)
+		: mManagedInstance(nullptr), mRuntimeType(nullptr), mManagedHandle(0), mRunInEditor(false), mRequiresReset(true)
+		, mMissingType(false), mOnInitializedThunk(nullptr), mOnUpdateThunk(nullptr), mOnResetThunk(nullptr)
+		, mOnDestroyThunk(nullptr), mOnDisabledThunk(nullptr), mOnEnabledThunk(nullptr), mOnTransformChangedThunk(nullptr)
+		, mCalculateBoundsMethod(nullptr)
 	{ }
 
 	ManagedComponent::ManagedComponent(const HSceneObject& parent, MonoReflectionType* runtimeType)
-		: Component(parent), mManagedInstance(nullptr), mRuntimeType(runtimeType), mOnUpdateThunk(nullptr), 
-		mOnDestroyThunk(nullptr), mOnInitializedThunk(nullptr), mOnResetThunk(nullptr), mMissingType(false), 
-		mRequiresReset(true), mOnEnabledThunk(nullptr), mOnDisabledThunk(nullptr), mCalculateBoundsMethod(nullptr),
-		mOnTransformChangedThunk(nullptr), mRunInEditor(false)
+		: Component(parent), mManagedInstance(nullptr), mRuntimeType(runtimeType), mManagedHandle(0), mRunInEditor(false)
+		, mRequiresReset(true), mMissingType(false), mOnInitializedThunk(nullptr), mOnUpdateThunk(nullptr)
+		, mOnResetThunk(nullptr), mOnDestroyThunk(nullptr), mOnDisabledThunk(nullptr), mOnEnabledThunk(nullptr)
+		, mOnTransformChangedThunk(nullptr), mCalculateBoundsMethod(nullptr)
 	{
 		MonoType* monoType = mono_reflection_type_get_type(mRuntimeType);
 		::MonoClass* monoClass = mono_type_get_class(monoType);
@@ -361,7 +362,7 @@ namespace BansheeEngine
 		}
 
 		assert(componentHandle != nullptr);
-		ScriptComponent* nativeInstance = ScriptGameObjectManager::instance().createScriptComponent(mManagedInstance, componentHandle);
+		ScriptGameObjectManager::instance().createScriptComponent(mManagedInstance, componentHandle);
 	}
 
 	void ManagedComponent::onInitialized()

+ 4 - 3
Source/SBansheeEngine/Source/BsManagedSerializableArray.cpp

@@ -11,14 +11,15 @@
 namespace BansheeEngine
 {
 	ManagedSerializableArray::ManagedSerializableArray(const ConstructPrivately& dummy)
-		:mManagedInstance(nullptr), mElemSize(0), mElementMonoClass(nullptr), mCopyMethod(nullptr)
+		:mManagedInstance(nullptr), mElementMonoClass(nullptr), mCopyMethod(nullptr), mElemSize(0)
 	{
 
 	}
 
 	ManagedSerializableArray::ManagedSerializableArray(const ConstructPrivately& dummy, const SPtr<ManagedSerializableTypeInfoArray>& typeInfo, MonoObject* managedInstance)
-		: mArrayTypeInfo(typeInfo), mManagedInstance(managedInstance), mElemSize(0), 
-		mElementMonoClass(nullptr), mCopyMethod(nullptr)
+		: mManagedInstance(managedInstance), mElementMonoClass(nullptr), mCopyMethod(nullptr), mArrayTypeInfo(typeInfo)
+		, mElemSize(0)
+		
 	{
 		::MonoClass* monoClass = mono_object_get_class(mManagedInstance);
 		mElemSize = mono_array_element_size(monoClass);

+ 7 - 5
Source/SBansheeEngine/Source/BsManagedSerializableDictionary.cpp

@@ -40,7 +40,7 @@ namespace BansheeEngine
 	}
 
 	ManagedSerializableDictionary::Enumerator::Enumerator(MonoObject* instance, const ManagedSerializableDictionary* parent)
-		:mInstance(instance), mParent(parent), mCurrent(nullptr), mIteratorInitialized(false)
+		:mInstance(instance), mCurrent(nullptr), mIteratorInitialized(false), mParent(parent)
 	{ }
 
 	SPtr<ManagedSerializableFieldData> ManagedSerializableDictionary::Enumerator::getKey() const
@@ -100,13 +100,15 @@ namespace BansheeEngine
 	}
 
 	ManagedSerializableDictionary::ManagedSerializableDictionary(const ConstructPrivately& dummy)
-		:mManagedInstance(nullptr), mAddMethod(nullptr), mGetEnumerator(nullptr), mEnumMoveNext(nullptr), mRemoveMethod(nullptr),
-		mEnumCurrentProp(nullptr), mKeyProp(nullptr), mValueProp(nullptr), mContainsKeyMethod(nullptr), mTryGetValueMethod(nullptr)
+		: mManagedInstance(nullptr), mAddMethod(nullptr), mRemoveMethod(nullptr), mTryGetValueMethod(nullptr)
+		, mContainsKeyMethod(nullptr), mGetEnumerator(nullptr), mEnumMoveNext(nullptr), mEnumCurrentProp(nullptr)
+		, mKeyProp(nullptr), mValueProp(nullptr)
 	{ }
 
 	ManagedSerializableDictionary::ManagedSerializableDictionary(const ConstructPrivately& dummy, const SPtr<ManagedSerializableTypeInfoDictionary>& typeInfo, MonoObject* managedInstance)
-		:mDictionaryTypeInfo(typeInfo), mManagedInstance(managedInstance), mAddMethod(nullptr), mGetEnumerator(nullptr), mEnumMoveNext(nullptr),
-		mEnumCurrentProp(nullptr), mKeyProp(nullptr), mValueProp(nullptr), mContainsKeyMethod(nullptr), mTryGetValueMethod(nullptr), mRemoveMethod(nullptr)
+		: mManagedInstance(managedInstance), mAddMethod(nullptr), mRemoveMethod(nullptr), mTryGetValueMethod(nullptr)
+		, mContainsKeyMethod(nullptr), mGetEnumerator(nullptr), mEnumMoveNext(nullptr), mEnumCurrentProp(nullptr)
+		, mKeyProp(nullptr), mValueProp(nullptr), mDictionaryTypeInfo(typeInfo)
 	{
 		MonoClass* dictClass = MonoManager::instance().findClass(mono_object_get_class(managedInstance));
 		if (dictClass == nullptr)

+ 2 - 2
Source/SBansheeEngine/Source/BsManagedSerializableField.cpp

@@ -307,6 +307,8 @@ namespace BansheeEngine
 
 					return fieldData;
 				}
+			default:
+				break;
 			}
 		}
 		else if (typeInfo->getTypeId() == TID_SerializableTypeInfoRef)
@@ -573,8 +575,6 @@ namespace BansheeEngine
 
 	void* ManagedSerializableFieldDataResourceRef::getValue(const SPtr<ManagedSerializableTypeInfo>& typeInfo)
 	{
-		static std::function<MonoObject*(const HResource&)> lookup[(int)ScriptReferenceType::Count];
-
 		if(typeInfo->getTypeId() == TID_SerializableTypeInfoRef)
 		{
 			auto refTypeInfo = std::static_pointer_cast<ManagedSerializableTypeInfoRef>(typeInfo);

+ 4 - 4
Source/SBansheeEngine/Source/BsManagedSerializableList.cpp

@@ -13,15 +13,15 @@
 namespace BansheeEngine
 {
 	ManagedSerializableList::ManagedSerializableList(const ConstructPrivately& dummy)
-		:mManagedInstance(nullptr), mNumElements(0), mItemProp(nullptr), mCountProp(nullptr), mAddMethod(nullptr),
-		mAddRangeMethod(nullptr), mCopyToMethod(nullptr), mClearMethod(nullptr)
+		: mManagedInstance(nullptr), mAddMethod(nullptr), mAddRangeMethod(nullptr), mClearMethod(nullptr)
+		, mCopyToMethod(nullptr), mItemProp(nullptr), mCountProp(nullptr), mNumElements(0)
 	{
 
 	}
 
 	ManagedSerializableList::ManagedSerializableList(const ConstructPrivately& dummy, const SPtr<ManagedSerializableTypeInfoList>& typeInfo, MonoObject* managedInstance)
-		:mListTypeInfo(typeInfo), mManagedInstance(managedInstance), mNumElements(0), mItemProp(nullptr),
-		mCountProp(nullptr), mAddMethod(nullptr), mAddRangeMethod(nullptr), mCopyToMethod(nullptr), mClearMethod(nullptr)
+		: mManagedInstance(managedInstance), mAddMethod(nullptr), mAddRangeMethod(nullptr), mClearMethod(nullptr)
+		, mCopyToMethod(nullptr), mItemProp(nullptr), mCountProp(nullptr), mListTypeInfo(typeInfo), mNumElements(0)
 	{
 		MonoClass* listClass = MonoManager::instance().findClass(mono_object_get_class(managedInstance));
 		if(listClass == nullptr)

+ 1 - 1
Source/SBansheeEngine/Source/BsManagedSerializableObject.cpp

@@ -32,7 +32,7 @@ namespace BansheeEngine
 	}
 
 	ManagedSerializableObject::ManagedSerializableObject(const ConstructPrivately& dummy, SPtr<ManagedSerializableObjectInfo> objInfo, MonoObject* managedInstance)
-		:mObjInfo(objInfo), mManagedInstance(managedInstance)
+		:mManagedInstance(managedInstance), mObjInfo(objInfo)
 	{
 
 	}

+ 3 - 1
Source/SBansheeEngine/Source/BsManagedSerializableObjectInfo.cpp

@@ -88,7 +88,7 @@ namespace BansheeEngine
 	}
 
 	ManagedSerializableFieldInfo::ManagedSerializableFieldInfo()
-		:mMonoField(nullptr), mFlags((ScriptFieldFlags)0), mFieldId(0)
+		:mFieldId(0), mFlags((ScriptFieldFlags)0), mMonoField(nullptr)
 	{
 
 	}
@@ -158,6 +158,8 @@ namespace BansheeEngine
 			return mono_get_double_class();
 		case ScriptPrimitiveType::String:
 			return mono_get_string_class();
+		default:
+			break;
 		}
 
 		return nullptr;

+ 2 - 0
Source/SBansheeEngine/Source/BsPlayInEditorManager.cpp

@@ -83,6 +83,8 @@ namespace BansheeEngine
 		case PlayInEditorState::Paused:
 			setState(PlayInEditorState::Playing);
 			break;
+		default:
+			break;
 		}
 
 		mFrameStepActive = true;

+ 4 - 4
Source/SBansheeEngine/Source/BsScriptAssemblyManager.cpp

@@ -29,10 +29,10 @@
 namespace BansheeEngine
 {
 	ScriptAssemblyManager::ScriptAssemblyManager()
-		:mBaseTypesInitialized(false), mSerializeObjectAttribute(nullptr), mDontSerializeFieldAttribute(nullptr), 
-		mComponentClass(nullptr), mSceneObjectClass(nullptr), mSerializeFieldAttribute(nullptr), mHideInInspectorAttribute(nullptr), 
-		mSystemArrayClass(nullptr), mSystemGenericListClass(nullptr), mSystemGenericDictionaryClass(nullptr), mMissingComponentClass(nullptr),
-		mSystemTypeClass(nullptr)
+		: mBaseTypesInitialized(false), mSystemArrayClass(nullptr), mSystemGenericListClass(nullptr)
+		, mSystemGenericDictionaryClass(nullptr), mSystemTypeClass(nullptr), mComponentClass(nullptr)
+		, mSceneObjectClass(nullptr), mMissingComponentClass(nullptr), mSerializeObjectAttribute(nullptr)
+		, mDontSerializeFieldAttribute(nullptr), mSerializeFieldAttribute(nullptr), mHideInInspectorAttribute(nullptr)
 	{
 
 	}

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptAsyncOp.cpp

@@ -39,7 +39,7 @@ namespace BansheeEngine
 
 	void ScriptAsyncOp::internal_createInstance(MonoObject* managedInstance)
 	{
-		ScriptAsyncOp* scriptAsyncOp = new (bs_alloc<ScriptAsyncOp>()) ScriptAsyncOp(managedInstance);
+		new (bs_alloc<ScriptAsyncOp>()) ScriptAsyncOp(managedInstance);
 	}
 
 	void ScriptAsyncOp::internal_isComplete(ScriptAsyncOp* thisPtr, bool* value)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptBoxCollider.cpp

@@ -28,7 +28,7 @@ namespace BansheeEngine
 		SPtr<BoxCollider> collider = BoxCollider::create(Vector3::ONE);
 		collider->_setOwner(PhysicsOwnerType::Script, instance);
 
-		ScriptBoxCollider* scriptCollider = new (bs_alloc<ScriptBoxCollider>()) ScriptBoxCollider(instance, collider);
+		new (bs_alloc<ScriptBoxCollider>()) ScriptBoxCollider(instance, collider);
 	}
 
 	void ScriptBoxCollider::internal_SetExtents(ScriptBoxCollider* thisPtr, Vector3* extents)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptCamera.cpp

@@ -142,7 +142,7 @@ namespace BansheeEngine
 		if (parentSO != nullptr)
 			so = parentSO->getNativeHandle();
 
-		ScriptCamera* nativeInstance = new (bs_alloc<ScriptCamera>()) ScriptCamera(managedInstance, so);
+		new (bs_alloc<ScriptCamera>()) ScriptCamera(managedInstance, so);
 	}
 
 	float ScriptCamera::internal_GetAspect(ScriptCamera* instance)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptCapsuleCollider.cpp

@@ -30,7 +30,7 @@ namespace BansheeEngine
 		SPtr<CapsuleCollider> collider = CapsuleCollider::create(0.2f, 0.5f);
 		collider->_setOwner(PhysicsOwnerType::Script, instance);
 
-		ScriptCapsuleCollider* scriptCollider = new (bs_alloc<ScriptCapsuleCollider>()) ScriptCapsuleCollider(instance, collider);
+		new (bs_alloc<ScriptCapsuleCollider>()) ScriptCapsuleCollider(instance, collider);
 	}
 
 	void ScriptCapsuleCollider::internal_SetHalfHeight(ScriptCapsuleCollider* thisPtr, float halfHeight)

+ 1 - 2
Source/SBansheeEngine/Source/BsScriptCharacterController.cpp

@@ -64,8 +64,7 @@ namespace BansheeEngine
 		SPtr<CharacterController> charController = CharacterController::create(*initData);
 		charController->_setOwner(PhysicsOwnerType::Script, instance);
 
-		ScriptCharacterController* scriptCharacterController = 
-			new (bs_alloc<ScriptCharacterController>()) ScriptCharacterController(instance, charController);
+		new (bs_alloc<ScriptCharacterController>()) ScriptCharacterController(instance, charController);
 	}
 
 	void ScriptCharacterController::internal_Destroy(ScriptCharacterController* thisPtr)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptComponent.cpp

@@ -226,7 +226,7 @@ namespace BansheeEngine
 	{
 		if (handle.isDestroyed())
 		{
-			LOGWRN("Trying to access a destroyed GameObject with instance ID: " + handle.getInstanceId());
+			LOGWRN("Trying to access a destroyed GameObject with instance ID: " + toString(handle.getInstanceId()));
 			return true;
 		}
 

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptContextMenu.cpp

@@ -34,7 +34,7 @@ namespace BansheeEngine
 
 	void ScriptContextMenu::internal_CreateInstance(MonoObject* instance)
 	{
-		ScriptContextMenu* nativeInstance = new (bs_alloc<ScriptContextMenu>()) ScriptContextMenu(instance);
+		new (bs_alloc<ScriptContextMenu>()) ScriptContextMenu(instance);
 	}
 
 	void ScriptContextMenu::internal_AddItem(ScriptContextMenu* instance, MonoString* path, UINT32 callbackIdx,

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptD6Joint.cpp

@@ -43,7 +43,7 @@ namespace BansheeEngine
 		SPtr<D6Joint> joint = D6Joint::create(desc);
 		joint->_setOwner(PhysicsOwnerType::Script, instance);
 
-		ScriptD6Joint* scriptJoint = new (bs_alloc<ScriptD6Joint>()) ScriptD6Joint(instance, joint);
+		new (bs_alloc<ScriptD6Joint>()) ScriptD6Joint(instance, joint);
 	}
 
 	void ScriptD6Joint::internal_SetMotion(ScriptD6Joint* thisPtr, D6Joint::Axis axis, D6Joint::Motion motion)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptDistanceJoint.cpp

@@ -39,7 +39,7 @@ namespace BansheeEngine
 		SPtr<DistanceJoint> joint = DistanceJoint::create(desc);
 		joint->_setOwner(PhysicsOwnerType::Script, instance);
 
-		ScriptDistanceJoint* scriptJoint = new (bs_alloc<ScriptDistanceJoint>()) ScriptDistanceJoint(instance, joint);
+		new (bs_alloc<ScriptDistanceJoint>()) ScriptDistanceJoint(instance, joint);
 	}
 
 	float ScriptDistanceJoint::internal_GetDistance(ScriptDistanceJoint* thisPtr)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptFixedJoint.cpp

@@ -29,6 +29,6 @@ namespace BansheeEngine
 		SPtr<FixedJoint> joint = FixedJoint::create(desc);
 		joint->_setOwner(PhysicsOwnerType::Script, instance);
 
-		ScriptFixedJoint* scriptJoint = new (bs_alloc<ScriptFixedJoint>()) ScriptFixedJoint(instance, joint);
+		new (bs_alloc<ScriptFixedJoint>()) ScriptFixedJoint(instance, joint);
 	}
 }

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptFontBitmap.cpp

@@ -52,7 +52,7 @@ namespace BansheeEngine
 	MonoObject* ScriptFontBitmap::create(SPtr<const FontBitmap> bitmap)
 	{
 		MonoObject* managedInstance = metaData.scriptClass->createInstance();
-		ScriptFontBitmap* fontBitmap = new (bs_alloc<ScriptFontBitmap>()) ScriptFontBitmap(managedInstance, bitmap);
+		new (bs_alloc<ScriptFontBitmap>()) ScriptFontBitmap(managedInstance, bitmap);
 
 		return managedInstance;
 	}

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIButton.cpp

@@ -57,7 +57,7 @@ namespace BansheeEngine
 		guiButton->onHover.connect(std::bind(&ScriptGUIButton::onHover, instance));
 		guiButton->onOut.connect(std::bind(&ScriptGUIButton::onOut, instance));
 
-		ScriptGUIButton* nativeInstance = new (bs_alloc<ScriptGUIButton>()) ScriptGUIButton(instance, guiButton);
+		new (bs_alloc<ScriptGUIButton>()) ScriptGUIButton(instance, guiButton);
 	}
 
 	void ScriptGUIButton::internal_setContent(ScriptGUIButton* nativeInstance, MonoObject* content)

+ 2 - 2
Source/SBansheeEngine/Source/BsScriptGUIElementStyle.cpp

@@ -102,13 +102,13 @@ namespace BansheeEngine
 
 		MonoObject* instance = metaData.scriptClass->createInstance(params, true);
 
-		ScriptGUIElementStyle* nativeInstance = new (bs_alloc<ScriptGUIElementStyle>()) ScriptGUIElementStyle(instance, style);
+		new (bs_alloc<ScriptGUIElementStyle>()) ScriptGUIElementStyle(instance, style);
 		return instance;
 	}
 
 	void ScriptGUIElementStyle::internal_createInstance(MonoObject* instance)
 	{
-		ScriptGUIElementStyle* nativeInstance = new (bs_alloc<ScriptGUIElementStyle>()) ScriptGUIElementStyle(instance);
+		new (bs_alloc<ScriptGUIElementStyle>()) ScriptGUIElementStyle(instance);
 	}
 
 	void ScriptGUIElementStyle::internal_addSubStyle(ScriptGUIElementStyle* nativeInstance, MonoString* guiType, MonoString* styleName)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIFixedSpace.cpp

@@ -42,7 +42,7 @@ namespace BansheeEngine
 	{
 		GUIFixedSpace* space = GUIFixedSpace::create(size);
 
-		ScriptGUIFixedSpace* nativeInstance = new (bs_alloc<ScriptGUIFixedSpace>()) ScriptGUIFixedSpace(instance, space);
+		new (bs_alloc<ScriptGUIFixedSpace>()) ScriptGUIFixedSpace(instance, space);
 	}
 
 	void ScriptGUIFixedSpace::internal_setSize(ScriptGUIFixedSpace* nativeInstance, UINT32 size)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIFlexibleSpace.cpp

@@ -41,6 +41,6 @@ namespace BansheeEngine
 	{
 		GUIFlexibleSpace* space = GUIFlexibleSpace::create();
 
-		ScriptGUIFlexibleSpace* nativeInstance = new (bs_alloc<ScriptGUIFlexibleSpace>()) ScriptGUIFlexibleSpace(instance, space);
+		new (bs_alloc<ScriptGUIFlexibleSpace>()) ScriptGUIFlexibleSpace(instance, space);
 	}
 }

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIInputBox.cpp

@@ -44,7 +44,7 @@ namespace BansheeEngine
 		GUIInputBox* guiInputBox = GUIInputBox::create(multiline, options, toString(MonoUtil::monoToWString(style)));
 		guiInputBox->onValueChanged.connect(std::bind(&ScriptGUIInputBox::onChanged, instance, _1));
 
-		ScriptGUIInputBox* nativeInstance = new (bs_alloc<ScriptGUIInputBox>()) ScriptGUIInputBox(instance, guiInputBox);
+		new (bs_alloc<ScriptGUIInputBox>()) ScriptGUIInputBox(instance, guiInputBox);
 	}
 
 	void ScriptGUIInputBox::internal_getText(ScriptGUIInputBox* nativeInstance, MonoString** text)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUILabel.cpp

@@ -41,7 +41,7 @@ namespace BansheeEngine
 		GUIContent nativeContent(ScriptGUIContent::getText(content), ScriptGUIContent::getImage(content), ScriptGUIContent::getTooltip(content));
 		GUILabel* guiLabel = GUILabel::create(nativeContent, options, toString(MonoUtil::monoToWString(style)));
 
-		ScriptGUILabel* nativeInstance = new (bs_alloc<ScriptGUILabel>()) ScriptGUILabel(instance, guiLabel);
+		new (bs_alloc<ScriptGUILabel>()) ScriptGUILabel(instance, guiLabel);
 	}
 
 	void ScriptGUILabel::internal_setContent(ScriptGUILabel* nativeInstance, MonoObject* content)

+ 4 - 4
Source/SBansheeEngine/Source/BsScriptGUILayout.cpp

@@ -97,7 +97,7 @@ namespace BansheeEngine
 
 		GUILayout* layout = GUILayoutX::create(options);
 
-		ScriptGUILayout* nativeInstance = new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(instance, layout);
+		new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(instance, layout);
 	}
 
 	void ScriptGUILayout::internal_createInstanceY(MonoObject* instance, MonoArray* guiOptions)
@@ -110,7 +110,7 @@ namespace BansheeEngine
 
 		GUILayout* layout = GUILayoutY::create(options);
 
-		ScriptGUILayout* nativeInstance = new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(instance, layout);
+		new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(instance, layout);
 	}
 
 	void ScriptGUILayout::internal_createInstancePanel(MonoObject* instance, INT16 depth, UINT16 depthRangeMin, UINT32 depthRangeMax, MonoArray* guiOptions)
@@ -123,7 +123,7 @@ namespace BansheeEngine
 
 		GUILayout* layout = GUIPanel::create(depth, depthRangeMin, depthRangeMax, options);
 
-		ScriptGUILayout* nativeInstance = new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(instance, layout);
+		new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(instance, layout);
 	}
 
 	void ScriptGUILayout::internal_createInstanceYFromScrollArea(MonoObject* instance, MonoObject* parentScrollArea)
@@ -210,7 +210,7 @@ namespace BansheeEngine
 	MonoObject* ScriptGUIPanel::createFromExisting(GUIPanel* panel)
 	{
 		MonoObject* managedInstance = metaData.scriptClass->createInstance();
-		ScriptGUILayout* nativeInstance = new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(managedInstance, panel, false);
+		new (bs_alloc<ScriptGUILayout>()) ScriptGUILayout(managedInstance, panel, false);
 
 		return managedInstance;
 	}

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIListBox.cpp

@@ -67,7 +67,7 @@ namespace BansheeEngine
 		GUIListBox* guiListBox = GUIListBox::create(nativeElements, multiselect, options, toString(MonoUtil::monoToWString(style)));
 		guiListBox->onSelectionToggled.connect(std::bind(&ScriptGUIListBox::onSelectionChanged, instance, _1, _2));
 
-		ScriptGUIListBox* nativeInstance = new (bs_alloc<ScriptGUIListBox>()) ScriptGUIListBox(instance, guiListBox);
+		new (bs_alloc<ScriptGUIListBox>()) ScriptGUIListBox(instance, guiListBox);
 	}
 
 	void ScriptGUIListBox::internal_setElements(ScriptGUIListBox* nativeInstance, MonoArray* elements)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIProgressBar.cpp

@@ -43,7 +43,7 @@ namespace BansheeEngine
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
 		GUIProgressBar* progressBar = GUIProgressBar::create(options, toString(MonoUtil::monoToWString(style)));
-		ScriptGUIProgressBar* nativeInstance = new (bs_alloc<ScriptGUIProgressBar>()) ScriptGUIProgressBar(instance, progressBar);
+		new (bs_alloc<ScriptGUIProgressBar>()) ScriptGUIProgressBar(instance, progressBar);
 	}
 
 	void ScriptGUIProgressBar::internal_setPercent(ScriptGUIProgressBar* nativeInstance, float percent)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIRenderTexture.cpp

@@ -46,7 +46,7 @@ namespace BansheeEngine
 
 		GUIRenderTexture* guiTexture = GUIRenderTexture::create(renderTexture, transparent, options, toString(MonoUtil::monoToWString(style)));
 
-		ScriptGUIRenderTexture* nativeInstance = new (bs_alloc<ScriptGUIRenderTexture>()) ScriptGUIRenderTexture(instance, guiTexture);
+		new (bs_alloc<ScriptGUIRenderTexture>()) ScriptGUIRenderTexture(instance, guiTexture);
 	}
 
 	void ScriptGUIRenderTexture::internal_setTexture(ScriptGUIRenderTexture* nativeInstance, ScriptRenderTexture2D* texture)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIScrollArea.cpp

@@ -81,7 +81,7 @@ namespace BansheeEngine
 		GUIScrollArea* guiScrollArea = GUIScrollArea::create(vertBarType, horzBarType, options, 
 			toString(MonoUtil::monoToWString(scrollBarStyle)), toString(MonoUtil::monoToWString(scrollAreaStyle)));
 
-		ScriptGUIScrollArea* nativeInstance = new (bs_alloc<ScriptGUIScrollArea>()) ScriptGUIScrollArea(instance, guiScrollArea);
+		new (bs_alloc<ScriptGUIScrollArea>()) ScriptGUIScrollArea(instance, guiScrollArea);
 	}
 
 	void ScriptGUIScrollArea::internal_getContentBounds(ScriptGUIScrollArea* nativeInstance, Rect2I* bounds)

+ 2 - 2
Source/SBansheeEngine/Source/BsScriptGUISlider.cpp

@@ -53,7 +53,7 @@ namespace BansheeEngine
 		GUISliderHorz* guiSlider = GUISliderHorz::create(options, toString(MonoUtil::monoToWString(style)));
 		guiSlider->onChanged.connect(std::bind(&ScriptGUISliderH::onChanged, instance, _1));
 
-		ScriptGUISliderH* nativeInstance = new (bs_alloc<ScriptGUISliderH>()) ScriptGUISliderH(instance, guiSlider);
+		new (bs_alloc<ScriptGUISliderH>()) ScriptGUISliderH(instance, guiSlider);
 	}
 
 	void ScriptGUISliderH::internal_setPercent(ScriptGUISliderH* nativeInstance, float percent)
@@ -136,7 +136,7 @@ namespace BansheeEngine
 		GUISliderVert* guiSlider = GUISliderVert::create(options, toString(MonoUtil::monoToWString(style)));
 		guiSlider->onChanged.connect(std::bind(&ScriptGUISliderV::onChanged, instance, _1));
 
-		ScriptGUISliderV* nativeInstance = new (bs_alloc<ScriptGUISliderV>()) ScriptGUISliderV(instance, guiSlider);
+		new (bs_alloc<ScriptGUISliderV>()) ScriptGUISliderV(instance, guiSlider);
 	}
 
 	void ScriptGUISliderV::internal_setPercent(ScriptGUISliderV* nativeInstance, float percent)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUITexture.cpp

@@ -46,7 +46,7 @@ namespace BansheeEngine
 
 		GUITexture* guiTexture = GUITexture::create(nativeTexture, scale, transparent, options, toString(MonoUtil::monoToWString(style)));
 
-		ScriptGUITexture* nativeInstance = new (bs_alloc<ScriptGUITexture>()) ScriptGUITexture(instance, guiTexture);
+		new (bs_alloc<ScriptGUITexture>()) ScriptGUITexture(instance, guiTexture);
 	}
 
 	void ScriptGUITexture::internal_setTexture(ScriptGUITexture* nativeInstance, MonoObject* texture)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIToggle.cpp

@@ -75,7 +75,7 @@ namespace BansheeEngine
 		guiToggle->onToggled.connect(std::bind(&ScriptGUIToggle::onToggled, instance, std::placeholders::_1));
 		guiToggle->onDoubleClick.connect(std::bind(&ScriptGUIToggle::onDoubleClick, instance));
 
-		ScriptGUIToggle* nativeInstance = new (bs_alloc<ScriptGUIToggle>()) ScriptGUIToggle(instance, guiToggle);
+		new (bs_alloc<ScriptGUIToggle>()) ScriptGUIToggle(instance, guiToggle);
 	}
 
 	void ScriptGUIToggle::internal_setContent(ScriptGUIToggle* nativeInstance, MonoObject* content)

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIToggleGroup.cpp

@@ -26,6 +26,6 @@ namespace BansheeEngine
 	{
 		SPtr<GUIToggleGroup> toggleGroup = GUIToggle::createToggleGroup(allowAllOff);
 
-		ScriptGUIToggleGroup* nativeInstance = new (bs_alloc<ScriptGUIToggleGroup>()) ScriptGUIToggleGroup(instance, toggleGroup);
+		new (bs_alloc<ScriptGUIToggleGroup>()) ScriptGUIToggleGroup(instance, toggleGroup);
 	}
 }

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptGUIWidget.cpp

@@ -47,7 +47,7 @@ namespace BansheeEngine
 
 	void ScriptGUIWidget::internal_Create(MonoObject* managedInstance)
 	{
-		ScriptGUIWidget* nativeInstance = new (bs_alloc<ScriptGUIWidget>()) ScriptGUIWidget(managedInstance);
+		new (bs_alloc<ScriptGUIWidget>()) ScriptGUIWidget(managedInstance);
 	}
 
 	void ScriptGUIWidget::internal_UpdateTransform(ScriptGUIWidget* thisPtr, ScriptSceneObject* parent)

Неке датотеке нису приказане због велике количине промена