Forráskód Böngészése

Various fixes regarding the physics mesh
Fixed typos in features.md

BearishSun 9 éve
szülő
commit
1b7ae019df

+ 3 - 3
Documentation/GitHub/features.md

@@ -115,9 +115,9 @@ Here you will find a complete list of all currently available features. New feat
 	* Custom 2D/3D tools
 	* Code for automating common tasks
 * __Game publishing__
-  * Build a game ready for distribution from within editor
-  * One click build process, just choose a platform and go
-  * Automatically detects required resources
+  * Build a game ready for distribution from within the editor
+  * One click build process, just choose a platform and build
+  * Automatically detects only the required resources to minimize build size
   * Automatically packages and outputs an executable
 * __Customizable frontend__
   * Dockable layout and floating windows

+ 578 - 577
Source/BansheeCore/Include/BsCorePrerequisites.h

@@ -1,578 +1,579 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisitesUtil.h"
-
-/** @defgroup Core Core
- *	Second lowest layer that provides some very game-specific modules tied into a coherent whole, but it tries to be very 
- *  generic and offer something that every engine might need instead of focusing on very specialized techniques.
- *  @{
- */
-
-/** @defgroup CoreThread Core thread
- *	Functionality for dealing with core objects and interaction with the core thread.
- */
-
-/** @defgroup Importer Importer
- *	Functionality for dealing with import of resources into engine friendly format.
- */
-
-/** @defgroup Input Input
- *	Functionality for dealing with input (mouse, keyboard, gamepad, etc.).
- */
-
-/** @defgroup Localization Localization
- *	Functionality for dealing with GUI localization.
- */
-
-/** @defgroup Material Material
- *	Functionality for dealing with materials, shaders, and in general how objects are rendered.
- */
-
-/** @defgroup Platform Platform
- *	Functionality specific for some platform (e.g. Windows, Mac).
- */
-
- /** @defgroup Profiling Profiling
-  *	Functionality for measuring CPU and GPU execution times and memory usage.
-  */
-
-/** @defgroup RenderAPI RenderAPI
-  *	Functionality for interacting with underlying render API (e.g. DirectX, OpenGL).
-  */
-
-/** @defgroup Renderer Renderer
-  *	Abstract interface and helper functionality for rendering scene objects.
-  */
-
-/** @defgroup Resources Resources
-  *	Contains core resource types and resource management functionality (loading, saving, etc.).
-  */
-
-/** @defgroup RTTI-Impl-Core RTTI types
- *  Types containing RTTI for specific classes.
- */
-
-/** @defgroup Scene Scene
- *  Functionality for managing scene objects and their hierarchy.
- */
-
-/** @defgroup Text Text
- *  Functionality for rendering text.
- */
-
-/** @defgroup Utility-Core Utility
- *  Various utility methods and types used by the core layer.
- */
-
-/** @defgroup Application-Core Application
- *  Entry point into the application and other general application functionality.
- */
-
-/** @defgroup Components-Core Components
-  *	Built-in components (elements that may be attached to scene objects).
-  */
-
-/** @defgroup Physics Physics
- *	Functionality for dealing with physics: colliders, triggers, rigidbodies, joints, scene queries, etc.
- */
-
-/** @} */
-
-#define BS_MAX_MULTIPLE_RENDER_TARGETS 8
-#define BS_FORCE_SINGLETHREADED_RENDERING 0
-
-// Windows Settings
-#if BS_PLATFORM == BS_PLATFORM_WIN32
-
-// If we're not including this from a client build, specify that the stuff
-// should get exported. Otherwise, import it.
-#	if defined(BS_STATIC_LIB)
-// Linux compilers don't have symbol import/export directives.
-#   	define BS_CORE_EXPORT
-#   else
-#   	if defined(BS_CORE_EXPORTS)
-#       	define BS_CORE_EXPORT __declspec( dllexport )
-#   	else
-#           if defined( __MINGW32__ )
-#               define BS_CORE_EXPORT
-#           else
-#       	    define BS_CORE_EXPORT __declspec( dllimport )
-#           endif
-#   	endif
-#	endif
-
-#endif
-
-// Linux/Apple Settings
-#if BS_PLATFORM == BS_PLATFORM_LINUX || BS_PLATFORM == BS_PLATFORM_OSX
-
-// Enable GCC symbol visibility
-#   if defined( BS_GCC_VISIBILITY )
-#       define BS_CORE_EXPORT  __attribute__ ((visibility("default")))
-#       define BS_HIDDEN __attribute__ ((visibility("hidden")))
-#   else
-#       define BS_CORE_EXPORT
-#       define BS_HIDDEN
-#   endif
-
-#endif
-
-#include "BsHString.h"
-
-namespace BansheeEngine 
-{
-	static const StringID RenderAPIAny = "AnyRenderAPI";
-	static const StringID RendererAny = "AnyRenderer";
-
-    class Color;
-    class GpuProgram;
-    class GpuProgramManager;
-    class IndexBuffer;
-	class IndexBufferCore;
-    class OcclusionQuery;
-    class VertexBuffer;
-	class VertexBufferCore;
-	class PixelBuffer;
-	class GpuBuffer;
-	class HighLevelGpuProgram;
-	class GpuProgramManager;
-	class GpuProgramFactory;
-    class IndexData;
-    class Pass;
-	class Technique;
-	class Shader;
-	class Material;
-    class RenderAPICore;
-    class RenderAPICapabilities;
-    class RenderTarget;
-	class RenderTargetCore;
-    class RenderTexture;
-	class RenderTextureCore;
-	class MultiRenderTexture;
-	class MultiRenderTextureCore;
-    class RenderWindow;
-	class RenderWindowCore;
-	class RenderTargetProperties;
-    struct RenderOpMesh;
-    class StringInterface;
-    class SamplerState;
-	class SamplerStateCore;
-    class TextureManager;
-    class Viewport;
-    class VertexData;
-    class VertexDeclaration;
-	class Input;
-	struct PointerEvent;
-	class RawInputHandler;
-	class CoreRenderer;
-	class RendererFactory;
-	class AsyncOp;
-	class HardwareBufferManager;
-	class FontManager;
-	class DepthStencilState;
-	class DepthStencilStateCore;
-	class RenderStateManager;
-	class RasterizerState;
-	class RasterizerStateCore;
-	class BlendState;
-	class BlendStateCore;
-	class GpuParamBlock;
-	class GpuParamBlockBuffer;
-	class GpuParams;
-	struct GpuParamDesc;
-	struct GpuParamDataDesc;
-	struct GpuParamObjectDesc;
-	struct GpuParamBlockDesc;
-	class ShaderInclude;
-	class TextureView;
-	class CoreObject;
-	class CoreObjectCore;
-	class ImportOptions;
-	class TextureImportOptions;
-	class FontImportOptions;
-	class GpuProgramImportOptions;
-	class MeshImportOptions;
-	struct FontBitmap;
-	class GameObject;
-	class GpuResourceData;
-	struct RenderOperation;
-	class RenderQueue;
-	struct ProfilerReport;
-	class VertexDataDesc;
-	class EventQuery;
-	class TimerQuery;
-	class OcclusionQuery;
-	class FrameAlloc;
-	class FolderMonitor;
-	class VideoMode;
-	class VideoOutputInfo;
-	class VideoModeInfo;
-	class RenderableElement;
-	class CameraCore;
-	class MeshCoreBase;
-	class MeshCore;
-	struct SubMesh;
-	class TransientMeshCore;
-	class TextureCore;
-	class MeshHeapCore;
-	class VertexDeclarationCore;
-	class GpuBufferCore;
-	class GpuParamBlockBufferCore;
-	class GpuParamsCore;
-	class ShaderCore;
-	class ViewportCore;
-	class PassCore;
-	class PassParametersCore;
-	class TechniqueCore;
-	class MaterialCore;
-	class GpuProgramCore;
-	class IResourceListener;
-	class TextureProperties;
-	class IShaderIncludeHandler;
-	class Prefab;
-	class PrefabDiff;
-	class RendererMeshData;
-	class LightCore;
-	class Light;
-	class Win32Window;
-	class RenderAPIFactory;
-	class PhysicsManager;
-	class Physics;
-	class FCollider;
-	class Collider;
-	class Rigidbody;
-	class PhysicsMaterial;
-	class BoxCollider;
-	class SphereCollider;
-	class PlaneCollider;
-	class CapsuleCollider;
-	class MeshCollider;
-	class CCollider;
-	class CRigidbody;
-	class CBoxCollider;
-	class CSphereCollider;
-	class CPlaneCollider;
-	class CCapsuleCollider;
-	class CMeshCollider;
-	class Joint;
-	class FixedJoint;
-	class DistanceJoint;
-	class HingeJoint;
-	class SphericalJoint;
-	class SliderJoint;
-	class D6Joint;
-	class CharacterController;
-	class CJoint;
-	class CHingeJoint;
-	class CDistanceJoint;
-	class CFixedJoint;
-	class CSphericalJoint;
-	class CSliderJoint;
-	class CD6Joint;
-	class CCharacterController;
-	// Asset import
-	class SpecificImporter;
-	class Importer;
-	// Resources
-	class Resource;
-	class Resources;
-	class ResourceManifest;
-	class Texture;
-	class Mesh;
-	class MeshBase;
-	class TransientMesh;
-	class MeshHeap;
-	class Font;
-	class ResourceMetaData;
-	class OSDropTarget;
-	class StringTable;
-	class PhysicsMaterial;
-	class PhysicsMesh;
-	struct CollisionData;
-	// Scene
-	class SceneObject;
-	class Component;
-	class SceneManager;
-	// RTTI
-	class MeshRTTI;
-	// Desc structs
-	struct SAMPLER_STATE_DESC;
-	struct DEPTH_STENCIL_STATE_DESC;
-	struct RASTERIZER_STATE_DESC;
-	struct BLEND_STATE_DESC;
-	struct RENDER_TARGET_BLEND_STATE_DESC;
-	struct RENDER_TEXTURE_DESC;
-	struct RENDER_WINDOW_DESC;
-	struct FONT_DESC;
-	struct CHAR_CONTROLLER_DESC;
-
-	template<class T>
-	class CoreThreadAccessor;
-	class CommandQueueNoSync;
-	class CommandQueueSync;
-}
-
-/************************************************************************/
-/* 						Shared pointer typedefs	                    	*/
-/************************************************************************/
-
-namespace BansheeEngine
-{
-	typedef std::shared_ptr<RenderAPICore> RenderAPIPtr;
-	typedef std::shared_ptr<GpuProgram> GpuProgramPtr;
-	typedef std::shared_ptr<PixelBuffer> PixelBufferPtr;
-	typedef std::shared_ptr<VertexBuffer> VertexBufferPtr;
-	typedef std::shared_ptr<IndexBuffer> IndexBufferPtr;
-	typedef std::shared_ptr<GpuBuffer> GpuBufferPtr;
-	typedef std::shared_ptr<VertexDeclaration> VertexDeclarationPtr;
-	typedef std::shared_ptr<Mesh> MeshPtr;
-	typedef std::shared_ptr<MeshBase> MeshBasePtr;
-	typedef std::shared_ptr<MeshHeap> MeshHeapPtr;
-	typedef std::shared_ptr<TransientMesh> TransientMeshPtr;
-	typedef std::shared_ptr<Texture> TexturePtr;
-	typedef std::shared_ptr<Resource> ResourcePtr;
-	typedef std::shared_ptr<Technique> TechniquePtr;
-	typedef std::shared_ptr<Pass> PassPtr;
-	typedef std::shared_ptr<Shader> ShaderPtr;
-	typedef std::shared_ptr<Material> MaterialPtr;
-	typedef std::shared_ptr<CoreRenderer> CoreRendererPtr;
-	typedef std::shared_ptr<RendererFactory> RendererFactoryPtr;
-	typedef std::shared_ptr<Component> ComponentPtr;
-	typedef std::shared_ptr<GameObject> GameObjectPtr;
-	typedef std::shared_ptr<SceneObject> SceneObjectPtr;
-	typedef std::shared_ptr<SamplerState> SamplerStatePtr;
-	typedef std::shared_ptr<DepthStencilState> DepthStencilStatePtr;
-	typedef std::shared_ptr<RasterizerState> RasterizerStatePtr;
-	typedef std::shared_ptr<BlendState> BlendStatePtr;
-	typedef std::shared_ptr<RenderWindow> RenderWindowPtr;
-	typedef std::shared_ptr<RenderTarget> RenderTargetPtr;
-	typedef std::shared_ptr<RenderTexture> RenderTexturePtr;
-	typedef std::shared_ptr<MultiRenderTexture> MultiRenderTexturePtr;
-	typedef std::shared_ptr<GpuParamBlockBuffer> GpuParamBlockBufferPtr;
-	typedef std::shared_ptr<GpuParams> GpuParamsPtr;
-	typedef std::shared_ptr<TextureView> TextureViewPtr;
-	typedef std::shared_ptr<Viewport> ViewportPtr;
-	typedef std::shared_ptr<ShaderInclude> ShaderIncludePtr;
-	typedef std::shared_ptr<ImportOptions> ImportOptionsPtr;
-	typedef std::shared_ptr<const ImportOptions> ConstImportOptionsPtr;
-	typedef std::shared_ptr<Font> FontPtr;
-	typedef std::shared_ptr<VertexDataDesc> VertexDataDescPtr;
-	typedef CoreThreadAccessor<CommandQueueNoSync> CoreAccessor;
-	typedef CoreThreadAccessor<CommandQueueSync> SyncedCoreAccessor;
-	typedef std::shared_ptr<CoreThreadAccessor<CommandQueueNoSync>> CoreAccessorPtr;
-	typedef std::shared_ptr<CoreThreadAccessor<CommandQueueSync>> SyncedCoreAccessorPtr;
-	typedef std::shared_ptr<EventQuery> EventQueryPtr;
-	typedef std::shared_ptr<TimerQuery> TimerQueryPtr;
-	typedef std::shared_ptr<OcclusionQuery> OcclusionQueryPtr;
-	typedef std::shared_ptr<ResourceManifest> ResourceManifestPtr;
-	typedef std::shared_ptr<VideoModeInfo> VideoModeInfoPtr;
-	typedef std::shared_ptr<RenderQueue> RenderQueuePtr;
-	typedef std::shared_ptr<GpuParamDesc> GpuParamDescPtr;
-	typedef std::shared_ptr<ResourceMetaData> ResourceMetaDataPtr;
-	typedef std::shared_ptr<IShaderIncludeHandler> ShaderIncludeHandlerPtr;
-	typedef std::shared_ptr<Prefab> PrefabPtr;
-	typedef std::shared_ptr<PrefabDiff> PrefabDiffPtr;
-	typedef std::shared_ptr<RendererMeshData> RendererMeshDataPtr;
-	typedef std::shared_ptr<RenderAPIFactory> RenderAPIFactoryPtr;
-	typedef std::shared_ptr<PhysicsMaterial> PhysicsMaterialPtr;
-	typedef std::shared_ptr<PhysicsMesh> PhysicsMeshPtr;
-}
-
-/************************************************************************/
-/* 									RTTI                      			*/
-/************************************************************************/
-namespace BansheeEngine
-{
-	enum TypeID_Core
-	{
-		TID_Texture = 1001,
-		TID_Mesh = 1002,
-		TID_MeshData = 1003,
-		TID_VertexDeclaration = 1004,
-		TID_VertexElementData = 1005,
-		TID_Component = 1006,
-		TID_ResourceHandle = 1009,
-		TID_GpuProgram = 1010,
-		TID_ResourceHandleData = 1011,
-		TID_CgProgram = 1012,
-		TID_Pass = 1014,
-		TID_Technique = 1015,
-		TID_Shader = 1016,
-		TID_Material = 1017,
-		TID_SamplerState = 1021,
-		TID_BlendState = 1023,
-		TID_RasterizerState = 1024,
-		TID_DepthStencilState = 1025,
-		TID_BLEND_STATE_DESC = 1034,
-		TID_SHADER_DATA_PARAM_DESC = 1035,
-		TID_SHADER_OBJECT_PARAM_DESC = 1036,
-		TID_SHADER_PARAM_BLOCK_DESC = 1047,
-		TID_ImportOptions = 1048,
-		TID_Font = 1051,
-		TID_FONT_DESC = 1052,
-		TID_CHAR_DESC = 1053,
-		TID_FontImportOptions = 1056,
-		TID_FontBitmap = 1057,
-		TID_SceneObject = 1059,
-		TID_GameObject = 1060,
-		TID_PixelData = 1062,
-		TID_GpuResourceData = 1063,
-		TID_VertexDataDesc = 1064,
-		TID_MeshBase = 1065,
-		TID_GameObjectHandleBase = 1066,
-		TID_ResourceManifest = 1067,
-		TID_ResourceManifestEntry = 1068,
-		TID_EmulatedParamBlock = 1069,
-		TID_TextureImportOptions = 1070,
-		TID_ResourceMetaData = 1071,
-		TID_ShaderInclude = 1072,
-		TID_Viewport = 1073,
-		TID_ResourceDependencies = 1074,
-		TID_ShaderMetaData = 1075,
-		TID_MeshImportOptions = 1076,
-		TID_Prefab = 1077,
-		TID_PrefabDiff = 1078,
-		TID_PrefabObjectDiff = 1079,
-		TID_PrefabComponentDiff = 1080,
-		TID_CGUIWidget = 1081,
-		TID_ProfilerOverlay = 1082,
-		TID_StringTable = 1083,
-		TID_LanguageData = 1084,
-		TID_LocalizedStringData = 1085,
-		TID_MaterialParamColor = 1086,
-		TID_WeakResourceHandle = 1087,
-		TID_TextureParamData = 1088,
-		TID_StructParamData = 1089,
-		TID_MaterialParams = 1090,
-		TID_MaterialRTTIParam = 1091,
-		TID_PhysicsMaterial = 1092,
-		TID_CCollider = 1093,
-		TID_CBoxCollider = 1094,
-		TID_CSphereCollider = 1095,
-		TID_CCapsuleCollider = 1096,
-		TID_CPlaneCollider = 1097,
-		TID_CRigidbody = 1098,
-		TID_PhysicsMesh = 1099,
-		TID_CMeshCollider = 1100,
-		TID_CJoint = 1101,
-		TID_CFixedJoint = 1102,
-		TID_CDistanceJoint = 1103,
-		TID_CHingeJoint = 1104,
-		TID_CSphericalJoint = 1105,
-		TID_CSliderJoint = 1106,
-		TID_CD6Joint = 1107,
-		TID_CCharacterController = 1108
-	};
-}
-
-/************************************************************************/
-/* 							Resource references                   		*/
-/************************************************************************/
-
-#include "BsResourceHandle.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup Resources
-	 *  @{
-	 */
-
-	typedef ResourceHandle<Resource> HResource;
-	typedef ResourceHandle<Texture> HTexture;
-	typedef ResourceHandle<Mesh> HMesh;
-	typedef ResourceHandle<Material> HMaterial;
-	typedef ResourceHandle<ShaderInclude> HShaderInclude;
-	typedef ResourceHandle<Font> HFont;
-	typedef ResourceHandle<Shader> HShader;
-	typedef ResourceHandle<Prefab> HPrefab;
-	typedef ResourceHandle<StringTable> HStringTable;
-	typedef ResourceHandle<PhysicsMaterial> HPhysicsMaterial;
-	typedef ResourceHandle<PhysicsMesh> HPhysicsMesh;
-
-	/** @} */
-}
-
-
-#include "BsGameObjectHandle.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup Scene
-	 *  @{
-	 */
-
-	// Game object handles
-	typedef GameObjectHandle<GameObject> HGameObject;
-	typedef GameObjectHandle<SceneObject> HSceneObject;
-	typedef GameObjectHandle<Component> HComponent;
-	typedef GameObjectHandle<CRigidbody> HRigidbody;
-	typedef GameObjectHandle<CCollider> HCollider;
-	typedef GameObjectHandle<CBoxCollider> HBoxCollider;
-	typedef GameObjectHandle<CSphereCollider> HSphereCollider;
-	typedef GameObjectHandle<CCapsuleCollider> HCapsuleCollider;
-	typedef GameObjectHandle<CPlaneCollider> HPlaneCollider;
-	typedef GameObjectHandle<CJoint> HJoint;
-	typedef GameObjectHandle<CHingeJoint> HHingeJoint;
-	typedef GameObjectHandle<CSliderJoint> HSliderJoint;
-	typedef GameObjectHandle<CDistanceJoint> HDistanceJoint;
-	typedef GameObjectHandle<CSphericalJoint> HSphericalJoint;
-	typedef GameObjectHandle<CFixedJoint> HFixedJoint;
-	typedef GameObjectHandle<CD6Joint> HD6Joint;
-	typedef GameObjectHandle<CCharacterController> HCharacterController;
-
-	/** @} */
-}
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Defers function execution until the next frame. If this function is called
-	 * 			within another deferred call, then it will be executed the same frame,
-	 * 			but only after all existing deferred calls are done.
-	 * 			
-	 * @note	This method can be used for breaking dependencies among other things. If a class
-	 * 			A depends on class B having something done, but class B also depends in some way on class A,
-	 * 			you can break up the initialization into two separate steps, queuing the second step
-	 * 			using this method.
-	 * 			
-	 *			Similar situation can happen if you have multiple classes being initialized in an undefined order
-	 *			but some of them depend on others. Using this method you can defer the dependent step until next frame,
-	 *			which will ensure everything was initialized.
-	 *
-	 * @param	callback	The callback.
-	 */
-	void BS_CORE_EXPORT deferredCall(std::function<void()> callback);
-
-	// Special types for use by profilers
-	typedef std::basic_string<char, std::char_traits<char>, StdAlloc<char, ProfilerAlloc>> ProfilerString;
-
-	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
-	using ProfilerVector = std::vector<T, A>;
-
-	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
-	using ProfilerStack = std::stack<T, std::deque<T, A>>;
-
-	/**
-	* @brief	Banshee thread policy that performs special startup/shutdown on threads
-	*			managed by thread pool.
-	*/
-	class BS_CORE_EXPORT ThreadBansheePolicy
-	{
-	public:
-		static void onThreadStarted(const String& name)
-		{
-			MemStack::beginThread();
-		}
-
-		static void onThreadEnded(const String& name)
-		{
-			MemStack::endThread();
-		}
-	};
-
-	#define BS_ALL_LAYERS 0xFFFFFFFFFFFFFFFF
-}
-
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisitesUtil.h"
+
+/** @defgroup Core Core
+ *	Second lowest layer that provides some very game-specific modules tied into a coherent whole, but it tries to be very 
+ *  generic and offer something that every engine might need instead of focusing on very specialized techniques.
+ *  @{
+ */
+
+/** @defgroup CoreThread Core thread
+ *	Functionality for dealing with core objects and interaction with the core thread.
+ */
+
+/** @defgroup Importer Importer
+ *	Functionality for dealing with import of resources into engine friendly format.
+ */
+
+/** @defgroup Input Input
+ *	Functionality for dealing with input (mouse, keyboard, gamepad, etc.).
+ */
+
+/** @defgroup Localization Localization
+ *	Functionality for dealing with GUI localization.
+ */
+
+/** @defgroup Material Material
+ *	Functionality for dealing with materials, shaders, and in general how objects are rendered.
+ */
+
+/** @defgroup Platform Platform
+ *	Functionality specific for some platform (e.g. Windows, Mac).
+ */
+
+ /** @defgroup Profiling Profiling
+  *	Functionality for measuring CPU and GPU execution times and memory usage.
+  */
+
+/** @defgroup RenderAPI RenderAPI
+  *	Functionality for interacting with underlying render API (e.g. DirectX, OpenGL).
+  */
+
+/** @defgroup Renderer Renderer
+  *	Abstract interface and helper functionality for rendering scene objects.
+  */
+
+/** @defgroup Resources Resources
+  *	Contains core resource types and resource management functionality (loading, saving, etc.).
+  */
+
+/** @defgroup RTTI-Impl-Core RTTI types
+ *  Types containing RTTI for specific classes.
+ */
+
+/** @defgroup Scene Scene
+ *  Functionality for managing scene objects and their hierarchy.
+ */
+
+/** @defgroup Text Text
+ *  Functionality for rendering text.
+ */
+
+/** @defgroup Utility-Core Utility
+ *  Various utility methods and types used by the core layer.
+ */
+
+/** @defgroup Application-Core Application
+ *  Entry point into the application and other general application functionality.
+ */
+
+/** @defgroup Components-Core Components
+  *	Built-in components (elements that may be attached to scene objects).
+  */
+
+/** @defgroup Physics Physics
+ *	Functionality for dealing with physics: colliders, triggers, rigidbodies, joints, scene queries, etc.
+ */
+
+/** @} */
+
+#define BS_MAX_MULTIPLE_RENDER_TARGETS 8
+#define BS_FORCE_SINGLETHREADED_RENDERING 0
+
+// Windows Settings
+#if BS_PLATFORM == BS_PLATFORM_WIN32
+
+// If we're not including this from a client build, specify that the stuff
+// should get exported. Otherwise, import it.
+#	if defined(BS_STATIC_LIB)
+// Linux compilers don't have symbol import/export directives.
+#   	define BS_CORE_EXPORT
+#   else
+#   	if defined(BS_CORE_EXPORTS)
+#       	define BS_CORE_EXPORT __declspec( dllexport )
+#   	else
+#           if defined( __MINGW32__ )
+#               define BS_CORE_EXPORT
+#           else
+#       	    define BS_CORE_EXPORT __declspec( dllimport )
+#           endif
+#   	endif
+#	endif
+
+#endif
+
+// Linux/Apple Settings
+#if BS_PLATFORM == BS_PLATFORM_LINUX || BS_PLATFORM == BS_PLATFORM_OSX
+
+// Enable GCC symbol visibility
+#   if defined( BS_GCC_VISIBILITY )
+#       define BS_CORE_EXPORT  __attribute__ ((visibility("default")))
+#       define BS_HIDDEN __attribute__ ((visibility("hidden")))
+#   else
+#       define BS_CORE_EXPORT
+#       define BS_HIDDEN
+#   endif
+
+#endif
+
+#include "BsHString.h"
+
+namespace BansheeEngine 
+{
+	static const StringID RenderAPIAny = "AnyRenderAPI";
+	static const StringID RendererAny = "AnyRenderer";
+
+    class Color;
+    class GpuProgram;
+    class GpuProgramManager;
+    class IndexBuffer;
+	class IndexBufferCore;
+    class OcclusionQuery;
+    class VertexBuffer;
+	class VertexBufferCore;
+	class PixelBuffer;
+	class GpuBuffer;
+	class HighLevelGpuProgram;
+	class GpuProgramManager;
+	class GpuProgramFactory;
+    class IndexData;
+    class Pass;
+	class Technique;
+	class Shader;
+	class Material;
+    class RenderAPICore;
+    class RenderAPICapabilities;
+    class RenderTarget;
+	class RenderTargetCore;
+    class RenderTexture;
+	class RenderTextureCore;
+	class MultiRenderTexture;
+	class MultiRenderTextureCore;
+    class RenderWindow;
+	class RenderWindowCore;
+	class RenderTargetProperties;
+    struct RenderOpMesh;
+    class StringInterface;
+    class SamplerState;
+	class SamplerStateCore;
+    class TextureManager;
+    class Viewport;
+    class VertexData;
+    class VertexDeclaration;
+	class Input;
+	struct PointerEvent;
+	class RawInputHandler;
+	class CoreRenderer;
+	class RendererFactory;
+	class AsyncOp;
+	class HardwareBufferManager;
+	class FontManager;
+	class DepthStencilState;
+	class DepthStencilStateCore;
+	class RenderStateManager;
+	class RasterizerState;
+	class RasterizerStateCore;
+	class BlendState;
+	class BlendStateCore;
+	class GpuParamBlock;
+	class GpuParamBlockBuffer;
+	class GpuParams;
+	struct GpuParamDesc;
+	struct GpuParamDataDesc;
+	struct GpuParamObjectDesc;
+	struct GpuParamBlockDesc;
+	class ShaderInclude;
+	class TextureView;
+	class CoreObject;
+	class CoreObjectCore;
+	class ImportOptions;
+	class TextureImportOptions;
+	class FontImportOptions;
+	class GpuProgramImportOptions;
+	class MeshImportOptions;
+	struct FontBitmap;
+	class GameObject;
+	class GpuResourceData;
+	struct RenderOperation;
+	class RenderQueue;
+	struct ProfilerReport;
+	class VertexDataDesc;
+	class EventQuery;
+	class TimerQuery;
+	class OcclusionQuery;
+	class FrameAlloc;
+	class FolderMonitor;
+	class VideoMode;
+	class VideoOutputInfo;
+	class VideoModeInfo;
+	class RenderableElement;
+	class CameraCore;
+	class MeshCoreBase;
+	class MeshCore;
+	struct SubMesh;
+	class TransientMeshCore;
+	class TextureCore;
+	class MeshHeapCore;
+	class VertexDeclarationCore;
+	class GpuBufferCore;
+	class GpuParamBlockBufferCore;
+	class GpuParamsCore;
+	class ShaderCore;
+	class ViewportCore;
+	class PassCore;
+	class PassParametersCore;
+	class TechniqueCore;
+	class MaterialCore;
+	class GpuProgramCore;
+	class IResourceListener;
+	class TextureProperties;
+	class IShaderIncludeHandler;
+	class Prefab;
+	class PrefabDiff;
+	class RendererMeshData;
+	class LightCore;
+	class Light;
+	class Win32Window;
+	class RenderAPIFactory;
+	class PhysicsManager;
+	class Physics;
+	class FCollider;
+	class Collider;
+	class Rigidbody;
+	class PhysicsMaterial;
+	class BoxCollider;
+	class SphereCollider;
+	class PlaneCollider;
+	class CapsuleCollider;
+	class MeshCollider;
+	class CCollider;
+	class CRigidbody;
+	class CBoxCollider;
+	class CSphereCollider;
+	class CPlaneCollider;
+	class CCapsuleCollider;
+	class CMeshCollider;
+	class Joint;
+	class FixedJoint;
+	class DistanceJoint;
+	class HingeJoint;
+	class SphericalJoint;
+	class SliderJoint;
+	class D6Joint;
+	class CharacterController;
+	class CJoint;
+	class CHingeJoint;
+	class CDistanceJoint;
+	class CFixedJoint;
+	class CSphericalJoint;
+	class CSliderJoint;
+	class CD6Joint;
+	class CCharacterController;
+	// Asset import
+	class SpecificImporter;
+	class Importer;
+	// Resources
+	class Resource;
+	class Resources;
+	class ResourceManifest;
+	class Texture;
+	class Mesh;
+	class MeshBase;
+	class TransientMesh;
+	class MeshHeap;
+	class Font;
+	class ResourceMetaData;
+	class OSDropTarget;
+	class StringTable;
+	class PhysicsMaterial;
+	class PhysicsMesh;
+	struct CollisionData;
+	// Scene
+	class SceneObject;
+	class Component;
+	class SceneManager;
+	// RTTI
+	class MeshRTTI;
+	// Desc structs
+	struct SAMPLER_STATE_DESC;
+	struct DEPTH_STENCIL_STATE_DESC;
+	struct RASTERIZER_STATE_DESC;
+	struct BLEND_STATE_DESC;
+	struct RENDER_TARGET_BLEND_STATE_DESC;
+	struct RENDER_TEXTURE_DESC;
+	struct RENDER_WINDOW_DESC;
+	struct FONT_DESC;
+	struct CHAR_CONTROLLER_DESC;
+
+	template<class T>
+	class CoreThreadAccessor;
+	class CommandQueueNoSync;
+	class CommandQueueSync;
+}
+
+/************************************************************************/
+/* 						Shared pointer typedefs	                    	*/
+/************************************************************************/
+
+namespace BansheeEngine
+{
+	typedef std::shared_ptr<RenderAPICore> RenderAPIPtr;
+	typedef std::shared_ptr<GpuProgram> GpuProgramPtr;
+	typedef std::shared_ptr<PixelBuffer> PixelBufferPtr;
+	typedef std::shared_ptr<VertexBuffer> VertexBufferPtr;
+	typedef std::shared_ptr<IndexBuffer> IndexBufferPtr;
+	typedef std::shared_ptr<GpuBuffer> GpuBufferPtr;
+	typedef std::shared_ptr<VertexDeclaration> VertexDeclarationPtr;
+	typedef std::shared_ptr<Mesh> MeshPtr;
+	typedef std::shared_ptr<MeshBase> MeshBasePtr;
+	typedef std::shared_ptr<MeshHeap> MeshHeapPtr;
+	typedef std::shared_ptr<TransientMesh> TransientMeshPtr;
+	typedef std::shared_ptr<Texture> TexturePtr;
+	typedef std::shared_ptr<Resource> ResourcePtr;
+	typedef std::shared_ptr<Technique> TechniquePtr;
+	typedef std::shared_ptr<Pass> PassPtr;
+	typedef std::shared_ptr<Shader> ShaderPtr;
+	typedef std::shared_ptr<Material> MaterialPtr;
+	typedef std::shared_ptr<CoreRenderer> CoreRendererPtr;
+	typedef std::shared_ptr<RendererFactory> RendererFactoryPtr;
+	typedef std::shared_ptr<Component> ComponentPtr;
+	typedef std::shared_ptr<GameObject> GameObjectPtr;
+	typedef std::shared_ptr<SceneObject> SceneObjectPtr;
+	typedef std::shared_ptr<SamplerState> SamplerStatePtr;
+	typedef std::shared_ptr<DepthStencilState> DepthStencilStatePtr;
+	typedef std::shared_ptr<RasterizerState> RasterizerStatePtr;
+	typedef std::shared_ptr<BlendState> BlendStatePtr;
+	typedef std::shared_ptr<RenderWindow> RenderWindowPtr;
+	typedef std::shared_ptr<RenderTarget> RenderTargetPtr;
+	typedef std::shared_ptr<RenderTexture> RenderTexturePtr;
+	typedef std::shared_ptr<MultiRenderTexture> MultiRenderTexturePtr;
+	typedef std::shared_ptr<GpuParamBlockBuffer> GpuParamBlockBufferPtr;
+	typedef std::shared_ptr<GpuParams> GpuParamsPtr;
+	typedef std::shared_ptr<TextureView> TextureViewPtr;
+	typedef std::shared_ptr<Viewport> ViewportPtr;
+	typedef std::shared_ptr<ShaderInclude> ShaderIncludePtr;
+	typedef std::shared_ptr<ImportOptions> ImportOptionsPtr;
+	typedef std::shared_ptr<const ImportOptions> ConstImportOptionsPtr;
+	typedef std::shared_ptr<Font> FontPtr;
+	typedef std::shared_ptr<VertexDataDesc> VertexDataDescPtr;
+	typedef CoreThreadAccessor<CommandQueueNoSync> CoreAccessor;
+	typedef CoreThreadAccessor<CommandQueueSync> SyncedCoreAccessor;
+	typedef std::shared_ptr<CoreThreadAccessor<CommandQueueNoSync>> CoreAccessorPtr;
+	typedef std::shared_ptr<CoreThreadAccessor<CommandQueueSync>> SyncedCoreAccessorPtr;
+	typedef std::shared_ptr<EventQuery> EventQueryPtr;
+	typedef std::shared_ptr<TimerQuery> TimerQueryPtr;
+	typedef std::shared_ptr<OcclusionQuery> OcclusionQueryPtr;
+	typedef std::shared_ptr<ResourceManifest> ResourceManifestPtr;
+	typedef std::shared_ptr<VideoModeInfo> VideoModeInfoPtr;
+	typedef std::shared_ptr<RenderQueue> RenderQueuePtr;
+	typedef std::shared_ptr<GpuParamDesc> GpuParamDescPtr;
+	typedef std::shared_ptr<ResourceMetaData> ResourceMetaDataPtr;
+	typedef std::shared_ptr<IShaderIncludeHandler> ShaderIncludeHandlerPtr;
+	typedef std::shared_ptr<Prefab> PrefabPtr;
+	typedef std::shared_ptr<PrefabDiff> PrefabDiffPtr;
+	typedef std::shared_ptr<RendererMeshData> RendererMeshDataPtr;
+	typedef std::shared_ptr<RenderAPIFactory> RenderAPIFactoryPtr;
+	typedef std::shared_ptr<PhysicsMaterial> PhysicsMaterialPtr;
+	typedef std::shared_ptr<PhysicsMesh> PhysicsMeshPtr;
+}
+
+/************************************************************************/
+/* 									RTTI                      			*/
+/************************************************************************/
+namespace BansheeEngine
+{
+	enum TypeID_Core
+	{
+		TID_Texture = 1001,
+		TID_Mesh = 1002,
+		TID_MeshData = 1003,
+		TID_VertexDeclaration = 1004,
+		TID_VertexElementData = 1005,
+		TID_Component = 1006,
+		TID_ResourceHandle = 1009,
+		TID_GpuProgram = 1010,
+		TID_ResourceHandleData = 1011,
+		TID_CgProgram = 1012,
+		TID_Pass = 1014,
+		TID_Technique = 1015,
+		TID_Shader = 1016,
+		TID_Material = 1017,
+		TID_SamplerState = 1021,
+		TID_BlendState = 1023,
+		TID_RasterizerState = 1024,
+		TID_DepthStencilState = 1025,
+		TID_BLEND_STATE_DESC = 1034,
+		TID_SHADER_DATA_PARAM_DESC = 1035,
+		TID_SHADER_OBJECT_PARAM_DESC = 1036,
+		TID_SHADER_PARAM_BLOCK_DESC = 1047,
+		TID_ImportOptions = 1048,
+		TID_Font = 1051,
+		TID_FONT_DESC = 1052,
+		TID_CHAR_DESC = 1053,
+		TID_FontImportOptions = 1056,
+		TID_FontBitmap = 1057,
+		TID_SceneObject = 1059,
+		TID_GameObject = 1060,
+		TID_PixelData = 1062,
+		TID_GpuResourceData = 1063,
+		TID_VertexDataDesc = 1064,
+		TID_MeshBase = 1065,
+		TID_GameObjectHandleBase = 1066,
+		TID_ResourceManifest = 1067,
+		TID_ResourceManifestEntry = 1068,
+		TID_EmulatedParamBlock = 1069,
+		TID_TextureImportOptions = 1070,
+		TID_ResourceMetaData = 1071,
+		TID_ShaderInclude = 1072,
+		TID_Viewport = 1073,
+		TID_ResourceDependencies = 1074,
+		TID_ShaderMetaData = 1075,
+		TID_MeshImportOptions = 1076,
+		TID_Prefab = 1077,
+		TID_PrefabDiff = 1078,
+		TID_PrefabObjectDiff = 1079,
+		TID_PrefabComponentDiff = 1080,
+		TID_CGUIWidget = 1081,
+		TID_ProfilerOverlay = 1082,
+		TID_StringTable = 1083,
+		TID_LanguageData = 1084,
+		TID_LocalizedStringData = 1085,
+		TID_MaterialParamColor = 1086,
+		TID_WeakResourceHandle = 1087,
+		TID_TextureParamData = 1088,
+		TID_StructParamData = 1089,
+		TID_MaterialParams = 1090,
+		TID_MaterialRTTIParam = 1091,
+		TID_PhysicsMaterial = 1092,
+		TID_CCollider = 1093,
+		TID_CBoxCollider = 1094,
+		TID_CSphereCollider = 1095,
+		TID_CCapsuleCollider = 1096,
+		TID_CPlaneCollider = 1097,
+		TID_CRigidbody = 1098,
+		TID_PhysicsMesh = 1099,
+		TID_CMeshCollider = 1100,
+		TID_CJoint = 1101,
+		TID_CFixedJoint = 1102,
+		TID_CDistanceJoint = 1103,
+		TID_CHingeJoint = 1104,
+		TID_CSphericalJoint = 1105,
+		TID_CSliderJoint = 1106,
+		TID_CD6Joint = 1107,
+		TID_CCharacterController = 1108,
+		TID_FPhysicsMesh = 1109,
+	};
+}
+
+/************************************************************************/
+/* 							Resource references                   		*/
+/************************************************************************/
+
+#include "BsResourceHandle.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Resources
+	 *  @{
+	 */
+
+	typedef ResourceHandle<Resource> HResource;
+	typedef ResourceHandle<Texture> HTexture;
+	typedef ResourceHandle<Mesh> HMesh;
+	typedef ResourceHandle<Material> HMaterial;
+	typedef ResourceHandle<ShaderInclude> HShaderInclude;
+	typedef ResourceHandle<Font> HFont;
+	typedef ResourceHandle<Shader> HShader;
+	typedef ResourceHandle<Prefab> HPrefab;
+	typedef ResourceHandle<StringTable> HStringTable;
+	typedef ResourceHandle<PhysicsMaterial> HPhysicsMaterial;
+	typedef ResourceHandle<PhysicsMesh> HPhysicsMesh;
+
+	/** @} */
+}
+
+
+#include "BsGameObjectHandle.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Scene
+	 *  @{
+	 */
+
+	// Game object handles
+	typedef GameObjectHandle<GameObject> HGameObject;
+	typedef GameObjectHandle<SceneObject> HSceneObject;
+	typedef GameObjectHandle<Component> HComponent;
+	typedef GameObjectHandle<CRigidbody> HRigidbody;
+	typedef GameObjectHandle<CCollider> HCollider;
+	typedef GameObjectHandle<CBoxCollider> HBoxCollider;
+	typedef GameObjectHandle<CSphereCollider> HSphereCollider;
+	typedef GameObjectHandle<CCapsuleCollider> HCapsuleCollider;
+	typedef GameObjectHandle<CPlaneCollider> HPlaneCollider;
+	typedef GameObjectHandle<CJoint> HJoint;
+	typedef GameObjectHandle<CHingeJoint> HHingeJoint;
+	typedef GameObjectHandle<CSliderJoint> HSliderJoint;
+	typedef GameObjectHandle<CDistanceJoint> HDistanceJoint;
+	typedef GameObjectHandle<CSphericalJoint> HSphericalJoint;
+	typedef GameObjectHandle<CFixedJoint> HFixedJoint;
+	typedef GameObjectHandle<CD6Joint> HD6Joint;
+	typedef GameObjectHandle<CCharacterController> HCharacterController;
+
+	/** @} */
+}
+
+namespace BansheeEngine
+{
+	/**
+	 * @brief	Defers function execution until the next frame. If this function is called
+	 * 			within another deferred call, then it will be executed the same frame,
+	 * 			but only after all existing deferred calls are done.
+	 * 			
+	 * @note	This method can be used for breaking dependencies among other things. If a class
+	 * 			A depends on class B having something done, but class B also depends in some way on class A,
+	 * 			you can break up the initialization into two separate steps, queuing the second step
+	 * 			using this method.
+	 * 			
+	 *			Similar situation can happen if you have multiple classes being initialized in an undefined order
+	 *			but some of them depend on others. Using this method you can defer the dependent step until next frame,
+	 *			which will ensure everything was initialized.
+	 *
+	 * @param	callback	The callback.
+	 */
+	void BS_CORE_EXPORT deferredCall(std::function<void()> callback);
+
+	// Special types for use by profilers
+	typedef std::basic_string<char, std::char_traits<char>, StdAlloc<char, ProfilerAlloc>> ProfilerString;
+
+	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
+	using ProfilerVector = std::vector<T, A>;
+
+	template <typename T, typename A = StdAlloc<T, ProfilerAlloc>>
+	using ProfilerStack = std::stack<T, std::deque<T, A>>;
+
+	/**
+	* @brief	Banshee thread policy that performs special startup/shutdown on threads
+	*			managed by thread pool.
+	*/
+	class BS_CORE_EXPORT ThreadBansheePolicy
+	{
+	public:
+		static void onThreadStarted(const String& name)
+		{
+			MemStack::beginThread();
+		}
+
+		static void onThreadEnded(const String& name)
+		{
+			MemStack::endThread();
+		}
+	};
+
+	#define BS_ALL_LAYERS 0xFFFFFFFFFFFFFFFF
+}
+
 #include "BsCommonTypes.h"

+ 100 - 67
Source/BansheeCore/Include/BsPhysicsMesh.h

@@ -1,68 +1,101 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsResource.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup Physics
-	 *  @{
-	 */
-
-	/** 
-	 * Represents a physics mesh that can be used for physics MeshCollider%s. Physics mesh can be a generic triangle mesh
-	 * or a convex mesh. Convex meshes are limited to 255 faces.
-	 */
-	class BS_CORE_EXPORT PhysicsMesh : public Resource
-	{
-	public:
-		PhysicsMesh(const MeshDataPtr& meshData, PhysicsMeshType type);
-		virtual ~PhysicsMesh() { }
-
-		/** Returns the type of the physics mesh. */
-		PhysicsMeshType getType() const { return mType; }
-
-		/** Returns the mesh's indices and vertices. */
-		virtual MeshDataPtr getMeshData() const = 0;
-
-		/** 
-		 * Creates a new physics mesh. 
-		 *
-		 * @param[in]	meshData	Index and vertices of the mesh data.
-		 * @param[in]	type		Type of the mesh. If convex the provided mesh geometry will be converted into a convex
-		 *							mesh (that might not be the same as the provided mesh data).
-		 */
-		static HPhysicsMesh create(const MeshDataPtr& meshData, PhysicsMeshType type = PhysicsMeshType::Convex);
-
-		/** @cond INTERNAL */
-
-		/** 
-		 * @copydoc create()
-		 *
-		 * For internal use. Requires manual initialization after creation.
-		 */
-		static PhysicsMeshPtr _createPtr(const MeshDataPtr& meshData, PhysicsMeshType type);
-
-		/** @endcond */
-
-	protected:
-		/** @copydoc Resource::initialize() */
-		void initialize() override;
-
-		PhysicsMeshType mType;
-
-		MeshDataPtr mInitMeshData; // Transient, only used during initalization
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class PhysicsMeshRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsResource.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Physics
+	 *  @{
+	 */
+
+	class FPhysicsMesh;
+
+	/** 
+	 * Represents a physics mesh that can be used for physics MeshCollider%s. Physics mesh can be a generic triangle mesh
+	 * or a convex mesh. Convex meshes are limited to 255 faces.
+	 */
+	class BS_CORE_EXPORT PhysicsMesh : public Resource
+	{
+	public:
+		PhysicsMesh(const MeshDataPtr& meshData, PhysicsMeshType type);
+		virtual ~PhysicsMesh() { }
+
+		/** Returns the type of the physics mesh. */
+		PhysicsMeshType getType() const;
+
+		/** Returns the mesh's indices and vertices. */
+		MeshDataPtr getMeshData() const;
+
+		/** 
+		 * Creates a new physics mesh. 
+		 *
+		 * @param[in]	meshData	Index and vertices of the mesh data.
+		 * @param[in]	type		Type of the mesh. If convex the provided mesh geometry will be converted into a convex
+		 *							mesh (that might not be the same as the provided mesh data).
+		 */
+		static HPhysicsMesh create(const MeshDataPtr& meshData, PhysicsMeshType type = PhysicsMeshType::Convex);
+
+		/** @cond INTERNAL */
+
+		/** Returns the internal implementation of the physics mesh. */
+		virtual FPhysicsMesh* _getInternal() { return mInternal.get(); }
+
+		/** 
+		 * @copydoc create()
+		 *
+		 * For internal use. Requires manual initialization after creation.
+		 */
+		static PhysicsMeshPtr _createPtr(const MeshDataPtr& meshData, PhysicsMeshType type);
+
+		/** @endcond */
+
+	protected:
+		/** @copydoc Resource::initialize() */
+		void initialize() override;
+
+		SPtr<FPhysicsMesh> mInternal;
+		MeshDataPtr mInitMeshData; // Transient, only used during initalization
+		PhysicsMeshType mType; // Transient, only used during initalization
+
+		/************************************************************************/
+		/* 								SERIALIZATION                      		*/
+		/************************************************************************/
+	public:
+		friend class PhysicsMeshRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @cond INTERNAL */
+
+	/** Foundation that contains a specific implementation of a PhysicsMesh. */
+	class BS_CORE_EXPORT FPhysicsMesh : public IReflectable
+	{
+	public:
+		FPhysicsMesh(const MeshDataPtr& meshData, PhysicsMeshType type);
+		virtual ~FPhysicsMesh();
+
+		/** Returns the mesh's indices and vertices. */
+		virtual MeshDataPtr getMeshData() const = 0;
+
+	protected:
+		friend class PhysicsMesh;
+
+		PhysicsMeshType mType;
+		
+		/************************************************************************/
+		/* 								SERIALIZATION                      		*/
+		/************************************************************************/
+	public:
+		friend class FPhysicsMeshRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @endcond */
+
+	/** @} */
 }

+ 84 - 46
Source/BansheeCore/Include/BsPhysicsMeshRTTI.h

@@ -1,47 +1,85 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsPhysicsMesh.h"
-
-namespace BansheeEngine
-{
-	/** @cond RTTI */
-	/** @addtogroup RTTI-Impl-Core
-	*  @{
-	*/
-
-	class BS_CORE_EXPORT PhysicsMeshRTTI : public RTTIType<PhysicsMesh, Resource, PhysicsMeshRTTI>
-	{
-	private:
-		BS_PLAIN_MEMBER(mType)
-
-	public:
-		PhysicsMeshRTTI()
-		{
-			BS_ADD_PLAIN_FIELD(mType, 0)
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "PhysicsMesh";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_PhysicsMesh;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			BS_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");
-			return nullptr;
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsPhysicsMesh.h"
+#include "BsPhysics.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Core
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT PhysicsMeshRTTI : public RTTIType<PhysicsMesh, Resource, PhysicsMeshRTTI>
+	{
+	private:
+		BS_REFLPTR_MEMBER(mInternal)
+
+	public:
+		PhysicsMeshRTTI()
+		{
+			BS_ADD_REFLPTR_FIELD(mInternal, 0)
+		}
+
+		void onDeserializationEnded(IReflectable* obj) override
+		{
+			PhysicsMesh* mesh = static_cast<PhysicsMesh*>(obj);
+			mesh->initialize();
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "PhysicsMesh";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_PhysicsMesh;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			SPtr<PhysicsMesh> mesh = gPhysics().createMesh(nullptr, PhysicsMeshType::Convex);
+			mesh->_setThisPtr(mesh);
+
+			return mesh;
+		}
+	};
+
+	class BS_CORE_EXPORT FPhysicsMeshRTTI : public RTTIType<FPhysicsMesh, IReflectable, FPhysicsMeshRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mType)
+
+	public:
+		FPhysicsMeshRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mType, 0)
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "FPhysicsMesh";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_FPhysicsMesh;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			BS_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");
+			return nullptr;
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }

+ 79 - 46
Source/BansheeCore/Source/BsPhysicsMesh.cpp

@@ -1,46 +1,79 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsPhysicsMesh.h"
-#include "BsPhysicsMeshRTTI.h"
-#include "BsResources.h"
-#include "BsPhysics.h"
-
-namespace BansheeEngine
-{
-	PhysicsMesh::PhysicsMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
-		:mInitMeshData(meshData), mType(type)
-	{ }
-
-	HPhysicsMesh PhysicsMesh::create(const MeshDataPtr& meshData, PhysicsMeshType type)
-	{
-		PhysicsMeshPtr newMesh = _createPtr(meshData, type);
-
-		return static_resource_cast<PhysicsMesh>(gResources()._createResourceHandle(newMesh));
-	}
-
-	PhysicsMeshPtr PhysicsMesh::_createPtr(const MeshDataPtr& meshData, PhysicsMeshType type)
-	{
-		PhysicsMeshPtr newMesh = gPhysics().createMesh(meshData, type);
-		newMesh->_setThisPtr(newMesh);
-		newMesh->initialize();
-
-		return newMesh;
-	}
-
-	void PhysicsMesh::initialize()
-	{
-		mInitMeshData = nullptr;
-
-		Resource::initialize();
-	}
-
-	RTTITypeBase* PhysicsMesh::getRTTIStatic()
-	{
-		return PhysicsMeshRTTI::instance();
-	}
-
-	RTTITypeBase* PhysicsMesh::getRTTI() const
-	{
-		return getRTTIStatic();
-	}
-}
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsPhysicsMesh.h"
+#include "BsPhysicsMeshRTTI.h"
+#include "BsResources.h"
+#include "BsPhysics.h"
+
+namespace BansheeEngine
+{
+	PhysicsMesh::PhysicsMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
+		:mInitMeshData(meshData), mType(type)
+	{
+		// Derived class is responsible for initializing mInternal
+	}
+
+	PhysicsMeshType PhysicsMesh::getType() const
+	{
+		return mInternal->mType;
+	}
+
+	MeshDataPtr PhysicsMesh::getMeshData() const
+	{
+		return mInternal->getMeshData();
+	}
+
+	HPhysicsMesh PhysicsMesh::create(const MeshDataPtr& meshData, PhysicsMeshType type)
+	{
+		PhysicsMeshPtr newMesh = _createPtr(meshData, type);
+
+		return static_resource_cast<PhysicsMesh>(gResources()._createResourceHandle(newMesh));
+	}
+
+	PhysicsMeshPtr PhysicsMesh::_createPtr(const MeshDataPtr& meshData, PhysicsMeshType type)
+	{
+		PhysicsMeshPtr newMesh = gPhysics().createMesh(meshData, type);
+		newMesh->_setThisPtr(newMesh);
+		newMesh->initialize();
+
+		return newMesh;
+	}
+
+	void PhysicsMesh::initialize()
+	{
+		mInitMeshData = nullptr;
+
+		Resource::initialize();
+	}
+
+	RTTITypeBase* PhysicsMesh::getRTTIStatic()
+	{
+		return PhysicsMeshRTTI::instance();
+	}
+
+	RTTITypeBase* PhysicsMesh::getRTTI() const
+	{
+		return getRTTIStatic();
+	}
+
+	FPhysicsMesh::FPhysicsMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
+		:mType(type)
+	{
+		
+	}
+
+	FPhysicsMesh::~FPhysicsMesh()
+	{
+		
+	}
+
+	RTTITypeBase* FPhysicsMesh::getRTTIStatic()
+	{
+		return FPhysicsMeshRTTI::instance();
+	}
+
+	RTTITypeBase* FPhysicsMesh::getRTTI() const
+	{
+		return getRTTIStatic();
+	}
+}

+ 2304 - 2304
Source/BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -1,2305 +1,2305 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsBuiltinEditorResources.h"
-#include "BsBuiltinResources.h"
-#include "BsGUIElementStyle.h"
-#include "BsGUILabel.h"
-#include "BsGUITexture.h"
-#include "BsGUIButton.h"
-#include "BsGUIInputBox.h"
-#include "BsGUIToggle.h"
-#include "BsGUIColor.h"
-#include "BsTextSprite.h"
-#include "BsSpriteTexture.h"
-#include "BsGUITreeViewEditBox.h"
-#include "BsGUIIntField.h"
-#include "BsGUIFloatField.h"
-#include "BsGUIColorField.h"
-#include "BsGUITextField.h"
-#include "BsGUIToggleField.h"
-#include "BsGUIVector2Field.h"
-#include "BsGUIVector3Field.h"
-#include "BsGUIVector4Field.h"
-#include "BsGUIListBoxField.h"
-#include "BsGUISliderField.h"
-#include "BsGUIProgressBar.h"
-#include "BsGUISlider.h"
-#include "BsGUIDropDownContent.h"
-#include "BsGUIStatusBar.h"
-#include "BsGUIMenuBar.h"
-#include "BsGUIListBox.h"
-#include "BsCoreThread.h"
-#include "BsFont.h"
-#include "BsTexture.h"
-#include "BsShader.h"
-#include "BsMaterial.h"
-#include "BsResources.h"
-#include "BsFileSystem.h"
-#include "BsResourceManifest.h"
-#include "BsDataStream.h"
-#include "BsGUITooltip.h"
-
-namespace BansheeEngine
-{
-	static const Path EDITOR_DATA_FOLDER = "Editor\\";
-
-	const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
-	const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
-	const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
-	const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
-
-	const String BuiltinEditorResources::TextureFieldStyleName = "GUITextureField";
-	const String BuiltinEditorResources::TextureFieldLabelStyleName = "TextureFieldLabel";
-	const String BuiltinEditorResources::TextureFieldDropStyleName = "TextureDrop";
-	const String BuiltinEditorResources::TextureFieldClearBtnStyleName = "TextureClearButton";
-
-	const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
-	const WString BuiltinEditorResources::DefaultAAFontFilename = L"arialAA.ttf";
-	const UINT32 BuiltinEditorResources::DefaultFontSize = 8;
-	const UINT32 BuiltinEditorResources::TitleFontSize = 16;
-
-	const Color BuiltinEditorResources::TextNormalColor = Color(0.7f, 0.7f, 0.7f);
-	const Color BuiltinEditorResources::TextActiveColor = Color(0.0f, 0.0f, 0.0f);
-
-	const WString BuiltinEditorResources::GUISkinFile = L"GUISkin";
-
-	const char* BuiltinEditorResources::ShaderFolder = "Shaders\\";
-	const char* BuiltinEditorResources::SkinFolder = "Skin\\";
-	const char* BuiltinEditorResources::IconFolder = "Skin\\Icons";
-	const char* BuiltinEditorResources::ShaderIncludeFolder = "Includes\\";
-
-	const WString BuiltinEditorResources::FolderIconTex = L"FolderIcon.psd";
-	const WString BuiltinEditorResources::MeshIconTex = L"MeshIcon.psd";
-	const WString BuiltinEditorResources::TextureIconTex = L"TextureIcon.psd";
-	const WString BuiltinEditorResources::FontIconTex = L"FontIcon.psd";
-	const WString BuiltinEditorResources::PlainTextIconTex = L"TextIcon.psd";
-	const WString BuiltinEditorResources::ScriptCodeIconTex = L"CSharpIcon.psd";
-	const WString BuiltinEditorResources::ShaderIconTex = L"ShaderIcon.psd";
-	const WString BuiltinEditorResources::ShaderIncludeIconTex = L"ShaderIncludeIcon.psd";
-	const WString BuiltinEditorResources::MaterialIconTex = L"MaterialIcon.psd";
-	const WString BuiltinEditorResources::SpriteTextureIconTex = L"SpriteIcon.psd";
-	const WString BuiltinEditorResources::PrefabIconTex = L"PrefabIcon.psd";
-	const WString BuiltinEditorResources::GUISkinIconTex = L"GUISkinIcon.psd";
-	const WString BuiltinEditorResources::PhysicsMaterialIconTex = L"PhysicsMaterialIcon.psd";
-	const WString BuiltinEditorResources::PhysicsMeshIconTex = L"PhysicsMeshIcon.psd";
-
-	const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.png";
-	const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.png";
-	const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.png";
-
-	const WString BuiltinEditorResources::ButtonLeftNormalTex = L"ButtonLeftNormal.png";
-	const WString BuiltinEditorResources::ButtonLeftHoverTex = L"ButtonLeftHover.png";
-	const WString BuiltinEditorResources::ButtonLeftActiveTex = L"ButtonLeftActive.png";
-
-	const WString BuiltinEditorResources::ButtonRightNormalTex = L"ButtonRightNormal.png";
-	const WString BuiltinEditorResources::ButtonRightHoverTex = L"ButtonRightHover.png";
-	const WString BuiltinEditorResources::ButtonRightActiveTex = L"ButtonRightActive.png";
-
-	const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.png";
-	const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.png";
-	const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleNormalOn.png";
-	const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleHoverOn.png";
-
-	const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.png";
-	const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.png";
-	const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxActive.png";
-
-	const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectDropNormal.png";
-	const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectDropNormalOn.png";
-	const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectDropClearNormal.png";
-	const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectDropClearHover.png";
-	const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectDropClearActive.png";
-	
-	const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownButtonNormal.png";
-	const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownButtonHover.png";
-	const WString BuiltinEditorResources::DropDownBtnActiveTex = L"DropDownButtonActive.png";
-
-	const WString BuiltinEditorResources::SliderHBackgroundTex = L"SliderHBackground.png";
-	const WString BuiltinEditorResources::SliderHFillTex = L"SliderHFill.png";
-	const WString BuiltinEditorResources::SliderVBackgroundTex = L"SliderVBackground.png";
-	const WString BuiltinEditorResources::SliderVFillTex = L"SliderVFill.png";
-	const WString BuiltinEditorResources::SliderHandleNormalTex = L"SliderHandleNormal.png";
-	const WString BuiltinEditorResources::SliderHandleHoverTex = L"SliderHandleHover.png";
-	const WString BuiltinEditorResources::SliderHandleActiveTex = L"SliderHandleActive.png";
-
-	const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutNormalOn.png";
-	const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutHoverOn.png";
-	const WString BuiltinEditorResources::FoldoutOpenActiveTex = L"FoldoutHoverOn.png";
-	const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutNormalOff.png";
-	const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutHoverOff.png";
-	const WString BuiltinEditorResources::FoldoutClosedActiveTex = L"FoldoutHoverOff.png";
-
-	const WString BuiltinEditorResources::WindowBackgroundTex = L"WindowBackground.png";
-
-	const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.png";
-	const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.png";
-
-	const WString BuiltinEditorResources::CloseButtonNormalTex = L"CloseButtonNormal.png";
-	const WString BuiltinEditorResources::CloseButtonHoverTex = L"CloseButtonHover.png";
-	const WString BuiltinEditorResources::CloseButtonActiveTex = L"CloseButtonActive.png";
-
-	const WString BuiltinEditorResources::MinButtonNormalTex = L"MinimizeButtonNormal.png"; 
-	const WString BuiltinEditorResources::MinButtonHoverTex = L"MinimizeButtonHover.png"; 
-	const WString BuiltinEditorResources::MinButtonActiveTex = L"MinimizeButtonActive.png";
-
-	const WString BuiltinEditorResources::MaxButtonNormalTex = L"MaximizeButtonNormal.png";
-	const WString BuiltinEditorResources::MaxButtonHoverTex = L"MaximizeButtonHover.png";
-	const WString BuiltinEditorResources::MaxButtonActiveTex = L"MaximizeButtonActive.png";
-
-	const WString BuiltinEditorResources::TabBarBackgroundTex = L"TabBarBackground.png";
-	const WString BuiltinEditorResources::TitleBarBackgroundTex = L"TitleBarBackground.png";
-
-	const WString BuiltinEditorResources::TabButtonNormalTex = L"TabButtonNormal.png";
-	const WString BuiltinEditorResources::TabButtonFocusedTex = L"TabButtonFocused.png";
-
-	const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollArrowUpNormal.png";
-	const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollArrowUpHover.png";
-	const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollArrowUpActive.png";
-
-	const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollArrowDownNormal.png";
-	const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollArrowDownHover.png";
-	const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollArrowDownActive.png";
-
-	const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollArrowLeftNormal.png";
-	const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollArrowLeftHover.png";
-	const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollArrowLeftActive.png";
-
-	const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollArrowRightNormal.png";
-	const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollArrowRightHover.png";
-	const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollArrowRightActive.png";
-
-	const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHHandleNormal.png";
-	const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHHandleHover.png";
-	const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHHandleActive.png";
-
-	const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVHandleNormal.png";
-	const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVHandleHover.png";
-	const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVHandleActive.png";
-
-	const WString BuiltinEditorResources::ScrollBarHBgTex = L"ScrollBarHBackground.png";
-	const WString BuiltinEditorResources::ScrollBarVBgTex = L"ScrollBarVBackground.png";
-
-	const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.png";
-	const WString BuiltinEditorResources::DropDownBoxSideBgTex = L"DropDownBoxSideBg.png";
-	const WString BuiltinEditorResources::DropDownBoxHandleTex = L"DropDownBoxScrollHandle.png";
-
-	const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownBoxEntryNormal.png";
-	const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownBoxEntryHover.png";
-
-	const WString BuiltinEditorResources::DropDownBoxEntryToggleNormalTex = L"DropDownBoxEntryToggleNormal.png";
-	const WString BuiltinEditorResources::DropDownBoxEntryToggleHoverTex = L"DropDownBoxEntryToggleHover.png";
-	const WString BuiltinEditorResources::DropDownBoxEntryToggleNormalOnTex = L"DropDownBoxEntryToggleNormalOn.png";
-	const WString BuiltinEditorResources::DropDownBoxEntryToggleHoverOnTex = L"DropDownBoxEntryToggleHoverOn.png";
-
-	const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxArrowUpNormal.png";
-	const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxArrowUpHover.png";
-
-	const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxArrowDownNormal.png";
-	const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxArrowDownHover.png";
-
-	const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownBoxExpandBtnNormal.png";
-	const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownBoxExpandBtnHover.png";
-
-	const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownBoxSeparator.png";
-
-	const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBackground.png";
-	const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarLog.png";
-
-	const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.png";
-	const WString BuiltinEditorResources::MenuBarBtnActiveTex = L"MenuBarButtonActive.png";
-	const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.png";
-
-	const WString BuiltinEditorResources::MenuBarLineNormalTex = L"MenuBarLineNormal.png";
-	const WString BuiltinEditorResources::MenuBarLineActiveTex = L"MenuBarLineActive.png";
-
-	const WString BuiltinEditorResources::ToolBarBtnNormalTex = L"ToolBarButtonNormal.png";
-	const WString BuiltinEditorResources::ToolBarBtnHoverTex = L"ToolBarButtonHover.png";
-	const WString BuiltinEditorResources::ToolBarBtnActiveTex = L"ToolBarButtonActive.png";
-
-	const WString BuiltinEditorResources::ToolBarSeparatorTex = L"ToolBarSeparator.png";
-
-	const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderNormal.png";
-
-	const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"ExpandArrowNormalOff.png";
-	const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"ExpandArrowHoverOff.png";
-	const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"ExpandArrowNormalOn.png";
-	const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"ExpandArrowHoverOn.png";
-
-	const WString BuiltinEditorResources::TreeViewHighlightBackground = L"TreeViewHighlightBackground.psd";
-	const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
-	const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
-	const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
-
-	const WString BuiltinEditorResources::ColorPickerSliderHorzHandleTex = L"ColorPickerSliderHorzHandle.psd";
-	const WString BuiltinEditorResources::ColorPickerSliderVertHandleTex = L"ColorPickerSliderVertHandle.psd";
-	const WString BuiltinEditorResources::ColorPickerSlider2DHandleTex = L"ColorPicker2DHandle.psd";
-
-	const WString BuiltinEditorResources::ProgressBarFillTex = L"ProgressBarFill.png";
-	const WString BuiltinEditorResources::ProgressBarBgTex = L"ProgressBarBg.png";
-
-	const WString BuiltinEditorResources::SelectionAreaTex = L"SelectionHighlight.png";
-	const WString BuiltinEditorResources::SelectionBgTex = L"SelectionBg.psd";
-
-	const WString BuiltinEditorResources::TextureDropTex = L"TextureDrop.png";
-	const WString BuiltinEditorResources::TextureDropOnTex = L"TextureDropHover.png";
-
-	const WString BuiltinEditorResources::XButtonNormalTex = L"XBtnNormal.png";
-	const WString BuiltinEditorResources::XButtonHoverTex = L"XBtnHover.png";
-	const WString BuiltinEditorResources::XButtonActiveTex = L"XBtnActive.png";
-
-	const WString BuiltinEditorResources::StatusBarBgTex = L"StatusBarBackground.png";
-	const WString BuiltinEditorResources::ScrollAreaBgTex = L"ScrollAreaBg.png";
-
-	const WString BuiltinEditorResources::InspectorTitleBgTex = L"InspectorTitleBg.png";
-	const WString BuiltinEditorResources::InspectorContentBgTex = L"InspectorContentBg.png";
-	const WString BuiltinEditorResources::InspectorContentBgAlternateTex = L"InspectorContentBgAlternate.png";
-
-	/************************************************************************/
-	/* 									SHADERS                      		*/
-	/************************************************************************/
-
-	const WString BuiltinEditorResources::ShaderDockOverlayFile = L"DockDropOverlay.bsl";
-	const WString BuiltinEditorResources::ShaderSceneGridFile = L"SceneGrid.bsl";
-	const WString BuiltinEditorResources::ShaderPickingCullNoneFile = L"PickingCullNone.bsl";
-	const WString BuiltinEditorResources::ShaderPickingCullCWFile = L"PickingCullCW.bsl";
-	const WString BuiltinEditorResources::ShaderPickingCullCCWFile = L"PickingCullCCW.bsl";
-	const WString BuiltinEditorResources::ShaderPickingAlphaCullNoneFile = L"PickingAlphaCullNone.bsl";
-	const WString BuiltinEditorResources::ShaderPickingAlphaCullCWFile = L"PickingAlphaCullCW.bsl";
-	const WString BuiltinEditorResources::ShaderPickingAlphaCullCCWFile = L"PickingAlphaCullCCW.bsl";
-	const WString BuiltinEditorResources::ShaderWireGizmoFile = L"WireGizmo.bsl";
-	const WString BuiltinEditorResources::ShaderSolidGizmoFile = L"SolidGizmo.bsl";
-	const WString BuiltinEditorResources::ShaderWireHandleFile = L"WireHandle.bsl";
-	const WString BuiltinEditorResources::ShaderSolidHandleFile = L"SolidHandle.bsl";
-	const WString BuiltinEditorResources::ShaderHandleClearAlphaFile = L"ClearHandleAlpha.bsl";
-	const WString BuiltinEditorResources::ShaderIconGizmoFile = L"IconGizmo.bsl";
-	const WString BuiltinEditorResources::ShaderGizmoPickingFile = L"GizmoPicking.bsl";
-	const WString BuiltinEditorResources::ShaderGizmoPickingAlphaFile = L"GizmoPickingAlpha.bsl";
-	const WString BuiltinEditorResources::ShaderTextGizmoFile = L"TextGizmo.bsl";
-	const WString BuiltinEditorResources::ShaderSelectionFile = L"Selection.bsl";
-
-	/************************************************************************/
-	/* 								OTHER							  		*/
-	/************************************************************************/
-	const WString BuiltinEditorResources::EmptyShaderCodeFile = L"EmptyShaderText.txt";
-	const WString BuiltinEditorResources::EmptyCSScriptCodeFile = L"EmptyCSScriptText.txt";
-
-	BuiltinEditorResources::BuiltinEditorResources()
-	{
-		// Set up paths
-		BuiltinRawDataFolder = Paths::getRuntimeDataPath() + L"Raw\\Editor\\";
-		EditorRawSkinFolder = BuiltinRawDataFolder + SkinFolder;
-		EditorRawShaderFolder = BuiltinRawDataFolder + ShaderFolder;
-		EditorRawShaderIncludeFolder = BuiltinRawDataFolder + ShaderIncludeFolder;
-
-		BuiltinDataFolder = Paths::getRuntimeDataPath() + EDITOR_DATA_FOLDER;
-		EditorSkinFolder = BuiltinDataFolder + SkinFolder;
-		EditorIconFolder = BuiltinDataFolder + IconFolder;
-		EditorShaderFolder = BuiltinDataFolder + ShaderFolder;
-		EditorShaderIncludeFolder = BuiltinDataFolder + ShaderIncludeFolder;
-
-		ResourceManifestPath = BuiltinDataFolder + "ResourceManifest.asset";
-
-		Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
-		absoluteDataPath.append(BuiltinDataFolder);
-
-		// Update from raw assets if needed
-#if BS_DEBUG_MODE
-		if (BuiltinResourcesHelper::checkForModifications(BuiltinRawDataFolder, BuiltinDataFolder + L"Timestamp.asset"))
-		{
-			mResourceManifest = ResourceManifest::create("BuiltinResources");
-			gResources().registerResourceManifest(mResourceManifest);
-
-			preprocess();
-			BuiltinResourcesHelper::writeTimestamp(BuiltinDataFolder + L"Timestamp.asset");
-
-			Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
-			absoluteDataPath.append(BuiltinDataFolder);
-
-			ResourceManifest::save(mResourceManifest, ResourceManifestPath, absoluteDataPath);
-		}
-#endif
-
-		// Load manifest
-		if (mResourceManifest == nullptr)
-		{
-			if (FileSystem::exists(ResourceManifestPath))
-				mResourceManifest = ResourceManifest::load(ResourceManifestPath, absoluteDataPath);
-
-			if (mResourceManifest == nullptr)
-				mResourceManifest = ResourceManifest::create("BuiltinResources");
-
-			gResources().registerResourceManifest(mResourceManifest);
-		}
-
-		// Load basic resources
-		mShaderDockOverlay = getShader(ShaderDockOverlayFile);
-		mShaderSceneGrid = getShader(ShaderSceneGridFile);
-		mShaderPicking[(int)CULL_NONE] = getShader(ShaderPickingCullNoneFile);
-		mShaderPicking[(int)CULL_CLOCKWISE] = getShader(ShaderPickingCullCWFile);
-		mShaderPicking[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingCullCCWFile);
-		mShaderPickingAlpha[(int)CULL_NONE] = getShader(ShaderPickingAlphaCullNoneFile);
-		mShaderPickingAlpha[(int)CULL_CLOCKWISE] = getShader(ShaderPickingAlphaCullCWFile);
-		mShaderPickingAlpha[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingAlphaCullCCWFile);
-		mShaderGizmoSolid = getShader(ShaderSolidGizmoFile);
-		mShaderGizmoWire = getShader(ShaderWireGizmoFile);
-		mShaderGizmoIcon = getShader(ShaderIconGizmoFile);
-		mShaderGizmoPicking = getShader(ShaderGizmoPickingFile);
-		mShaderGizmoAlphaPicking = getShader(ShaderGizmoPickingAlphaFile);
-		mShaderGizmoText = getShader(ShaderTextGizmoFile);
-		mShaderHandleSolid = getShader(ShaderSolidHandleFile);
-		mShaderHandleClearAlpha = getShader(ShaderHandleClearAlphaFile);
-		mShaderHandleWire = getShader(ShaderWireHandleFile);
-		mShaderSelection = getShader(ShaderSelectionFile);
-
-		mDefaultFont = gResources().load<Font>(BuiltinDataFolder + (DefaultAAFontFilename + L".asset"));
-		mSkin = gResources().load<GUISkin>(BuiltinDataFolder + (GUISkinFile + L".asset"));
-	}
-
-	BuiltinEditorResources::~BuiltinEditorResources()
-	{ }
-
-	void BuiltinEditorResources::preprocess()
-	{
-		BuiltinResourcesHelper::importAssets(EditorRawShaderIncludeFolder, EditorShaderIncludeFolder, mResourceManifest); // Hidden dependency: Includes must be imported before shaders
-		BuiltinResourcesHelper::importAssets(EditorRawShaderFolder, EditorShaderFolder, mResourceManifest);
-		BuiltinResourcesHelper::importAssets(EditorRawSkinFolder, EditorSkinFolder, mResourceManifest);
-
-		// Generate different sizes of resource icons
-		generateResourceIcons(EditorIconFolder, mResourceManifest);
-
-		// Import fonts
-		BuiltinResourcesHelper::importFont(BuiltinRawDataFolder + DefaultFontFilename, DefaultFontFilename, 
-			BuiltinDataFolder, { DefaultFontSize }, true, mResourceManifest);
-
-		BuiltinResourcesHelper::importFont(BuiltinRawDataFolder + DefaultFontFilename, DefaultAAFontFilename, 
-			BuiltinDataFolder, { TitleFontSize }, true, mResourceManifest);
-
-		// Generate & save GUI sprite textures
-		BuiltinResourcesHelper::generateSpriteTextures(EditorSkinFolder, mResourceManifest);
-
-		// Generate & save GUI skin
-		{
-			GUISkinPtr skin = generateGUISkin();
-			Path outputPath = FileSystem::getWorkingDirectoryPath() + BuiltinDataFolder + (GUISkinFile + L".asset");
-
-			HResource skinResource;
-			if (FileSystem::exists(outputPath))
-				skinResource = gResources().load(outputPath);
-
-			if (skinResource.isLoaded())
-				gResources().update(skinResource, skin);
-			else
-				skinResource = gResources()._createResourceHandle(skin);
-
-			gResources().save(skinResource, outputPath, true);
-			mResourceManifest->registerResource(skinResource.getUUID(), outputPath);
-		}
-
-		Resources::instance().unloadAllUnused();
-	}
-
-	void BuiltinEditorResources::generateResourceIcons(const Path& inputFolder, const ResourceManifestPtr& manifest)
-	{
-		if (!FileSystem::exists(inputFolder))
-			return;
-
-		WString iconsToProcess[] = { FolderIconTex, FontIconTex, MeshIconTex, TextureIconTex, PlainTextIconTex, 
-			ScriptCodeIconTex, ShaderIconTex, ShaderIncludeIconTex, MaterialIconTex, SpriteTextureIconTex, PrefabIconTex,
-			GUISkinIconTex, PhysicsMaterialIconTex, PhysicsMeshIconTex };
-
-		PixelDataPtr srcData[sizeof(iconsToProcess)];
-
-		UINT32 idx = 0;
-		for (auto& iconName : iconsToProcess)
-		{
-			Path path = inputFolder + (iconName + L".asset");
-
-			HTexture source = gResources().load<Texture>(path);
-			if (source != nullptr)
-			{
-				srcData[idx] = source->getProperties().allocateSubresourceBuffer(0);
-				source->readSubresource(gCoreAccessor(), 0, srcData[idx]);
-			}
-
-			idx++;
-		}
-
-		gCoreAccessor().submitToCoreThread(true);
-
-		idx = 0;
-		for (auto& iconName : iconsToProcess)
-		{
-			PixelDataPtr src = srcData[idx];
-
-			PixelDataPtr scaled48 = PixelData::create(48, 48, 1, src->getFormat());
-			PixelUtil::scale(*src, *scaled48);
-
-			PixelDataPtr scaled32 = PixelData::create(32, 32, 1, src->getFormat());
-			PixelUtil::scale(*scaled48, *scaled32);
-
-			PixelDataPtr scaled16 = PixelData::create(16, 16, 1, src->getFormat());
-			PixelUtil::scale(*scaled32, *scaled16);
-
-			HTexture tex48 = Texture::create(scaled48);
-			HTexture tex32 = Texture::create(scaled32);
-			HTexture tex16 = Texture::create(scaled16);
-
-			Path outputPath48 = FileSystem::getWorkingDirectoryPath() + inputFolder + (iconName + L"48.asset");
-			Resources::instance().save(tex48, outputPath48, true);
-			manifest->registerResource(tex48.getUUID(), outputPath48);
-
-			Path outputPath32 = FileSystem::getWorkingDirectoryPath() + inputFolder + (iconName + L"32.asset");
-			Resources::instance().save(tex32, outputPath32, true);
-			manifest->registerResource(tex32.getUUID(), outputPath32);
-
-			Path outputPath16 = FileSystem::getWorkingDirectoryPath() + inputFolder + (iconName + L"16.asset");
-			Resources::instance().save(tex16, outputPath16, true);
-			manifest->registerResource(tex16.getUUID(), outputPath16);
-
-			idx++;
-		}
-	}
-
-	GUISkinPtr BuiltinEditorResources::generateGUISkin()
-	{
-		GUISkinPtr skin = GUISkin::_createPtr();
-
-		Path defaultFontPath = FileSystem::getWorkingDirectoryPath();
-		defaultFontPath.append(BuiltinDataFolder);
-		defaultFontPath.append(DefaultFontFilename + L".asset");
-
-		HFont defaultFont = gResources().load<Font>(defaultFontPath);
-
-		Path defaultAAFontPath = FileSystem::getWorkingDirectoryPath();
-		defaultAAFontPath.append(BuiltinDataFolder);
-		defaultAAFontPath.append(DefaultAAFontFilename + L".asset");
-
-		HFont defaultAAFont = gResources().load<Font>(defaultAAFontPath);
-
-		// Blank entry
-		GUIElementStyle blankStyle;
-
-		skin->setStyle("Blank", blankStyle);
-		skin->setStyle(GUITexture::getGUITypeName(), blankStyle);
-
-		// Label
-		GUIElementStyle labelStyle;
-		labelStyle.font = defaultFont;
-		labelStyle.fontSize = DefaultFontSize;
-		labelStyle.fixedWidth = false;
-		labelStyle.fixedHeight = true;
-		labelStyle.height = 14;
-		labelStyle.minWidth = 10;
-		labelStyle.normal.textColor = TextNormalColor;
-
-		skin->setStyle(GUILabel::getGUITypeName(), labelStyle);
-
-		// Window frame
-		GUIElementStyle windowFrameStyle;
-		windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
-		windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
-		windowFrameStyle.border.left = 1;
-		windowFrameStyle.border.right = 1;
-		windowFrameStyle.border.top = 1;
-		windowFrameStyle.border.bottom = 1;
-
-		skin->setStyle("WindowFrame", windowFrameStyle);
-
-		// Button
-		GUIElementStyle buttonStyle;
-		buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
-		buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
-		buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
-		buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
-		buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
-		buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
-		buttonStyle.normal.textColor = TextNormalColor;
-		buttonStyle.hover.textColor = TextNormalColor;
-		buttonStyle.active.textColor = TextActiveColor;
-		buttonStyle.normalOn.textColor = TextActiveColor;
-		buttonStyle.hoverOn.textColor = TextActiveColor;
-		buttonStyle.activeOn.textColor = TextActiveColor;
-		buttonStyle.border.left = 2;
-		buttonStyle.border.right = 2;
-		buttonStyle.border.top = 2;
-		buttonStyle.border.bottom = 4;
-		buttonStyle.contentOffset.top = 2;
-		buttonStyle.contentOffset.left = 3;
-		buttonStyle.contentOffset.right = 3;
-		buttonStyle.margins.bottom = 2;
-		buttonStyle.fixedHeight = true;
-		buttonStyle.height = 21;
-		buttonStyle.minWidth = 20;
-		buttonStyle.font = defaultFont;
-		buttonStyle.fontSize = DefaultFontSize;
-		buttonStyle.textHorzAlign = THA_Center;
-		buttonStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle(GUIButton::getGUITypeName(), buttonStyle);
-
-		// Left edge button
-		GUIElementStyle leftButtonStyle;
-		leftButtonStyle.normal.texture = getGUITexture(ButtonLeftNormalTex);
-		leftButtonStyle.hover.texture = getGUITexture(ButtonLeftHoverTex);
-		leftButtonStyle.active.texture = getGUITexture(ButtonLeftActiveTex);
-		leftButtonStyle.normalOn.texture = getGUITexture(ButtonLeftActiveTex);
-		leftButtonStyle.hoverOn.texture = getGUITexture(ButtonLeftActiveTex);
-		leftButtonStyle.activeOn.texture = getGUITexture(ButtonLeftActiveTex);
-		leftButtonStyle.normal.textColor = TextNormalColor;
-		leftButtonStyle.hover.textColor = TextNormalColor;
-		leftButtonStyle.active.textColor = TextActiveColor;
-		leftButtonStyle.normalOn.textColor = TextActiveColor;
-		leftButtonStyle.hoverOn.textColor = TextActiveColor;
-		leftButtonStyle.activeOn.textColor = TextActiveColor;
-		leftButtonStyle.border.left = 7;
-		leftButtonStyle.border.right = 2;
-		leftButtonStyle.border.top = 2;
-		leftButtonStyle.border.bottom = 4;
-		leftButtonStyle.contentOffset.top = 2;
-		leftButtonStyle.contentOffset.left = 7;
-		leftButtonStyle.contentOffset.right = 3;
-		leftButtonStyle.margins.bottom = 2;
-		leftButtonStyle.fixedHeight = true;
-		leftButtonStyle.height = 21;
-		leftButtonStyle.minWidth = 20;
-		leftButtonStyle.font = defaultFont;
-		leftButtonStyle.fontSize = DefaultFontSize;
-		leftButtonStyle.textHorzAlign = THA_Center;
-		leftButtonStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle("ButtonLeft", leftButtonStyle);
-
-		// Right edge button
-		GUIElementStyle rightButtonStyle;
-		rightButtonStyle.normal.texture = getGUITexture(ButtonRightNormalTex);
-		rightButtonStyle.hover.texture = getGUITexture(ButtonRightHoverTex);
-		rightButtonStyle.active.texture = getGUITexture(ButtonRightActiveTex);
-		rightButtonStyle.normalOn.texture = getGUITexture(ButtonRightActiveTex);
-		rightButtonStyle.hoverOn.texture = getGUITexture(ButtonRightActiveTex);
-		rightButtonStyle.activeOn.texture = getGUITexture(ButtonRightActiveTex);
-		rightButtonStyle.normal.textColor = TextNormalColor;
-		rightButtonStyle.hover.textColor = TextNormalColor;
-		rightButtonStyle.active.textColor = TextActiveColor;
-		rightButtonStyle.normalOn.textColor = TextActiveColor;
-		rightButtonStyle.hoverOn.textColor = TextActiveColor;
-		rightButtonStyle.activeOn.textColor = TextActiveColor;
-		rightButtonStyle.border.left = 2;
-		rightButtonStyle.border.right = 7;
-		rightButtonStyle.border.top = 2;
-		rightButtonStyle.border.bottom = 4;
-		rightButtonStyle.contentOffset.top = 2;
-		rightButtonStyle.contentOffset.left = 3;
-		rightButtonStyle.contentOffset.right = 7;
-		rightButtonStyle.margins.bottom = 2;
-		rightButtonStyle.fixedHeight = true;
-		rightButtonStyle.height = 21;
-		rightButtonStyle.minWidth = 20;
-		rightButtonStyle.font = defaultFont;
-		rightButtonStyle.fontSize = DefaultFontSize;
-		rightButtonStyle.textHorzAlign = THA_Center;
-		rightButtonStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle("ButtonRight", rightButtonStyle);
-
-		// Toggle
-		GUIElementStyle toggleStyle;
-		toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
-		toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
-		toggleStyle.active.texture = toggleStyle.hover.texture;
-		toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
-		toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
-		toggleStyle.activeOn.texture = toggleStyle.hoverOn.texture;
-		toggleStyle.fixedHeight = true;
-		toggleStyle.fixedWidth = true;
-		toggleStyle.margins.bottom = 2;
-		toggleStyle.height = 15;
-		toggleStyle.width = 13;
-
-		skin->setStyle(GUIToggle::getGUITypeName(), toggleStyle);
-
-		// Color
-		GUIElementStyle colorStyle;
-		colorStyle.margins.left = 2;
-		colorStyle.margins.right = 2;
-		colorStyle.margins.top = 2;
-		colorStyle.margins.bottom = 2;
-		colorStyle.fixedHeight = true;
-		colorStyle.height = 15;
-		colorStyle.minWidth = 10;
-
-		skin->setStyle(GUIColor::getGUITypeName(), colorStyle);
-
-		// Window background texture
-		GUIElementStyle windowBgStyle;
-		windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTex);
-
-		skin->setStyle("WindowBackground", windowBgStyle);
-
-		// Window tab bar background
-		GUIElementStyle tabBarBgStyle;
-		tabBarBgStyle.normal.texture = getGUITexture(TabBarBackgroundTex);
-		tabBarBgStyle.fixedHeight = true;
-		tabBarBgStyle.height = 16;
-
-		skin->setStyle("TabBarBackground", tabBarBgStyle);
-
-		// Tabbed title bar tab button
-		GUIElementStyle tabbedBarButton;
-		tabbedBarButton.normal.texture = getGUITexture(TabButtonNormalTex);
-		tabbedBarButton.hover.texture = tabbedBarButton.normal.texture;
-		tabbedBarButton.active.texture = getGUITexture(TabButtonFocusedTex);
-		tabbedBarButton.normalOn.texture = tabbedBarButton.active.texture;
-		tabbedBarButton.hoverOn.texture = tabbedBarButton.active.texture;
-		tabbedBarButton.activeOn.texture = tabbedBarButton.active.texture;
-		tabbedBarButton.normal.textColor = TextNormalColor;
-		tabbedBarButton.hover.textColor = TextNormalColor;
-		tabbedBarButton.active.textColor = TextActiveColor;
-		tabbedBarButton.normalOn.textColor = TextActiveColor;
-		tabbedBarButton.hoverOn.textColor = TextActiveColor;
-		tabbedBarButton.activeOn.textColor = TextActiveColor;
-		tabbedBarButton.border.left = 12;
-		tabbedBarButton.border.right = 12;
-		tabbedBarButton.margins.left = 5;
-		tabbedBarButton.margins.right = 5;
-		tabbedBarButton.contentOffset.top = 3;
-		tabbedBarButton.contentOffset.left = 6;
-		tabbedBarButton.contentOffset.right = 6;
-		tabbedBarButton.fixedHeight = true;
-		tabbedBarButton.height = 15;
-		tabbedBarButton.minWidth = 24;
-		tabbedBarButton.maxWidth = 110;
-		tabbedBarButton.font = defaultFont;
-		tabbedBarButton.fontSize = DefaultFontSize;
-		tabbedBarButton.textHorzAlign = THA_Center;
-		tabbedBarButton.textVertAlign = TVA_Center;
-
-		skin->setStyle("TabbedBarBtn", tabbedBarButton);
-
-		// Tabbed title bar drag/drop button
-		GUIElementStyle tabbedBarDropButton;
-		tabbedBarDropButton.fixedHeight = true;
-		tabbedBarDropButton.fixedWidth = true;
-		tabbedBarDropButton.height = 13;
-		tabbedBarDropButton.width = 6;
-
-		skin->setStyle("TabbedBarDropArea", tabbedBarDropButton);
-
-		// Window title bar background
-		GUIElementStyle titleBarBgStyle;
-		titleBarBgStyle.normal.texture = getGUITexture(TitleBarBackgroundTex);
-		titleBarBgStyle.fixedHeight = true;
-		titleBarBgStyle.height = 17;
-
-		skin->setStyle("TitleBarBackground", titleBarBgStyle);
-
-		// Window minimize button
-		GUIElementStyle winMinButtonStyle;
-		winMinButtonStyle.normal.texture = getGUITexture(MinButtonNormalTex);
-		winMinButtonStyle.hover.texture = getGUITexture(MinButtonHoverTex);
-		winMinButtonStyle.active.texture = getGUITexture(MinButtonActiveTex);
-		winMinButtonStyle.fixedHeight = true;
-		winMinButtonStyle.fixedWidth = true;
-		winMinButtonStyle.height = 14;
-		winMinButtonStyle.width = 14;
-
-		skin->setStyle("WinMinimizeBtn", winMinButtonStyle);
-
-		// Window maximize button
-		GUIElementStyle winMaxButtonStyle;
-		winMaxButtonStyle.normal.texture = getGUITexture(MaxButtonNormalTex);
-		winMaxButtonStyle.hover.texture = getGUITexture(MaxButtonHoverTex);
-		winMaxButtonStyle.active.texture = getGUITexture(MaxButtonActiveTex);
-		winMaxButtonStyle.fixedHeight = true;
-		winMaxButtonStyle.fixedWidth = true;
-		winMaxButtonStyle.height = 14;
-		winMaxButtonStyle.width = 14;
-
-		skin->setStyle("WinMaximizeBtn", winMaxButtonStyle);
-
-		// Window close button
-		GUIElementStyle winCloseButtonStyle;
-		winCloseButtonStyle.normal.texture = getGUITexture(CloseButtonNormalTex);
-		winCloseButtonStyle.hover.texture = getGUITexture(CloseButtonHoverTex);
-		winCloseButtonStyle.active.texture = getGUITexture(CloseButtonActiveTex);
-		winCloseButtonStyle.fixedHeight = true;
-		winCloseButtonStyle.fixedWidth = true;
-		winCloseButtonStyle.height = 14;
-		winCloseButtonStyle.width = 14;
-
-		skin->setStyle("WinCloseBtn", winCloseButtonStyle);
-
-		// Input box
-		GUIElementStyle inputBoxStyle;
-		inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
-		inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
-		inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
-		inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
-		inputBoxStyle.normal.textColor = TextNormalColor;
-		inputBoxStyle.hover.textColor = TextNormalColor;
-		inputBoxStyle.focused.textColor = TextNormalColor;
-		inputBoxStyle.active.textColor = TextNormalColor;
-		inputBoxStyle.border.left = 4;
-		inputBoxStyle.border.right = 4;
-		inputBoxStyle.border.top = 4;
-		inputBoxStyle.border.bottom = 6;
-		inputBoxStyle.contentOffset.left = 4;
-		inputBoxStyle.contentOffset.right = 4;
-		inputBoxStyle.contentOffset.top = 4;
-		inputBoxStyle.contentOffset.bottom = 4;
-		inputBoxStyle.margins.bottom = 2;
-		inputBoxStyle.fixedHeight = true;
-		inputBoxStyle.height = 21;
-		inputBoxStyle.minWidth = 10;
-		inputBoxStyle.font = defaultFont;
-		inputBoxStyle.fontSize = DefaultFontSize;
-		inputBoxStyle.textHorzAlign = THA_Left;
-		inputBoxStyle.textVertAlign = TVA_Top;
-
-		skin->setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
-
-		/************************************************************************/
-		/* 								SCROLL BAR                      		*/
-		/************************************************************************/
-
-		// Up button
-		GUIElementStyle scrollUpBtnStyle;
-		scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
-		scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
-		scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
-		scrollUpBtnStyle.fixedHeight = true;
-		scrollUpBtnStyle.fixedWidth = true;
-		scrollUpBtnStyle.height = 11;
-		scrollUpBtnStyle.width = 13;
-
-		skin->setStyle("ScrollUpBtn", scrollUpBtnStyle);
-
-		// Down button
-		GUIElementStyle scrollDownBtnStyle;
-		scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
-		scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
-		scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
-		scrollDownBtnStyle.fixedHeight = true;
-		scrollDownBtnStyle.fixedWidth = true;
-		scrollDownBtnStyle.height = 11;
-		scrollDownBtnStyle.width = 13;
-
-		skin->setStyle("ScrollDownBtn", scrollDownBtnStyle);
-
-		// Left button
-		GUIElementStyle scrollLeftBtnStyle;
-		scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
-		scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
-		scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
-		scrollLeftBtnStyle.fixedHeight = true;
-		scrollLeftBtnStyle.fixedWidth = true;
-		scrollLeftBtnStyle.height = 13;
-		scrollLeftBtnStyle.width = 11;
-
-		skin->setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
-
-		// Right button
-		GUIElementStyle scrollRightBtnStyle;
-		scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
-		scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
-		scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
-		scrollRightBtnStyle.fixedHeight = true;
-		scrollRightBtnStyle.fixedWidth = true;
-		scrollRightBtnStyle.height = 13;
-		scrollRightBtnStyle.width = 11;
-
-		skin->setStyle("ScrollRightBtn", scrollRightBtnStyle);
-
-		// Horizontal handle
-		GUIElementStyle scrollBarHorzBtnStyle;
-		scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
-		scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
-		scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
-		scrollBarHorzBtnStyle.fixedHeight = true;
-		scrollBarHorzBtnStyle.fixedWidth = false;
-		scrollBarHorzBtnStyle.width = 10;
-		scrollBarHorzBtnStyle.height = 13;
-		scrollBarHorzBtnStyle.border.left = 4;
-		scrollBarHorzBtnStyle.border.right = 4;
-
-		skin->setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
-
-		// Vertical handle
-		GUIElementStyle scrollBarVertBtnStyle;
-		scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
-		scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
-		scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
-		scrollBarVertBtnStyle.fixedHeight = false;
-		scrollBarVertBtnStyle.fixedWidth = true;
-		scrollBarVertBtnStyle.width = 13;
-		scrollBarVertBtnStyle.height = 10;
-		scrollBarVertBtnStyle.border.top = 4;
-		scrollBarVertBtnStyle.border.bottom = 4;
-
-		skin->setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
-
-		// Vertical scroll bar
-		GUIElementStyle vertScrollBarStyle;
-		vertScrollBarStyle.normal.texture = getGUITexture(ScrollBarVBgTex);
-		vertScrollBarStyle.hover.texture = vertScrollBarStyle.normal.texture;
-		vertScrollBarStyle.active.texture = vertScrollBarStyle.normal.texture;
-		vertScrollBarStyle.fixedHeight = false;
-		vertScrollBarStyle.fixedWidth = true;
-		vertScrollBarStyle.minHeight = 8;
-		vertScrollBarStyle.width = 16;
-
-		skin->setStyle("ScrollBarVert", vertScrollBarStyle);
-
-		// Horizontal scroll bar
-		GUIElementStyle horzScrollBarStyle;
-		horzScrollBarStyle.normal.texture = getGUITexture(ScrollBarHBgTex);
-		horzScrollBarStyle.hover.texture = horzScrollBarStyle.normal.texture;
-		horzScrollBarStyle.active.texture = horzScrollBarStyle.normal.texture;
-		horzScrollBarStyle.fixedHeight = true;
-		horzScrollBarStyle.fixedWidth = false;
-		horzScrollBarStyle.minWidth = 8;
-		horzScrollBarStyle.height = 16;
-
-		skin->setStyle("ScrollBarHorz", horzScrollBarStyle);
-
-		/************************************************************************/
-		/* 								DROP DOWN BOX                      		*/
-		/************************************************************************/
-
-		// ListBox button
-		GUIElementStyle dropDownListStyle;
-		dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
-		dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
-		dropDownListStyle.active.texture = getGUITexture(DropDownBtnActiveTex);
-		dropDownListStyle.normalOn.texture = dropDownListStyle.active.texture;
-		dropDownListStyle.hoverOn.texture = dropDownListStyle.active.texture;
-		dropDownListStyle.activeOn.texture = dropDownListStyle.active.texture;
-		dropDownListStyle.normal.textColor = TextNormalColor;
-		dropDownListStyle.hover.textColor = TextNormalColor;
-		dropDownListStyle.active.textColor = TextNormalColor;
-		dropDownListStyle.normalOn.textColor = TextNormalColor;
-		dropDownListStyle.hoverOn.textColor = TextNormalColor;
-		dropDownListStyle.activeOn.textColor = TextNormalColor;
-		dropDownListStyle.fixedHeight = true;
-		dropDownListStyle.fixedWidth = false;
-		dropDownListStyle.height = 21;
-		dropDownListStyle.minWidth = 20;
-		dropDownListStyle.contentOffset.left = 3;
-		dropDownListStyle.contentOffset.right = 18;
-		dropDownListStyle.contentOffset.top = 2;
-		dropDownListStyle.contentOffset.bottom = 2;
-		dropDownListStyle.border.left = 2;
-		dropDownListStyle.border.right = 16;
-		dropDownListStyle.border.top = 2;
-		dropDownListStyle.border.bottom = 4;
-		dropDownListStyle.margins.bottom = 2;
-		dropDownListStyle.font = defaultFont;
-		dropDownListStyle.fontSize = DefaultFontSize;
-		dropDownListStyle.textHorzAlign = THA_Left;
-		dropDownListStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle(GUIListBox::getGUITypeName(), dropDownListStyle);
-
-		// DropDown scroll up button
-		GUIElementStyle dropDownScrollUpBtnStyle;
-		dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
-		dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
-		dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
-		dropDownScrollUpBtnStyle.fixedHeight = true;
-		dropDownScrollUpBtnStyle.fixedWidth = true;
-		dropDownScrollUpBtnStyle.width = 8;
-		dropDownScrollUpBtnStyle.height = 12;
-
-		skin->setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
-		skin->setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
-		skin->setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
-
-		// DropDown scroll down button
-		GUIElementStyle dropDownScrollDownBtnStyle;
-		dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
-		dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
-		dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
-		dropDownScrollDownBtnStyle.fixedHeight = true;
-		dropDownScrollDownBtnStyle.fixedWidth = true;
-		dropDownScrollDownBtnStyle.width = 8;
-		dropDownScrollDownBtnStyle.height = 12;
-
-		skin->setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
-		skin->setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
-		skin->setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
-
-		// DropDown handle
-		GUIElementStyle dropDownScrollHandleStyle;
-		dropDownScrollHandleStyle.normal.texture = getGUITexture(DropDownBoxHandleTex);
-		dropDownScrollHandleStyle.fixedHeight = false;
-		dropDownScrollHandleStyle.fixedWidth = true;
-		dropDownScrollHandleStyle.height = 8;
-		dropDownScrollHandleStyle.width = 8;
-
-		skin->setStyle("ListBoxHandle", dropDownScrollHandleStyle);
-		skin->setStyle("MenuBarHandle", dropDownScrollHandleStyle);
-		skin->setStyle("ContextMenuHandle", dropDownScrollHandleStyle);
-
-		// DropDown sidebar background
-		GUIElementStyle dropDownSidebarBg;
-		dropDownSidebarBg.normal.texture = getGUITexture(DropDownBoxSideBgTex);
-		dropDownSidebarBg.fixedHeight = false;
-		dropDownSidebarBg.fixedWidth = true;
-		dropDownSidebarBg.height = 8;
-		dropDownSidebarBg.width = 9;
-		dropDownSidebarBg.border.left = 1;
-		dropDownSidebarBg.border.top = 1;
-		dropDownSidebarBg.border.bottom = 1;
-
-		skin->setStyle("ListBoxSidebarBg", dropDownSidebarBg);
-		skin->setStyle("MenuBarSidebarBg", dropDownSidebarBg);
-		skin->setStyle("ContextMenuSidebarBg", dropDownSidebarBg);
-
-		// DropDown entry button
-		GUIElementStyle dropDownEntryBtnStyle;
-		dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
-		dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
-		dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
-		dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
-		dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
-		dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
-		dropDownEntryBtnStyle.normal.textColor = TextNormalColor;
-		dropDownEntryBtnStyle.hover.textColor = TextNormalColor;
-		dropDownEntryBtnStyle.active.textColor = TextNormalColor;
-		dropDownEntryBtnStyle.normalOn.textColor = TextNormalColor;
-		dropDownEntryBtnStyle.hoverOn.textColor = TextNormalColor;
-		dropDownEntryBtnStyle.activeOn.textColor = TextNormalColor;
-		dropDownEntryBtnStyle.fixedHeight = true;
-		dropDownEntryBtnStyle.fixedWidth = false;
-		dropDownEntryBtnStyle.height = 16;
-		dropDownEntryBtnStyle.width = 30;
-		dropDownEntryBtnStyle.font = defaultFont;
-		dropDownEntryBtnStyle.fontSize = DefaultFontSize;
-		dropDownEntryBtnStyle.textHorzAlign = THA_Left;
-		dropDownEntryBtnStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
-
-		// DropDown toggle entry button
-		GUIElementStyle dropDownToggleEntryBtnStyle;
-		dropDownToggleEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryToggleNormalTex);
-		dropDownToggleEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryToggleHoverTex);
-		dropDownToggleEntryBtnStyle.active.texture = dropDownToggleEntryBtnStyle.hover.texture;
-		dropDownToggleEntryBtnStyle.normalOn.texture = getGUITexture(DropDownBoxEntryToggleNormalOnTex);
-		dropDownToggleEntryBtnStyle.hoverOn.texture = getGUITexture(DropDownBoxEntryToggleHoverOnTex);
-		dropDownToggleEntryBtnStyle.activeOn.texture = dropDownToggleEntryBtnStyle.hoverOn.texture;
-		dropDownToggleEntryBtnStyle.normal.textColor = TextNormalColor;
-		dropDownToggleEntryBtnStyle.hover.textColor = TextNormalColor;
-		dropDownToggleEntryBtnStyle.active.textColor = TextNormalColor;
-		dropDownToggleEntryBtnStyle.normalOn.textColor = TextNormalColor;
-		dropDownToggleEntryBtnStyle.hoverOn.textColor = TextNormalColor;
-		dropDownToggleEntryBtnStyle.activeOn.textColor = TextNormalColor;
-		dropDownToggleEntryBtnStyle.fixedHeight = true;
-		dropDownToggleEntryBtnStyle.fixedWidth = false;
-		dropDownToggleEntryBtnStyle.height = 18;
-		dropDownToggleEntryBtnStyle.width = 30;
-		dropDownToggleEntryBtnStyle.border.left = 17;
-		dropDownToggleEntryBtnStyle.contentOffset.left = 17;
-		dropDownToggleEntryBtnStyle.font = defaultFont;
-		dropDownToggleEntryBtnStyle.fontSize = DefaultFontSize;
-		dropDownToggleEntryBtnStyle.textHorzAlign = THA_Left;
-		dropDownToggleEntryBtnStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle(GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE, dropDownToggleEntryBtnStyle);
-
-		// DropDown entry button with expand
-		GUIElementStyle dropDownEntryExpBtnStyle;
-		dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
-		dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
-		dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
-		dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
-		dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
-		dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
-		dropDownEntryExpBtnStyle.normal.textColor = TextNormalColor;
-		dropDownEntryExpBtnStyle.hover.textColor = TextNormalColor;
-		dropDownEntryExpBtnStyle.active.textColor = TextNormalColor;
-		dropDownEntryExpBtnStyle.normalOn.textColor = TextNormalColor;
-		dropDownEntryExpBtnStyle.hoverOn.textColor = TextNormalColor;
-		dropDownEntryExpBtnStyle.activeOn.textColor = TextNormalColor;
-		dropDownEntryExpBtnStyle.fixedHeight = true;
-		dropDownEntryExpBtnStyle.fixedWidth = false;
-		dropDownEntryExpBtnStyle.height = 16;
-		dropDownEntryExpBtnStyle.width = 30;
-		dropDownEntryExpBtnStyle.border.right = 13;
-		dropDownEntryExpBtnStyle.font = defaultFont;
-		dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
-		dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
-		dropDownEntryExpBtnStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
-
-		// Drop down separator
-		GUIElementStyle dropDownSeparatorStyle;
-		dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
-		dropDownSeparatorStyle.fixedHeight = true;
-		dropDownSeparatorStyle.fixedWidth = false;
-		dropDownSeparatorStyle.height = 3;
-		dropDownSeparatorStyle.width = 30;
-
-		skin->setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
-
-		// Drop down content
-		GUIElementStyle dropDownContentStyle;
-		dropDownContentStyle.minWidth = 50;
-		dropDownContentStyle.minHeight = 20;
-		dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE] = GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE;
-		dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
-		dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
-		dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
-
-		skin->setStyle("ListBoxContent", dropDownContentStyle);
-		skin->setStyle("MenuBarContent", dropDownContentStyle);
-		skin->setStyle("ContextMenuContent", dropDownContentStyle);
-
-		// DropDown box frame
-		GUIElementStyle dropDownBoxStyle;
-		dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
-		dropDownBoxStyle.hover.texture = dropDownBoxStyle.normal.texture;
-		dropDownBoxStyle.active.texture = dropDownBoxStyle.hover.texture;
-		dropDownBoxStyle.fixedHeight = false;
-		dropDownBoxStyle.fixedWidth = false;
-		dropDownBoxStyle.border.left = 2;
-		dropDownBoxStyle.border.right = 2;
-		dropDownBoxStyle.border.top = 2;
-		dropDownBoxStyle.border.bottom = 4;
-		dropDownBoxStyle.margins.left = 6;
-		dropDownBoxStyle.margins.right = 6;
-		dropDownBoxStyle.margins.top = 4;
-		dropDownBoxStyle.margins.bottom = 6;
-
-		skin->setStyle("ListBoxFrame", dropDownBoxStyle);
-		skin->setStyle("MenuBarFrame", dropDownBoxStyle);
-		skin->setStyle("ContextMenuFrame", dropDownBoxStyle);
-
-		/************************************************************************/
-		/* 								TOOLTIP                      			*/
-		/************************************************************************/
-
-		GUIElementStyle tooltipFrameStyle;
-		tooltipFrameStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
-		tooltipFrameStyle.hover.texture = tooltipFrameStyle.normal.texture;
-		tooltipFrameStyle.active.texture = tooltipFrameStyle.hover.texture;
-		tooltipFrameStyle.fixedHeight = false;
-		tooltipFrameStyle.fixedWidth = false;
-		tooltipFrameStyle.border.left = 2;
-		tooltipFrameStyle.border.right = 2;
-		tooltipFrameStyle.border.top = 2;
-		tooltipFrameStyle.border.bottom = 4;
-		tooltipFrameStyle.margins.left = 6;
-		tooltipFrameStyle.margins.right = 6;
-		tooltipFrameStyle.margins.top = 4;
-		tooltipFrameStyle.margins.bottom = 6;
-
-		skin->setStyle(GUITooltip::getFrameStyleName(), tooltipFrameStyle);
-
-		/************************************************************************/
-		/* 								MENU BAR	                     		*/
-		/************************************************************************/
-
-		// MenuBar background
-		GUIElementStyle menuBarBgStyle;
-		menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
-		menuBarBgStyle.height = 14;
-		menuBarBgStyle.width = 2;
-		menuBarBgStyle.border.bottom = 2;
-
-		skin->setStyle(GUIMenuBar::getBackgroundStyleType(), menuBarBgStyle);
-
-		// MenuBar separator line
-		GUIElementStyle menuBarLineStyle;
-		menuBarLineStyle.normal.texture = getGUITexture(MenuBarLineNormalTex);
-		menuBarLineStyle.normalOn.texture = getGUITexture(MenuBarLineActiveTex);
-		menuBarLineStyle.fixedHeight = true;
-		menuBarLineStyle.height = 1;
-
-		skin->setStyle(GUIMenuBar::getLineStyleType(), menuBarLineStyle);
-
-		// MenuBar Banshee logo
-		GUIElementStyle menuBarBansheeLogoStyle;
-		menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
-		menuBarBansheeLogoStyle.fixedHeight = true;
-		menuBarBansheeLogoStyle.fixedWidth = true;
-		menuBarBansheeLogoStyle.height = 46;
-		menuBarBansheeLogoStyle.width = 46;
-
-		skin->setStyle(GUIMenuBar::getLogoStyleType(), menuBarBansheeLogoStyle);
-
-		// MenuBar button
-		GUIElementStyle menuBarBtnStyle;
-		menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
-		menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
-		menuBarBtnStyle.active.texture = getGUITexture(MenuBarBtnActiveTex);
-		menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.active.texture;
-		menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.active.texture;
-		menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.active.texture;
-		menuBarBtnStyle.normal.textColor = TextNormalColor;
-		menuBarBtnStyle.hover.textColor = TextNormalColor;
-		menuBarBtnStyle.active.textColor = TextActiveColor;
-		menuBarBtnStyle.normalOn.textColor = TextActiveColor;
-		menuBarBtnStyle.hoverOn.textColor = TextActiveColor;
-		menuBarBtnStyle.activeOn.textColor = TextActiveColor;
-		menuBarBtnStyle.fixedHeight = true;
-		menuBarBtnStyle.fixedWidth = false;
-		menuBarBtnStyle.height = 14;
-		menuBarBtnStyle.width = 4;
-		menuBarBtnStyle.margins.left = 2;
-		menuBarBtnStyle.margins.right = 2;
-		menuBarBtnStyle.margins.top = 2;
-		menuBarBtnStyle.margins.bottom = 2;
-		menuBarBtnStyle.font = defaultFont;
-		menuBarBtnStyle.fontSize = DefaultFontSize;
-		menuBarBtnStyle.textHorzAlign = THA_Left;
-		menuBarBtnStyle.textVertAlign = TVA_Top;
-
-		skin->setStyle(GUIMenuBar::getMenuItemButtonStyleType(), menuBarBtnStyle);
-
-		// ToolBar separator
-		GUIElementStyle toolBarSeparator;
-		toolBarSeparator.normal.texture = getGUITexture(ToolBarSeparatorTex);
-		toolBarSeparator.fixedWidth = true;
-		toolBarSeparator.width = 3;
-		toolBarSeparator.height = 32;
-
-		skin->setStyle(GUIMenuBar::getToolBarSeparatorStyleType(), toolBarSeparator);
-
-		// ToolBar button
-		GUIElementStyle toolBarBtnStyle;
-		toolBarBtnStyle.normal.texture = getGUITexture(ToolBarBtnNormalTex);
-		toolBarBtnStyle.hover.texture = getGUITexture(ToolBarBtnHoverTex);
-		toolBarBtnStyle.active.texture = getGUITexture(ToolBarBtnActiveTex);
-		toolBarBtnStyle.normalOn.texture = getGUITexture(ToolBarBtnActiveTex);
-		toolBarBtnStyle.hoverOn.texture = getGUITexture(ToolBarBtnActiveTex);
-		toolBarBtnStyle.activeOn.texture = getGUITexture(ToolBarBtnActiveTex);
-		toolBarBtnStyle.normal.textColor = TextNormalColor;
-		toolBarBtnStyle.hover.textColor = TextNormalColor;
-		toolBarBtnStyle.active.textColor = TextActiveColor;
-		toolBarBtnStyle.normalOn.textColor = TextNormalColor;
-		toolBarBtnStyle.hoverOn.textColor = TextNormalColor;
-		toolBarBtnStyle.activeOn.textColor = TextActiveColor;
-		toolBarBtnStyle.fixedHeight = true;
-		toolBarBtnStyle.fixedWidth = true;
-		toolBarBtnStyle.height = 32;
-		toolBarBtnStyle.width = 32;
-
-		skin->setStyle(GUIMenuBar::getToolBarButtonStyleType(), toolBarBtnStyle);
-
-		/************************************************************************/
-		/* 								DOCK SLIDER	                     		*/
-		/************************************************************************/
-
-		GUIElementStyle dockSliderBtnStyle;
-		dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
-		dockSliderBtnStyle.hover.texture = dockSliderBtnStyle.normal.texture;
-		dockSliderBtnStyle.active.texture = dockSliderBtnStyle.normal.texture;
-		dockSliderBtnStyle.fixedHeight = false;
-		dockSliderBtnStyle.fixedWidth = false;
-		dockSliderBtnStyle.height = 2;
-		dockSliderBtnStyle.width = 2;
-
-		skin->setStyle("DockSliderBtn", dockSliderBtnStyle);
-
-		/************************************************************************/
-		/* 								TREE VIEW	                     		*/
-		/************************************************************************/
-
-		// Expand button
-		GUIElementStyle treeViewExpandButtonStyle;
-		treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
-		treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
-		treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
-		treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
-		treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
-		treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
-		treeViewExpandButtonStyle.fixedHeight = true;
-		treeViewExpandButtonStyle.fixedWidth = true;
-		treeViewExpandButtonStyle.height = 10;
-		treeViewExpandButtonStyle.width = 10;
-
-		skin->setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
-
-		// Entry
-		GUIElementStyle treeViewEntryStyle;
-		treeViewEntryStyle.font = defaultFont;
-		treeViewEntryStyle.fontSize = DefaultFontSize;
-		treeViewEntryStyle.fixedWidth = false;
-		treeViewEntryStyle.fixedHeight = true;
-		treeViewEntryStyle.height = 16;
-		treeViewEntryStyle.minWidth = 10;
-		treeViewEntryStyle.normal.textColor = TextNormalColor;
-
-		skin->setStyle("TreeViewElementBtn", treeViewEntryStyle);
-
-		// Background
-		GUIElementStyle treeViewBackgroundStyle;
-
-		skin->setStyle("TreeViewBackground", treeViewBackgroundStyle);
-
-		// Selection background
-		GUIElementStyle treeViewSelBackgroundStyle;
-		treeViewSelBackgroundStyle.normal.texture = getGUITexture(SelectionBgTex);
-		treeViewSelBackgroundStyle.fixedHeight = false;
-		treeViewSelBackgroundStyle.fixedWidth = false;
-		treeViewSelBackgroundStyle.height = 2;
-		treeViewSelBackgroundStyle.width = 2;
-
-		skin->setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
-
-		// Highlight background
-		GUIElementStyle treeViewHLBackgroundStyle;
-		treeViewHLBackgroundStyle.normal.texture = getGUITexture(TreeViewHighlightBackground);
-		treeViewHLBackgroundStyle.fixedHeight = false;
-		treeViewHLBackgroundStyle.fixedWidth = false;
-		treeViewHLBackgroundStyle.height = 2;
-		treeViewHLBackgroundStyle.width = 2;
-
-		skin->setStyle("TreeViewHighlightBackground", treeViewHLBackgroundStyle);
-
-		// Edit box
-		GUIElementStyle treeViewEditBox;
-		treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
-		treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
-		treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
-		treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
-		treeViewEditBox.normal.textColor = TextNormalColor;
-		treeViewEditBox.hover.textColor = TextNormalColor;
-		treeViewEditBox.focused.textColor = TextNormalColor;
-		treeViewEditBox.active.textColor = TextNormalColor;
-		treeViewEditBox.border.left = 1;
-		treeViewEditBox.border.right = 1;
-		treeViewEditBox.border.top = 1;
-		treeViewEditBox.border.bottom = 1;
-		treeViewEditBox.margins.left = 1;
-		treeViewEditBox.margins.right = 1;
-		treeViewEditBox.margins.top = 1;
-		treeViewEditBox.margins.bottom = 1;
-		treeViewEditBox.fixedHeight = true;
-		treeViewEditBox.height = 13;
-		treeViewEditBox.minWidth = 10;
-		treeViewEditBox.font = defaultFont;
-		treeViewEditBox.fontSize = DefaultFontSize;
-		treeViewEditBox.textHorzAlign = THA_Left;
-		treeViewEditBox.textVertAlign = TVA_Top;
-
-		skin->setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
-
-		// Element highlight
-		GUIElementStyle treeViewElementHighlight;
-		treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
-		treeViewElementHighlight.border.left = 1;
-		treeViewElementHighlight.border.right = 1;
-		treeViewElementHighlight.border.top = 1;
-		treeViewElementHighlight.border.bottom = 1;
-
-		skin->setStyle("TreeViewElementHighlight", treeViewElementHighlight);
-
-		// Element separator highlight
-		GUIElementStyle treeViewElementSepHighlight;
-		treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
-		treeViewElementSepHighlight.border.left = 1;
-		treeViewElementSepHighlight.border.right = 1;
-		treeViewElementSepHighlight.border.top = 1;
-		treeViewElementSepHighlight.border.bottom = 1;
-
-		skin->setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
-
-		/************************************************************************/
-		/* 							OBJECT DROP FIELD                      		*/
-		/************************************************************************/
-		GUIElementStyle objectDropStyle;
-		objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
-		objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
-		objectDropStyle.hover.texture = objectDropStyle.normal.texture;
-		objectDropStyle.hoverOn.texture = objectDropStyle.normalOn.texture;
-		objectDropStyle.active.texture = objectDropStyle.normal.texture;
-		objectDropStyle.activeOn.texture = objectDropStyle.normalOn.texture;
-		objectDropStyle.normal.textColor = TextNormalColor;
-		objectDropStyle.hover.textColor = TextNormalColor;
-		objectDropStyle.active.textColor = TextNormalColor;
-		objectDropStyle.normalOn.textColor = TextNormalColor;
-		objectDropStyle.hoverOn.textColor = TextNormalColor;
-		objectDropStyle.activeOn.textColor = TextNormalColor;
-		objectDropStyle.border.left = 2;
-		objectDropStyle.border.top = 2;
-		objectDropStyle.border.bottom = 4;
-		objectDropStyle.contentOffset.left = 3;
-		objectDropStyle.contentOffset.right = 1;
-		objectDropStyle.margins.bottom = 2;
-		objectDropStyle.fixedHeight = true;
-		objectDropStyle.height = 21;
-		objectDropStyle.minWidth = 20;
-		objectDropStyle.font = defaultFont;
-		objectDropStyle.fontSize = DefaultFontSize;
-		objectDropStyle.textHorzAlign = THA_Center;
-		objectDropStyle.textVertAlign = TVA_Center;
-
-		skin->setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
-
-		GUIElementStyle objectClearBtnStyle;
-		objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
-		objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
-		objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
-		objectClearBtnStyle.fixedHeight = true;
-		objectClearBtnStyle.fixedWidth = true;
-		objectClearBtnStyle.height = 21;
-		objectClearBtnStyle.width = 16;
-		objectClearBtnStyle.margins.bottom = 2;
-
-		skin->setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
-
-		GUIElementStyle editorObjectFieldStyle;
-		editorObjectFieldStyle.fixedHeight = true;
-		editorObjectFieldStyle.height = 21;
-		editorObjectFieldStyle.minWidth = 30;
-		editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
-		editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
-		editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
-
-		skin->setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
-
-		/************************************************************************/
-		/* 						TEXTURE DROP FIELD                      		*/
-		/************************************************************************/
-		GUIElementStyle textureFieldStyle;
-		textureFieldStyle.minHeight = 15;
-		textureFieldStyle.minWidth = 15;
-		textureFieldStyle.subStyles[TextureFieldDropStyleName] = TextureFieldDropStyleName;
-		textureFieldStyle.subStyles[TextureFieldClearBtnStyleName] = TextureFieldClearBtnStyleName;
-		textureFieldStyle.subStyles[TextureFieldLabelStyleName] = GUITextField::getLabelStyleType();
-
-		skin->setStyle(TextureFieldStyleName, textureFieldStyle);
-
-		GUIElementStyle textureDropStyle;
-		textureDropStyle.font = defaultFont;
-		textureDropStyle.fontSize = DefaultFontSize;
-		textureDropStyle.textHorzAlign = THA_Center;
-		textureDropStyle.textVertAlign = TVA_Center;
-		textureDropStyle.normal.textColor = Color(95 / 255.0f, 95 / 255.0f, 95 / 255.0f, 1.0f);
-		textureDropStyle.normal.texture = getGUITexture(TextureDropTex);
-		textureDropStyle.hover.textColor = textureDropStyle.normal.textColor;
-		textureDropStyle.hover.texture = textureDropStyle.normal.texture;
-		textureDropStyle.active.textColor = textureDropStyle.normal.textColor;
-		textureDropStyle.active.texture = textureDropStyle.normal.texture;
-		textureDropStyle.normalOn.textColor = Color(95 / 255.0f, 95 / 255.0f, 95 / 255.0f, 1.0f);
-		textureDropStyle.normalOn.texture = getGUITexture(TextureDropOnTex);
-		textureDropStyle.hoverOn.textColor = textureDropStyle.normalOn.textColor;
-		textureDropStyle.hoverOn.texture = textureDropStyle.normalOn.texture;
-		textureDropStyle.activeOn.textColor = textureDropStyle.normalOn.textColor;
-		textureDropStyle.activeOn.texture = textureDropStyle.normalOn.texture;
-		textureDropStyle.height = 84;
-		textureDropStyle.width = 82;
-		textureDropStyle.fixedHeight = true;
-		textureDropStyle.fixedWidth = true;
-		textureDropStyle.border.left = 2;
-		textureDropStyle.border.right = 2;
-		textureDropStyle.border.top = 2;
-		textureDropStyle.border.bottom = 4;
-		textureDropStyle.contentOffset.left = 4;
-		textureDropStyle.contentOffset.right = 4;
-		textureDropStyle.contentOffset.top = 4;
-		textureDropStyle.contentOffset.bottom = 4;
-
-		skin->setStyle(TextureFieldDropStyleName, textureDropStyle);
-		
-		GUIElementStyle textureDropClearStyle;
-		textureDropClearStyle.normal.texture = getGUITexture(XButtonNormalTex);
-		textureDropClearStyle.hover.texture = getGUITexture(XButtonHoverTex);
-		textureDropClearStyle.active.texture = getGUITexture(XButtonActiveTex);
-		textureDropClearStyle.fixedWidth = true;
-		textureDropClearStyle.fixedHeight = true;
-		textureDropClearStyle.height = 10;
-		textureDropClearStyle.width = 10;
-
-		skin->setStyle(TextureFieldClearBtnStyleName, textureDropClearStyle);
-
-		/************************************************************************/
-		/* 								EDITOR FIELDS                      		*/
-		/************************************************************************/
-
-		GUIElementStyle editorFieldLabelStyle;
-		editorFieldLabelStyle.font = defaultFont;
-		editorFieldLabelStyle.fontSize = DefaultFontSize;
-		editorFieldLabelStyle.normal.textColor = TextNormalColor;
-		editorFieldLabelStyle.fixedWidth = false;
-		editorFieldLabelStyle.fixedHeight = true;
-		editorFieldLabelStyle.height = 14;
-		editorFieldLabelStyle.minWidth = 10;
-		editorFieldLabelStyle.textHorzAlign = THA_Left;
-
-		skin->setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
-
-		GUIElementStyle editorIntFieldStyle;
-		editorIntFieldStyle.fixedHeight = true;
-		editorIntFieldStyle.height = 21;
-		editorIntFieldStyle.minWidth = 30;
-		editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
-
-		skin->setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
-
-		GUIElementStyle editorFloatFieldStyle;
-		editorFloatFieldStyle.fixedHeight = true;
-		editorFloatFieldStyle.height = 21;
-		editorFloatFieldStyle.minWidth = 30;
-		editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
-
-		skin->setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
-
-		GUIElementStyle editorTextFieldStyle;
-		editorTextFieldStyle.fixedHeight = true;
-		editorTextFieldStyle.height = 21;
-		editorTextFieldStyle.minWidth = 30;
-		editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
-
-		skin->setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
-
-		GUIElementStyle editorColorFieldStyle;
-		editorColorFieldStyle.fixedHeight = true;
-		editorColorFieldStyle.height = 21;
-		editorColorFieldStyle.minWidth = 30;
-		editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
-
-		skin->setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
-
-		GUIElementStyle editorToggleFieldStyle;
-		editorToggleFieldStyle.fixedHeight = true;
-		editorToggleFieldStyle.height = 15;
-		editorToggleFieldStyle.minWidth = 30;
-		editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
-
-		skin->setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
-
-		GUIElementStyle editorVector2FieldStyle;
-		editorVector2FieldStyle.fixedHeight = true;
-		editorVector2FieldStyle.height = 35;
-		editorVector2FieldStyle.minWidth = 30;
-		editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
-
-		skin->setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
-
-		GUIElementStyle editorVector3FieldStyle;
-		editorVector3FieldStyle.fixedHeight = true;
-		editorVector3FieldStyle.height = 35;
-		editorVector3FieldStyle.minWidth = 30;
-		editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
-
-		skin->setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
-
-		GUIElementStyle editorVector4FieldStyle;
-		editorVector4FieldStyle.fixedHeight = true;
-		editorVector4FieldStyle.height = 35;
-		editorVector4FieldStyle.minWidth = 30;
-		editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
-
-		skin->setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
-
-		GUIElementStyle editorListBoxFieldStyle;
-		editorListBoxFieldStyle.fixedHeight = true;
-		editorListBoxFieldStyle.height = 21;
-		editorListBoxFieldStyle.minWidth = 30;
-		editorListBoxFieldStyle.subStyles[GUIListBoxField::getLabelStyleType()] = GUIListBoxField::getLabelStyleType();
-		editorListBoxFieldStyle.subStyles[GUIListBoxField::getListBoxStyleType()] = GUIListBox::getGUITypeName();
-
-		skin->setStyle(GUIListBoxField::getGUITypeName(), editorListBoxFieldStyle);
-
-		GUIElementStyle editorSliderFieldStyle;
-		editorSliderFieldStyle.fixedHeight = true;
-		editorSliderFieldStyle.height = 21;
-		editorSliderFieldStyle.minWidth = 30;
-		editorSliderFieldStyle.subStyles[GUISliderField::getLabelStyleType()] = GUISliderField::getLabelStyleType();
-		editorSliderFieldStyle.subStyles[GUISliderField::getInputStyleType()] = GUIInputBox::getGUITypeName();
-		editorSliderFieldStyle.subStyles[GUISliderField::getSliderStyleType()] = GUISliderHorz::getGUITypeName();
-
-		skin->setStyle(GUISliderField::getGUITypeName(), editorSliderFieldStyle);
-
-		/************************************************************************/
-		/* 							     FOLDOUT                      		    */
-		/************************************************************************/
-
-		GUIElementStyle foldoutStyle;
-		foldoutStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
-		foldoutStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
-		foldoutStyle.active.texture = getGUITexture(FoldoutOpenActiveTex);
-		foldoutStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
-		foldoutStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
-		foldoutStyle.activeOn.texture = getGUITexture(FoldoutOpenActiveTex);
-		foldoutStyle.normal.textColor = TextNormalColor;
-		foldoutStyle.hover.textColor = TextNormalColor;
-		foldoutStyle.active.textColor = TextNormalColor;
-		foldoutStyle.normalOn.textColor = TextNormalColor;
-		foldoutStyle.hoverOn.textColor = TextNormalColor;
-		foldoutStyle.activeOn.textColor = TextNormalColor;
-		foldoutStyle.fixedHeight = true;
-		foldoutStyle.fixedWidth = false;
-		foldoutStyle.height = 21;
-		foldoutStyle.minWidth = 17;
-		foldoutStyle.font = defaultFont;
-		foldoutStyle.fontSize = DefaultFontSize;
-		foldoutStyle.textHorzAlign = THA_Left;
-		foldoutStyle.textVertAlign = TVA_Center;
-		foldoutStyle.contentOffset = RectOffset(16, 0, 0, 0);
-		foldoutStyle.border.left = 15;
-		foldoutStyle.border.right = 2;
-		foldoutStyle.border.top = 2;
-		foldoutStyle.border.bottom = 4;
-
-		skin->setStyle("Foldout", foldoutStyle);
-
-		/************************************************************************/
-		/* 								PROGRESS BAR                      		*/
-		/************************************************************************/
-		GUIElementStyle progressBarBgStyle;
-		progressBarBgStyle.fixedHeight = true;
-		progressBarBgStyle.height = 17;
-		progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
-		progressBarBgStyle.border.left = 8;
-		progressBarBgStyle.border.right = 8;
-
-		skin->setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
-
-		GUIElementStyle progressBarFillStyle;
-		progressBarFillStyle.fixedHeight = true;
-		progressBarFillStyle.height = 16;
-		progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
-		progressBarFillStyle.border.left = 9;
-		progressBarFillStyle.border.right = 10;
-
-		skin->setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
-
-		GUIElementStyle progressBarStyle;
-		progressBarStyle.fixedHeight = true;
-		progressBarStyle.height = 17;
-		progressBarStyle.minWidth = 100;
-
-		progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
-		progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
-
-		skin->setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
-
-		/************************************************************************/
-		/* 								SLIDER                      			*/
-		/************************************************************************/
-
-		GUIElementStyle sliderHandleStyle;
-		sliderHandleStyle.fixedHeight = true;
-		sliderHandleStyle.fixedWidth = true;
-		sliderHandleStyle.width = 12;
-		sliderHandleStyle.height = 13;
-		sliderHandleStyle.normal.texture = getGUITexture(SliderHandleNormalTex);
-		sliderHandleStyle.hover.texture = getGUITexture(SliderHandleHoverTex);
-		sliderHandleStyle.active.texture = getGUITexture(SliderHandleActiveTex);
-
-		skin->setStyle(GUISlider::getHandleStyleType(), sliderHandleStyle);
-
-		GUIElementStyle sliderHorizontalBgStyle;
-		sliderHorizontalBgStyle.fixedHeight = true;
-		sliderHorizontalBgStyle.height = 10;
-		sliderHorizontalBgStyle.normal.texture = getGUITexture(SliderHBackgroundTex);
-		sliderHorizontalBgStyle.border.left = 4;
-		sliderHorizontalBgStyle.border.right = 4;
-
-		skin->setStyle("SliderHorzBg", sliderHorizontalBgStyle);
-
-		GUIElementStyle sliderHorizontalFillStyle;
-		sliderHorizontalFillStyle.fixedHeight = true;
-		sliderHorizontalFillStyle.height = 10;
-		sliderHorizontalFillStyle.normal.texture = getGUITexture(SliderHFillTex);
-		sliderHorizontalFillStyle.border.left = 6;
-		sliderHorizontalFillStyle.border.right = 4;
-
-		skin->setStyle("SliderHorzFill", sliderHorizontalFillStyle);
-
-		GUIElementStyle sliderHorizontalStyle;
-		sliderHorizontalStyle.fixedHeight = true;
-		sliderHorizontalStyle.height = 13;
-		sliderHorizontalStyle.width = 150;
-		sliderHorizontalStyle.minWidth = 10;
-		sliderHorizontalStyle.subStyles[GUISlider::getHandleStyleType()] = GUISlider::getHandleStyleType();
-		sliderHorizontalStyle.subStyles[GUISlider::getBackgroundStyleType()] = "SliderHorzBg";
-		sliderHorizontalStyle.subStyles[GUISlider::getFillStyleType()] = "SliderHorzFill";
-
-		skin->setStyle(GUISliderHorz::getGUITypeName(), sliderHorizontalStyle);
-
-		GUIElementStyle sliderVerticalBgStyle;
-		sliderVerticalBgStyle.fixedWidth = true;
-		sliderVerticalBgStyle.width = 10;
-		sliderVerticalBgStyle.normal.texture = getGUITexture(SliderVBackgroundTex);
-		sliderVerticalBgStyle.border.top = 4;
-		sliderVerticalBgStyle.border.bottom = 4;
-
-		skin->setStyle("SliderVertBg", sliderVerticalBgStyle);
-
-		GUIElementStyle sliderVerticalFillStyle;
-		sliderVerticalFillStyle.fixedWidth = true;
-		sliderVerticalFillStyle.width = 10;
-		sliderVerticalFillStyle.normal.texture = getGUITexture(SliderVFillTex);
-		sliderVerticalFillStyle.border.top = 6;
-		sliderVerticalFillStyle.border.bottom = 4;
-
-		skin->setStyle("SliderVertFill", sliderVerticalFillStyle);
-
-		GUIElementStyle sliderVerticalStyle;
-		sliderVerticalStyle.fixedWidth = true;
-		sliderVerticalStyle.width = 13;
-		sliderVerticalStyle.height = 150;
-		sliderVerticalStyle.minHeight = 10;
-		sliderVerticalStyle.subStyles[GUISlider::getHandleStyleType()] = GUISlider::getHandleStyleType();
-		sliderVerticalStyle.subStyles[GUISlider::getBackgroundStyleType()] = "SliderVertBg";
-		sliderVerticalStyle.subStyles[GUISlider::getFillStyleType()] = "SliderVertFill";
-
-		skin->setStyle(GUISliderVert::getGUITypeName(), sliderVerticalStyle);
-
-		/************************************************************************/
-		/* 							COLOR PICKER SLIDER                      	*/
-		/************************************************************************/
-
-		GUIElementStyle colorPickerSliderHorzHandleStyle;
-		colorPickerSliderHorzHandleStyle.fixedHeight = true;
-		colorPickerSliderHorzHandleStyle.fixedWidth = true;
-		colorPickerSliderHorzHandleStyle.height = 20;
-		colorPickerSliderHorzHandleStyle.width = 7;
-		colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
-		colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
-		colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
-
-		skin->setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
-
-		GUIElementStyle colorPickerSliderHorzStyle;
-		colorPickerSliderHorzStyle.fixedHeight = true;
-		colorPickerSliderHorzStyle.height = 32;
-		colorPickerSliderHorzStyle.minWidth = 20;
-		colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
-
-		skin->setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
-
-		GUIElementStyle colorPickerSliderVertHandleStyle;
-		colorPickerSliderVertHandleStyle.fixedHeight = true;
-		colorPickerSliderVertHandleStyle.fixedWidth = true;
-		colorPickerSliderVertHandleStyle.height = 7;
-		colorPickerSliderVertHandleStyle.width = 45;
-		colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
-		colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
-		colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
-
-		skin->setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
-
-		GUIElementStyle colorPickerSliderVertStyle;
-		colorPickerSliderVertStyle.fixedWidth = true;
-		colorPickerSliderVertStyle.width = 30;
-		colorPickerSliderVertStyle.minHeight = 20;
-		colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
-
-		skin->setStyle("ColorSliderVert", colorPickerSliderVertStyle);
-
-		GUIElementStyle colorPickerSlider2DHandleStyle;
-		colorPickerSlider2DHandleStyle.fixedHeight = true;
-		colorPickerSlider2DHandleStyle.fixedWidth = true;
-		colorPickerSlider2DHandleStyle.height = 7;
-		colorPickerSlider2DHandleStyle.width = 7;
-		colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
-		colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
-		colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
-
-		skin->setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
-
-		/************************************************************************/
-		/* 								STATUS BAR                      		*/
-		/************************************************************************/
-		GUIElementStyle statusBarBgStyle;
-		statusBarBgStyle.height = 16;
-		statusBarBgStyle.border.top = 2;
-		statusBarBgStyle.normal.texture = getGUITexture(StatusBarBgTex);
-
-		skin->setStyle(GUIStatusBar::getGUIBackgroundTypeName(), statusBarBgStyle);
-
-		GUIElementStyle statusBarMessageBtnStyle;
-		statusBarMessageBtnStyle.font = defaultFont;
-		statusBarMessageBtnStyle.fontSize = DefaultFontSize;
-		statusBarMessageBtnStyle.fixedHeight = true;
-		statusBarMessageBtnStyle.height = 16;
-		statusBarMessageBtnStyle.minWidth = 10;
-		statusBarMessageBtnStyle.textHorzAlign = THA_Left;
-		statusBarMessageBtnStyle.textVertAlign = TVA_Center;
-		statusBarMessageBtnStyle.imagePosition = GUIImagePosition::Left;
-
-		skin->setStyle(GUIStatusBar::getGUIMessageTypeName(), statusBarMessageBtnStyle);
-
-		GUIElementStyle statusBarStyle;
-		statusBarStyle.height = 16;
-
-		statusBarStyle.subStyles[GUIStatusBar::getGUIBackgroundTypeName()] = GUIStatusBar::getGUIBackgroundTypeName();
-		statusBarStyle.subStyles[GUIStatusBar::getGUIMessageTypeName()] = GUIStatusBar::getGUIMessageTypeName();
-
-		skin->setStyle(GUIStatusBar::getGUITypeName(), statusBarStyle);
-
-		/************************************************************************/
-		/* 									OTHER                      			*/
-		/************************************************************************/
-
-		// Centered label
-		GUIElementStyle centeredLabelStyle;
-		centeredLabelStyle.font = defaultFont;
-		centeredLabelStyle.fontSize = DefaultFontSize;
-		centeredLabelStyle.fixedWidth = false;
-		centeredLabelStyle.fixedHeight = true;
-		centeredLabelStyle.height = 11;
-		centeredLabelStyle.minWidth = 10;
-		centeredLabelStyle.textHorzAlign = THA_Center;
-		centeredLabelStyle.normal.textColor = TextNormalColor;
-
-		skin->setStyle("LabelCentered", centeredLabelStyle);
-
-		// Right-aligned label
-		GUIElementStyle rightAlignedLabelStyle;
-		rightAlignedLabelStyle.font = defaultFont;
-		rightAlignedLabelStyle.fontSize = DefaultFontSize;
-		rightAlignedLabelStyle.fixedWidth = false;
-		rightAlignedLabelStyle.fixedHeight = true;
-		rightAlignedLabelStyle.height = 11;
-		rightAlignedLabelStyle.minWidth = 10;
-		rightAlignedLabelStyle.textHorzAlign = THA_Right;
-		rightAlignedLabelStyle.normal.textColor = TextNormalColor;
-
-		skin->setStyle("RightAlignedLabel", rightAlignedLabelStyle);
-
-		// Multi-line label
-		GUIElementStyle multiLinelabelStyle;
-		multiLinelabelStyle.font = defaultFont;
-		multiLinelabelStyle.fontSize = DefaultFontSize;
-		multiLinelabelStyle.fixedWidth = false;
-		multiLinelabelStyle.fixedHeight = true;
-		multiLinelabelStyle.height = 11;
-		multiLinelabelStyle.minWidth = 10;
-		multiLinelabelStyle.wordWrap = true;
-		multiLinelabelStyle.normal.textColor = TextNormalColor;
-
-		skin->setStyle(BuiltinResources::MultiLineLabelStyle, multiLinelabelStyle);
-
-		// Multi-line centered label
-		GUIElementStyle multiLineCenteredLabelStyle;
-		multiLineCenteredLabelStyle.font = defaultFont;
-		multiLineCenteredLabelStyle.fontSize = DefaultFontSize;
-		multiLineCenteredLabelStyle.fixedWidth = false;
-		multiLineCenteredLabelStyle.fixedHeight = true;
-		multiLineCenteredLabelStyle.height = 11;
-		multiLineCenteredLabelStyle.minWidth = 10;
-		multiLineCenteredLabelStyle.wordWrap = true;
-		multiLineCenteredLabelStyle.textHorzAlign = THA_Center;
-		multiLineCenteredLabelStyle.normal.textColor = TextNormalColor;
-
-		skin->setStyle("MultiLineLabelCentered", multiLineCenteredLabelStyle);
-
-		// Title label
-		GUIElementStyle titleLabel;
-		titleLabel.font = defaultAAFont;
-		titleLabel.fontSize = TitleFontSize;
-		titleLabel.fixedWidth = false;
-		titleLabel.fixedHeight = true;
-		titleLabel.height = 20;
-		titleLabel.minWidth = 10;
-		titleLabel.wordWrap = true;
-		titleLabel.textHorzAlign = THA_Center;
-		titleLabel.normal.textColor = TextNormalColor;
-
-		skin->setStyle("TitleLabel", titleLabel);
-
-		// Selection area
-		GUIElementStyle selectionAreaStyle;
-		selectionAreaStyle.normal.texture = getGUITexture(SelectionAreaTex);
-		selectionAreaStyle.border.left = 1;
-		selectionAreaStyle.border.right = 1;
-		selectionAreaStyle.border.top = 1;
-		selectionAreaStyle.border.bottom = 1;
-
-		skin->setStyle("SelectionArea", selectionAreaStyle);
-
-		// Selectable label
-		GUIElementStyle selectableLabelStyle;
-		selectableLabelStyle.normalOn.texture = getGUITexture(SelectionBgTex);
-		selectableLabelStyle.hoverOn.texture = selectableLabelStyle.normalOn.texture;
-		selectableLabelStyle.activeOn.texture = selectableLabelStyle.normalOn.texture;
-		selectableLabelStyle.fixedHeight = true;
-		selectableLabelStyle.height = 11;
-		selectableLabelStyle.minWidth = 10;
-		selectableLabelStyle.font = defaultFont;
-		selectableLabelStyle.fontSize = DefaultFontSize;
-		selectableLabelStyle.textHorzAlign = THA_Left;
-		selectableLabelStyle.normal.textColor = TextNormalColor;
-
-		skin->setStyle("SelectableLabel", selectableLabelStyle);
-
-		// Scroll area background
-		GUIElementStyle scrollAreaBg;
-		scrollAreaBg.normal.texture = getGUITexture(ScrollAreaBgTex);
-		scrollAreaBg.minHeight = 6;
-		scrollAreaBg.minWidth = 4;
-		scrollAreaBg.border.left = 2;
-		scrollAreaBg.border.right = 2;
-		scrollAreaBg.border.top = 2;
-		scrollAreaBg.border.bottom = 4;
-		
-		skin->setStyle("ScrollAreaBg", scrollAreaBg);
-
-		// Inspector title area background
-		GUIElementStyle inspectorTitleBg;
-		inspectorTitleBg.normal.texture = getGUITexture(InspectorTitleBgTex);
-		inspectorTitleBg.minHeight = 4;
-		inspectorTitleBg.border.bottom = 2;
-
-		skin->setStyle("InspectorTitleBg", inspectorTitleBg);
-
-		// Inspector content background
-		GUIElementStyle inspectorContentBg;
-		inspectorContentBg.normal.texture = getGUITexture(InspectorContentBgTex);
-		inspectorContentBg.minWidth = 4;
-		inspectorContentBg.minHeight = 6;
-		inspectorContentBg.border.left = 2;
-		inspectorContentBg.border.right = 2;
-		inspectorContentBg.border.top = 2;
-		inspectorContentBg.border.bottom = 4;
-
-		skin->setStyle("InspectorContentBg", inspectorContentBg);
-
-		// Inspector content alternate background
-		GUIElementStyle inspectorContentBgAlternate;
-		inspectorContentBgAlternate.normal.texture = getGUITexture(InspectorContentBgAlternateTex);
-		inspectorContentBgAlternate.minWidth = 4;
-		inspectorContentBgAlternate.minHeight = 6;
-		inspectorContentBgAlternate.border.left = 2;
-		inspectorContentBgAlternate.border.right = 2;
-		inspectorContentBgAlternate.border.top = 2;
-		inspectorContentBgAlternate.border.bottom = 4;
-
-		skin->setStyle("InspectorContentBgAlternate", inspectorContentBgAlternate);
-
-		return skin;
-	}
-
-	HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name) const
-	{
-		Path texturePath = FileSystem::getWorkingDirectoryPath();
-		texturePath.append(EditorSkinFolder);
-		texturePath.append(L"sprite_" + name + L".asset");
-
-		return gResources().load<SpriteTexture>(texturePath);
-	}
-
-	HSpriteTexture BuiltinEditorResources::getGUIIcon(const WString& name) const
-	{
-		Path texturePath = FileSystem::getWorkingDirectoryPath();
-		texturePath.append(EditorIconFolder);
-		texturePath.append(L"sprite_" + name + L".asset");
-
-		return gResources().load<SpriteTexture>(texturePath);
-	}
-
-	HShader BuiltinEditorResources::getShader(const WString& name) const
-	{
-		Path programPath = EditorShaderFolder;
-		programPath.append(name + L".asset");
-
-		return gResources().load<Shader>(programPath);
-	}
-
-	HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
-	{
-		return Material::create(mShaderDockOverlay);
-	}
-
-	HMaterial BuiltinEditorResources::createSceneGridMaterial() const
-	{
-		return Material::create(mShaderSceneGrid);
-	}
-
-	HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
-	{
-		UINT32 modeIdx = (UINT32)cullMode;
-
-		return Material::create(mShaderPicking[modeIdx]);
-	}
-
-	HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
-	{
-		UINT32 modeIdx = (UINT32)cullMode;
-
-		return Material::create(mShaderPickingAlpha[modeIdx]);
-	}
-
-	HMaterial BuiltinEditorResources::createWireGizmoMat() const
-	{
-		return Material::create(mShaderGizmoWire);
-	}
-
-	HMaterial BuiltinEditorResources::createSolidGizmoMat() const
-	{
-		return Material::create(mShaderGizmoSolid);
-	}
-
-	HMaterial BuiltinEditorResources::createIconGizmoMat() const
-	{
-		return Material::create(mShaderGizmoIcon);
-	}
-
-	HMaterial BuiltinEditorResources::createGizmoPickingMat() const
-	{
-		return Material::create(mShaderGizmoPicking);
-	}
-
-	HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
-	{
-		return Material::create(mShaderGizmoAlphaPicking);
-	}
-
-	HMaterial BuiltinEditorResources::createWireHandleMat() const
-	{
-		return Material::create(mShaderHandleWire);
-	}
-
-	HMaterial BuiltinEditorResources::createTextGizmoMat() const
-	{
-		return Material::create(mShaderGizmoText);
-	}
-
-	HMaterial BuiltinEditorResources::createSolidHandleMat() const
-	{
-		return Material::create(mShaderHandleSolid);
-	}
-
-	HMaterial BuiltinEditorResources::createHandleClearAlphaMat() const
-	{
-		return Material::create(mShaderHandleClearAlpha);
-	}
-
-	HMaterial BuiltinEditorResources::createSelectionMat() const
-	{
-		return Material::create(mShaderSelection);
-	}
-
-	HSpriteTexture BuiltinEditorResources::getLibraryIcon(ProjectIcon icon, int size) const
-	{
-		WString iconName;
-
-		switch (icon)
-		{
-		case ProjectIcon::Folder:
-			iconName = FolderIconTex;
-			break;
-		case ProjectIcon::Font:
-			iconName = FontIconTex;
-			break;
-		case ProjectIcon::Mesh:
-			iconName = MeshIconTex;
-			break;
-		case ProjectIcon::Texture:
-			iconName = TextureIconTex;
-			break;
-		case ProjectIcon::PlainText:
-			iconName = PlainTextIconTex;
-			break;
-		case ProjectIcon::ScriptCode:
-			iconName = ScriptCodeIconTex;
-			break;
-		case ProjectIcon::Shader:
-			iconName = ShaderIconTex;
-			break;
-		case ProjectIcon::ShaderInclude:
-			iconName = ShaderIncludeIconTex;
-			break;
-		case ProjectIcon::Material:
-			iconName = MaterialIconTex;
-			break;
-		case ProjectIcon::SpriteTexture:
-			iconName = SpriteTextureIconTex;
-			break;
-		case ProjectIcon::Prefab:
-			iconName = PrefabIconTex;
-			break;
-		case ProjectIcon::GUISkin:
-			iconName = GUISkinIconTex;
-			break;
-		case ProjectIcon::PhysicsMaterial:
-			iconName = PhysicsMaterialIconTex;
-			break;
-		case ProjectIcon::PhysicsMesh:
-			iconName = PhysicsMeshIconTex;
-			break;
-		}
-
-		if (iconName.empty())
-			return HSpriteTexture();
-
-		if (size <= 16)
-			iconName += L"16";
-		else if (size <= 32)
-			iconName += L"32";
-		else if (size <= 48)
-			iconName += L"48";
-
-		return getGUIIcon(iconName);
-	}
-
-	HSpriteTexture BuiltinEditorResources::getToolbarIcon(ToolbarIcon icon) const
-	{
-		switch (icon)
-		{
-		case ToolbarIcon::NewCamera:
-			return getGUIIcon(L"ToolbarNewCameraIcon.png");
-		case ToolbarIcon::NewRenderable:
-			return getGUIIcon(L"ToolbarNewRenderableIcon.png");
-		case ToolbarIcon::NewPointLight:
-			return getGUIIcon(L"ToolbarNewPointLightIcon.png");
-		case ToolbarIcon::NewDirLight:
-			return getGUIIcon(L"ToolbarNewDirectionalLightIcon.png");
-		case ToolbarIcon::NewSpotLight:
-			return getGUIIcon(L"ToolbarNewSpotLightIcon.png");
-		case ToolbarIcon::NewSceneObject:
-			return getGUIIcon(L"ToolbarNewSceneObjectIcon.png");
-		case ToolbarIcon::NewCube:
-			return getGUIIcon(L"ToolbarNewCubeIcon.png");
-		case ToolbarIcon::NewSphere:
-			return getGUIIcon(L"ToolbarNewSphereIcon.png");
-		case ToolbarIcon::NewCone:
-			return getGUIIcon(L"ToolbarNewConeIcon.png");
-		case ToolbarIcon::NewQuad:
-			return getGUIIcon(L"ToolbarNewQuadIcon.png");
-		case ToolbarIcon::NewMat:
-			return getGUIIcon(L"ToolbarNewMaterialIcon.png");
-		case ToolbarIcon::NewCSScript:
-			return getGUIIcon(L"ToolbarNewCSScriptIcon.png");
-		case ToolbarIcon::NewShader:
-			return getGUIIcon(L"ToolbarNewShaderIcon.png");
-		case ToolbarIcon::NewSpriteTex:
-			return getGUIIcon(L"ToolbarNewSpriteTextureIcon.png");
-		case ToolbarIcon::Pause:
-			return getGUIIcon(L"ToolbarPauseIcon.png");
-		case ToolbarIcon::Play:
-			return getGUIIcon(L"ToolbarPlayIcon.png");
-		case ToolbarIcon::Step:
-			return getGUIIcon(L"ToolbarStepIcon.png");
-		case ToolbarIcon::Undo:
-			return getGUIIcon(L"ToolbarUndoIcon.png");
-		case ToolbarIcon::Redo:
-			return getGUIIcon(L"ToolbarRedoIcon.png");
-		case ToolbarIcon::OpenProject:
-			return getGUIIcon(L"ToolbarOpenProjectIcon.png");
-		case ToolbarIcon::SaveProject:
-			return getGUIIcon(L"ToolbarSaveProjectIcon.png");
-		case ToolbarIcon::SaveScene:
-			return getGUIIcon(L"ToolbarSaveSceneIcon.png");
-		}
-
-		return HSpriteTexture();
-	}
-
-	GUIContentImages BuiltinEditorResources::getSceneWindowIcon(SceneWindowIcon icon) const
-	{
-		HSpriteTexture off;
-		HSpriteTexture on;
-
-		switch (icon)
-		{
-		case SceneWindowIcon::View:
-			off = getGUIIcon(L"SceneViewIcon.png");
-			on = getGUIIcon(L"SceneViewIconOn.png");
-			break;
-		case SceneWindowIcon::Move:
-			off = getGUIIcon(L"SceneMoveIcon.png");
-			on = getGUIIcon(L"SceneMoveIconOn.png");
-			break;
-		case SceneWindowIcon::Rotate:
-			off = getGUIIcon(L"SceneRotateIcon.png");
-			on = getGUIIcon(L"SceneRotateIconOn.png");
-			break;
-		case SceneWindowIcon::Scale:
-			off = getGUIIcon(L"SceneScaleIcon.png");
-			on = getGUIIcon(L"SceneScaleIconOn.png");
-			break;
-		case SceneWindowIcon::Pivot:
-			off = getGUIIcon(L"ScenePivotIcon.png");
-			on = getGUIIcon(L"ScenePivotIconOn.png");
-			break;
-		case SceneWindowIcon::Center:
-			off = getGUIIcon(L"SceneCenterIcon.png");
-			on = getGUIIcon(L"SceneCenterIconOn.png");
-			break;
-		case SceneWindowIcon::Local:
-			off = getGUIIcon(L"SceneLocalIcon.png");
-			on = getGUIIcon(L"SceneLocalIconOn.png");
-			break;
-		case SceneWindowIcon::World:
-			off = getGUIIcon(L"SceneWorldIcon.png");
-			on = getGUIIcon(L"SceneWorldIconOn.png");
-			break;
-		case SceneWindowIcon::MoveSnap:
-			off = getGUIIcon(L"SceneMoveSnapIcon.png");
-			on = getGUIIcon(L"SceneMoveSnapIconOn.png");
-			break;
-		case SceneWindowIcon::RotateSnap:
-			off = getGUIIcon(L"SceneRotateSnapIcon.png");
-			on = getGUIIcon(L"SceneRotateSnapIconOn.png");
-			break;
-		}
-
-		GUIContentImages output;
-		output.normal = off;
-		output.hover = off;
-		output.active = on;
-		output.focused = off;
-		output.normalOn = on;
-		output.hoverOn = on;
-		output.activeOn = on;
-		output.focusedOn = on;
-
-		return output;
-	}
-
-	HSpriteTexture BuiltinEditorResources::getLibraryWindowIcon(LibraryWindowIcon icon) const
-	{
-		switch (icon)
-		{
-		case LibraryWindowIcon::Home:
-			return getGUIIcon(L"LibraryHomeIcon.png");
-		case LibraryWindowIcon::Up:
-			return getGUIIcon(L"LibraryUpIcon.png");
-		case LibraryWindowIcon::Clear:
-			return getGUIIcon(L"LibraryClearSearchIcon.png");
-		case LibraryWindowIcon::Options:
-			return getGUIIcon(L"LibraryOptionsIcon.png");
-		}
-
-		return HSpriteTexture();
-	}
-
-	HSpriteTexture BuiltinEditorResources::getInspectorWindowIcon(InspectorWindowIcon icon) const
-	{
-		switch (icon)
-		{
-		case InspectorWindowIcon::Create:
-			return getGUIIcon(L"InspectorCreateIcon.png");
-		case InspectorWindowIcon::Clone:
-			return getGUIIcon(L"InspectorCloneIcon.png");
-		case InspectorWindowIcon::Clear:
-			return getGUIIcon(L"InspectorClearIcon.png");
-		case InspectorWindowIcon::Resize:
-			return getGUIIcon(L"InspectorResizeIcon.png");
-		case InspectorWindowIcon::Delete:
-			return getGUIIcon(L"InspectorDeleteIcon.png");
-		case InspectorWindowIcon::MoveUp:
-			return getGUIIcon(L"InspectorMoveUpIcon.png");
-		case InspectorWindowIcon::MoveDown:
-			return getGUIIcon(L"InspectorMoveDownIcon.png");
-		case InspectorWindowIcon::Edit:
-			return getGUIIcon(L"InspectorEditIcon.png");
-		case InspectorWindowIcon::Apply:
-			return getGUIIcon(L"InspectorApplyIcon.png");
-		case InspectorWindowIcon::Add:
-			return getGUIIcon(L"InspectorAddIcon.png");
-		case InspectorWindowIcon::Cancel:
-			return getGUIIcon(L"InspectorCancelIcon.png");
-		}
-
-		return HSpriteTexture();
-	}
-
-	HSpriteTexture BuiltinEditorResources::getIcon(EditorIcon icon) const
-	{
-		switch (icon)
-		{
-		case EditorIcon::XBtn:
-			return getGUIIcon(XButtonNormalTex);
-		}
-
-		return HSpriteTexture();
-	}
-
-	HSpriteTexture BuiltinEditorResources::getLogMessageIcon(LogMessageIcon icon, UINT32 size, bool dark) const
-	{
-		if (size < 24) // Round to 16
-		{
-			if (dark)
-			{
-				switch (icon)
-				{
-				case LogMessageIcon::Info:
-					return getGUIIcon(L"IconInfoDark.png");
-				case LogMessageIcon::Warning:
-					return getGUIIcon(L"IconWarningDark.png");
-				case LogMessageIcon::Error:
-					return getGUIIcon(L"IconErrorDark.png");
-				}
-			}
-			else
-			{
-				switch (icon)
-				{
-				case LogMessageIcon::Info:
-					return getGUIIcon(L"IconInfo.png");
-				case LogMessageIcon::Warning:
-					return getGUIIcon(L"IconWarning.png");
-				case LogMessageIcon::Error:
-					return getGUIIcon(L"IconError.png");
-				}
-			}
-		}
-		else // Round to 32
-		{
-			switch (icon)
-			{
-			case LogMessageIcon::Info:
-				return getGUIIcon(L"IconInfo32.png");
-			case LogMessageIcon::Warning:
-				return getGUIIcon(L"IconWarning32.png");
-			case LogMessageIcon::Error:
-				return getGUIIcon(L"IconError32.png");
-			}
-		}
-
-		return HSpriteTexture();
-	}
-
-	WString BuiltinEditorResources::getEmptyShaderCode() const
-	{
-		Path filePath = FileSystem::getWorkingDirectoryPath();
-		filePath.append(BuiltinDataFolder);
-		filePath.append(EmptyShaderCodeFile);
-
-		DataStreamPtr fileStream = FileSystem::openFile(filePath);
-		if (fileStream != nullptr)
-			return fileStream->getAsWString();
-
-		return StringUtil::WBLANK;
-	}
-
-	WString BuiltinEditorResources::getEmptyCSScriptCode() const
-	{
-		Path filePath = FileSystem::getWorkingDirectoryPath();
-		filePath.append(BuiltinDataFolder);
-		filePath.append(EmptyCSScriptCodeFile);
-
-		DataStreamPtr fileStream = FileSystem::openFile(filePath);
-		if (fileStream != nullptr)
-			return fileStream->getAsWString();
-
-		return StringUtil::WBLANK;
-	}
-
-	Path BuiltinEditorResources::getShaderIncludeFolder()
-	{
-		return Paths::getRuntimeDataPath() + EDITOR_DATA_FOLDER + ShaderIncludeFolder;
-	}
-
-	Path BuiltinEditorResources::getDefaultWidgetLayoutPath()
-	{
-		return Paths::getRuntimeDataPath() + EDITOR_DATA_FOLDER + "Layout.asset";
-	}
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsBuiltinEditorResources.h"
+#include "BsBuiltinResources.h"
+#include "BsGUIElementStyle.h"
+#include "BsGUILabel.h"
+#include "BsGUITexture.h"
+#include "BsGUIButton.h"
+#include "BsGUIInputBox.h"
+#include "BsGUIToggle.h"
+#include "BsGUIColor.h"
+#include "BsTextSprite.h"
+#include "BsSpriteTexture.h"
+#include "BsGUITreeViewEditBox.h"
+#include "BsGUIIntField.h"
+#include "BsGUIFloatField.h"
+#include "BsGUIColorField.h"
+#include "BsGUITextField.h"
+#include "BsGUIToggleField.h"
+#include "BsGUIVector2Field.h"
+#include "BsGUIVector3Field.h"
+#include "BsGUIVector4Field.h"
+#include "BsGUIListBoxField.h"
+#include "BsGUISliderField.h"
+#include "BsGUIProgressBar.h"
+#include "BsGUISlider.h"
+#include "BsGUIDropDownContent.h"
+#include "BsGUIStatusBar.h"
+#include "BsGUIMenuBar.h"
+#include "BsGUIListBox.h"
+#include "BsCoreThread.h"
+#include "BsFont.h"
+#include "BsTexture.h"
+#include "BsShader.h"
+#include "BsMaterial.h"
+#include "BsResources.h"
+#include "BsFileSystem.h"
+#include "BsResourceManifest.h"
+#include "BsDataStream.h"
+#include "BsGUITooltip.h"
+
+namespace BansheeEngine
+{
+	static const Path EDITOR_DATA_FOLDER = "Editor\\";
+
+	const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
+	const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
+	const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
+	const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
+
+	const String BuiltinEditorResources::TextureFieldStyleName = "GUITextureField";
+	const String BuiltinEditorResources::TextureFieldLabelStyleName = "TextureFieldLabel";
+	const String BuiltinEditorResources::TextureFieldDropStyleName = "TextureDrop";
+	const String BuiltinEditorResources::TextureFieldClearBtnStyleName = "TextureClearButton";
+
+	const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
+	const WString BuiltinEditorResources::DefaultAAFontFilename = L"arialAA.ttf";
+	const UINT32 BuiltinEditorResources::DefaultFontSize = 8;
+	const UINT32 BuiltinEditorResources::TitleFontSize = 16;
+
+	const Color BuiltinEditorResources::TextNormalColor = Color(0.7f, 0.7f, 0.7f);
+	const Color BuiltinEditorResources::TextActiveColor = Color(0.0f, 0.0f, 0.0f);
+
+	const WString BuiltinEditorResources::GUISkinFile = L"GUISkin";
+
+	const char* BuiltinEditorResources::ShaderFolder = "Shaders\\";
+	const char* BuiltinEditorResources::SkinFolder = "Skin\\";
+	const char* BuiltinEditorResources::IconFolder = "Skin\\Icons";
+	const char* BuiltinEditorResources::ShaderIncludeFolder = "Includes\\";
+
+	const WString BuiltinEditorResources::FolderIconTex = L"FolderIcon.psd";
+	const WString BuiltinEditorResources::MeshIconTex = L"MeshIcon.psd";
+	const WString BuiltinEditorResources::TextureIconTex = L"TextureIcon.psd";
+	const WString BuiltinEditorResources::FontIconTex = L"FontIcon.psd";
+	const WString BuiltinEditorResources::PlainTextIconTex = L"TextIcon.psd";
+	const WString BuiltinEditorResources::ScriptCodeIconTex = L"CSharpIcon.psd";
+	const WString BuiltinEditorResources::ShaderIconTex = L"ShaderIcon.psd";
+	const WString BuiltinEditorResources::ShaderIncludeIconTex = L"ShaderIncludeIcon.psd";
+	const WString BuiltinEditorResources::MaterialIconTex = L"MaterialIcon.psd";
+	const WString BuiltinEditorResources::SpriteTextureIconTex = L"SpriteIcon.psd";
+	const WString BuiltinEditorResources::PrefabIconTex = L"PrefabIcon.psd";
+	const WString BuiltinEditorResources::GUISkinIconTex = L"GUISkinIcon.psd";
+	const WString BuiltinEditorResources::PhysicsMaterialIconTex = L"PhysicsMaterialIcon.psd";
+	const WString BuiltinEditorResources::PhysicsMeshIconTex = L"PhysicsMeshIcon.psd";
+
+	const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.png";
+	const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.png";
+	const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.png";
+
+	const WString BuiltinEditorResources::ButtonLeftNormalTex = L"ButtonLeftNormal.png";
+	const WString BuiltinEditorResources::ButtonLeftHoverTex = L"ButtonLeftHover.png";
+	const WString BuiltinEditorResources::ButtonLeftActiveTex = L"ButtonLeftActive.png";
+
+	const WString BuiltinEditorResources::ButtonRightNormalTex = L"ButtonRightNormal.png";
+	const WString BuiltinEditorResources::ButtonRightHoverTex = L"ButtonRightHover.png";
+	const WString BuiltinEditorResources::ButtonRightActiveTex = L"ButtonRightActive.png";
+
+	const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.png";
+	const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.png";
+	const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleNormalOn.png";
+	const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleHoverOn.png";
+
+	const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.png";
+	const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.png";
+	const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxActive.png";
+
+	const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectDropNormal.png";
+	const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectDropNormalOn.png";
+	const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectDropClearNormal.png";
+	const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectDropClearHover.png";
+	const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectDropClearActive.png";
+	
+	const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownButtonNormal.png";
+	const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownButtonHover.png";
+	const WString BuiltinEditorResources::DropDownBtnActiveTex = L"DropDownButtonActive.png";
+
+	const WString BuiltinEditorResources::SliderHBackgroundTex = L"SliderHBackground.png";
+	const WString BuiltinEditorResources::SliderHFillTex = L"SliderHFill.png";
+	const WString BuiltinEditorResources::SliderVBackgroundTex = L"SliderVBackground.png";
+	const WString BuiltinEditorResources::SliderVFillTex = L"SliderVFill.png";
+	const WString BuiltinEditorResources::SliderHandleNormalTex = L"SliderHandleNormal.png";
+	const WString BuiltinEditorResources::SliderHandleHoverTex = L"SliderHandleHover.png";
+	const WString BuiltinEditorResources::SliderHandleActiveTex = L"SliderHandleActive.png";
+
+	const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutNormalOn.png";
+	const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutHoverOn.png";
+	const WString BuiltinEditorResources::FoldoutOpenActiveTex = L"FoldoutHoverOn.png";
+	const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutNormalOff.png";
+	const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutHoverOff.png";
+	const WString BuiltinEditorResources::FoldoutClosedActiveTex = L"FoldoutHoverOff.png";
+
+	const WString BuiltinEditorResources::WindowBackgroundTex = L"WindowBackground.png";
+
+	const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.png";
+	const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.png";
+
+	const WString BuiltinEditorResources::CloseButtonNormalTex = L"CloseButtonNormal.png";
+	const WString BuiltinEditorResources::CloseButtonHoverTex = L"CloseButtonHover.png";
+	const WString BuiltinEditorResources::CloseButtonActiveTex = L"CloseButtonActive.png";
+
+	const WString BuiltinEditorResources::MinButtonNormalTex = L"MinimizeButtonNormal.png"; 
+	const WString BuiltinEditorResources::MinButtonHoverTex = L"MinimizeButtonHover.png"; 
+	const WString BuiltinEditorResources::MinButtonActiveTex = L"MinimizeButtonActive.png";
+
+	const WString BuiltinEditorResources::MaxButtonNormalTex = L"MaximizeButtonNormal.png";
+	const WString BuiltinEditorResources::MaxButtonHoverTex = L"MaximizeButtonHover.png";
+	const WString BuiltinEditorResources::MaxButtonActiveTex = L"MaximizeButtonActive.png";
+
+	const WString BuiltinEditorResources::TabBarBackgroundTex = L"TabBarBackground.png";
+	const WString BuiltinEditorResources::TitleBarBackgroundTex = L"TitleBarBackground.png";
+
+	const WString BuiltinEditorResources::TabButtonNormalTex = L"TabButtonNormal.png";
+	const WString BuiltinEditorResources::TabButtonFocusedTex = L"TabButtonFocused.png";
+
+	const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollArrowUpNormal.png";
+	const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollArrowUpHover.png";
+	const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollArrowUpActive.png";
+
+	const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollArrowDownNormal.png";
+	const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollArrowDownHover.png";
+	const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollArrowDownActive.png";
+
+	const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollArrowLeftNormal.png";
+	const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollArrowLeftHover.png";
+	const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollArrowLeftActive.png";
+
+	const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollArrowRightNormal.png";
+	const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollArrowRightHover.png";
+	const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollArrowRightActive.png";
+
+	const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHHandleNormal.png";
+	const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHHandleHover.png";
+	const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHHandleActive.png";
+
+	const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVHandleNormal.png";
+	const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVHandleHover.png";
+	const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVHandleActive.png";
+
+	const WString BuiltinEditorResources::ScrollBarHBgTex = L"ScrollBarHBackground.png";
+	const WString BuiltinEditorResources::ScrollBarVBgTex = L"ScrollBarVBackground.png";
+
+	const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.png";
+	const WString BuiltinEditorResources::DropDownBoxSideBgTex = L"DropDownBoxSideBg.png";
+	const WString BuiltinEditorResources::DropDownBoxHandleTex = L"DropDownBoxScrollHandle.png";
+
+	const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownBoxEntryNormal.png";
+	const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownBoxEntryHover.png";
+
+	const WString BuiltinEditorResources::DropDownBoxEntryToggleNormalTex = L"DropDownBoxEntryToggleNormal.png";
+	const WString BuiltinEditorResources::DropDownBoxEntryToggleHoverTex = L"DropDownBoxEntryToggleHover.png";
+	const WString BuiltinEditorResources::DropDownBoxEntryToggleNormalOnTex = L"DropDownBoxEntryToggleNormalOn.png";
+	const WString BuiltinEditorResources::DropDownBoxEntryToggleHoverOnTex = L"DropDownBoxEntryToggleHoverOn.png";
+
+	const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxArrowUpNormal.png";
+	const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxArrowUpHover.png";
+
+	const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxArrowDownNormal.png";
+	const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxArrowDownHover.png";
+
+	const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownBoxExpandBtnNormal.png";
+	const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownBoxExpandBtnHover.png";
+
+	const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownBoxSeparator.png";
+
+	const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBackground.png";
+	const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarLog.png";
+
+	const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.png";
+	const WString BuiltinEditorResources::MenuBarBtnActiveTex = L"MenuBarButtonActive.png";
+	const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.png";
+
+	const WString BuiltinEditorResources::MenuBarLineNormalTex = L"MenuBarLineNormal.png";
+	const WString BuiltinEditorResources::MenuBarLineActiveTex = L"MenuBarLineActive.png";
+
+	const WString BuiltinEditorResources::ToolBarBtnNormalTex = L"ToolBarButtonNormal.png";
+	const WString BuiltinEditorResources::ToolBarBtnHoverTex = L"ToolBarButtonHover.png";
+	const WString BuiltinEditorResources::ToolBarBtnActiveTex = L"ToolBarButtonActive.png";
+
+	const WString BuiltinEditorResources::ToolBarSeparatorTex = L"ToolBarSeparator.png";
+
+	const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderNormal.png";
+
+	const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"ExpandArrowNormalOff.png";
+	const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"ExpandArrowHoverOff.png";
+	const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"ExpandArrowNormalOn.png";
+	const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"ExpandArrowHoverOn.png";
+
+	const WString BuiltinEditorResources::TreeViewHighlightBackground = L"TreeViewHighlightBackground.psd";
+	const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
+	const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
+	const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
+
+	const WString BuiltinEditorResources::ColorPickerSliderHorzHandleTex = L"ColorPickerSliderHorzHandle.psd";
+	const WString BuiltinEditorResources::ColorPickerSliderVertHandleTex = L"ColorPickerSliderVertHandle.psd";
+	const WString BuiltinEditorResources::ColorPickerSlider2DHandleTex = L"ColorPicker2DHandle.psd";
+
+	const WString BuiltinEditorResources::ProgressBarFillTex = L"ProgressBarFill.png";
+	const WString BuiltinEditorResources::ProgressBarBgTex = L"ProgressBarBg.png";
+
+	const WString BuiltinEditorResources::SelectionAreaTex = L"SelectionHighlight.png";
+	const WString BuiltinEditorResources::SelectionBgTex = L"SelectionBg.psd";
+
+	const WString BuiltinEditorResources::TextureDropTex = L"TextureDrop.png";
+	const WString BuiltinEditorResources::TextureDropOnTex = L"TextureDropHover.png";
+
+	const WString BuiltinEditorResources::XButtonNormalTex = L"XBtnNormal.png";
+	const WString BuiltinEditorResources::XButtonHoverTex = L"XBtnHover.png";
+	const WString BuiltinEditorResources::XButtonActiveTex = L"XBtnActive.png";
+
+	const WString BuiltinEditorResources::StatusBarBgTex = L"StatusBarBackground.png";
+	const WString BuiltinEditorResources::ScrollAreaBgTex = L"ScrollAreaBg.png";
+
+	const WString BuiltinEditorResources::InspectorTitleBgTex = L"InspectorTitleBg.png";
+	const WString BuiltinEditorResources::InspectorContentBgTex = L"InspectorContentBg.png";
+	const WString BuiltinEditorResources::InspectorContentBgAlternateTex = L"InspectorContentBgAlternate.png";
+
+	/************************************************************************/
+	/* 									SHADERS                      		*/
+	/************************************************************************/
+
+	const WString BuiltinEditorResources::ShaderDockOverlayFile = L"DockDropOverlay.bsl";
+	const WString BuiltinEditorResources::ShaderSceneGridFile = L"SceneGrid.bsl";
+	const WString BuiltinEditorResources::ShaderPickingCullNoneFile = L"PickingCullNone.bsl";
+	const WString BuiltinEditorResources::ShaderPickingCullCWFile = L"PickingCullCW.bsl";
+	const WString BuiltinEditorResources::ShaderPickingCullCCWFile = L"PickingCullCCW.bsl";
+	const WString BuiltinEditorResources::ShaderPickingAlphaCullNoneFile = L"PickingAlphaCullNone.bsl";
+	const WString BuiltinEditorResources::ShaderPickingAlphaCullCWFile = L"PickingAlphaCullCW.bsl";
+	const WString BuiltinEditorResources::ShaderPickingAlphaCullCCWFile = L"PickingAlphaCullCCW.bsl";
+	const WString BuiltinEditorResources::ShaderWireGizmoFile = L"WireGizmo.bsl";
+	const WString BuiltinEditorResources::ShaderSolidGizmoFile = L"SolidGizmo.bsl";
+	const WString BuiltinEditorResources::ShaderWireHandleFile = L"WireHandle.bsl";
+	const WString BuiltinEditorResources::ShaderSolidHandleFile = L"SolidHandle.bsl";
+	const WString BuiltinEditorResources::ShaderHandleClearAlphaFile = L"ClearHandleAlpha.bsl";
+	const WString BuiltinEditorResources::ShaderIconGizmoFile = L"IconGizmo.bsl";
+	const WString BuiltinEditorResources::ShaderGizmoPickingFile = L"GizmoPicking.bsl";
+	const WString BuiltinEditorResources::ShaderGizmoPickingAlphaFile = L"GizmoPickingAlpha.bsl";
+	const WString BuiltinEditorResources::ShaderTextGizmoFile = L"TextGizmo.bsl";
+	const WString BuiltinEditorResources::ShaderSelectionFile = L"Selection.bsl";
+
+	/************************************************************************/
+	/* 								OTHER							  		*/
+	/************************************************************************/
+	const WString BuiltinEditorResources::EmptyShaderCodeFile = L"EmptyShaderText.txt";
+	const WString BuiltinEditorResources::EmptyCSScriptCodeFile = L"EmptyCSScriptText.txt";
+
+	BuiltinEditorResources::BuiltinEditorResources()
+	{
+		// Set up paths
+		BuiltinRawDataFolder = Paths::getRuntimeDataPath() + L"Raw\\Editor\\";
+		EditorRawSkinFolder = BuiltinRawDataFolder + SkinFolder;
+		EditorRawShaderFolder = BuiltinRawDataFolder + ShaderFolder;
+		EditorRawShaderIncludeFolder = BuiltinRawDataFolder + ShaderIncludeFolder;
+
+		BuiltinDataFolder = Paths::getRuntimeDataPath() + EDITOR_DATA_FOLDER;
+		EditorSkinFolder = BuiltinDataFolder + SkinFolder;
+		EditorIconFolder = BuiltinDataFolder + IconFolder;
+		EditorShaderFolder = BuiltinDataFolder + ShaderFolder;
+		EditorShaderIncludeFolder = BuiltinDataFolder + ShaderIncludeFolder;
+
+		ResourceManifestPath = BuiltinDataFolder + "ResourceManifest.asset";
+
+		Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
+		absoluteDataPath.append(BuiltinDataFolder);
+
+		// Update from raw assets if needed
+#if BS_DEBUG_MODE
+		if (BuiltinResourcesHelper::checkForModifications(BuiltinRawDataFolder, BuiltinDataFolder + L"Timestamp.asset"))
+		{
+			mResourceManifest = ResourceManifest::create("BuiltinResources");
+			gResources().registerResourceManifest(mResourceManifest);
+
+			preprocess();
+			BuiltinResourcesHelper::writeTimestamp(BuiltinDataFolder + L"Timestamp.asset");
+
+			Path absoluteDataPath = FileSystem::getWorkingDirectoryPath();
+			absoluteDataPath.append(BuiltinDataFolder);
+
+			ResourceManifest::save(mResourceManifest, ResourceManifestPath, absoluteDataPath);
+		}
+#endif
+
+		// Load manifest
+		if (mResourceManifest == nullptr)
+		{
+			if (FileSystem::exists(ResourceManifestPath))
+				mResourceManifest = ResourceManifest::load(ResourceManifestPath, absoluteDataPath);
+
+			if (mResourceManifest == nullptr)
+				mResourceManifest = ResourceManifest::create("BuiltinResources");
+
+			gResources().registerResourceManifest(mResourceManifest);
+		}
+
+		// Load basic resources
+		mShaderDockOverlay = getShader(ShaderDockOverlayFile);
+		mShaderSceneGrid = getShader(ShaderSceneGridFile);
+		mShaderPicking[(int)CULL_NONE] = getShader(ShaderPickingCullNoneFile);
+		mShaderPicking[(int)CULL_CLOCKWISE] = getShader(ShaderPickingCullCWFile);
+		mShaderPicking[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingCullCCWFile);
+		mShaderPickingAlpha[(int)CULL_NONE] = getShader(ShaderPickingAlphaCullNoneFile);
+		mShaderPickingAlpha[(int)CULL_CLOCKWISE] = getShader(ShaderPickingAlphaCullCWFile);
+		mShaderPickingAlpha[(int)CULL_COUNTERCLOCKWISE] = getShader(ShaderPickingAlphaCullCCWFile);
+		mShaderGizmoSolid = getShader(ShaderSolidGizmoFile);
+		mShaderGizmoWire = getShader(ShaderWireGizmoFile);
+		mShaderGizmoIcon = getShader(ShaderIconGizmoFile);
+		mShaderGizmoPicking = getShader(ShaderGizmoPickingFile);
+		mShaderGizmoAlphaPicking = getShader(ShaderGizmoPickingAlphaFile);
+		mShaderGizmoText = getShader(ShaderTextGizmoFile);
+		mShaderHandleSolid = getShader(ShaderSolidHandleFile);
+		mShaderHandleClearAlpha = getShader(ShaderHandleClearAlphaFile);
+		mShaderHandleWire = getShader(ShaderWireHandleFile);
+		mShaderSelection = getShader(ShaderSelectionFile);
+
+		mDefaultFont = gResources().load<Font>(BuiltinDataFolder + (DefaultAAFontFilename + L".asset"));
+		mSkin = gResources().load<GUISkin>(BuiltinDataFolder + (GUISkinFile + L".asset"));
+	}
+
+	BuiltinEditorResources::~BuiltinEditorResources()
+	{ }
+
+	void BuiltinEditorResources::preprocess()
+	{
+		BuiltinResourcesHelper::importAssets(EditorRawShaderIncludeFolder, EditorShaderIncludeFolder, mResourceManifest); // Hidden dependency: Includes must be imported before shaders
+		BuiltinResourcesHelper::importAssets(EditorRawShaderFolder, EditorShaderFolder, mResourceManifest);
+		BuiltinResourcesHelper::importAssets(EditorRawSkinFolder, EditorSkinFolder, mResourceManifest);
+
+		// Generate different sizes of resource icons
+		generateResourceIcons(EditorIconFolder, mResourceManifest);
+
+		// Import fonts
+		BuiltinResourcesHelper::importFont(BuiltinRawDataFolder + DefaultFontFilename, DefaultFontFilename, 
+			BuiltinDataFolder, { DefaultFontSize }, true, mResourceManifest);
+
+		BuiltinResourcesHelper::importFont(BuiltinRawDataFolder + DefaultFontFilename, DefaultAAFontFilename, 
+			BuiltinDataFolder, { TitleFontSize }, true, mResourceManifest);
+
+		// Generate & save GUI sprite textures
+		BuiltinResourcesHelper::generateSpriteTextures(EditorSkinFolder, mResourceManifest);
+
+		// Generate & save GUI skin
+		{
+			GUISkinPtr skin = generateGUISkin();
+			Path outputPath = FileSystem::getWorkingDirectoryPath() + BuiltinDataFolder + (GUISkinFile + L".asset");
+
+			HResource skinResource;
+			if (FileSystem::exists(outputPath))
+				skinResource = gResources().load(outputPath);
+
+			if (skinResource.isLoaded())
+				gResources().update(skinResource, skin);
+			else
+				skinResource = gResources()._createResourceHandle(skin);
+
+			gResources().save(skinResource, outputPath, true);
+			mResourceManifest->registerResource(skinResource.getUUID(), outputPath);
+		}
+
+		Resources::instance().unloadAllUnused();
+	}
+
+	void BuiltinEditorResources::generateResourceIcons(const Path& inputFolder, const ResourceManifestPtr& manifest)
+	{
+		if (!FileSystem::exists(inputFolder))
+			return;
+
+		WString iconsToProcess[] = { FolderIconTex, FontIconTex, MeshIconTex, TextureIconTex, PlainTextIconTex, 
+			ScriptCodeIconTex, ShaderIconTex, ShaderIncludeIconTex, MaterialIconTex, SpriteTextureIconTex, PrefabIconTex,
+			GUISkinIconTex, PhysicsMaterialIconTex, PhysicsMeshIconTex };
+
+		PixelDataPtr srcData[sizeof(iconsToProcess)/sizeof(iconsToProcess[0])];
+
+		UINT32 idx = 0;
+		for (auto& iconName : iconsToProcess)
+		{
+			Path path = inputFolder + (iconName + L".asset");
+
+			HTexture source = gResources().load<Texture>(path);
+			if (source != nullptr)
+			{
+				srcData[idx] = source->getProperties().allocateSubresourceBuffer(0);
+				source->readSubresource(gCoreAccessor(), 0, srcData[idx]);
+			}
+
+			idx++;
+		}
+
+		gCoreAccessor().submitToCoreThread(true);
+
+		idx = 0;
+		for (auto& iconName : iconsToProcess)
+		{
+			PixelDataPtr src = srcData[idx];
+
+			PixelDataPtr scaled48 = PixelData::create(48, 48, 1, src->getFormat());
+			PixelUtil::scale(*src, *scaled48);
+
+			PixelDataPtr scaled32 = PixelData::create(32, 32, 1, src->getFormat());
+			PixelUtil::scale(*scaled48, *scaled32);
+
+			PixelDataPtr scaled16 = PixelData::create(16, 16, 1, src->getFormat());
+			PixelUtil::scale(*scaled32, *scaled16);
+
+			HTexture tex48 = Texture::create(scaled48);
+			HTexture tex32 = Texture::create(scaled32);
+			HTexture tex16 = Texture::create(scaled16);
+
+			Path outputPath48 = FileSystem::getWorkingDirectoryPath() + inputFolder + (iconName + L"48.asset");
+			Resources::instance().save(tex48, outputPath48, true);
+			manifest->registerResource(tex48.getUUID(), outputPath48);
+
+			Path outputPath32 = FileSystem::getWorkingDirectoryPath() + inputFolder + (iconName + L"32.asset");
+			Resources::instance().save(tex32, outputPath32, true);
+			manifest->registerResource(tex32.getUUID(), outputPath32);
+
+			Path outputPath16 = FileSystem::getWorkingDirectoryPath() + inputFolder + (iconName + L"16.asset");
+			Resources::instance().save(tex16, outputPath16, true);
+			manifest->registerResource(tex16.getUUID(), outputPath16);
+
+			idx++;
+		}
+	}
+
+	GUISkinPtr BuiltinEditorResources::generateGUISkin()
+	{
+		GUISkinPtr skin = GUISkin::_createPtr();
+
+		Path defaultFontPath = FileSystem::getWorkingDirectoryPath();
+		defaultFontPath.append(BuiltinDataFolder);
+		defaultFontPath.append(DefaultFontFilename + L".asset");
+
+		HFont defaultFont = gResources().load<Font>(defaultFontPath);
+
+		Path defaultAAFontPath = FileSystem::getWorkingDirectoryPath();
+		defaultAAFontPath.append(BuiltinDataFolder);
+		defaultAAFontPath.append(DefaultAAFontFilename + L".asset");
+
+		HFont defaultAAFont = gResources().load<Font>(defaultAAFontPath);
+
+		// Blank entry
+		GUIElementStyle blankStyle;
+
+		skin->setStyle("Blank", blankStyle);
+		skin->setStyle(GUITexture::getGUITypeName(), blankStyle);
+
+		// Label
+		GUIElementStyle labelStyle;
+		labelStyle.font = defaultFont;
+		labelStyle.fontSize = DefaultFontSize;
+		labelStyle.fixedWidth = false;
+		labelStyle.fixedHeight = true;
+		labelStyle.height = 14;
+		labelStyle.minWidth = 10;
+		labelStyle.normal.textColor = TextNormalColor;
+
+		skin->setStyle(GUILabel::getGUITypeName(), labelStyle);
+
+		// Window frame
+		GUIElementStyle windowFrameStyle;
+		windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
+		windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
+		windowFrameStyle.border.left = 1;
+		windowFrameStyle.border.right = 1;
+		windowFrameStyle.border.top = 1;
+		windowFrameStyle.border.bottom = 1;
+
+		skin->setStyle("WindowFrame", windowFrameStyle);
+
+		// Button
+		GUIElementStyle buttonStyle;
+		buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
+		buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
+		buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
+		buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
+		buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
+		buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
+		buttonStyle.normal.textColor = TextNormalColor;
+		buttonStyle.hover.textColor = TextNormalColor;
+		buttonStyle.active.textColor = TextActiveColor;
+		buttonStyle.normalOn.textColor = TextActiveColor;
+		buttonStyle.hoverOn.textColor = TextActiveColor;
+		buttonStyle.activeOn.textColor = TextActiveColor;
+		buttonStyle.border.left = 2;
+		buttonStyle.border.right = 2;
+		buttonStyle.border.top = 2;
+		buttonStyle.border.bottom = 4;
+		buttonStyle.contentOffset.top = 2;
+		buttonStyle.contentOffset.left = 3;
+		buttonStyle.contentOffset.right = 3;
+		buttonStyle.margins.bottom = 2;
+		buttonStyle.fixedHeight = true;
+		buttonStyle.height = 21;
+		buttonStyle.minWidth = 20;
+		buttonStyle.font = defaultFont;
+		buttonStyle.fontSize = DefaultFontSize;
+		buttonStyle.textHorzAlign = THA_Center;
+		buttonStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle(GUIButton::getGUITypeName(), buttonStyle);
+
+		// Left edge button
+		GUIElementStyle leftButtonStyle;
+		leftButtonStyle.normal.texture = getGUITexture(ButtonLeftNormalTex);
+		leftButtonStyle.hover.texture = getGUITexture(ButtonLeftHoverTex);
+		leftButtonStyle.active.texture = getGUITexture(ButtonLeftActiveTex);
+		leftButtonStyle.normalOn.texture = getGUITexture(ButtonLeftActiveTex);
+		leftButtonStyle.hoverOn.texture = getGUITexture(ButtonLeftActiveTex);
+		leftButtonStyle.activeOn.texture = getGUITexture(ButtonLeftActiveTex);
+		leftButtonStyle.normal.textColor = TextNormalColor;
+		leftButtonStyle.hover.textColor = TextNormalColor;
+		leftButtonStyle.active.textColor = TextActiveColor;
+		leftButtonStyle.normalOn.textColor = TextActiveColor;
+		leftButtonStyle.hoverOn.textColor = TextActiveColor;
+		leftButtonStyle.activeOn.textColor = TextActiveColor;
+		leftButtonStyle.border.left = 7;
+		leftButtonStyle.border.right = 2;
+		leftButtonStyle.border.top = 2;
+		leftButtonStyle.border.bottom = 4;
+		leftButtonStyle.contentOffset.top = 2;
+		leftButtonStyle.contentOffset.left = 7;
+		leftButtonStyle.contentOffset.right = 3;
+		leftButtonStyle.margins.bottom = 2;
+		leftButtonStyle.fixedHeight = true;
+		leftButtonStyle.height = 21;
+		leftButtonStyle.minWidth = 20;
+		leftButtonStyle.font = defaultFont;
+		leftButtonStyle.fontSize = DefaultFontSize;
+		leftButtonStyle.textHorzAlign = THA_Center;
+		leftButtonStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle("ButtonLeft", leftButtonStyle);
+
+		// Right edge button
+		GUIElementStyle rightButtonStyle;
+		rightButtonStyle.normal.texture = getGUITexture(ButtonRightNormalTex);
+		rightButtonStyle.hover.texture = getGUITexture(ButtonRightHoverTex);
+		rightButtonStyle.active.texture = getGUITexture(ButtonRightActiveTex);
+		rightButtonStyle.normalOn.texture = getGUITexture(ButtonRightActiveTex);
+		rightButtonStyle.hoverOn.texture = getGUITexture(ButtonRightActiveTex);
+		rightButtonStyle.activeOn.texture = getGUITexture(ButtonRightActiveTex);
+		rightButtonStyle.normal.textColor = TextNormalColor;
+		rightButtonStyle.hover.textColor = TextNormalColor;
+		rightButtonStyle.active.textColor = TextActiveColor;
+		rightButtonStyle.normalOn.textColor = TextActiveColor;
+		rightButtonStyle.hoverOn.textColor = TextActiveColor;
+		rightButtonStyle.activeOn.textColor = TextActiveColor;
+		rightButtonStyle.border.left = 2;
+		rightButtonStyle.border.right = 7;
+		rightButtonStyle.border.top = 2;
+		rightButtonStyle.border.bottom = 4;
+		rightButtonStyle.contentOffset.top = 2;
+		rightButtonStyle.contentOffset.left = 3;
+		rightButtonStyle.contentOffset.right = 7;
+		rightButtonStyle.margins.bottom = 2;
+		rightButtonStyle.fixedHeight = true;
+		rightButtonStyle.height = 21;
+		rightButtonStyle.minWidth = 20;
+		rightButtonStyle.font = defaultFont;
+		rightButtonStyle.fontSize = DefaultFontSize;
+		rightButtonStyle.textHorzAlign = THA_Center;
+		rightButtonStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle("ButtonRight", rightButtonStyle);
+
+		// Toggle
+		GUIElementStyle toggleStyle;
+		toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
+		toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
+		toggleStyle.active.texture = toggleStyle.hover.texture;
+		toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
+		toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
+		toggleStyle.activeOn.texture = toggleStyle.hoverOn.texture;
+		toggleStyle.fixedHeight = true;
+		toggleStyle.fixedWidth = true;
+		toggleStyle.margins.bottom = 2;
+		toggleStyle.height = 15;
+		toggleStyle.width = 13;
+
+		skin->setStyle(GUIToggle::getGUITypeName(), toggleStyle);
+
+		// Color
+		GUIElementStyle colorStyle;
+		colorStyle.margins.left = 2;
+		colorStyle.margins.right = 2;
+		colorStyle.margins.top = 2;
+		colorStyle.margins.bottom = 2;
+		colorStyle.fixedHeight = true;
+		colorStyle.height = 15;
+		colorStyle.minWidth = 10;
+
+		skin->setStyle(GUIColor::getGUITypeName(), colorStyle);
+
+		// Window background texture
+		GUIElementStyle windowBgStyle;
+		windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTex);
+
+		skin->setStyle("WindowBackground", windowBgStyle);
+
+		// Window tab bar background
+		GUIElementStyle tabBarBgStyle;
+		tabBarBgStyle.normal.texture = getGUITexture(TabBarBackgroundTex);
+		tabBarBgStyle.fixedHeight = true;
+		tabBarBgStyle.height = 16;
+
+		skin->setStyle("TabBarBackground", tabBarBgStyle);
+
+		// Tabbed title bar tab button
+		GUIElementStyle tabbedBarButton;
+		tabbedBarButton.normal.texture = getGUITexture(TabButtonNormalTex);
+		tabbedBarButton.hover.texture = tabbedBarButton.normal.texture;
+		tabbedBarButton.active.texture = getGUITexture(TabButtonFocusedTex);
+		tabbedBarButton.normalOn.texture = tabbedBarButton.active.texture;
+		tabbedBarButton.hoverOn.texture = tabbedBarButton.active.texture;
+		tabbedBarButton.activeOn.texture = tabbedBarButton.active.texture;
+		tabbedBarButton.normal.textColor = TextNormalColor;
+		tabbedBarButton.hover.textColor = TextNormalColor;
+		tabbedBarButton.active.textColor = TextActiveColor;
+		tabbedBarButton.normalOn.textColor = TextActiveColor;
+		tabbedBarButton.hoverOn.textColor = TextActiveColor;
+		tabbedBarButton.activeOn.textColor = TextActiveColor;
+		tabbedBarButton.border.left = 12;
+		tabbedBarButton.border.right = 12;
+		tabbedBarButton.margins.left = 5;
+		tabbedBarButton.margins.right = 5;
+		tabbedBarButton.contentOffset.top = 3;
+		tabbedBarButton.contentOffset.left = 6;
+		tabbedBarButton.contentOffset.right = 6;
+		tabbedBarButton.fixedHeight = true;
+		tabbedBarButton.height = 15;
+		tabbedBarButton.minWidth = 24;
+		tabbedBarButton.maxWidth = 110;
+		tabbedBarButton.font = defaultFont;
+		tabbedBarButton.fontSize = DefaultFontSize;
+		tabbedBarButton.textHorzAlign = THA_Center;
+		tabbedBarButton.textVertAlign = TVA_Center;
+
+		skin->setStyle("TabbedBarBtn", tabbedBarButton);
+
+		// Tabbed title bar drag/drop button
+		GUIElementStyle tabbedBarDropButton;
+		tabbedBarDropButton.fixedHeight = true;
+		tabbedBarDropButton.fixedWidth = true;
+		tabbedBarDropButton.height = 13;
+		tabbedBarDropButton.width = 6;
+
+		skin->setStyle("TabbedBarDropArea", tabbedBarDropButton);
+
+		// Window title bar background
+		GUIElementStyle titleBarBgStyle;
+		titleBarBgStyle.normal.texture = getGUITexture(TitleBarBackgroundTex);
+		titleBarBgStyle.fixedHeight = true;
+		titleBarBgStyle.height = 17;
+
+		skin->setStyle("TitleBarBackground", titleBarBgStyle);
+
+		// Window minimize button
+		GUIElementStyle winMinButtonStyle;
+		winMinButtonStyle.normal.texture = getGUITexture(MinButtonNormalTex);
+		winMinButtonStyle.hover.texture = getGUITexture(MinButtonHoverTex);
+		winMinButtonStyle.active.texture = getGUITexture(MinButtonActiveTex);
+		winMinButtonStyle.fixedHeight = true;
+		winMinButtonStyle.fixedWidth = true;
+		winMinButtonStyle.height = 14;
+		winMinButtonStyle.width = 14;
+
+		skin->setStyle("WinMinimizeBtn", winMinButtonStyle);
+
+		// Window maximize button
+		GUIElementStyle winMaxButtonStyle;
+		winMaxButtonStyle.normal.texture = getGUITexture(MaxButtonNormalTex);
+		winMaxButtonStyle.hover.texture = getGUITexture(MaxButtonHoverTex);
+		winMaxButtonStyle.active.texture = getGUITexture(MaxButtonActiveTex);
+		winMaxButtonStyle.fixedHeight = true;
+		winMaxButtonStyle.fixedWidth = true;
+		winMaxButtonStyle.height = 14;
+		winMaxButtonStyle.width = 14;
+
+		skin->setStyle("WinMaximizeBtn", winMaxButtonStyle);
+
+		// Window close button
+		GUIElementStyle winCloseButtonStyle;
+		winCloseButtonStyle.normal.texture = getGUITexture(CloseButtonNormalTex);
+		winCloseButtonStyle.hover.texture = getGUITexture(CloseButtonHoverTex);
+		winCloseButtonStyle.active.texture = getGUITexture(CloseButtonActiveTex);
+		winCloseButtonStyle.fixedHeight = true;
+		winCloseButtonStyle.fixedWidth = true;
+		winCloseButtonStyle.height = 14;
+		winCloseButtonStyle.width = 14;
+
+		skin->setStyle("WinCloseBtn", winCloseButtonStyle);
+
+		// Input box
+		GUIElementStyle inputBoxStyle;
+		inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
+		inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
+		inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
+		inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
+		inputBoxStyle.normal.textColor = TextNormalColor;
+		inputBoxStyle.hover.textColor = TextNormalColor;
+		inputBoxStyle.focused.textColor = TextNormalColor;
+		inputBoxStyle.active.textColor = TextNormalColor;
+		inputBoxStyle.border.left = 4;
+		inputBoxStyle.border.right = 4;
+		inputBoxStyle.border.top = 4;
+		inputBoxStyle.border.bottom = 6;
+		inputBoxStyle.contentOffset.left = 4;
+		inputBoxStyle.contentOffset.right = 4;
+		inputBoxStyle.contentOffset.top = 4;
+		inputBoxStyle.contentOffset.bottom = 4;
+		inputBoxStyle.margins.bottom = 2;
+		inputBoxStyle.fixedHeight = true;
+		inputBoxStyle.height = 21;
+		inputBoxStyle.minWidth = 10;
+		inputBoxStyle.font = defaultFont;
+		inputBoxStyle.fontSize = DefaultFontSize;
+		inputBoxStyle.textHorzAlign = THA_Left;
+		inputBoxStyle.textVertAlign = TVA_Top;
+
+		skin->setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
+
+		/************************************************************************/
+		/* 								SCROLL BAR                      		*/
+		/************************************************************************/
+
+		// Up button
+		GUIElementStyle scrollUpBtnStyle;
+		scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
+		scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
+		scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
+		scrollUpBtnStyle.fixedHeight = true;
+		scrollUpBtnStyle.fixedWidth = true;
+		scrollUpBtnStyle.height = 11;
+		scrollUpBtnStyle.width = 13;
+
+		skin->setStyle("ScrollUpBtn", scrollUpBtnStyle);
+
+		// Down button
+		GUIElementStyle scrollDownBtnStyle;
+		scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
+		scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
+		scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
+		scrollDownBtnStyle.fixedHeight = true;
+		scrollDownBtnStyle.fixedWidth = true;
+		scrollDownBtnStyle.height = 11;
+		scrollDownBtnStyle.width = 13;
+
+		skin->setStyle("ScrollDownBtn", scrollDownBtnStyle);
+
+		// Left button
+		GUIElementStyle scrollLeftBtnStyle;
+		scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
+		scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
+		scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
+		scrollLeftBtnStyle.fixedHeight = true;
+		scrollLeftBtnStyle.fixedWidth = true;
+		scrollLeftBtnStyle.height = 13;
+		scrollLeftBtnStyle.width = 11;
+
+		skin->setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
+
+		// Right button
+		GUIElementStyle scrollRightBtnStyle;
+		scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
+		scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
+		scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
+		scrollRightBtnStyle.fixedHeight = true;
+		scrollRightBtnStyle.fixedWidth = true;
+		scrollRightBtnStyle.height = 13;
+		scrollRightBtnStyle.width = 11;
+
+		skin->setStyle("ScrollRightBtn", scrollRightBtnStyle);
+
+		// Horizontal handle
+		GUIElementStyle scrollBarHorzBtnStyle;
+		scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
+		scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
+		scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
+		scrollBarHorzBtnStyle.fixedHeight = true;
+		scrollBarHorzBtnStyle.fixedWidth = false;
+		scrollBarHorzBtnStyle.width = 10;
+		scrollBarHorzBtnStyle.height = 13;
+		scrollBarHorzBtnStyle.border.left = 4;
+		scrollBarHorzBtnStyle.border.right = 4;
+
+		skin->setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
+
+		// Vertical handle
+		GUIElementStyle scrollBarVertBtnStyle;
+		scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
+		scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
+		scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
+		scrollBarVertBtnStyle.fixedHeight = false;
+		scrollBarVertBtnStyle.fixedWidth = true;
+		scrollBarVertBtnStyle.width = 13;
+		scrollBarVertBtnStyle.height = 10;
+		scrollBarVertBtnStyle.border.top = 4;
+		scrollBarVertBtnStyle.border.bottom = 4;
+
+		skin->setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
+
+		// Vertical scroll bar
+		GUIElementStyle vertScrollBarStyle;
+		vertScrollBarStyle.normal.texture = getGUITexture(ScrollBarVBgTex);
+		vertScrollBarStyle.hover.texture = vertScrollBarStyle.normal.texture;
+		vertScrollBarStyle.active.texture = vertScrollBarStyle.normal.texture;
+		vertScrollBarStyle.fixedHeight = false;
+		vertScrollBarStyle.fixedWidth = true;
+		vertScrollBarStyle.minHeight = 8;
+		vertScrollBarStyle.width = 16;
+
+		skin->setStyle("ScrollBarVert", vertScrollBarStyle);
+
+		// Horizontal scroll bar
+		GUIElementStyle horzScrollBarStyle;
+		horzScrollBarStyle.normal.texture = getGUITexture(ScrollBarHBgTex);
+		horzScrollBarStyle.hover.texture = horzScrollBarStyle.normal.texture;
+		horzScrollBarStyle.active.texture = horzScrollBarStyle.normal.texture;
+		horzScrollBarStyle.fixedHeight = true;
+		horzScrollBarStyle.fixedWidth = false;
+		horzScrollBarStyle.minWidth = 8;
+		horzScrollBarStyle.height = 16;
+
+		skin->setStyle("ScrollBarHorz", horzScrollBarStyle);
+
+		/************************************************************************/
+		/* 								DROP DOWN BOX                      		*/
+		/************************************************************************/
+
+		// ListBox button
+		GUIElementStyle dropDownListStyle;
+		dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
+		dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
+		dropDownListStyle.active.texture = getGUITexture(DropDownBtnActiveTex);
+		dropDownListStyle.normalOn.texture = dropDownListStyle.active.texture;
+		dropDownListStyle.hoverOn.texture = dropDownListStyle.active.texture;
+		dropDownListStyle.activeOn.texture = dropDownListStyle.active.texture;
+		dropDownListStyle.normal.textColor = TextNormalColor;
+		dropDownListStyle.hover.textColor = TextNormalColor;
+		dropDownListStyle.active.textColor = TextNormalColor;
+		dropDownListStyle.normalOn.textColor = TextNormalColor;
+		dropDownListStyle.hoverOn.textColor = TextNormalColor;
+		dropDownListStyle.activeOn.textColor = TextNormalColor;
+		dropDownListStyle.fixedHeight = true;
+		dropDownListStyle.fixedWidth = false;
+		dropDownListStyle.height = 21;
+		dropDownListStyle.minWidth = 20;
+		dropDownListStyle.contentOffset.left = 3;
+		dropDownListStyle.contentOffset.right = 18;
+		dropDownListStyle.contentOffset.top = 2;
+		dropDownListStyle.contentOffset.bottom = 2;
+		dropDownListStyle.border.left = 2;
+		dropDownListStyle.border.right = 16;
+		dropDownListStyle.border.top = 2;
+		dropDownListStyle.border.bottom = 4;
+		dropDownListStyle.margins.bottom = 2;
+		dropDownListStyle.font = defaultFont;
+		dropDownListStyle.fontSize = DefaultFontSize;
+		dropDownListStyle.textHorzAlign = THA_Left;
+		dropDownListStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle(GUIListBox::getGUITypeName(), dropDownListStyle);
+
+		// DropDown scroll up button
+		GUIElementStyle dropDownScrollUpBtnStyle;
+		dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
+		dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
+		dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
+		dropDownScrollUpBtnStyle.fixedHeight = true;
+		dropDownScrollUpBtnStyle.fixedWidth = true;
+		dropDownScrollUpBtnStyle.width = 8;
+		dropDownScrollUpBtnStyle.height = 12;
+
+		skin->setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
+		skin->setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
+		skin->setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
+
+		// DropDown scroll down button
+		GUIElementStyle dropDownScrollDownBtnStyle;
+		dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
+		dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
+		dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
+		dropDownScrollDownBtnStyle.fixedHeight = true;
+		dropDownScrollDownBtnStyle.fixedWidth = true;
+		dropDownScrollDownBtnStyle.width = 8;
+		dropDownScrollDownBtnStyle.height = 12;
+
+		skin->setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
+		skin->setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
+		skin->setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
+
+		// DropDown handle
+		GUIElementStyle dropDownScrollHandleStyle;
+		dropDownScrollHandleStyle.normal.texture = getGUITexture(DropDownBoxHandleTex);
+		dropDownScrollHandleStyle.fixedHeight = false;
+		dropDownScrollHandleStyle.fixedWidth = true;
+		dropDownScrollHandleStyle.height = 8;
+		dropDownScrollHandleStyle.width = 8;
+
+		skin->setStyle("ListBoxHandle", dropDownScrollHandleStyle);
+		skin->setStyle("MenuBarHandle", dropDownScrollHandleStyle);
+		skin->setStyle("ContextMenuHandle", dropDownScrollHandleStyle);
+
+		// DropDown sidebar background
+		GUIElementStyle dropDownSidebarBg;
+		dropDownSidebarBg.normal.texture = getGUITexture(DropDownBoxSideBgTex);
+		dropDownSidebarBg.fixedHeight = false;
+		dropDownSidebarBg.fixedWidth = true;
+		dropDownSidebarBg.height = 8;
+		dropDownSidebarBg.width = 9;
+		dropDownSidebarBg.border.left = 1;
+		dropDownSidebarBg.border.top = 1;
+		dropDownSidebarBg.border.bottom = 1;
+
+		skin->setStyle("ListBoxSidebarBg", dropDownSidebarBg);
+		skin->setStyle("MenuBarSidebarBg", dropDownSidebarBg);
+		skin->setStyle("ContextMenuSidebarBg", dropDownSidebarBg);
+
+		// DropDown entry button
+		GUIElementStyle dropDownEntryBtnStyle;
+		dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
+		dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
+		dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
+		dropDownEntryBtnStyle.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
+		dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
+		dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
+		dropDownEntryBtnStyle.normal.textColor = TextNormalColor;
+		dropDownEntryBtnStyle.hover.textColor = TextNormalColor;
+		dropDownEntryBtnStyle.active.textColor = TextNormalColor;
+		dropDownEntryBtnStyle.normalOn.textColor = TextNormalColor;
+		dropDownEntryBtnStyle.hoverOn.textColor = TextNormalColor;
+		dropDownEntryBtnStyle.activeOn.textColor = TextNormalColor;
+		dropDownEntryBtnStyle.fixedHeight = true;
+		dropDownEntryBtnStyle.fixedWidth = false;
+		dropDownEntryBtnStyle.height = 16;
+		dropDownEntryBtnStyle.width = 30;
+		dropDownEntryBtnStyle.font = defaultFont;
+		dropDownEntryBtnStyle.fontSize = DefaultFontSize;
+		dropDownEntryBtnStyle.textHorzAlign = THA_Left;
+		dropDownEntryBtnStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
+
+		// DropDown toggle entry button
+		GUIElementStyle dropDownToggleEntryBtnStyle;
+		dropDownToggleEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryToggleNormalTex);
+		dropDownToggleEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryToggleHoverTex);
+		dropDownToggleEntryBtnStyle.active.texture = dropDownToggleEntryBtnStyle.hover.texture;
+		dropDownToggleEntryBtnStyle.normalOn.texture = getGUITexture(DropDownBoxEntryToggleNormalOnTex);
+		dropDownToggleEntryBtnStyle.hoverOn.texture = getGUITexture(DropDownBoxEntryToggleHoverOnTex);
+		dropDownToggleEntryBtnStyle.activeOn.texture = dropDownToggleEntryBtnStyle.hoverOn.texture;
+		dropDownToggleEntryBtnStyle.normal.textColor = TextNormalColor;
+		dropDownToggleEntryBtnStyle.hover.textColor = TextNormalColor;
+		dropDownToggleEntryBtnStyle.active.textColor = TextNormalColor;
+		dropDownToggleEntryBtnStyle.normalOn.textColor = TextNormalColor;
+		dropDownToggleEntryBtnStyle.hoverOn.textColor = TextNormalColor;
+		dropDownToggleEntryBtnStyle.activeOn.textColor = TextNormalColor;
+		dropDownToggleEntryBtnStyle.fixedHeight = true;
+		dropDownToggleEntryBtnStyle.fixedWidth = false;
+		dropDownToggleEntryBtnStyle.height = 18;
+		dropDownToggleEntryBtnStyle.width = 30;
+		dropDownToggleEntryBtnStyle.border.left = 17;
+		dropDownToggleEntryBtnStyle.contentOffset.left = 17;
+		dropDownToggleEntryBtnStyle.font = defaultFont;
+		dropDownToggleEntryBtnStyle.fontSize = DefaultFontSize;
+		dropDownToggleEntryBtnStyle.textHorzAlign = THA_Left;
+		dropDownToggleEntryBtnStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle(GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE, dropDownToggleEntryBtnStyle);
+
+		// DropDown entry button with expand
+		GUIElementStyle dropDownEntryExpBtnStyle;
+		dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
+		dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
+		dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
+		dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
+		dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
+		dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
+		dropDownEntryExpBtnStyle.normal.textColor = TextNormalColor;
+		dropDownEntryExpBtnStyle.hover.textColor = TextNormalColor;
+		dropDownEntryExpBtnStyle.active.textColor = TextNormalColor;
+		dropDownEntryExpBtnStyle.normalOn.textColor = TextNormalColor;
+		dropDownEntryExpBtnStyle.hoverOn.textColor = TextNormalColor;
+		dropDownEntryExpBtnStyle.activeOn.textColor = TextNormalColor;
+		dropDownEntryExpBtnStyle.fixedHeight = true;
+		dropDownEntryExpBtnStyle.fixedWidth = false;
+		dropDownEntryExpBtnStyle.height = 16;
+		dropDownEntryExpBtnStyle.width = 30;
+		dropDownEntryExpBtnStyle.border.right = 13;
+		dropDownEntryExpBtnStyle.font = defaultFont;
+		dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
+		dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
+		dropDownEntryExpBtnStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
+
+		// Drop down separator
+		GUIElementStyle dropDownSeparatorStyle;
+		dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
+		dropDownSeparatorStyle.fixedHeight = true;
+		dropDownSeparatorStyle.fixedWidth = false;
+		dropDownSeparatorStyle.height = 3;
+		dropDownSeparatorStyle.width = 30;
+
+		skin->setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
+
+		// Drop down content
+		GUIElementStyle dropDownContentStyle;
+		dropDownContentStyle.minWidth = 50;
+		dropDownContentStyle.minHeight = 20;
+		dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE] = GUIDropDownContent::ENTRY_TOGGLE_STYLE_TYPE;
+		dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
+		dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
+		dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
+
+		skin->setStyle("ListBoxContent", dropDownContentStyle);
+		skin->setStyle("MenuBarContent", dropDownContentStyle);
+		skin->setStyle("ContextMenuContent", dropDownContentStyle);
+
+		// DropDown box frame
+		GUIElementStyle dropDownBoxStyle;
+		dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
+		dropDownBoxStyle.hover.texture = dropDownBoxStyle.normal.texture;
+		dropDownBoxStyle.active.texture = dropDownBoxStyle.hover.texture;
+		dropDownBoxStyle.fixedHeight = false;
+		dropDownBoxStyle.fixedWidth = false;
+		dropDownBoxStyle.border.left = 2;
+		dropDownBoxStyle.border.right = 2;
+		dropDownBoxStyle.border.top = 2;
+		dropDownBoxStyle.border.bottom = 4;
+		dropDownBoxStyle.margins.left = 6;
+		dropDownBoxStyle.margins.right = 6;
+		dropDownBoxStyle.margins.top = 4;
+		dropDownBoxStyle.margins.bottom = 6;
+
+		skin->setStyle("ListBoxFrame", dropDownBoxStyle);
+		skin->setStyle("MenuBarFrame", dropDownBoxStyle);
+		skin->setStyle("ContextMenuFrame", dropDownBoxStyle);
+
+		/************************************************************************/
+		/* 								TOOLTIP                      			*/
+		/************************************************************************/
+
+		GUIElementStyle tooltipFrameStyle;
+		tooltipFrameStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
+		tooltipFrameStyle.hover.texture = tooltipFrameStyle.normal.texture;
+		tooltipFrameStyle.active.texture = tooltipFrameStyle.hover.texture;
+		tooltipFrameStyle.fixedHeight = false;
+		tooltipFrameStyle.fixedWidth = false;
+		tooltipFrameStyle.border.left = 2;
+		tooltipFrameStyle.border.right = 2;
+		tooltipFrameStyle.border.top = 2;
+		tooltipFrameStyle.border.bottom = 4;
+		tooltipFrameStyle.margins.left = 6;
+		tooltipFrameStyle.margins.right = 6;
+		tooltipFrameStyle.margins.top = 4;
+		tooltipFrameStyle.margins.bottom = 6;
+
+		skin->setStyle(GUITooltip::getFrameStyleName(), tooltipFrameStyle);
+
+		/************************************************************************/
+		/* 								MENU BAR	                     		*/
+		/************************************************************************/
+
+		// MenuBar background
+		GUIElementStyle menuBarBgStyle;
+		menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
+		menuBarBgStyle.height = 14;
+		menuBarBgStyle.width = 2;
+		menuBarBgStyle.border.bottom = 2;
+
+		skin->setStyle(GUIMenuBar::getBackgroundStyleType(), menuBarBgStyle);
+
+		// MenuBar separator line
+		GUIElementStyle menuBarLineStyle;
+		menuBarLineStyle.normal.texture = getGUITexture(MenuBarLineNormalTex);
+		menuBarLineStyle.normalOn.texture = getGUITexture(MenuBarLineActiveTex);
+		menuBarLineStyle.fixedHeight = true;
+		menuBarLineStyle.height = 1;
+
+		skin->setStyle(GUIMenuBar::getLineStyleType(), menuBarLineStyle);
+
+		// MenuBar Banshee logo
+		GUIElementStyle menuBarBansheeLogoStyle;
+		menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
+		menuBarBansheeLogoStyle.fixedHeight = true;
+		menuBarBansheeLogoStyle.fixedWidth = true;
+		menuBarBansheeLogoStyle.height = 46;
+		menuBarBansheeLogoStyle.width = 46;
+
+		skin->setStyle(GUIMenuBar::getLogoStyleType(), menuBarBansheeLogoStyle);
+
+		// MenuBar button
+		GUIElementStyle menuBarBtnStyle;
+		menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
+		menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
+		menuBarBtnStyle.active.texture = getGUITexture(MenuBarBtnActiveTex);
+		menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.active.texture;
+		menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.active.texture;
+		menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.active.texture;
+		menuBarBtnStyle.normal.textColor = TextNormalColor;
+		menuBarBtnStyle.hover.textColor = TextNormalColor;
+		menuBarBtnStyle.active.textColor = TextActiveColor;
+		menuBarBtnStyle.normalOn.textColor = TextActiveColor;
+		menuBarBtnStyle.hoverOn.textColor = TextActiveColor;
+		menuBarBtnStyle.activeOn.textColor = TextActiveColor;
+		menuBarBtnStyle.fixedHeight = true;
+		menuBarBtnStyle.fixedWidth = false;
+		menuBarBtnStyle.height = 14;
+		menuBarBtnStyle.width = 4;
+		menuBarBtnStyle.margins.left = 2;
+		menuBarBtnStyle.margins.right = 2;
+		menuBarBtnStyle.margins.top = 2;
+		menuBarBtnStyle.margins.bottom = 2;
+		menuBarBtnStyle.font = defaultFont;
+		menuBarBtnStyle.fontSize = DefaultFontSize;
+		menuBarBtnStyle.textHorzAlign = THA_Left;
+		menuBarBtnStyle.textVertAlign = TVA_Top;
+
+		skin->setStyle(GUIMenuBar::getMenuItemButtonStyleType(), menuBarBtnStyle);
+
+		// ToolBar separator
+		GUIElementStyle toolBarSeparator;
+		toolBarSeparator.normal.texture = getGUITexture(ToolBarSeparatorTex);
+		toolBarSeparator.fixedWidth = true;
+		toolBarSeparator.width = 3;
+		toolBarSeparator.height = 32;
+
+		skin->setStyle(GUIMenuBar::getToolBarSeparatorStyleType(), toolBarSeparator);
+
+		// ToolBar button
+		GUIElementStyle toolBarBtnStyle;
+		toolBarBtnStyle.normal.texture = getGUITexture(ToolBarBtnNormalTex);
+		toolBarBtnStyle.hover.texture = getGUITexture(ToolBarBtnHoverTex);
+		toolBarBtnStyle.active.texture = getGUITexture(ToolBarBtnActiveTex);
+		toolBarBtnStyle.normalOn.texture = getGUITexture(ToolBarBtnActiveTex);
+		toolBarBtnStyle.hoverOn.texture = getGUITexture(ToolBarBtnActiveTex);
+		toolBarBtnStyle.activeOn.texture = getGUITexture(ToolBarBtnActiveTex);
+		toolBarBtnStyle.normal.textColor = TextNormalColor;
+		toolBarBtnStyle.hover.textColor = TextNormalColor;
+		toolBarBtnStyle.active.textColor = TextActiveColor;
+		toolBarBtnStyle.normalOn.textColor = TextNormalColor;
+		toolBarBtnStyle.hoverOn.textColor = TextNormalColor;
+		toolBarBtnStyle.activeOn.textColor = TextActiveColor;
+		toolBarBtnStyle.fixedHeight = true;
+		toolBarBtnStyle.fixedWidth = true;
+		toolBarBtnStyle.height = 32;
+		toolBarBtnStyle.width = 32;
+
+		skin->setStyle(GUIMenuBar::getToolBarButtonStyleType(), toolBarBtnStyle);
+
+		/************************************************************************/
+		/* 								DOCK SLIDER	                     		*/
+		/************************************************************************/
+
+		GUIElementStyle dockSliderBtnStyle;
+		dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
+		dockSliderBtnStyle.hover.texture = dockSliderBtnStyle.normal.texture;
+		dockSliderBtnStyle.active.texture = dockSliderBtnStyle.normal.texture;
+		dockSliderBtnStyle.fixedHeight = false;
+		dockSliderBtnStyle.fixedWidth = false;
+		dockSliderBtnStyle.height = 2;
+		dockSliderBtnStyle.width = 2;
+
+		skin->setStyle("DockSliderBtn", dockSliderBtnStyle);
+
+		/************************************************************************/
+		/* 								TREE VIEW	                     		*/
+		/************************************************************************/
+
+		// Expand button
+		GUIElementStyle treeViewExpandButtonStyle;
+		treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
+		treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
+		treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
+		treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
+		treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
+		treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
+		treeViewExpandButtonStyle.fixedHeight = true;
+		treeViewExpandButtonStyle.fixedWidth = true;
+		treeViewExpandButtonStyle.height = 10;
+		treeViewExpandButtonStyle.width = 10;
+
+		skin->setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
+
+		// Entry
+		GUIElementStyle treeViewEntryStyle;
+		treeViewEntryStyle.font = defaultFont;
+		treeViewEntryStyle.fontSize = DefaultFontSize;
+		treeViewEntryStyle.fixedWidth = false;
+		treeViewEntryStyle.fixedHeight = true;
+		treeViewEntryStyle.height = 16;
+		treeViewEntryStyle.minWidth = 10;
+		treeViewEntryStyle.normal.textColor = TextNormalColor;
+
+		skin->setStyle("TreeViewElementBtn", treeViewEntryStyle);
+
+		// Background
+		GUIElementStyle treeViewBackgroundStyle;
+
+		skin->setStyle("TreeViewBackground", treeViewBackgroundStyle);
+
+		// Selection background
+		GUIElementStyle treeViewSelBackgroundStyle;
+		treeViewSelBackgroundStyle.normal.texture = getGUITexture(SelectionBgTex);
+		treeViewSelBackgroundStyle.fixedHeight = false;
+		treeViewSelBackgroundStyle.fixedWidth = false;
+		treeViewSelBackgroundStyle.height = 2;
+		treeViewSelBackgroundStyle.width = 2;
+
+		skin->setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
+
+		// Highlight background
+		GUIElementStyle treeViewHLBackgroundStyle;
+		treeViewHLBackgroundStyle.normal.texture = getGUITexture(TreeViewHighlightBackground);
+		treeViewHLBackgroundStyle.fixedHeight = false;
+		treeViewHLBackgroundStyle.fixedWidth = false;
+		treeViewHLBackgroundStyle.height = 2;
+		treeViewHLBackgroundStyle.width = 2;
+
+		skin->setStyle("TreeViewHighlightBackground", treeViewHLBackgroundStyle);
+
+		// Edit box
+		GUIElementStyle treeViewEditBox;
+		treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
+		treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
+		treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
+		treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
+		treeViewEditBox.normal.textColor = TextNormalColor;
+		treeViewEditBox.hover.textColor = TextNormalColor;
+		treeViewEditBox.focused.textColor = TextNormalColor;
+		treeViewEditBox.active.textColor = TextNormalColor;
+		treeViewEditBox.border.left = 1;
+		treeViewEditBox.border.right = 1;
+		treeViewEditBox.border.top = 1;
+		treeViewEditBox.border.bottom = 1;
+		treeViewEditBox.margins.left = 1;
+		treeViewEditBox.margins.right = 1;
+		treeViewEditBox.margins.top = 1;
+		treeViewEditBox.margins.bottom = 1;
+		treeViewEditBox.fixedHeight = true;
+		treeViewEditBox.height = 13;
+		treeViewEditBox.minWidth = 10;
+		treeViewEditBox.font = defaultFont;
+		treeViewEditBox.fontSize = DefaultFontSize;
+		treeViewEditBox.textHorzAlign = THA_Left;
+		treeViewEditBox.textVertAlign = TVA_Top;
+
+		skin->setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
+
+		// Element highlight
+		GUIElementStyle treeViewElementHighlight;
+		treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
+		treeViewElementHighlight.border.left = 1;
+		treeViewElementHighlight.border.right = 1;
+		treeViewElementHighlight.border.top = 1;
+		treeViewElementHighlight.border.bottom = 1;
+
+		skin->setStyle("TreeViewElementHighlight", treeViewElementHighlight);
+
+		// Element separator highlight
+		GUIElementStyle treeViewElementSepHighlight;
+		treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
+		treeViewElementSepHighlight.border.left = 1;
+		treeViewElementSepHighlight.border.right = 1;
+		treeViewElementSepHighlight.border.top = 1;
+		treeViewElementSepHighlight.border.bottom = 1;
+
+		skin->setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
+
+		/************************************************************************/
+		/* 							OBJECT DROP FIELD                      		*/
+		/************************************************************************/
+		GUIElementStyle objectDropStyle;
+		objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
+		objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
+		objectDropStyle.hover.texture = objectDropStyle.normal.texture;
+		objectDropStyle.hoverOn.texture = objectDropStyle.normalOn.texture;
+		objectDropStyle.active.texture = objectDropStyle.normal.texture;
+		objectDropStyle.activeOn.texture = objectDropStyle.normalOn.texture;
+		objectDropStyle.normal.textColor = TextNormalColor;
+		objectDropStyle.hover.textColor = TextNormalColor;
+		objectDropStyle.active.textColor = TextNormalColor;
+		objectDropStyle.normalOn.textColor = TextNormalColor;
+		objectDropStyle.hoverOn.textColor = TextNormalColor;
+		objectDropStyle.activeOn.textColor = TextNormalColor;
+		objectDropStyle.border.left = 2;
+		objectDropStyle.border.top = 2;
+		objectDropStyle.border.bottom = 4;
+		objectDropStyle.contentOffset.left = 3;
+		objectDropStyle.contentOffset.right = 1;
+		objectDropStyle.margins.bottom = 2;
+		objectDropStyle.fixedHeight = true;
+		objectDropStyle.height = 21;
+		objectDropStyle.minWidth = 20;
+		objectDropStyle.font = defaultFont;
+		objectDropStyle.fontSize = DefaultFontSize;
+		objectDropStyle.textHorzAlign = THA_Center;
+		objectDropStyle.textVertAlign = TVA_Center;
+
+		skin->setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
+
+		GUIElementStyle objectClearBtnStyle;
+		objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
+		objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
+		objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
+		objectClearBtnStyle.fixedHeight = true;
+		objectClearBtnStyle.fixedWidth = true;
+		objectClearBtnStyle.height = 21;
+		objectClearBtnStyle.width = 16;
+		objectClearBtnStyle.margins.bottom = 2;
+
+		skin->setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
+
+		GUIElementStyle editorObjectFieldStyle;
+		editorObjectFieldStyle.fixedHeight = true;
+		editorObjectFieldStyle.height = 21;
+		editorObjectFieldStyle.minWidth = 30;
+		editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
+		editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
+		editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
+
+		skin->setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
+
+		/************************************************************************/
+		/* 						TEXTURE DROP FIELD                      		*/
+		/************************************************************************/
+		GUIElementStyle textureFieldStyle;
+		textureFieldStyle.minHeight = 15;
+		textureFieldStyle.minWidth = 15;
+		textureFieldStyle.subStyles[TextureFieldDropStyleName] = TextureFieldDropStyleName;
+		textureFieldStyle.subStyles[TextureFieldClearBtnStyleName] = TextureFieldClearBtnStyleName;
+		textureFieldStyle.subStyles[TextureFieldLabelStyleName] = GUITextField::getLabelStyleType();
+
+		skin->setStyle(TextureFieldStyleName, textureFieldStyle);
+
+		GUIElementStyle textureDropStyle;
+		textureDropStyle.font = defaultFont;
+		textureDropStyle.fontSize = DefaultFontSize;
+		textureDropStyle.textHorzAlign = THA_Center;
+		textureDropStyle.textVertAlign = TVA_Center;
+		textureDropStyle.normal.textColor = Color(95 / 255.0f, 95 / 255.0f, 95 / 255.0f, 1.0f);
+		textureDropStyle.normal.texture = getGUITexture(TextureDropTex);
+		textureDropStyle.hover.textColor = textureDropStyle.normal.textColor;
+		textureDropStyle.hover.texture = textureDropStyle.normal.texture;
+		textureDropStyle.active.textColor = textureDropStyle.normal.textColor;
+		textureDropStyle.active.texture = textureDropStyle.normal.texture;
+		textureDropStyle.normalOn.textColor = Color(95 / 255.0f, 95 / 255.0f, 95 / 255.0f, 1.0f);
+		textureDropStyle.normalOn.texture = getGUITexture(TextureDropOnTex);
+		textureDropStyle.hoverOn.textColor = textureDropStyle.normalOn.textColor;
+		textureDropStyle.hoverOn.texture = textureDropStyle.normalOn.texture;
+		textureDropStyle.activeOn.textColor = textureDropStyle.normalOn.textColor;
+		textureDropStyle.activeOn.texture = textureDropStyle.normalOn.texture;
+		textureDropStyle.height = 84;
+		textureDropStyle.width = 82;
+		textureDropStyle.fixedHeight = true;
+		textureDropStyle.fixedWidth = true;
+		textureDropStyle.border.left = 2;
+		textureDropStyle.border.right = 2;
+		textureDropStyle.border.top = 2;
+		textureDropStyle.border.bottom = 4;
+		textureDropStyle.contentOffset.left = 4;
+		textureDropStyle.contentOffset.right = 4;
+		textureDropStyle.contentOffset.top = 4;
+		textureDropStyle.contentOffset.bottom = 4;
+
+		skin->setStyle(TextureFieldDropStyleName, textureDropStyle);
+		
+		GUIElementStyle textureDropClearStyle;
+		textureDropClearStyle.normal.texture = getGUITexture(XButtonNormalTex);
+		textureDropClearStyle.hover.texture = getGUITexture(XButtonHoverTex);
+		textureDropClearStyle.active.texture = getGUITexture(XButtonActiveTex);
+		textureDropClearStyle.fixedWidth = true;
+		textureDropClearStyle.fixedHeight = true;
+		textureDropClearStyle.height = 10;
+		textureDropClearStyle.width = 10;
+
+		skin->setStyle(TextureFieldClearBtnStyleName, textureDropClearStyle);
+
+		/************************************************************************/
+		/* 								EDITOR FIELDS                      		*/
+		/************************************************************************/
+
+		GUIElementStyle editorFieldLabelStyle;
+		editorFieldLabelStyle.font = defaultFont;
+		editorFieldLabelStyle.fontSize = DefaultFontSize;
+		editorFieldLabelStyle.normal.textColor = TextNormalColor;
+		editorFieldLabelStyle.fixedWidth = false;
+		editorFieldLabelStyle.fixedHeight = true;
+		editorFieldLabelStyle.height = 14;
+		editorFieldLabelStyle.minWidth = 10;
+		editorFieldLabelStyle.textHorzAlign = THA_Left;
+
+		skin->setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
+
+		GUIElementStyle editorIntFieldStyle;
+		editorIntFieldStyle.fixedHeight = true;
+		editorIntFieldStyle.height = 21;
+		editorIntFieldStyle.minWidth = 30;
+		editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
+
+		skin->setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
+
+		GUIElementStyle editorFloatFieldStyle;
+		editorFloatFieldStyle.fixedHeight = true;
+		editorFloatFieldStyle.height = 21;
+		editorFloatFieldStyle.minWidth = 30;
+		editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
+
+		skin->setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
+
+		GUIElementStyle editorTextFieldStyle;
+		editorTextFieldStyle.fixedHeight = true;
+		editorTextFieldStyle.height = 21;
+		editorTextFieldStyle.minWidth = 30;
+		editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
+
+		skin->setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
+
+		GUIElementStyle editorColorFieldStyle;
+		editorColorFieldStyle.fixedHeight = true;
+		editorColorFieldStyle.height = 21;
+		editorColorFieldStyle.minWidth = 30;
+		editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
+
+		skin->setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
+
+		GUIElementStyle editorToggleFieldStyle;
+		editorToggleFieldStyle.fixedHeight = true;
+		editorToggleFieldStyle.height = 15;
+		editorToggleFieldStyle.minWidth = 30;
+		editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
+
+		skin->setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
+
+		GUIElementStyle editorVector2FieldStyle;
+		editorVector2FieldStyle.fixedHeight = true;
+		editorVector2FieldStyle.height = 35;
+		editorVector2FieldStyle.minWidth = 30;
+		editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
+
+		skin->setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
+
+		GUIElementStyle editorVector3FieldStyle;
+		editorVector3FieldStyle.fixedHeight = true;
+		editorVector3FieldStyle.height = 35;
+		editorVector3FieldStyle.minWidth = 30;
+		editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
+
+		skin->setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
+
+		GUIElementStyle editorVector4FieldStyle;
+		editorVector4FieldStyle.fixedHeight = true;
+		editorVector4FieldStyle.height = 35;
+		editorVector4FieldStyle.minWidth = 30;
+		editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
+
+		skin->setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
+
+		GUIElementStyle editorListBoxFieldStyle;
+		editorListBoxFieldStyle.fixedHeight = true;
+		editorListBoxFieldStyle.height = 21;
+		editorListBoxFieldStyle.minWidth = 30;
+		editorListBoxFieldStyle.subStyles[GUIListBoxField::getLabelStyleType()] = GUIListBoxField::getLabelStyleType();
+		editorListBoxFieldStyle.subStyles[GUIListBoxField::getListBoxStyleType()] = GUIListBox::getGUITypeName();
+
+		skin->setStyle(GUIListBoxField::getGUITypeName(), editorListBoxFieldStyle);
+
+		GUIElementStyle editorSliderFieldStyle;
+		editorSliderFieldStyle.fixedHeight = true;
+		editorSliderFieldStyle.height = 21;
+		editorSliderFieldStyle.minWidth = 30;
+		editorSliderFieldStyle.subStyles[GUISliderField::getLabelStyleType()] = GUISliderField::getLabelStyleType();
+		editorSliderFieldStyle.subStyles[GUISliderField::getInputStyleType()] = GUIInputBox::getGUITypeName();
+		editorSliderFieldStyle.subStyles[GUISliderField::getSliderStyleType()] = GUISliderHorz::getGUITypeName();
+
+		skin->setStyle(GUISliderField::getGUITypeName(), editorSliderFieldStyle);
+
+		/************************************************************************/
+		/* 							     FOLDOUT                      		    */
+		/************************************************************************/
+
+		GUIElementStyle foldoutStyle;
+		foldoutStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
+		foldoutStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
+		foldoutStyle.active.texture = getGUITexture(FoldoutOpenActiveTex);
+		foldoutStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
+		foldoutStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
+		foldoutStyle.activeOn.texture = getGUITexture(FoldoutOpenActiveTex);
+		foldoutStyle.normal.textColor = TextNormalColor;
+		foldoutStyle.hover.textColor = TextNormalColor;
+		foldoutStyle.active.textColor = TextNormalColor;
+		foldoutStyle.normalOn.textColor = TextNormalColor;
+		foldoutStyle.hoverOn.textColor = TextNormalColor;
+		foldoutStyle.activeOn.textColor = TextNormalColor;
+		foldoutStyle.fixedHeight = true;
+		foldoutStyle.fixedWidth = false;
+		foldoutStyle.height = 21;
+		foldoutStyle.minWidth = 17;
+		foldoutStyle.font = defaultFont;
+		foldoutStyle.fontSize = DefaultFontSize;
+		foldoutStyle.textHorzAlign = THA_Left;
+		foldoutStyle.textVertAlign = TVA_Center;
+		foldoutStyle.contentOffset = RectOffset(16, 0, 0, 0);
+		foldoutStyle.border.left = 15;
+		foldoutStyle.border.right = 2;
+		foldoutStyle.border.top = 2;
+		foldoutStyle.border.bottom = 4;
+
+		skin->setStyle("Foldout", foldoutStyle);
+
+		/************************************************************************/
+		/* 								PROGRESS BAR                      		*/
+		/************************************************************************/
+		GUIElementStyle progressBarBgStyle;
+		progressBarBgStyle.fixedHeight = true;
+		progressBarBgStyle.height = 17;
+		progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
+		progressBarBgStyle.border.left = 8;
+		progressBarBgStyle.border.right = 8;
+
+		skin->setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
+
+		GUIElementStyle progressBarFillStyle;
+		progressBarFillStyle.fixedHeight = true;
+		progressBarFillStyle.height = 16;
+		progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
+		progressBarFillStyle.border.left = 9;
+		progressBarFillStyle.border.right = 10;
+
+		skin->setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
+
+		GUIElementStyle progressBarStyle;
+		progressBarStyle.fixedHeight = true;
+		progressBarStyle.height = 17;
+		progressBarStyle.minWidth = 100;
+
+		progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
+		progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
+
+		skin->setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
+
+		/************************************************************************/
+		/* 								SLIDER                      			*/
+		/************************************************************************/
+
+		GUIElementStyle sliderHandleStyle;
+		sliderHandleStyle.fixedHeight = true;
+		sliderHandleStyle.fixedWidth = true;
+		sliderHandleStyle.width = 12;
+		sliderHandleStyle.height = 13;
+		sliderHandleStyle.normal.texture = getGUITexture(SliderHandleNormalTex);
+		sliderHandleStyle.hover.texture = getGUITexture(SliderHandleHoverTex);
+		sliderHandleStyle.active.texture = getGUITexture(SliderHandleActiveTex);
+
+		skin->setStyle(GUISlider::getHandleStyleType(), sliderHandleStyle);
+
+		GUIElementStyle sliderHorizontalBgStyle;
+		sliderHorizontalBgStyle.fixedHeight = true;
+		sliderHorizontalBgStyle.height = 10;
+		sliderHorizontalBgStyle.normal.texture = getGUITexture(SliderHBackgroundTex);
+		sliderHorizontalBgStyle.border.left = 4;
+		sliderHorizontalBgStyle.border.right = 4;
+
+		skin->setStyle("SliderHorzBg", sliderHorizontalBgStyle);
+
+		GUIElementStyle sliderHorizontalFillStyle;
+		sliderHorizontalFillStyle.fixedHeight = true;
+		sliderHorizontalFillStyle.height = 10;
+		sliderHorizontalFillStyle.normal.texture = getGUITexture(SliderHFillTex);
+		sliderHorizontalFillStyle.border.left = 6;
+		sliderHorizontalFillStyle.border.right = 4;
+
+		skin->setStyle("SliderHorzFill", sliderHorizontalFillStyle);
+
+		GUIElementStyle sliderHorizontalStyle;
+		sliderHorizontalStyle.fixedHeight = true;
+		sliderHorizontalStyle.height = 13;
+		sliderHorizontalStyle.width = 150;
+		sliderHorizontalStyle.minWidth = 10;
+		sliderHorizontalStyle.subStyles[GUISlider::getHandleStyleType()] = GUISlider::getHandleStyleType();
+		sliderHorizontalStyle.subStyles[GUISlider::getBackgroundStyleType()] = "SliderHorzBg";
+		sliderHorizontalStyle.subStyles[GUISlider::getFillStyleType()] = "SliderHorzFill";
+
+		skin->setStyle(GUISliderHorz::getGUITypeName(), sliderHorizontalStyle);
+
+		GUIElementStyle sliderVerticalBgStyle;
+		sliderVerticalBgStyle.fixedWidth = true;
+		sliderVerticalBgStyle.width = 10;
+		sliderVerticalBgStyle.normal.texture = getGUITexture(SliderVBackgroundTex);
+		sliderVerticalBgStyle.border.top = 4;
+		sliderVerticalBgStyle.border.bottom = 4;
+
+		skin->setStyle("SliderVertBg", sliderVerticalBgStyle);
+
+		GUIElementStyle sliderVerticalFillStyle;
+		sliderVerticalFillStyle.fixedWidth = true;
+		sliderVerticalFillStyle.width = 10;
+		sliderVerticalFillStyle.normal.texture = getGUITexture(SliderVFillTex);
+		sliderVerticalFillStyle.border.top = 6;
+		sliderVerticalFillStyle.border.bottom = 4;
+
+		skin->setStyle("SliderVertFill", sliderVerticalFillStyle);
+
+		GUIElementStyle sliderVerticalStyle;
+		sliderVerticalStyle.fixedWidth = true;
+		sliderVerticalStyle.width = 13;
+		sliderVerticalStyle.height = 150;
+		sliderVerticalStyle.minHeight = 10;
+		sliderVerticalStyle.subStyles[GUISlider::getHandleStyleType()] = GUISlider::getHandleStyleType();
+		sliderVerticalStyle.subStyles[GUISlider::getBackgroundStyleType()] = "SliderVertBg";
+		sliderVerticalStyle.subStyles[GUISlider::getFillStyleType()] = "SliderVertFill";
+
+		skin->setStyle(GUISliderVert::getGUITypeName(), sliderVerticalStyle);
+
+		/************************************************************************/
+		/* 							COLOR PICKER SLIDER                      	*/
+		/************************************************************************/
+
+		GUIElementStyle colorPickerSliderHorzHandleStyle;
+		colorPickerSliderHorzHandleStyle.fixedHeight = true;
+		colorPickerSliderHorzHandleStyle.fixedWidth = true;
+		colorPickerSliderHorzHandleStyle.height = 20;
+		colorPickerSliderHorzHandleStyle.width = 7;
+		colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
+		colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
+		colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
+
+		skin->setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
+
+		GUIElementStyle colorPickerSliderHorzStyle;
+		colorPickerSliderHorzStyle.fixedHeight = true;
+		colorPickerSliderHorzStyle.height = 32;
+		colorPickerSliderHorzStyle.minWidth = 20;
+		colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
+
+		skin->setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
+
+		GUIElementStyle colorPickerSliderVertHandleStyle;
+		colorPickerSliderVertHandleStyle.fixedHeight = true;
+		colorPickerSliderVertHandleStyle.fixedWidth = true;
+		colorPickerSliderVertHandleStyle.height = 7;
+		colorPickerSliderVertHandleStyle.width = 45;
+		colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
+		colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
+		colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
+
+		skin->setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
+
+		GUIElementStyle colorPickerSliderVertStyle;
+		colorPickerSliderVertStyle.fixedWidth = true;
+		colorPickerSliderVertStyle.width = 30;
+		colorPickerSliderVertStyle.minHeight = 20;
+		colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
+
+		skin->setStyle("ColorSliderVert", colorPickerSliderVertStyle);
+
+		GUIElementStyle colorPickerSlider2DHandleStyle;
+		colorPickerSlider2DHandleStyle.fixedHeight = true;
+		colorPickerSlider2DHandleStyle.fixedWidth = true;
+		colorPickerSlider2DHandleStyle.height = 7;
+		colorPickerSlider2DHandleStyle.width = 7;
+		colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
+		colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
+		colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
+
+		skin->setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
+
+		/************************************************************************/
+		/* 								STATUS BAR                      		*/
+		/************************************************************************/
+		GUIElementStyle statusBarBgStyle;
+		statusBarBgStyle.height = 16;
+		statusBarBgStyle.border.top = 2;
+		statusBarBgStyle.normal.texture = getGUITexture(StatusBarBgTex);
+
+		skin->setStyle(GUIStatusBar::getGUIBackgroundTypeName(), statusBarBgStyle);
+
+		GUIElementStyle statusBarMessageBtnStyle;
+		statusBarMessageBtnStyle.font = defaultFont;
+		statusBarMessageBtnStyle.fontSize = DefaultFontSize;
+		statusBarMessageBtnStyle.fixedHeight = true;
+		statusBarMessageBtnStyle.height = 16;
+		statusBarMessageBtnStyle.minWidth = 10;
+		statusBarMessageBtnStyle.textHorzAlign = THA_Left;
+		statusBarMessageBtnStyle.textVertAlign = TVA_Center;
+		statusBarMessageBtnStyle.imagePosition = GUIImagePosition::Left;
+
+		skin->setStyle(GUIStatusBar::getGUIMessageTypeName(), statusBarMessageBtnStyle);
+
+		GUIElementStyle statusBarStyle;
+		statusBarStyle.height = 16;
+
+		statusBarStyle.subStyles[GUIStatusBar::getGUIBackgroundTypeName()] = GUIStatusBar::getGUIBackgroundTypeName();
+		statusBarStyle.subStyles[GUIStatusBar::getGUIMessageTypeName()] = GUIStatusBar::getGUIMessageTypeName();
+
+		skin->setStyle(GUIStatusBar::getGUITypeName(), statusBarStyle);
+
+		/************************************************************************/
+		/* 									OTHER                      			*/
+		/************************************************************************/
+
+		// Centered label
+		GUIElementStyle centeredLabelStyle;
+		centeredLabelStyle.font = defaultFont;
+		centeredLabelStyle.fontSize = DefaultFontSize;
+		centeredLabelStyle.fixedWidth = false;
+		centeredLabelStyle.fixedHeight = true;
+		centeredLabelStyle.height = 11;
+		centeredLabelStyle.minWidth = 10;
+		centeredLabelStyle.textHorzAlign = THA_Center;
+		centeredLabelStyle.normal.textColor = TextNormalColor;
+
+		skin->setStyle("LabelCentered", centeredLabelStyle);
+
+		// Right-aligned label
+		GUIElementStyle rightAlignedLabelStyle;
+		rightAlignedLabelStyle.font = defaultFont;
+		rightAlignedLabelStyle.fontSize = DefaultFontSize;
+		rightAlignedLabelStyle.fixedWidth = false;
+		rightAlignedLabelStyle.fixedHeight = true;
+		rightAlignedLabelStyle.height = 11;
+		rightAlignedLabelStyle.minWidth = 10;
+		rightAlignedLabelStyle.textHorzAlign = THA_Right;
+		rightAlignedLabelStyle.normal.textColor = TextNormalColor;
+
+		skin->setStyle("RightAlignedLabel", rightAlignedLabelStyle);
+
+		// Multi-line label
+		GUIElementStyle multiLinelabelStyle;
+		multiLinelabelStyle.font = defaultFont;
+		multiLinelabelStyle.fontSize = DefaultFontSize;
+		multiLinelabelStyle.fixedWidth = false;
+		multiLinelabelStyle.fixedHeight = true;
+		multiLinelabelStyle.height = 11;
+		multiLinelabelStyle.minWidth = 10;
+		multiLinelabelStyle.wordWrap = true;
+		multiLinelabelStyle.normal.textColor = TextNormalColor;
+
+		skin->setStyle(BuiltinResources::MultiLineLabelStyle, multiLinelabelStyle);
+
+		// Multi-line centered label
+		GUIElementStyle multiLineCenteredLabelStyle;
+		multiLineCenteredLabelStyle.font = defaultFont;
+		multiLineCenteredLabelStyle.fontSize = DefaultFontSize;
+		multiLineCenteredLabelStyle.fixedWidth = false;
+		multiLineCenteredLabelStyle.fixedHeight = true;
+		multiLineCenteredLabelStyle.height = 11;
+		multiLineCenteredLabelStyle.minWidth = 10;
+		multiLineCenteredLabelStyle.wordWrap = true;
+		multiLineCenteredLabelStyle.textHorzAlign = THA_Center;
+		multiLineCenteredLabelStyle.normal.textColor = TextNormalColor;
+
+		skin->setStyle("MultiLineLabelCentered", multiLineCenteredLabelStyle);
+
+		// Title label
+		GUIElementStyle titleLabel;
+		titleLabel.font = defaultAAFont;
+		titleLabel.fontSize = TitleFontSize;
+		titleLabel.fixedWidth = false;
+		titleLabel.fixedHeight = true;
+		titleLabel.height = 20;
+		titleLabel.minWidth = 10;
+		titleLabel.wordWrap = true;
+		titleLabel.textHorzAlign = THA_Center;
+		titleLabel.normal.textColor = TextNormalColor;
+
+		skin->setStyle("TitleLabel", titleLabel);
+
+		// Selection area
+		GUIElementStyle selectionAreaStyle;
+		selectionAreaStyle.normal.texture = getGUITexture(SelectionAreaTex);
+		selectionAreaStyle.border.left = 1;
+		selectionAreaStyle.border.right = 1;
+		selectionAreaStyle.border.top = 1;
+		selectionAreaStyle.border.bottom = 1;
+
+		skin->setStyle("SelectionArea", selectionAreaStyle);
+
+		// Selectable label
+		GUIElementStyle selectableLabelStyle;
+		selectableLabelStyle.normalOn.texture = getGUITexture(SelectionBgTex);
+		selectableLabelStyle.hoverOn.texture = selectableLabelStyle.normalOn.texture;
+		selectableLabelStyle.activeOn.texture = selectableLabelStyle.normalOn.texture;
+		selectableLabelStyle.fixedHeight = true;
+		selectableLabelStyle.height = 11;
+		selectableLabelStyle.minWidth = 10;
+		selectableLabelStyle.font = defaultFont;
+		selectableLabelStyle.fontSize = DefaultFontSize;
+		selectableLabelStyle.textHorzAlign = THA_Left;
+		selectableLabelStyle.normal.textColor = TextNormalColor;
+
+		skin->setStyle("SelectableLabel", selectableLabelStyle);
+
+		// Scroll area background
+		GUIElementStyle scrollAreaBg;
+		scrollAreaBg.normal.texture = getGUITexture(ScrollAreaBgTex);
+		scrollAreaBg.minHeight = 6;
+		scrollAreaBg.minWidth = 4;
+		scrollAreaBg.border.left = 2;
+		scrollAreaBg.border.right = 2;
+		scrollAreaBg.border.top = 2;
+		scrollAreaBg.border.bottom = 4;
+		
+		skin->setStyle("ScrollAreaBg", scrollAreaBg);
+
+		// Inspector title area background
+		GUIElementStyle inspectorTitleBg;
+		inspectorTitleBg.normal.texture = getGUITexture(InspectorTitleBgTex);
+		inspectorTitleBg.minHeight = 4;
+		inspectorTitleBg.border.bottom = 2;
+
+		skin->setStyle("InspectorTitleBg", inspectorTitleBg);
+
+		// Inspector content background
+		GUIElementStyle inspectorContentBg;
+		inspectorContentBg.normal.texture = getGUITexture(InspectorContentBgTex);
+		inspectorContentBg.minWidth = 4;
+		inspectorContentBg.minHeight = 6;
+		inspectorContentBg.border.left = 2;
+		inspectorContentBg.border.right = 2;
+		inspectorContentBg.border.top = 2;
+		inspectorContentBg.border.bottom = 4;
+
+		skin->setStyle("InspectorContentBg", inspectorContentBg);
+
+		// Inspector content alternate background
+		GUIElementStyle inspectorContentBgAlternate;
+		inspectorContentBgAlternate.normal.texture = getGUITexture(InspectorContentBgAlternateTex);
+		inspectorContentBgAlternate.minWidth = 4;
+		inspectorContentBgAlternate.minHeight = 6;
+		inspectorContentBgAlternate.border.left = 2;
+		inspectorContentBgAlternate.border.right = 2;
+		inspectorContentBgAlternate.border.top = 2;
+		inspectorContentBgAlternate.border.bottom = 4;
+
+		skin->setStyle("InspectorContentBgAlternate", inspectorContentBgAlternate);
+
+		return skin;
+	}
+
+	HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name) const
+	{
+		Path texturePath = FileSystem::getWorkingDirectoryPath();
+		texturePath.append(EditorSkinFolder);
+		texturePath.append(L"sprite_" + name + L".asset");
+
+		return gResources().load<SpriteTexture>(texturePath);
+	}
+
+	HSpriteTexture BuiltinEditorResources::getGUIIcon(const WString& name) const
+	{
+		Path texturePath = FileSystem::getWorkingDirectoryPath();
+		texturePath.append(EditorIconFolder);
+		texturePath.append(L"sprite_" + name + L".asset");
+
+		return gResources().load<SpriteTexture>(texturePath);
+	}
+
+	HShader BuiltinEditorResources::getShader(const WString& name) const
+	{
+		Path programPath = EditorShaderFolder;
+		programPath.append(name + L".asset");
+
+		return gResources().load<Shader>(programPath);
+	}
+
+	HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
+	{
+		return Material::create(mShaderDockOverlay);
+	}
+
+	HMaterial BuiltinEditorResources::createSceneGridMaterial() const
+	{
+		return Material::create(mShaderSceneGrid);
+	}
+
+	HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
+	{
+		UINT32 modeIdx = (UINT32)cullMode;
+
+		return Material::create(mShaderPicking[modeIdx]);
+	}
+
+	HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
+	{
+		UINT32 modeIdx = (UINT32)cullMode;
+
+		return Material::create(mShaderPickingAlpha[modeIdx]);
+	}
+
+	HMaterial BuiltinEditorResources::createWireGizmoMat() const
+	{
+		return Material::create(mShaderGizmoWire);
+	}
+
+	HMaterial BuiltinEditorResources::createSolidGizmoMat() const
+	{
+		return Material::create(mShaderGizmoSolid);
+	}
+
+	HMaterial BuiltinEditorResources::createIconGizmoMat() const
+	{
+		return Material::create(mShaderGizmoIcon);
+	}
+
+	HMaterial BuiltinEditorResources::createGizmoPickingMat() const
+	{
+		return Material::create(mShaderGizmoPicking);
+	}
+
+	HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
+	{
+		return Material::create(mShaderGizmoAlphaPicking);
+	}
+
+	HMaterial BuiltinEditorResources::createWireHandleMat() const
+	{
+		return Material::create(mShaderHandleWire);
+	}
+
+	HMaterial BuiltinEditorResources::createTextGizmoMat() const
+	{
+		return Material::create(mShaderGizmoText);
+	}
+
+	HMaterial BuiltinEditorResources::createSolidHandleMat() const
+	{
+		return Material::create(mShaderHandleSolid);
+	}
+
+	HMaterial BuiltinEditorResources::createHandleClearAlphaMat() const
+	{
+		return Material::create(mShaderHandleClearAlpha);
+	}
+
+	HMaterial BuiltinEditorResources::createSelectionMat() const
+	{
+		return Material::create(mShaderSelection);
+	}
+
+	HSpriteTexture BuiltinEditorResources::getLibraryIcon(ProjectIcon icon, int size) const
+	{
+		WString iconName;
+
+		switch (icon)
+		{
+		case ProjectIcon::Folder:
+			iconName = FolderIconTex;
+			break;
+		case ProjectIcon::Font:
+			iconName = FontIconTex;
+			break;
+		case ProjectIcon::Mesh:
+			iconName = MeshIconTex;
+			break;
+		case ProjectIcon::Texture:
+			iconName = TextureIconTex;
+			break;
+		case ProjectIcon::PlainText:
+			iconName = PlainTextIconTex;
+			break;
+		case ProjectIcon::ScriptCode:
+			iconName = ScriptCodeIconTex;
+			break;
+		case ProjectIcon::Shader:
+			iconName = ShaderIconTex;
+			break;
+		case ProjectIcon::ShaderInclude:
+			iconName = ShaderIncludeIconTex;
+			break;
+		case ProjectIcon::Material:
+			iconName = MaterialIconTex;
+			break;
+		case ProjectIcon::SpriteTexture:
+			iconName = SpriteTextureIconTex;
+			break;
+		case ProjectIcon::Prefab:
+			iconName = PrefabIconTex;
+			break;
+		case ProjectIcon::GUISkin:
+			iconName = GUISkinIconTex;
+			break;
+		case ProjectIcon::PhysicsMaterial:
+			iconName = PhysicsMaterialIconTex;
+			break;
+		case ProjectIcon::PhysicsMesh:
+			iconName = PhysicsMeshIconTex;
+			break;
+		}
+
+		if (iconName.empty())
+			return HSpriteTexture();
+
+		if (size <= 16)
+			iconName += L"16";
+		else if (size <= 32)
+			iconName += L"32";
+		else if (size <= 48)
+			iconName += L"48";
+
+		return getGUIIcon(iconName);
+	}
+
+	HSpriteTexture BuiltinEditorResources::getToolbarIcon(ToolbarIcon icon) const
+	{
+		switch (icon)
+		{
+		case ToolbarIcon::NewCamera:
+			return getGUIIcon(L"ToolbarNewCameraIcon.png");
+		case ToolbarIcon::NewRenderable:
+			return getGUIIcon(L"ToolbarNewRenderableIcon.png");
+		case ToolbarIcon::NewPointLight:
+			return getGUIIcon(L"ToolbarNewPointLightIcon.png");
+		case ToolbarIcon::NewDirLight:
+			return getGUIIcon(L"ToolbarNewDirectionalLightIcon.png");
+		case ToolbarIcon::NewSpotLight:
+			return getGUIIcon(L"ToolbarNewSpotLightIcon.png");
+		case ToolbarIcon::NewSceneObject:
+			return getGUIIcon(L"ToolbarNewSceneObjectIcon.png");
+		case ToolbarIcon::NewCube:
+			return getGUIIcon(L"ToolbarNewCubeIcon.png");
+		case ToolbarIcon::NewSphere:
+			return getGUIIcon(L"ToolbarNewSphereIcon.png");
+		case ToolbarIcon::NewCone:
+			return getGUIIcon(L"ToolbarNewConeIcon.png");
+		case ToolbarIcon::NewQuad:
+			return getGUIIcon(L"ToolbarNewQuadIcon.png");
+		case ToolbarIcon::NewMat:
+			return getGUIIcon(L"ToolbarNewMaterialIcon.png");
+		case ToolbarIcon::NewCSScript:
+			return getGUIIcon(L"ToolbarNewCSScriptIcon.png");
+		case ToolbarIcon::NewShader:
+			return getGUIIcon(L"ToolbarNewShaderIcon.png");
+		case ToolbarIcon::NewSpriteTex:
+			return getGUIIcon(L"ToolbarNewSpriteTextureIcon.png");
+		case ToolbarIcon::Pause:
+			return getGUIIcon(L"ToolbarPauseIcon.png");
+		case ToolbarIcon::Play:
+			return getGUIIcon(L"ToolbarPlayIcon.png");
+		case ToolbarIcon::Step:
+			return getGUIIcon(L"ToolbarStepIcon.png");
+		case ToolbarIcon::Undo:
+			return getGUIIcon(L"ToolbarUndoIcon.png");
+		case ToolbarIcon::Redo:
+			return getGUIIcon(L"ToolbarRedoIcon.png");
+		case ToolbarIcon::OpenProject:
+			return getGUIIcon(L"ToolbarOpenProjectIcon.png");
+		case ToolbarIcon::SaveProject:
+			return getGUIIcon(L"ToolbarSaveProjectIcon.png");
+		case ToolbarIcon::SaveScene:
+			return getGUIIcon(L"ToolbarSaveSceneIcon.png");
+		}
+
+		return HSpriteTexture();
+	}
+
+	GUIContentImages BuiltinEditorResources::getSceneWindowIcon(SceneWindowIcon icon) const
+	{
+		HSpriteTexture off;
+		HSpriteTexture on;
+
+		switch (icon)
+		{
+		case SceneWindowIcon::View:
+			off = getGUIIcon(L"SceneViewIcon.png");
+			on = getGUIIcon(L"SceneViewIconOn.png");
+			break;
+		case SceneWindowIcon::Move:
+			off = getGUIIcon(L"SceneMoveIcon.png");
+			on = getGUIIcon(L"SceneMoveIconOn.png");
+			break;
+		case SceneWindowIcon::Rotate:
+			off = getGUIIcon(L"SceneRotateIcon.png");
+			on = getGUIIcon(L"SceneRotateIconOn.png");
+			break;
+		case SceneWindowIcon::Scale:
+			off = getGUIIcon(L"SceneScaleIcon.png");
+			on = getGUIIcon(L"SceneScaleIconOn.png");
+			break;
+		case SceneWindowIcon::Pivot:
+			off = getGUIIcon(L"ScenePivotIcon.png");
+			on = getGUIIcon(L"ScenePivotIconOn.png");
+			break;
+		case SceneWindowIcon::Center:
+			off = getGUIIcon(L"SceneCenterIcon.png");
+			on = getGUIIcon(L"SceneCenterIconOn.png");
+			break;
+		case SceneWindowIcon::Local:
+			off = getGUIIcon(L"SceneLocalIcon.png");
+			on = getGUIIcon(L"SceneLocalIconOn.png");
+			break;
+		case SceneWindowIcon::World:
+			off = getGUIIcon(L"SceneWorldIcon.png");
+			on = getGUIIcon(L"SceneWorldIconOn.png");
+			break;
+		case SceneWindowIcon::MoveSnap:
+			off = getGUIIcon(L"SceneMoveSnapIcon.png");
+			on = getGUIIcon(L"SceneMoveSnapIconOn.png");
+			break;
+		case SceneWindowIcon::RotateSnap:
+			off = getGUIIcon(L"SceneRotateSnapIcon.png");
+			on = getGUIIcon(L"SceneRotateSnapIconOn.png");
+			break;
+		}
+
+		GUIContentImages output;
+		output.normal = off;
+		output.hover = off;
+		output.active = on;
+		output.focused = off;
+		output.normalOn = on;
+		output.hoverOn = on;
+		output.activeOn = on;
+		output.focusedOn = on;
+
+		return output;
+	}
+
+	HSpriteTexture BuiltinEditorResources::getLibraryWindowIcon(LibraryWindowIcon icon) const
+	{
+		switch (icon)
+		{
+		case LibraryWindowIcon::Home:
+			return getGUIIcon(L"LibraryHomeIcon.png");
+		case LibraryWindowIcon::Up:
+			return getGUIIcon(L"LibraryUpIcon.png");
+		case LibraryWindowIcon::Clear:
+			return getGUIIcon(L"LibraryClearSearchIcon.png");
+		case LibraryWindowIcon::Options:
+			return getGUIIcon(L"LibraryOptionsIcon.png");
+		}
+
+		return HSpriteTexture();
+	}
+
+	HSpriteTexture BuiltinEditorResources::getInspectorWindowIcon(InspectorWindowIcon icon) const
+	{
+		switch (icon)
+		{
+		case InspectorWindowIcon::Create:
+			return getGUIIcon(L"InspectorCreateIcon.png");
+		case InspectorWindowIcon::Clone:
+			return getGUIIcon(L"InspectorCloneIcon.png");
+		case InspectorWindowIcon::Clear:
+			return getGUIIcon(L"InspectorClearIcon.png");
+		case InspectorWindowIcon::Resize:
+			return getGUIIcon(L"InspectorResizeIcon.png");
+		case InspectorWindowIcon::Delete:
+			return getGUIIcon(L"InspectorDeleteIcon.png");
+		case InspectorWindowIcon::MoveUp:
+			return getGUIIcon(L"InspectorMoveUpIcon.png");
+		case InspectorWindowIcon::MoveDown:
+			return getGUIIcon(L"InspectorMoveDownIcon.png");
+		case InspectorWindowIcon::Edit:
+			return getGUIIcon(L"InspectorEditIcon.png");
+		case InspectorWindowIcon::Apply:
+			return getGUIIcon(L"InspectorApplyIcon.png");
+		case InspectorWindowIcon::Add:
+			return getGUIIcon(L"InspectorAddIcon.png");
+		case InspectorWindowIcon::Cancel:
+			return getGUIIcon(L"InspectorCancelIcon.png");
+		}
+
+		return HSpriteTexture();
+	}
+
+	HSpriteTexture BuiltinEditorResources::getIcon(EditorIcon icon) const
+	{
+		switch (icon)
+		{
+		case EditorIcon::XBtn:
+			return getGUIIcon(XButtonNormalTex);
+		}
+
+		return HSpriteTexture();
+	}
+
+	HSpriteTexture BuiltinEditorResources::getLogMessageIcon(LogMessageIcon icon, UINT32 size, bool dark) const
+	{
+		if (size < 24) // Round to 16
+		{
+			if (dark)
+			{
+				switch (icon)
+				{
+				case LogMessageIcon::Info:
+					return getGUIIcon(L"IconInfoDark.png");
+				case LogMessageIcon::Warning:
+					return getGUIIcon(L"IconWarningDark.png");
+				case LogMessageIcon::Error:
+					return getGUIIcon(L"IconErrorDark.png");
+				}
+			}
+			else
+			{
+				switch (icon)
+				{
+				case LogMessageIcon::Info:
+					return getGUIIcon(L"IconInfo.png");
+				case LogMessageIcon::Warning:
+					return getGUIIcon(L"IconWarning.png");
+				case LogMessageIcon::Error:
+					return getGUIIcon(L"IconError.png");
+				}
+			}
+		}
+		else // Round to 32
+		{
+			switch (icon)
+			{
+			case LogMessageIcon::Info:
+				return getGUIIcon(L"IconInfo32.png");
+			case LogMessageIcon::Warning:
+				return getGUIIcon(L"IconWarning32.png");
+			case LogMessageIcon::Error:
+				return getGUIIcon(L"IconError32.png");
+			}
+		}
+
+		return HSpriteTexture();
+	}
+
+	WString BuiltinEditorResources::getEmptyShaderCode() const
+	{
+		Path filePath = FileSystem::getWorkingDirectoryPath();
+		filePath.append(BuiltinDataFolder);
+		filePath.append(EmptyShaderCodeFile);
+
+		DataStreamPtr fileStream = FileSystem::openFile(filePath);
+		if (fileStream != nullptr)
+			return fileStream->getAsWString();
+
+		return StringUtil::WBLANK;
+	}
+
+	WString BuiltinEditorResources::getEmptyCSScriptCode() const
+	{
+		Path filePath = FileSystem::getWorkingDirectoryPath();
+		filePath.append(BuiltinDataFolder);
+		filePath.append(EmptyCSScriptCodeFile);
+
+		DataStreamPtr fileStream = FileSystem::openFile(filePath);
+		if (fileStream != nullptr)
+			return fileStream->getAsWString();
+
+		return StringUtil::WBLANK;
+	}
+
+	Path BuiltinEditorResources::getShaderIncludeFolder()
+	{
+		return Paths::getRuntimeDataPath() + EDITOR_DATA_FOLDER + ShaderIncludeFolder;
+	}
+
+	Path BuiltinEditorResources::getDefaultWidgetLayoutPath()
+	{
+		return Paths::getRuntimeDataPath() + EDITOR_DATA_FOLDER + "Layout.asset";
+	}
 }

+ 1568 - 1559
Source/BansheeEditor/Source/BsProjectLibrary.cpp

@@ -1,1560 +1,1569 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsProjectLibrary.h"
-#include "BsFileSystem.h"
-#include "BsException.h"
-#include "BsResources.h"
-#include "BsResourceManifest.h"
-#include "BsImporter.h"
-#include "BsProjectResourceMeta.h"
-#include "BsResources.h"
-#include "BsImporter.h"
-#include "BsImportOptions.h"
-#include "BsFileSerializer.h"
-#include "BsDebug.h"
-#include "BsProjectLibraryEntries.h"
-#include "BsResource.h"
-#include "BsEditorApplication.h"
-#include "BsShader.h"
-#include <regex>
-
-using namespace std::placeholders;
-
-namespace BansheeEngine
-{
-	const Path ProjectLibrary::RESOURCES_DIR = L"Resources\\";
-	const Path ProjectLibrary::INTERNAL_RESOURCES_DIR = PROJECT_INTERNAL_DIR + GAME_RESOURCES_FOLDER_NAME;
-	const WString ProjectLibrary::LIBRARY_ENTRIES_FILENAME = L"ProjectLibrary.asset";
-	const WString ProjectLibrary::RESOURCE_MANIFEST_FILENAME = L"ResourceManifest.asset";
-
-	ProjectLibrary::LibraryEntry::LibraryEntry()
-		:parent(nullptr), type(LibraryEntryType::Directory)
-	{ }
-
-	ProjectLibrary::LibraryEntry::LibraryEntry(const Path& path, const WString& name, DirectoryEntry* parent, LibraryEntryType type)
-		:path(path), parent(parent), type(type), elementName(name)
-	{ }
-
-	ProjectLibrary::FileEntry::FileEntry()
-		: lastUpdateTime(0)
-	{ }
-
-	ProjectLibrary::FileEntry::FileEntry(const Path& path, const WString& name, DirectoryEntry* parent)
-		: LibraryEntry(path, name, parent, LibraryEntryType::File), lastUpdateTime(0)
-	{ }
-
-	ProjectLibrary::DirectoryEntry::DirectoryEntry()
-	{ }
-
-	ProjectLibrary::DirectoryEntry::DirectoryEntry(const Path& path, const WString& name, DirectoryEntry* parent)
-		:LibraryEntry(path, name, parent, LibraryEntryType::Directory)
-	{ }
-
-	ProjectLibrary::ProjectLibrary()
-		: mRootEntry(nullptr), mIsLoaded(false)
-	{
-		mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
-	}
-
-	ProjectLibrary::~ProjectLibrary()
-	{
-		clearEntries();
-	}
-
-	void ProjectLibrary::checkForModifications(const Path& fullPath)
-	{
-		Vector<Path> dirtyResources;
-		checkForModifications(fullPath, true, dirtyResources);
-	}
-
-	void ProjectLibrary::checkForModifications(const Path& fullPath, bool import, Vector<Path>& dirtyResources)
-	{
-		if (!mResourcesFolder.includes(fullPath))
-			return; // Folder not part of our resources path, so no modifications
-
-		if(mRootEntry == nullptr)
-		{
-			mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
-		}
-
-		Path pathToSearch = fullPath;
-		LibraryEntry* entry = findEntry(pathToSearch);
-		if (entry == nullptr) // File could be new, try to find parent directory entry
-		{
-			if (FileSystem::exists(pathToSearch))
-			{
-				if (isMeta(pathToSearch))
-				{
-					Path sourceFilePath = pathToSearch;
-					sourceFilePath.setExtension(L"");
-
-					if (!FileSystem::isFile(sourceFilePath))
-					{
-						LOGWRN("Found a .meta file without a corresponding resource. Deleting.");
-
-						FileSystem::remove(pathToSearch);
-					}
-				}
-				else
-				{
-					Path parentDirPath = pathToSearch.getParent();
-					entry = findEntry(parentDirPath);
-
-					// Cannot find parent directory. Create the needed hierarchy.
-					DirectoryEntry* entryParent = nullptr;
-					DirectoryEntry* newHierarchyParent = nullptr;
-					if (entry == nullptr)
-						createInternalParentHierarchy(pathToSearch, &newHierarchyParent, &entryParent);
-					else
-						entryParent = static_cast<DirectoryEntry*>(entry);
-
-					if (FileSystem::isFile(pathToSearch))
-					{
-						if (import)
-							addResourceInternal(entryParent, pathToSearch);
-
-						dirtyResources.push_back(pathToSearch);
-					}
-					else if (FileSystem::isDirectory(pathToSearch))
-					{
-						addDirectoryInternal(entryParent, pathToSearch);
-
-						checkForModifications(pathToSearch, import, dirtyResources);
-					}
-				}
-			}
-		}
-		else if(entry->type == LibraryEntryType::File)
-		{
-			if(FileSystem::isFile(entry->path))
-			{
-				FileEntry* resEntry = static_cast<FileEntry*>(entry);
-
-				if (import)
-					reimportResourceInternal(resEntry);
-
-				if (!isUpToDate(resEntry))
-					dirtyResources.push_back(entry->path);
-			}
-			else
-			{
-				deleteResourceInternal(static_cast<FileEntry*>(entry));
-			}
-		}
-		else if(entry->type == LibraryEntryType::Directory) // Check folder and all subfolders for modifications
-		{
-			if(!FileSystem::isDirectory(entry->path))
-			{
-				deleteDirectoryInternal(static_cast<DirectoryEntry*>(entry));
-			}
-			else
-			{
-				Stack<DirectoryEntry*> todo;
-				todo.push(static_cast<DirectoryEntry*>(entry));
-
-				Vector<Path> childFiles;
-				Vector<Path> childDirectories;
-				Vector<bool> existingEntries;
-				Vector<LibraryEntry*> toDelete;
-
-				while(!todo.empty())
-				{
-					DirectoryEntry* currentDir = todo.top();
-					todo.pop();
-
-					existingEntries.clear();
-					existingEntries.resize(currentDir->mChildren.size());
-					for(UINT32 i = 0; i < (UINT32)currentDir->mChildren.size(); i++)
-						existingEntries[i] = false;
-
-					childFiles.clear();
-					childDirectories.clear();
-
-					FileSystem::getChildren(currentDir->path, childFiles, childDirectories);
-			
-					for(auto& filePath : childFiles)
-					{
-						if(isMeta(filePath))
-						{
-							Path sourceFilePath = filePath;
-							sourceFilePath.setExtension(L"");
-
-							if(!FileSystem::isFile(sourceFilePath))
-							{
-								LOGWRN("Found a .meta file without a corresponding resource. Deleting.");
-
-								FileSystem::remove(filePath);
-							}
-						}
-						else
-						{
-							FileEntry* existingEntry = nullptr;
-							UINT32 idx = 0;
-							for(auto& child : currentDir->mChildren)
-							{
-								if(child->type == LibraryEntryType::File && child->path == filePath)
-								{
-									existingEntries[idx] = true;
-									existingEntry = static_cast<FileEntry*>(child);
-									break;
-								}
-
-								idx++;
-							}
-
-							if(existingEntry != nullptr)
-							{
-								if (import)
-									reimportResourceInternal(existingEntry);
-
-								if (!isUpToDate(existingEntry))
-									dirtyResources.push_back(existingEntry->path);
-							}
-							else
-							{
-								if (import)
-									addResourceInternal(currentDir, filePath);
-
-								dirtyResources.push_back(filePath);
-							}
-						}
-					}
-
-					for(auto& dirPath : childDirectories)
-					{
-						DirectoryEntry* existingEntry = nullptr;
-						UINT32 idx = 0;
-						for(auto& child : currentDir->mChildren)
-						{
-							if(child->type == LibraryEntryType::Directory && child->path == dirPath)
-							{
-								existingEntries[idx] = true;
-								existingEntry = static_cast<DirectoryEntry*>(child);
-								break;
-							}
-
-							idx++;
-						}
-
-						if(existingEntry == nullptr)
-							addDirectoryInternal(currentDir, dirPath);
-					}
-
-					{
-						for(UINT32 i = 0; i < (UINT32)existingEntries.size(); i++)
-						{
-							if(existingEntries[i])
-								continue;
-
-							toDelete.push_back(currentDir->mChildren[i]);
-						}
-
-						for(auto& child : toDelete)
-						{
-							if(child->type == LibraryEntryType::Directory)
-								deleteDirectoryInternal(static_cast<DirectoryEntry*>(child));
-							else if(child->type == LibraryEntryType::File)
-								deleteResourceInternal(static_cast<FileEntry*>(child));
-						}
-
-						toDelete.clear();
-					}
-
-					for(auto& child : currentDir->mChildren)
-					{
-						if(child->type == LibraryEntryType::Directory)
-							todo.push(static_cast<DirectoryEntry*>(child));
-					}
-				}
-			}
-		}
-	}
-
-	ProjectLibrary::FileEntry* ProjectLibrary::addResourceInternal(DirectoryEntry* parent, const Path& filePath, 
-		const ImportOptionsPtr& importOptions, bool forceReimport)
-	{
-		FileEntry* newResource = bs_new<FileEntry>(filePath, filePath.getWTail(), parent);
-		parent->mChildren.push_back(newResource);
-
-		reimportResourceInternal(newResource, importOptions, forceReimport);
-		onEntryAdded(newResource->path);
-
-		return newResource;
-	}
-
-	ProjectLibrary::DirectoryEntry* ProjectLibrary::addDirectoryInternal(DirectoryEntry* parent, const Path& dirPath)
-	{
-		DirectoryEntry* newEntry = bs_new<DirectoryEntry>(dirPath, dirPath.getWTail(), parent);
-		parent->mChildren.push_back(newEntry);
-
-		onEntryAdded(newEntry->path);
-		return newEntry;
-	}
-
-	void ProjectLibrary::deleteResourceInternal(FileEntry* resource)
-	{
-		if(resource->meta != nullptr)
-		{
-			auto& resourceMetas = resource->meta->getResourceMetaData();
-			for(auto& entry : resourceMetas)
-			{
-				String uuid = entry->getUUID();
-
-				Path path;
-				if (mResourceManifest->uuidToFilePath(uuid, path))
-				{
-					if (FileSystem::isFile(path))
-						FileSystem::remove(path);
-
-					mResourceManifest->unregisterResource(uuid);
-				}
-
-				mUUIDToPath.erase(uuid);
-			}
-		}
-
-		Path metaPath = getMetaPath(resource->path);
-		if (FileSystem::isFile(metaPath))
-			FileSystem::remove(metaPath);
-
-		DirectoryEntry* parent = resource->parent;
-		auto findIter = std::find_if(parent->mChildren.begin(), parent->mChildren.end(), 
-			[&] (const LibraryEntry* entry) { return entry == resource; });
-
-		parent->mChildren.erase(findIter);
-
-		Path originalPath = resource->path;
-		onEntryRemoved(originalPath);
-
-		removeDependencies(resource);
-		bs_delete(resource);
-
-		reimportDependants(originalPath);
-	}
-
-	void ProjectLibrary::deleteDirectoryInternal(DirectoryEntry* directory)
-	{
-		if(directory == mRootEntry)
-			mRootEntry = nullptr;
-
-		Vector<LibraryEntry*> childrenToDestroy = directory->mChildren;
-		for(auto& child : childrenToDestroy)
-		{
-			if(child->type == LibraryEntryType::Directory)
-				deleteDirectoryInternal(static_cast<DirectoryEntry*>(child));
-			else
-				deleteResourceInternal(static_cast<FileEntry*>(child));
-		}
-
-		DirectoryEntry* parent = directory->parent;
-		if(parent != nullptr)
-		{
-			auto findIter = std::find_if(parent->mChildren.begin(), parent->mChildren.end(), 
-				[&] (const LibraryEntry* entry) { return entry == directory; });
-
-			parent->mChildren.erase(findIter);
-		}
-
-		onEntryRemoved(directory->path);
-		bs_delete(directory);
-	}
-
-	void ProjectLibrary::reimportResourceInternal(FileEntry* fileEntry, const ImportOptionsPtr& importOptions,
-		bool forceReimport, bool pruneResourceMetas)
-	{
-		Path metaPath = fileEntry->path;
-		metaPath.setFilename(metaPath.getWFilename() + L".meta");
-
-		if(fileEntry->meta == nullptr)
-		{
-			if(FileSystem::isFile(metaPath))
-			{
-				FileDecoder fs(metaPath);
-				std::shared_ptr<IReflectable> loadedMeta = fs.decode();
-
-				if(loadedMeta != nullptr && loadedMeta->isDerivedFrom(ProjectFileMeta::getRTTIStatic()))
-				{
-					ProjectFileMetaPtr fileMeta = std::static_pointer_cast<ProjectFileMeta>(loadedMeta);
-					fileEntry->meta = fileMeta;
-
-					auto& resourceMetas = fileEntry->meta->getResourceMetaData();
-
-					if (resourceMetas.size() > 0)
-					{
-						mUUIDToPath[resourceMetas[0]->getUUID()] = fileEntry->path;
-						for (auto& entry : resourceMetas)
-							mUUIDToPath[entry->getUUID()] = fileEntry->path + entry->getUniqueName();
-					}
-				}
-			}
-		}
-
-		if (!isUpToDate(fileEntry) || forceReimport)
-		{
-			// Note: If resource is native we just copy it to the internal folder. We could avoid the copy and 
-			// load the resource directly from the Resources folder but that requires complicating library code.
-			bool isNativeResource = isNative(fileEntry->path);
-
-			ImportOptionsPtr curImportOptions = nullptr;
-			if (importOptions == nullptr && !isNativeResource)
-			{
-				if (fileEntry->meta != nullptr)
-					curImportOptions = fileEntry->meta->getImportOptions();
-				else
-					curImportOptions = Importer::instance().createImportOptions(fileEntry->path);
-			}
-			else
-				curImportOptions = importOptions;
-
-			Vector<SubResource> importedResources;
-			if (isNativeResource)
-			{
-				// If meta exists make sure it is registered in the manifest before load, otherwise it will get assigned a new UUID.
-				// This can happen if library isn't properly saved before exiting the application.
-				if (fileEntry->meta != nullptr)
-				{
-					auto& resourceMetas = fileEntry->meta->getResourceMetaData();
-					mResourceManifest->registerResource(resourceMetas[0]->getUUID(), fileEntry->path);
-				}
-
-				// Don't load dependencies because we don't need them, but also because they might not be in the manifest
-				// which would screw up their UUIDs.
-				importedResources.push_back({ L"primary", gResources().load(fileEntry->path, false, false) });
-			}
-
-			if(fileEntry->meta == nullptr)
-			{
-				if (!isNativeResource)
-					importedResources = Importer::instance().importAll(fileEntry->path, curImportOptions);
-
-				fileEntry->meta = ProjectFileMeta::create(curImportOptions);
-
-				if(importedResources.size() > 0)
-				{
-					HResource primary = importedResources[0].value;
-
-					mUUIDToPath[primary.getUUID()] = fileEntry->path;
-					for(auto& entry : importedResources)
-					{
-						ResourceMetaDataPtr subMeta = entry.value->getMetaData();
-						UINT32 typeId = entry.value->getTypeId();
-						const String& UUID = entry.value.getUUID();
-
-						ProjectResourceMetaPtr resMeta = ProjectResourceMeta::create(entry.name, UUID, typeId, subMeta);
-						fileEntry->meta->add(resMeta);
-
-						mUUIDToPath[UUID] = fileEntry->path + entry.name;
-					}
-				}
-
-				FileEncoder fs(metaPath);
-				fs.encode(fileEntry->meta.get());
-			}
-			else
-			{
-				removeDependencies(fileEntry);
-
-				if (!isNativeResource)
-				{
-					Vector<SubResourceRaw> importedResourcesRaw = gImporter()._importAllRaw(fileEntry->path, curImportOptions);
-					Vector<ProjectResourceMetaPtr> existingResourceMetas = fileEntry->meta->getResourceMetaData();
-					fileEntry->meta->clearResourceMetaData();
-
-					for(auto& resEntry : importedResourcesRaw)
-					{
-						bool foundMeta = false;
-						for (auto iter = existingResourceMetas.begin(); iter != existingResourceMetas.end(); ++iter)
-						{
-							ProjectResourceMetaPtr metaEntry = *iter;
-
-							if(resEntry.name == metaEntry->getUniqueName())
-							{
-								HResource importedResource = gResources()._getResourceHandle(metaEntry->getUUID());
-								gResources().update(importedResource, resEntry.value);
-
-								importedResources.push_back({ resEntry.name, importedResource });
-								fileEntry->meta->add(metaEntry);
-
-								existingResourceMetas.erase(iter);
-								foundMeta = true;
-								break;
-							}
-						}
-
-						if(!foundMeta)
-						{
-							HResource importedResource = gResources()._createResourceHandle(resEntry.value);
-							importedResources.push_back({ resEntry.name, importedResource });
-
-							ResourceMetaDataPtr subMeta = resEntry.value->getMetaData();
-							UINT32 typeId = resEntry.value->getTypeId();
-							const String& UUID = importedResource.getUUID();
-
-							ProjectResourceMetaPtr resMeta = ProjectResourceMeta::create(resEntry.name, UUID, typeId, subMeta);
-							fileEntry->meta->add(resMeta);
-						}
-					}
-
-					// Keep resource metas that we are not currently using, in case they get restored so their references
-					// don't get broken
-					if(!pruneResourceMetas)
-					{
-						for (auto& entry : existingResourceMetas)
-							fileEntry->meta->add(entry);
-					}
-				}
-
-				fileEntry->meta->mImportOptions = curImportOptions;
-
-				FileEncoder fs(metaPath);
-				fs.encode(fileEntry->meta.get());
-			}
-
-			addDependencies(fileEntry);
-
-			if (importedResources.size() > 0)
-			{
-				Path internalResourcesPath = mProjectFolder;
-				internalResourcesPath.append(INTERNAL_RESOURCES_DIR);
-
-				if (!FileSystem::isDirectory(internalResourcesPath))
-					FileSystem::createDir(internalResourcesPath);
-
-				for (auto& entry : importedResources)
-				{
-					internalResourcesPath.setFilename(toWString(entry.value.getUUID()) + L".asset");
-					gResources().save(entry.value, internalResourcesPath, true);
-
-					String uuid = entry.value.getUUID();
-					mResourceManifest->registerResource(uuid, internalResourcesPath);
-				}
-			}
-
-			fileEntry->lastUpdateTime = std::time(nullptr);
-
-			onEntryImported(fileEntry->path);
-			reimportDependants(fileEntry->path);
-		}
-	}
-
-	bool ProjectLibrary::isUpToDate(FileEntry* resource) const
-	{
-		if(resource->meta == nullptr)
-			return false;
-
-		auto& resourceMetas = resource->meta->getResourceMetaData();
-		for (auto& resMeta : resourceMetas)
-		{
-			Path internalPath;
-			if (!mResourceManifest->uuidToFilePath(resMeta->getUUID(), internalPath))
-				return false;
-
-			if (!FileSystem::isFile(internalPath))
-				return false;
-		}
-
-		std::time_t lastModifiedTime = FileSystem::getLastModifiedTime(resource->path);
-		return lastModifiedTime <= resource->lastUpdateTime;
-	}
-
-	Vector<ProjectLibrary::LibraryEntry*> ProjectLibrary::search(const WString& pattern)
-	{
-		return search(pattern, {});
-	}
-
-	Vector<ProjectLibrary::LibraryEntry*> ProjectLibrary::search(const WString& pattern, const Vector<UINT32>& typeIds)
-	{
-		Vector<LibraryEntry*> foundEntries;
-
-		std::wregex escape(L"[.^$|()\\[\\]{}*+?\\\\]");
-		WString replace(L"\\\\&");
-		WString escapedPattern = std::regex_replace(pattern, escape, replace, std::regex_constants::match_default | std::regex_constants::format_sed);
-
-		std::wregex wildcard(L"\\\\\\*");
-		WString wildcardReplace(L".*");
-		WString searchPattern = std::regex_replace(escapedPattern, wildcard, L".*");
-
-		std::wregex searchRegex(searchPattern, std::regex_constants::ECMAScript | std::regex_constants::icase);
-
-		Stack<DirectoryEntry*> todo;
-		todo.push(mRootEntry);
-		while (!todo.empty())
-		{
-			DirectoryEntry* dirEntry = todo.top();
-			todo.pop();
-
-			for (auto& child : dirEntry->mChildren)
-			{
-				if (std::regex_match(child->elementName, searchRegex))
-				{
-					if (typeIds.size() == 0)
-						foundEntries.push_back(child);
-					else
-					{
-						if (child->type == LibraryEntryType::File)
-						{
-							FileEntry* childFileEntry = static_cast<FileEntry*>(child);
-							if (childFileEntry->meta != nullptr)
-							{
-								auto& resourceMetas = childFileEntry->meta->getResourceMetaData();
-								for (auto& typeId : typeIds)
-								{
-									bool found = false;
-									for (auto& resMeta : resourceMetas)
-									{
-										if (resMeta->getTypeID() == typeId)
-										{
-											foundEntries.push_back(child);
-											found = true;
-											break;
-										}
-									}
-
-									if (found)
-										break;
-								}
-							}
-						}
-					}
-				}
-
-				if (child->type == LibraryEntryType::Directory)
-				{
-					DirectoryEntry* childDirEntry = static_cast<DirectoryEntry*>(child);
-					todo.push(childDirEntry);
-				}
-			}
-		}
-
-		std::sort(foundEntries.begin(), foundEntries.end(), 
-			[&](const LibraryEntry* a, const LibraryEntry* b) 
-		{ 
-			return a->elementName.compare(b->elementName) < 0;
-		});
-
-		return foundEntries;
-	}
-
-	ProjectLibrary::LibraryEntry* ProjectLibrary::findEntry(const Path& path) const
-	{
-		Path fullPath = path;
-		if (fullPath.isAbsolute())
-		{
-			if (!mResourcesFolder.includes(fullPath))
-				return nullptr;
-		}
-		else
-			fullPath.makeAbsolute(mResourcesFolder);
-
-		Path relPath = fullPath.getRelative(mRootEntry->path);
-		UINT32 numElems = relPath.getNumDirectories() + (relPath.isFile() ? 1 : 0);
-		UINT32 idx = 0;
-
-		LibraryEntry* current = mRootEntry;
-		while (current != nullptr)
-		{
-			if (idx == numElems)
-				return current;
-
-			WString curElem;
-			if (relPath.isFile() && idx == (numElems - 1))
-				curElem = relPath.getWFilename();
-			else
-				curElem = relPath[idx];
-
-			if (current->type == LibraryEntryType::Directory)
-			{
-				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(current);
-				current = nullptr;
-				for (auto& child : dirEntry->mChildren)
-				{
-					if (Path::comparePathElem(curElem, child->elementName))
-					{
-						idx++;
-						current = child;
-						break;
-					}
-				}
-			}
-			else // Found file
-			{
-				// If this is next to last element, next entry is assumed to be a sub-resource name, which we ignore
-				if (numElems >= 2 && idx == (numElems - 2))
-					return current;
-				else
-					break; // Not a valid path
-			}
-		}
-
-		return nullptr;
-	}
-
-	bool ProjectLibrary::isSubresource(const Path& path) const
-	{
-		UINT32 numElems = path.getNumDirectories() + (path.isFile() ? 1 : 0);
-
-		if (numElems <= 1)
-			return false;
-
-		Path filePath = path;
-		filePath.makeParent();
-
-		LibraryEntry* entry = findEntry(filePath);
-		if (entry != nullptr && entry->type == LibraryEntryType::File)
-			return true;
-
-		return false;
-	}
-
-	ProjectResourceMetaPtr ProjectLibrary::findResourceMeta(const Path& path) const
-	{
-		UINT32 numElems = path.getNumDirectories() + (path.isFile() ? 1 : 0);
-
-		// Check if it is a subresource path
-		if(numElems > 1)
-		{
-			Path filePath = path;
-			filePath.makeParent();
-
-			LibraryEntry* entry = findEntry(filePath);
-			if (entry == nullptr)
-				return nullptr;
-
-			// Entry is a subresource
-			if (entry->type == LibraryEntryType::File)
-			{
-				FileEntry* fileEntry = static_cast<FileEntry*>(entry);
-				if (fileEntry->meta == nullptr)
-					return nullptr;
-
-				auto& resourceMetas = fileEntry->meta->getResourceMetaData();
-				for(auto& resMeta : resourceMetas)
-				{
-					if (resMeta->getUniqueName() == path.getWTail())
-						return resMeta;
-				}
-
-				// Found the file but no subresource or meta information
-				return nullptr;
-			}
-			else // Entry not a subresource
-			{
-				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
-				for (auto& child : dirEntry->mChildren)
-				{
-					if (Path::comparePathElem(path.getWTail(), child->elementName))
-					{
-						if (child->type == LibraryEntryType::File)
-						{
-							FileEntry* fileEntry = static_cast<FileEntry*>(child);
-							if (fileEntry->meta == nullptr)
-								return nullptr;
-
-							return fileEntry->meta->getResourceMetaData()[0];
-						}
-					}
-				}
-
-				return nullptr;
-			}
-		}
-
-		// Not a subresource path, load directly
-		{
-			LibraryEntry* entry = findEntry(path);
-			if (entry == nullptr || entry->type == LibraryEntryType::Directory)
-				return nullptr;
-
-			FileEntry* fileEntry = static_cast<FileEntry*>(entry);
-			if (fileEntry->meta == nullptr)
-				return nullptr;
-
-			return fileEntry->meta->getResourceMetaData()[0];
-		}
-	}
-
-	Path ProjectLibrary::uuidToPath(const String& uuid) const
-	{
-		auto iterFind = mUUIDToPath.find(uuid);
-
-		if (iterFind != mUUIDToPath.end())
-			return iterFind->second;
-
-		return Path::BLANK;
-	}
-
-	void ProjectLibrary::createEntry(const HResource& resource, const Path& path)
-	{
-		if (resource == nullptr)
-			return;
-
-		Path assetPath = path;
-		if (path.isAbsolute())
-		{
-			if (!getResourcesFolder().includes(path))
-				return;
-
-			assetPath = path.getRelative(getResourcesFolder());
-		}
-
-		LibraryEntry* existingEntry = findEntry(assetPath);
-		if (existingEntry != nullptr)
-		{
-			LOGWRN("Resource already exists at the specified path : " + assetPath.toString() + ". Unable to save.");
-			return;
-		}
-
-		resource->setName(path.getWFilename(false));
-
-		Path absPath = assetPath.getAbsolute(getResourcesFolder());
-		Resources::instance().save(resource, absPath, false);
-		checkForModifications(absPath);
-	}
-
-	void ProjectLibrary::saveEntry(const HResource& resource)
-	{
-		if (resource == nullptr)
-			return;
-
-		Path filePath = uuidToPath(resource.getUUID());
-		filePath.makeAbsolute(getResourcesFolder());
-
-		Resources::instance().save(resource, filePath, true);
-		checkForModifications(filePath);
-	}
-
-	void ProjectLibrary::createFolderEntry(const Path& path)
-	{
-		Path fullPath = path;
-		if (fullPath.isAbsolute())
-		{
-			if (!mResourcesFolder.includes(fullPath))
-				return;
-		}
-		else
-			fullPath.makeAbsolute(mResourcesFolder);
-
-		if (FileSystem::isDirectory(fullPath))
-			return; // Already exists
-
-		FileSystem::createDir(fullPath);
-		Path parentPath = fullPath.getParent();
-
-		DirectoryEntry* newEntryParent = nullptr;
-		LibraryEntry* newEntryParentLib = findEntry(parentPath);
-		if (newEntryParentLib != nullptr)
-		{
-			assert(newEntryParentLib->type == LibraryEntryType::Directory);
-			newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
-		}
-
-		DirectoryEntry* newHierarchyParent = nullptr;
-		if (newEntryParent == nullptr) // New path parent doesn't exist, so we need to create the hierarchy
-			createInternalParentHierarchy(fullPath, &newHierarchyParent, &newEntryParent);
-
-		addDirectoryInternal(newEntryParent, fullPath);
-	}
-
-	void ProjectLibrary::moveEntry(const Path& oldPath, const Path& newPath, bool overwrite)
-	{
-		Path oldFullPath = oldPath;
-		if (!oldFullPath.isAbsolute())
-			oldFullPath.makeAbsolute(mResourcesFolder);
-
-		Path newFullPath = newPath;
-		if (!newFullPath.isAbsolute())
-			newFullPath.makeAbsolute(mResourcesFolder);
-
-		Path parentPath = newFullPath.getParent();
-		if (!FileSystem::isDirectory(parentPath))
-		{
-			LOGWRN("Move operation failed. Destination directory \"" + parentPath.toString() + "\" doesn't exist.");
-			return;
-		}
-
-		if(FileSystem::isFile(oldFullPath) || FileSystem::isDirectory(oldFullPath))
-			FileSystem::move(oldFullPath, newFullPath, overwrite);
-
-		Path oldMetaPath = getMetaPath(oldFullPath);
-		Path newMetaPath = getMetaPath(newFullPath);
-
-		LibraryEntry* oldEntry = findEntry(oldFullPath);
-		if(oldEntry != nullptr) // Moving from the Resources folder
-		{
-			// Moved outside of Resources, delete entry & meta file
-			if (!mResourcesFolder.includes(newFullPath))
-			{
-				if(oldEntry->type == LibraryEntryType::File)
-					deleteResourceInternal(static_cast<FileEntry*>(oldEntry));
-				else if(oldEntry->type == LibraryEntryType::Directory)
-					deleteDirectoryInternal(static_cast<DirectoryEntry*>(oldEntry));
-			}
-			else // Just moving internally
-			{
-				onEntryRemoved(oldEntry->path);
-
-				FileEntry* fileEntry = nullptr;
-				if (oldEntry->type == LibraryEntryType::File)
-				{
-					fileEntry = static_cast<FileEntry*>(oldEntry);
-					removeDependencies(fileEntry);
-
-					// Update uuid <-> path mapping
-					if(fileEntry->meta != nullptr)
-					{
-						auto& resourceMetas = fileEntry->meta->getResourceMetaData();
-
-						if (resourceMetas.size() > 0)
-						{
-							mUUIDToPath[resourceMetas[0]->getUUID()] = newFullPath;
-
-							for (auto& resMeta : resourceMetas)
-							{
-								const String& UUID = resMeta->getUUID();
-								mUUIDToPath[UUID] = newFullPath + resMeta->getUniqueName();
-							}
-						}
-					}
-				}
-
-				if(FileSystem::isFile(oldMetaPath))
-					FileSystem::move(oldMetaPath, newMetaPath);
-
-				DirectoryEntry* parent = oldEntry->parent;
-				auto findIter = std::find(parent->mChildren.begin(), parent->mChildren.end(), oldEntry);
-				if(findIter != parent->mChildren.end())
-					parent->mChildren.erase(findIter);
-
-				Path parentPath = newFullPath.getParent();
-
-				DirectoryEntry* newEntryParent = nullptr;
-				LibraryEntry* newEntryParentLib = findEntry(parentPath);
-				if(newEntryParentLib != nullptr)
-				{
-					assert(newEntryParentLib->type == LibraryEntryType::Directory);
-					newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
-				}
-
-				DirectoryEntry* newHierarchyParent = nullptr;
-				if(newEntryParent == nullptr) // New path parent doesn't exist, so we need to create the hierarchy
-					createInternalParentHierarchy(newFullPath, &newHierarchyParent, &newEntryParent);
-
-				newEntryParent->mChildren.push_back(oldEntry);
-				oldEntry->parent = newEntryParent;
-				oldEntry->path = newFullPath;
-				oldEntry->elementName = newFullPath.getWTail();
-
-				if(oldEntry->type == LibraryEntryType::Directory) // Update child paths
-				{
-					Stack<LibraryEntry*> todo;
-					todo.push(oldEntry);
-
-					while(!todo.empty())
-					{
-						LibraryEntry* curEntry = todo.top();
-						todo.pop();
-
-						DirectoryEntry* curDirEntry = static_cast<DirectoryEntry*>(curEntry);
-						for(auto& child : curDirEntry->mChildren)
-						{
-							child->path = child->parent->path;
-							child->path.append(child->elementName);
-
-							if(child->type == LibraryEntryType::Directory)
-								todo.push(child);
-						}
-					}
-				}
-
-				onEntryAdded(oldEntry->path);
-
-				if (fileEntry != nullptr)
-				{
-					reimportDependants(oldFullPath);
-					reimportDependants(newFullPath);
-				}
-			}
-		}
-		else // Moving from outside of the Resources folder (likely adding a new resource)
-		{
-			checkForModifications(newFullPath);
-		}
-	}
-
-	void ProjectLibrary::copyEntry(const Path& oldPath, const Path& newPath, bool overwrite)
-	{
-		Path oldFullPath = oldPath;
-		if (!oldFullPath.isAbsolute())
-			oldFullPath.makeAbsolute(mResourcesFolder);
-
-		Path newFullPath = newPath;
-		if (!newFullPath.isAbsolute())
-			newFullPath.makeAbsolute(mResourcesFolder);
-
-		if (!FileSystem::exists(oldFullPath))
-			return;
-
-		FileSystem::copy(oldFullPath, newFullPath, overwrite);
-
-		// Copying a file/folder outside of the Resources folder, no special handling needed
-		if (!mResourcesFolder.includes(newFullPath))
-			return;
-
-		Path parentPath = newFullPath.getParent();
-
-		DirectoryEntry* newEntryParent = nullptr;
-		LibraryEntry* newEntryParentLib = findEntry(parentPath);
-		if (newEntryParentLib != nullptr)
-		{
-			assert(newEntryParentLib->type == LibraryEntryType::Directory);
-			newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
-		}
-
-		// If the source is outside of Resources folder, just plain import the copy
-		LibraryEntry* oldEntry = findEntry(oldFullPath);
-		if (oldEntry == nullptr)
-		{
-			checkForModifications(newFullPath);
-			return;
-		}
-
-		// Both source and destination are within Resources folder, need to preserve import options on the copies
-		LibraryEntry* newEntry = nullptr;
-		if (FileSystem::isFile(newFullPath))
-		{
-			assert(oldEntry->type == LibraryEntryType::File);
-			FileEntry* oldResEntry = static_cast<FileEntry*>(oldEntry);
-
-			ImportOptionsPtr importOptions;
-			if (oldResEntry->meta != nullptr)
-				importOptions = oldResEntry->meta->getImportOptions();
-
-			newEntry = addResourceInternal(newEntryParent, newFullPath, importOptions, true);
-		}
-		else
-		{
-			assert(oldEntry->type == LibraryEntryType::File);
-			DirectoryEntry* oldDirEntry = static_cast<DirectoryEntry*>(oldEntry);
-
-			DirectoryEntry* newDirEntry = addDirectoryInternal(newEntryParent, newFullPath);
-			newEntry = newDirEntry;
-
-			Stack<std::tuple<DirectoryEntry*, DirectoryEntry*>> todo;
-			todo.push(std::make_tuple(oldDirEntry, newDirEntry));
-
-			while (!todo.empty())
-			{
-				auto current = todo.top();
-				todo.pop();
-
-				DirectoryEntry* sourceDir = std::get<0>(current);
-				DirectoryEntry* destDir = std::get<1>(current);
-
-				for (auto& child : sourceDir->mChildren)
-				{
-					Path childDestPath = destDir->path;
-					childDestPath.append(child->path.getWTail());
-
-					if (child->type == LibraryEntryType::File)
-					{
-						FileEntry* childResEntry = static_cast<FileEntry*>(child);
-
-						ImportOptionsPtr importOptions;
-						if (childResEntry->meta != nullptr)
-							importOptions = childResEntry->meta->getImportOptions();
-
-						addResourceInternal(destDir, childDestPath, importOptions, true);
-					}
-					else // Directory
-					{
-						DirectoryEntry* childSourceDirEntry = static_cast<DirectoryEntry*>(child);
-						DirectoryEntry* childDestDirEntry = addDirectoryInternal(destDir, childDestPath);
-
-						todo.push(std::make_tuple(childSourceDirEntry, childSourceDirEntry));
-					}
-				}
-			}
-		}
-	}
-
-	void ProjectLibrary::deleteEntry(const Path& path)
-	{
-		Path fullPath = path;
-		if (!fullPath.isAbsolute())
-			fullPath.makeAbsolute(mResourcesFolder);
-
-		if(FileSystem::exists(fullPath))
-			FileSystem::remove(fullPath);
-
-		LibraryEntry* entry = findEntry(fullPath);
-		if(entry != nullptr)
-		{
-			if(entry->type == LibraryEntryType::File)
-				deleteResourceInternal(static_cast<FileEntry*>(entry));
-			else if(entry->type == LibraryEntryType::Directory)
-				deleteDirectoryInternal(static_cast<DirectoryEntry*>(entry));
-		}
-	}
-
-	void ProjectLibrary::reimport(const Path& path, const ImportOptionsPtr& importOptions, bool forceReimport)
-	{
-		LibraryEntry* entry = findEntry(path);
-		if (entry != nullptr)
-		{
-			if (entry->type == LibraryEntryType::File)
-			{
-				FileEntry* resEntry = static_cast<FileEntry*>(entry);
-				reimportResourceInternal(resEntry, importOptions, forceReimport);
-			}
-		}
-	}
-
-	void ProjectLibrary::setIncludeInBuild(const Path& path, bool include)
-	{
-		LibraryEntry* entry = findEntry(path);
-
-		if (entry == nullptr || entry->type == LibraryEntryType::Directory)
-			return;
-
-		FileEntry* resEntry = static_cast<FileEntry*>(entry);
-		if (resEntry->meta == nullptr)
-			return;
-
-		resEntry->meta->setIncludeInBuild(include);
-
-		Path metaPath = resEntry->path;
-		metaPath.setFilename(metaPath.getWFilename() + L".meta");
-
-		FileEncoder fs(metaPath);
-		fs.encode(resEntry->meta.get());
-	}
-
-	Vector<ProjectLibrary::FileEntry*> ProjectLibrary::getResourcesForBuild() const
-	{
-		Vector<FileEntry*> output;
-
-		Stack<DirectoryEntry*> todo;
-		todo.push(mRootEntry);
-
-		while (!todo.empty())
-		{
-			DirectoryEntry* directory = todo.top();
-			todo.pop();
-
-			for (auto& child : directory->mChildren)
-			{
-				if (child->type == LibraryEntryType::File)
-				{
-					FileEntry* resEntry = static_cast<FileEntry*>(child);
-					if (resEntry->meta != nullptr && resEntry->meta->getIncludeInBuild())
-						output.push_back(resEntry);
-				}
-				else if (child->type == LibraryEntryType::Directory)
-				{
-					todo.push(static_cast<DirectoryEntry*>(child));
-				}
-			}
-		}
-
-		return output;
-	}
-
-	HResource ProjectLibrary::load(const Path& path)
-	{
-		ProjectResourceMetaPtr meta = findResourceMeta(path);
-		if (meta == nullptr)
-			return HResource();
-
-		String resUUID = meta->getUUID();
-		return gResources().loadFromUUID(resUUID);
-	}
-
-	void ProjectLibrary::createInternalParentHierarchy(const Path& fullPath, DirectoryEntry** newHierarchyRoot, DirectoryEntry** newHierarchyLeaf)
-	{
-		Path parentPath = fullPath;
-
-		DirectoryEntry* newEntryParent = nullptr;
-		Stack<Path> parentPaths;
-		do 
-		{
-			Path newParentPath = parentPath.getParent();
-
-			if(newParentPath == parentPath)
-				break;
-
-			LibraryEntry* newEntryParentLib = findEntry(newParentPath);
-			if(newEntryParentLib != nullptr)
-			{
-				assert(newEntryParentLib->type == LibraryEntryType::Directory);
-				newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
-
-				break;
-			}
-
-			parentPaths.push(newParentPath);
-			parentPath = newParentPath;
-
-		} while (true);
-
-		assert(newEntryParent != nullptr); // Must exist
-
-		if(newHierarchyRoot != nullptr)
-			*newHierarchyRoot = newEntryParent;
-
-		while(!parentPaths.empty())
-		{
-			Path curPath = parentPaths.top();
-			parentPaths.pop();
-
-			newEntryParent = addDirectoryInternal(newEntryParent, curPath);
-		}
-
-		if(newHierarchyLeaf != nullptr)
-			*newHierarchyLeaf = newEntryParent;
-	}
-
-	Path ProjectLibrary::getMetaPath(const Path& path) const
-	{
-		Path metaPath = path;
-		metaPath.setFilename(metaPath.getWFilename() + L".meta");
-
-		return metaPath;
-	}
-
-	bool ProjectLibrary::isMeta(const Path& fullPath) const
-	{
-		return fullPath.getWExtension() == L".meta";
-	}
-
-	bool ProjectLibrary::isNative(const Path& path) const
-	{
-		WString extension = path.getWExtension();
-
-		return extension == L".asset" || extension == L".prefab";
-	}
-
-	void ProjectLibrary::unloadLibrary()
-	{
-		if (!mIsLoaded)
-			return;
-
-		mProjectFolder = Path::BLANK;
-		mResourcesFolder = Path::BLANK;
-
-		clearEntries();
-		mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
-
-		mDependencies.clear();
-		gResources().unregisterResourceManifest(mResourceManifest);
-		mResourceManifest = nullptr;
-		mIsLoaded = false;
-	}
-
-	void ProjectLibrary::makeEntriesRelative()
-	{
-		// Make all paths relative before saving
-		std::function<void(LibraryEntry*, const Path&)> makeRelative =
-			[&](LibraryEntry* entry, const Path& root)
-		{
-			entry->path.makeRelative(root);
-
-			if (entry->type == LibraryEntryType::Directory)
-			{
-				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
-				for (auto& child : dirEntry->mChildren)
-					makeRelative(child, root);
-			}
-		};
-
-		Path root = getResourcesFolder();
-		makeRelative(mRootEntry, root);
-	}
-
-	void ProjectLibrary::makeEntriesAbsolute()
-	{
-		std::function<void(LibraryEntry*, const Path&)> makeAbsolute =
-			[&](LibraryEntry* entry, const Path& root)
-		{
-			entry->path.makeAbsolute(root);
-
-			if (entry->type == LibraryEntryType::Directory)
-			{
-				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
-				for (auto& child : dirEntry->mChildren)
-					makeAbsolute(child, root);
-			}
-		};
-
-		Path root = getResourcesFolder();
-		makeAbsolute(mRootEntry, root);
-	}
-
-	void ProjectLibrary::saveLibrary()
-	{
-		if (!mIsLoaded)
-			return;
-
-		// Make all paths relative before saving
-		makeEntriesRelative();		
-		std::shared_ptr<ProjectLibraryEntries> libEntries = ProjectLibraryEntries::create(*mRootEntry);
-
-		Path libraryEntriesPath = mProjectFolder;
-		libraryEntriesPath.append(PROJECT_INTERNAL_DIR);
-		libraryEntriesPath.append(LIBRARY_ENTRIES_FILENAME);
-
-		FileEncoder fs(libraryEntriesPath);
-		fs.encode(libEntries.get());
-
-		// Restore absolute entry paths
-		makeEntriesAbsolute();
-
-		Path resourceManifestPath = mProjectFolder;
-		resourceManifestPath.append(PROJECT_INTERNAL_DIR);
-		resourceManifestPath.append(RESOURCE_MANIFEST_FILENAME);
-
-		ResourceManifest::save(mResourceManifest, resourceManifestPath, mProjectFolder);
-	}
-
-	void ProjectLibrary::loadLibrary()
-	{
-		unloadLibrary();
-
-		mProjectFolder = gEditorApplication().getProjectPath();
-		mResourcesFolder = mProjectFolder;
-		mResourcesFolder.append(RESOURCES_DIR);
-
-		mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
-
-		Path libraryEntriesPath = mProjectFolder;
-		libraryEntriesPath.append(PROJECT_INTERNAL_DIR);
-		libraryEntriesPath.append(LIBRARY_ENTRIES_FILENAME);
-
-		if(FileSystem::exists(libraryEntriesPath))
-		{
-			FileDecoder fs(libraryEntriesPath);
-			std::shared_ptr<ProjectLibraryEntries> libEntries = std::static_pointer_cast<ProjectLibraryEntries>(fs.decode());
-
-			*mRootEntry = libEntries->getRootEntry();
-			for(auto& child : mRootEntry->mChildren)
-				child->parent = mRootEntry;
-
-			mRootEntry->parent = nullptr;
-		}
-
-		// Entries are stored relative to project folder, but we want their absolute paths now
-		makeEntriesAbsolute();
-
-		// Load resource manifest
-		Path resourceManifestPath = mProjectFolder;
-		resourceManifestPath.append(PROJECT_INTERNAL_DIR);
-		resourceManifestPath.append(RESOURCE_MANIFEST_FILENAME);
-
-		if (FileSystem::exists(resourceManifestPath))
-			mResourceManifest = ResourceManifest::load(resourceManifestPath, mProjectFolder);
-		else
-			mResourceManifest = ResourceManifest::create("ProjectLibrary");
-
-		gResources().registerResourceManifest(mResourceManifest);
-
-		// Load all meta files
-		Stack<DirectoryEntry*> todo;
-		todo.push(mRootEntry);
-
-		Vector<LibraryEntry*> deletedEntries;
-
-		while(!todo.empty())
-		{
-			DirectoryEntry* curDir = todo.top();
-			todo.pop();
-
-			for(auto& child : curDir->mChildren)
-			{
-				if(child->type == LibraryEntryType::File)
-				{
-					FileEntry* resEntry = static_cast<FileEntry*>(child);
-					
-					if (FileSystem::isFile(resEntry->path))
-					{
-						if (resEntry->meta == nullptr)
-						{
-							Path metaPath = resEntry->path;
-							metaPath.setFilename(metaPath.getWFilename() + L".meta");
-
-							if (FileSystem::isFile(metaPath))
-							{
-								FileDecoder fs(metaPath);
-								std::shared_ptr<IReflectable> loadedMeta = fs.decode();
-
-								if (loadedMeta != nullptr && loadedMeta->isDerivedFrom(ProjectFileMeta::getRTTIStatic()))
-								{
-									ProjectFileMetaPtr fileMeta = std::static_pointer_cast<ProjectFileMeta>(loadedMeta);
-									resEntry->meta = fileMeta;
-								}
-							}
-						}
-
-						if (resEntry->meta != nullptr)
-						{
-							auto& resourceMetas = resEntry->meta->getResourceMetaData();
-
-							if (resourceMetas.size() > 0)
-							{
-								mUUIDToPath[resourceMetas[0]->getUUID()] = resEntry->path;
-
-								for (auto& entry : resourceMetas)
-									mUUIDToPath[entry->getUUID()] = resEntry->path + entry->getUniqueName();
-							}
-						}
-
-						addDependencies(resEntry);
-					}
-					else
-						deletedEntries.push_back(resEntry);
-				}
-				else if(child->type == LibraryEntryType::Directory)
-				{
-					if (FileSystem::isDirectory(child->path))
-						todo.push(static_cast<DirectoryEntry*>(child));
-					else
-						deletedEntries.push_back(child);
-				}
-			}
-		}
-
-		// Remove entries that no longer have corresponding files
-		for (auto& deletedEntry : deletedEntries)
-		{
-			if (deletedEntry->type == LibraryEntryType::File)
-			{
-				FileEntry* resEntry = static_cast<FileEntry*>(deletedEntry);
-				deleteResourceInternal(resEntry);
-			}
-			else
-			{
-				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(deletedEntry);
-				deleteDirectoryInternal(dirEntry);
-			}
-		}
-
-		// Clean up internal library folder from obsolete files
-		Path internalResourcesFolder = mProjectFolder;
-		internalResourcesFolder.append(INTERNAL_RESOURCES_DIR);
-
-		Vector<Path> toDelete;
-		auto processFile = [&](const Path& file)
-		{
-			String uuid = file.getFilename(false);
-			if (mUUIDToPath.find(uuid) == mUUIDToPath.end())
-			{
-				mResourceManifest->unregisterResource(uuid);
-				toDelete.push_back(file);
-			}
-
-			return true;
-		};
-
-		FileSystem::iterate(internalResourcesFolder, processFile);
-
-		for (auto& entry : toDelete)
-			FileSystem::remove(entry);
-
-		mIsLoaded = true;
-	}
-
-	void ProjectLibrary::clearEntries()
-	{
-		if (mRootEntry == nullptr)
-			return;
-
-		std::function<void(LibraryEntry*)> deleteRecursive =
-			[&](LibraryEntry* entry)
-		{
-			if (entry->type == LibraryEntryType::Directory)
-			{
-				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
-
-				for (auto& child : dirEntry->mChildren)
-					deleteRecursive(child);
-			}
-
-			bs_delete(entry);
-		};
-
-		deleteRecursive(mRootEntry);
-		mRootEntry = nullptr;
-	}
-
-	Vector<Path> ProjectLibrary::getImportDependencies(const FileEntry* entry)
-	{
-		Vector<Path> output;
-
-		if (entry->meta == nullptr)
-			return output;
-
-		auto& resourceMetas = entry->meta->getResourceMetaData();
-		for(auto& resMeta : resourceMetas)
-		{
-			if (resMeta->getTypeID() == TID_Shader)
-			{
-				SPtr<ShaderMetaData> metaData = std::static_pointer_cast<ShaderMetaData>(resMeta->getResourceMetaData());
-
-				for (auto& include : metaData->includes)
-					output.push_back(include);
-			}
-		}
-
-		return output;
-	}
-
-	void ProjectLibrary::addDependencies(const FileEntry* entry)
-	{
-		Vector<Path> dependencies = getImportDependencies(entry);
-		for (auto& dependency : dependencies)
-			mDependencies[dependency].push_back(entry->path);
-	}
-
-	void ProjectLibrary::removeDependencies(const FileEntry* entry)
-	{
-		Vector<Path> dependencies = getImportDependencies(entry);
-		for (auto& dependency : dependencies)
-		{
-			Vector<Path>& curDependencies = mDependencies[dependency];
-			auto iterRemove = std::remove_if(curDependencies.begin(), curDependencies.end(),
-				[&](const Path& x)
-			{
-				return x == entry->path;
-			});
-
-			curDependencies.erase(iterRemove, curDependencies.end());
-		}
-	}
-
-	void ProjectLibrary::reimportDependants(const Path& entryPath)
-	{
-		auto iterFind = mDependencies.find(entryPath);
-		if (iterFind == mDependencies.end())
-			return;
-
-		// Make a copy since we might modify this list during reimport
-		Vector<Path> dependencies = iterFind->second;
-		for (auto& dependency : dependencies)
-		{
-			LibraryEntry* entry = findEntry(dependency);
-			if (entry != nullptr && entry->type == LibraryEntryType::File)
-			{
-				FileEntry* resEntry = static_cast<FileEntry*>(entry);
-
-				ImportOptionsPtr importOptions;
-				if (resEntry->meta != nullptr)
-					importOptions = resEntry->meta->getImportOptions();
-
-				reimportResourceInternal(resEntry, importOptions, true);
-			}
-		}
-	}
-
-	BS_ED_EXPORT ProjectLibrary& gProjectLibrary()
-	{
-		return ProjectLibrary::instance();
-	}
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsProjectLibrary.h"
+#include "BsFileSystem.h"
+#include "BsException.h"
+#include "BsResources.h"
+#include "BsResourceManifest.h"
+#include "BsImporter.h"
+#include "BsProjectResourceMeta.h"
+#include "BsResources.h"
+#include "BsImporter.h"
+#include "BsImportOptions.h"
+#include "BsFileSerializer.h"
+#include "BsDebug.h"
+#include "BsProjectLibraryEntries.h"
+#include "BsResource.h"
+#include "BsEditorApplication.h"
+#include "BsShader.h"
+#include <regex>
+
+using namespace std::placeholders;
+
+namespace BansheeEngine
+{
+	const Path ProjectLibrary::RESOURCES_DIR = L"Resources\\";
+	const Path ProjectLibrary::INTERNAL_RESOURCES_DIR = PROJECT_INTERNAL_DIR + GAME_RESOURCES_FOLDER_NAME;
+	const WString ProjectLibrary::LIBRARY_ENTRIES_FILENAME = L"ProjectLibrary.asset";
+	const WString ProjectLibrary::RESOURCE_MANIFEST_FILENAME = L"ResourceManifest.asset";
+
+	ProjectLibrary::LibraryEntry::LibraryEntry()
+		:parent(nullptr), type(LibraryEntryType::Directory)
+	{ }
+
+	ProjectLibrary::LibraryEntry::LibraryEntry(const Path& path, const WString& name, DirectoryEntry* parent, LibraryEntryType type)
+		:path(path), parent(parent), type(type), elementName(name)
+	{ }
+
+	ProjectLibrary::FileEntry::FileEntry()
+		: lastUpdateTime(0)
+	{ }
+
+	ProjectLibrary::FileEntry::FileEntry(const Path& path, const WString& name, DirectoryEntry* parent)
+		: LibraryEntry(path, name, parent, LibraryEntryType::File), lastUpdateTime(0)
+	{ }
+
+	ProjectLibrary::DirectoryEntry::DirectoryEntry()
+	{ }
+
+	ProjectLibrary::DirectoryEntry::DirectoryEntry(const Path& path, const WString& name, DirectoryEntry* parent)
+		:LibraryEntry(path, name, parent, LibraryEntryType::Directory)
+	{ }
+
+	ProjectLibrary::ProjectLibrary()
+		: mRootEntry(nullptr), mIsLoaded(false)
+	{
+		mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
+	}
+
+	ProjectLibrary::~ProjectLibrary()
+	{
+		clearEntries();
+	}
+
+	void ProjectLibrary::checkForModifications(const Path& fullPath)
+	{
+		Vector<Path> dirtyResources;
+		checkForModifications(fullPath, true, dirtyResources);
+	}
+
+	void ProjectLibrary::checkForModifications(const Path& fullPath, bool import, Vector<Path>& dirtyResources)
+	{
+		if (!mResourcesFolder.includes(fullPath))
+			return; // Folder not part of our resources path, so no modifications
+
+		if(mRootEntry == nullptr)
+		{
+			mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
+		}
+
+		Path pathToSearch = fullPath;
+		LibraryEntry* entry = findEntry(pathToSearch);
+		if (entry == nullptr) // File could be new, try to find parent directory entry
+		{
+			if (FileSystem::exists(pathToSearch))
+			{
+				if (isMeta(pathToSearch))
+				{
+					Path sourceFilePath = pathToSearch;
+					sourceFilePath.setExtension(L"");
+
+					if (!FileSystem::isFile(sourceFilePath))
+					{
+						LOGWRN("Found a .meta file without a corresponding resource. Deleting.");
+
+						FileSystem::remove(pathToSearch);
+					}
+				}
+				else
+				{
+					Path parentDirPath = pathToSearch.getParent();
+					entry = findEntry(parentDirPath);
+
+					// Cannot find parent directory. Create the needed hierarchy.
+					DirectoryEntry* entryParent = nullptr;
+					DirectoryEntry* newHierarchyParent = nullptr;
+					if (entry == nullptr)
+						createInternalParentHierarchy(pathToSearch, &newHierarchyParent, &entryParent);
+					else
+						entryParent = static_cast<DirectoryEntry*>(entry);
+
+					if (FileSystem::isFile(pathToSearch))
+					{
+						if (import)
+							addResourceInternal(entryParent, pathToSearch);
+
+						dirtyResources.push_back(pathToSearch);
+					}
+					else if (FileSystem::isDirectory(pathToSearch))
+					{
+						addDirectoryInternal(entryParent, pathToSearch);
+
+						checkForModifications(pathToSearch, import, dirtyResources);
+					}
+				}
+			}
+		}
+		else if(entry->type == LibraryEntryType::File)
+		{
+			if(FileSystem::isFile(entry->path))
+			{
+				FileEntry* resEntry = static_cast<FileEntry*>(entry);
+
+				if (import)
+					reimportResourceInternal(resEntry);
+
+				if (!isUpToDate(resEntry))
+					dirtyResources.push_back(entry->path);
+			}
+			else
+			{
+				deleteResourceInternal(static_cast<FileEntry*>(entry));
+			}
+		}
+		else if(entry->type == LibraryEntryType::Directory) // Check folder and all subfolders for modifications
+		{
+			if(!FileSystem::isDirectory(entry->path))
+			{
+				deleteDirectoryInternal(static_cast<DirectoryEntry*>(entry));
+			}
+			else
+			{
+				Stack<DirectoryEntry*> todo;
+				todo.push(static_cast<DirectoryEntry*>(entry));
+
+				Vector<Path> childFiles;
+				Vector<Path> childDirectories;
+				Vector<bool> existingEntries;
+				Vector<LibraryEntry*> toDelete;
+
+				while(!todo.empty())
+				{
+					DirectoryEntry* currentDir = todo.top();
+					todo.pop();
+
+					existingEntries.clear();
+					existingEntries.resize(currentDir->mChildren.size());
+					for(UINT32 i = 0; i < (UINT32)currentDir->mChildren.size(); i++)
+						existingEntries[i] = false;
+
+					childFiles.clear();
+					childDirectories.clear();
+
+					FileSystem::getChildren(currentDir->path, childFiles, childDirectories);
+			
+					for(auto& filePath : childFiles)
+					{
+						if(isMeta(filePath))
+						{
+							Path sourceFilePath = filePath;
+							sourceFilePath.setExtension(L"");
+
+							if(!FileSystem::isFile(sourceFilePath))
+							{
+								LOGWRN("Found a .meta file without a corresponding resource. Deleting.");
+
+								FileSystem::remove(filePath);
+							}
+						}
+						else
+						{
+							FileEntry* existingEntry = nullptr;
+							UINT32 idx = 0;
+							for(auto& child : currentDir->mChildren)
+							{
+								if(child->type == LibraryEntryType::File && child->path == filePath)
+								{
+									existingEntries[idx] = true;
+									existingEntry = static_cast<FileEntry*>(child);
+									break;
+								}
+
+								idx++;
+							}
+
+							if(existingEntry != nullptr)
+							{
+								if (import)
+									reimportResourceInternal(existingEntry);
+
+								if (!isUpToDate(existingEntry))
+									dirtyResources.push_back(existingEntry->path);
+							}
+							else
+							{
+								if (import)
+									addResourceInternal(currentDir, filePath);
+
+								dirtyResources.push_back(filePath);
+							}
+						}
+					}
+
+					for(auto& dirPath : childDirectories)
+					{
+						DirectoryEntry* existingEntry = nullptr;
+						UINT32 idx = 0;
+						for(auto& child : currentDir->mChildren)
+						{
+							if(child->type == LibraryEntryType::Directory && child->path == dirPath)
+							{
+								existingEntries[idx] = true;
+								existingEntry = static_cast<DirectoryEntry*>(child);
+								break;
+							}
+
+							idx++;
+						}
+
+						if(existingEntry == nullptr)
+							addDirectoryInternal(currentDir, dirPath);
+					}
+
+					{
+						for(UINT32 i = 0; i < (UINT32)existingEntries.size(); i++)
+						{
+							if(existingEntries[i])
+								continue;
+
+							toDelete.push_back(currentDir->mChildren[i]);
+						}
+
+						for(auto& child : toDelete)
+						{
+							if(child->type == LibraryEntryType::Directory)
+								deleteDirectoryInternal(static_cast<DirectoryEntry*>(child));
+							else if(child->type == LibraryEntryType::File)
+								deleteResourceInternal(static_cast<FileEntry*>(child));
+						}
+
+						toDelete.clear();
+					}
+
+					for(auto& child : currentDir->mChildren)
+					{
+						if(child->type == LibraryEntryType::Directory)
+							todo.push(static_cast<DirectoryEntry*>(child));
+					}
+				}
+			}
+		}
+	}
+
+	ProjectLibrary::FileEntry* ProjectLibrary::addResourceInternal(DirectoryEntry* parent, const Path& filePath, 
+		const ImportOptionsPtr& importOptions, bool forceReimport)
+	{
+		FileEntry* newResource = bs_new<FileEntry>(filePath, filePath.getWTail(), parent);
+		parent->mChildren.push_back(newResource);
+
+		reimportResourceInternal(newResource, importOptions, forceReimport);
+		onEntryAdded(newResource->path);
+
+		return newResource;
+	}
+
+	ProjectLibrary::DirectoryEntry* ProjectLibrary::addDirectoryInternal(DirectoryEntry* parent, const Path& dirPath)
+	{
+		DirectoryEntry* newEntry = bs_new<DirectoryEntry>(dirPath, dirPath.getWTail(), parent);
+		parent->mChildren.push_back(newEntry);
+
+		onEntryAdded(newEntry->path);
+		return newEntry;
+	}
+
+	void ProjectLibrary::deleteResourceInternal(FileEntry* resource)
+	{
+		if(resource->meta != nullptr)
+		{
+			auto& resourceMetas = resource->meta->getResourceMetaData();
+			for(auto& entry : resourceMetas)
+			{
+				String uuid = entry->getUUID();
+
+				Path path;
+				if (mResourceManifest->uuidToFilePath(uuid, path))
+				{
+					if (FileSystem::isFile(path))
+						FileSystem::remove(path);
+
+					mResourceManifest->unregisterResource(uuid);
+				}
+
+				mUUIDToPath.erase(uuid);
+			}
+		}
+
+		Path metaPath = getMetaPath(resource->path);
+		if (FileSystem::isFile(metaPath))
+			FileSystem::remove(metaPath);
+
+		DirectoryEntry* parent = resource->parent;
+		auto findIter = std::find_if(parent->mChildren.begin(), parent->mChildren.end(), 
+			[&] (const LibraryEntry* entry) { return entry == resource; });
+
+		parent->mChildren.erase(findIter);
+
+		Path originalPath = resource->path;
+		onEntryRemoved(originalPath);
+
+		removeDependencies(resource);
+		bs_delete(resource);
+
+		reimportDependants(originalPath);
+	}
+
+	void ProjectLibrary::deleteDirectoryInternal(DirectoryEntry* directory)
+	{
+		if(directory == mRootEntry)
+			mRootEntry = nullptr;
+
+		Vector<LibraryEntry*> childrenToDestroy = directory->mChildren;
+		for(auto& child : childrenToDestroy)
+		{
+			if(child->type == LibraryEntryType::Directory)
+				deleteDirectoryInternal(static_cast<DirectoryEntry*>(child));
+			else
+				deleteResourceInternal(static_cast<FileEntry*>(child));
+		}
+
+		DirectoryEntry* parent = directory->parent;
+		if(parent != nullptr)
+		{
+			auto findIter = std::find_if(parent->mChildren.begin(), parent->mChildren.end(), 
+				[&] (const LibraryEntry* entry) { return entry == directory; });
+
+			parent->mChildren.erase(findIter);
+		}
+
+		onEntryRemoved(directory->path);
+		bs_delete(directory);
+	}
+
+	void ProjectLibrary::reimportResourceInternal(FileEntry* fileEntry, const ImportOptionsPtr& importOptions,
+		bool forceReimport, bool pruneResourceMetas)
+	{
+		Path metaPath = fileEntry->path;
+		metaPath.setFilename(metaPath.getWFilename() + L".meta");
+
+		if(fileEntry->meta == nullptr)
+		{
+			if(FileSystem::isFile(metaPath))
+			{
+				FileDecoder fs(metaPath);
+				std::shared_ptr<IReflectable> loadedMeta = fs.decode();
+
+				if(loadedMeta != nullptr && loadedMeta->isDerivedFrom(ProjectFileMeta::getRTTIStatic()))
+				{
+					ProjectFileMetaPtr fileMeta = std::static_pointer_cast<ProjectFileMeta>(loadedMeta);
+					fileEntry->meta = fileMeta;
+
+					auto& resourceMetas = fileEntry->meta->getResourceMetaData();
+
+					if (resourceMetas.size() > 0)
+					{
+						mUUIDToPath[resourceMetas[0]->getUUID()] = fileEntry->path;
+
+						for (UINT32 i = 1; i < (UINT32)resourceMetas.size(); i++)
+						{
+							ProjectResourceMetaPtr entry = resourceMetas[i];
+							mUUIDToPath[entry->getUUID()] = fileEntry->path + entry->getUniqueName();
+						}
+					}
+				}
+			}
+		}
+
+		if (!isUpToDate(fileEntry) || forceReimport)
+		{
+			// Note: If resource is native we just copy it to the internal folder. We could avoid the copy and 
+			// load the resource directly from the Resources folder but that requires complicating library code.
+			bool isNativeResource = isNative(fileEntry->path);
+
+			ImportOptionsPtr curImportOptions = nullptr;
+			if (importOptions == nullptr && !isNativeResource)
+			{
+				if (fileEntry->meta != nullptr)
+					curImportOptions = fileEntry->meta->getImportOptions();
+				else
+					curImportOptions = Importer::instance().createImportOptions(fileEntry->path);
+			}
+			else
+				curImportOptions = importOptions;
+
+			Vector<SubResource> importedResources;
+			if (isNativeResource)
+			{
+				// If meta exists make sure it is registered in the manifest before load, otherwise it will get assigned a new UUID.
+				// This can happen if library isn't properly saved before exiting the application.
+				if (fileEntry->meta != nullptr)
+				{
+					auto& resourceMetas = fileEntry->meta->getResourceMetaData();
+					mResourceManifest->registerResource(resourceMetas[0]->getUUID(), fileEntry->path);
+				}
+
+				// Don't load dependencies because we don't need them, but also because they might not be in the manifest
+				// which would screw up their UUIDs.
+				importedResources.push_back({ L"primary", gResources().load(fileEntry->path, false, false) });
+			}
+
+			if(fileEntry->meta == nullptr)
+			{
+				if (!isNativeResource)
+					importedResources = Importer::instance().importAll(fileEntry->path, curImportOptions);
+
+				fileEntry->meta = ProjectFileMeta::create(curImportOptions);
+
+				if(importedResources.size() > 0)
+				{
+					HResource primary = importedResources[0].value;
+
+					mUUIDToPath[primary.getUUID()] = fileEntry->path;
+					for(auto& entry : importedResources)
+					{
+						ResourceMetaDataPtr subMeta = entry.value->getMetaData();
+						UINT32 typeId = entry.value->getTypeId();
+						const String& UUID = entry.value.getUUID();
+
+						ProjectResourceMetaPtr resMeta = ProjectResourceMeta::create(entry.name, UUID, typeId, subMeta);
+						fileEntry->meta->add(resMeta);
+
+						mUUIDToPath[UUID] = fileEntry->path + entry.name;
+					}
+				}
+
+				FileEncoder fs(metaPath);
+				fs.encode(fileEntry->meta.get());
+			}
+			else
+			{
+				removeDependencies(fileEntry);
+
+				if (!isNativeResource)
+				{
+					Vector<SubResourceRaw> importedResourcesRaw = gImporter()._importAllRaw(fileEntry->path, curImportOptions);
+					Vector<ProjectResourceMetaPtr> existingResourceMetas = fileEntry->meta->getResourceMetaData();
+					fileEntry->meta->clearResourceMetaData();
+
+					for(auto& resEntry : importedResourcesRaw)
+					{
+						bool foundMeta = false;
+						for (auto iter = existingResourceMetas.begin(); iter != existingResourceMetas.end(); ++iter)
+						{
+							ProjectResourceMetaPtr metaEntry = *iter;
+
+							if(resEntry.name == metaEntry->getUniqueName())
+							{
+								HResource importedResource = gResources()._getResourceHandle(metaEntry->getUUID());
+								gResources().update(importedResource, resEntry.value);
+
+								importedResources.push_back({ resEntry.name, importedResource });
+								fileEntry->meta->add(metaEntry);
+
+								existingResourceMetas.erase(iter);
+								foundMeta = true;
+								break;
+							}
+						}
+
+						if(!foundMeta)
+						{
+							HResource importedResource = gResources()._createResourceHandle(resEntry.value);
+							importedResources.push_back({ resEntry.name, importedResource });
+
+							ResourceMetaDataPtr subMeta = resEntry.value->getMetaData();
+							UINT32 typeId = resEntry.value->getTypeId();
+							const String& UUID = importedResource.getUUID();
+
+							ProjectResourceMetaPtr resMeta = ProjectResourceMeta::create(resEntry.name, UUID, typeId, subMeta);
+							fileEntry->meta->add(resMeta);
+						}
+					}
+
+					// Keep resource metas that we are not currently using, in case they get restored so their references
+					// don't get broken
+					if(!pruneResourceMetas)
+					{
+						for (auto& entry : existingResourceMetas)
+							fileEntry->meta->add(entry);
+					}
+				}
+
+				fileEntry->meta->mImportOptions = curImportOptions;
+
+				FileEncoder fs(metaPath);
+				fs.encode(fileEntry->meta.get());
+			}
+
+			addDependencies(fileEntry);
+
+			if (importedResources.size() > 0)
+			{
+				Path internalResourcesPath = mProjectFolder;
+				internalResourcesPath.append(INTERNAL_RESOURCES_DIR);
+
+				if (!FileSystem::isDirectory(internalResourcesPath))
+					FileSystem::createDir(internalResourcesPath);
+
+				for (auto& entry : importedResources)
+				{
+					internalResourcesPath.setFilename(toWString(entry.value.getUUID()) + L".asset");
+					gResources().save(entry.value, internalResourcesPath, true);
+
+					String uuid = entry.value.getUUID();
+					mResourceManifest->registerResource(uuid, internalResourcesPath);
+				}
+			}
+
+			fileEntry->lastUpdateTime = std::time(nullptr);
+
+			onEntryImported(fileEntry->path);
+			reimportDependants(fileEntry->path);
+		}
+	}
+
+	bool ProjectLibrary::isUpToDate(FileEntry* resource) const
+	{
+		if(resource->meta == nullptr)
+			return false;
+
+		auto& resourceMetas = resource->meta->getResourceMetaData();
+		for (auto& resMeta : resourceMetas)
+		{
+			Path internalPath;
+			if (!mResourceManifest->uuidToFilePath(resMeta->getUUID(), internalPath))
+				return false;
+
+			if (!FileSystem::isFile(internalPath))
+				return false;
+		}
+
+		std::time_t lastModifiedTime = FileSystem::getLastModifiedTime(resource->path);
+		return lastModifiedTime <= resource->lastUpdateTime;
+	}
+
+	Vector<ProjectLibrary::LibraryEntry*> ProjectLibrary::search(const WString& pattern)
+	{
+		return search(pattern, {});
+	}
+
+	Vector<ProjectLibrary::LibraryEntry*> ProjectLibrary::search(const WString& pattern, const Vector<UINT32>& typeIds)
+	{
+		Vector<LibraryEntry*> foundEntries;
+
+		std::wregex escape(L"[.^$|()\\[\\]{}*+?\\\\]");
+		WString replace(L"\\\\&");
+		WString escapedPattern = std::regex_replace(pattern, escape, replace, std::regex_constants::match_default | std::regex_constants::format_sed);
+
+		std::wregex wildcard(L"\\\\\\*");
+		WString wildcardReplace(L".*");
+		WString searchPattern = std::regex_replace(escapedPattern, wildcard, L".*");
+
+		std::wregex searchRegex(searchPattern, std::regex_constants::ECMAScript | std::regex_constants::icase);
+
+		Stack<DirectoryEntry*> todo;
+		todo.push(mRootEntry);
+		while (!todo.empty())
+		{
+			DirectoryEntry* dirEntry = todo.top();
+			todo.pop();
+
+			for (auto& child : dirEntry->mChildren)
+			{
+				if (std::regex_match(child->elementName, searchRegex))
+				{
+					if (typeIds.size() == 0)
+						foundEntries.push_back(child);
+					else
+					{
+						if (child->type == LibraryEntryType::File)
+						{
+							FileEntry* childFileEntry = static_cast<FileEntry*>(child);
+							if (childFileEntry->meta != nullptr)
+							{
+								auto& resourceMetas = childFileEntry->meta->getResourceMetaData();
+								for (auto& typeId : typeIds)
+								{
+									bool found = false;
+									for (auto& resMeta : resourceMetas)
+									{
+										if (resMeta->getTypeID() == typeId)
+										{
+											foundEntries.push_back(child);
+											found = true;
+											break;
+										}
+									}
+
+									if (found)
+										break;
+								}
+							}
+						}
+					}
+				}
+
+				if (child->type == LibraryEntryType::Directory)
+				{
+					DirectoryEntry* childDirEntry = static_cast<DirectoryEntry*>(child);
+					todo.push(childDirEntry);
+				}
+			}
+		}
+
+		std::sort(foundEntries.begin(), foundEntries.end(), 
+			[&](const LibraryEntry* a, const LibraryEntry* b) 
+		{ 
+			return a->elementName.compare(b->elementName) < 0;
+		});
+
+		return foundEntries;
+	}
+
+	ProjectLibrary::LibraryEntry* ProjectLibrary::findEntry(const Path& path) const
+	{
+		Path fullPath = path;
+		if (fullPath.isAbsolute())
+		{
+			if (!mResourcesFolder.includes(fullPath))
+				return nullptr;
+		}
+		else
+			fullPath.makeAbsolute(mResourcesFolder);
+
+		Path relPath = fullPath.getRelative(mRootEntry->path);
+		UINT32 numElems = relPath.getNumDirectories() + (relPath.isFile() ? 1 : 0);
+		UINT32 idx = 0;
+
+		LibraryEntry* current = mRootEntry;
+		while (current != nullptr)
+		{
+			if (idx == numElems)
+				return current;
+
+			WString curElem;
+			if (relPath.isFile() && idx == (numElems - 1))
+				curElem = relPath.getWFilename();
+			else
+				curElem = relPath[idx];
+
+			if (current->type == LibraryEntryType::Directory)
+			{
+				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(current);
+				current = nullptr;
+				for (auto& child : dirEntry->mChildren)
+				{
+					if (Path::comparePathElem(curElem, child->elementName))
+					{
+						idx++;
+						current = child;
+						break;
+					}
+				}
+			}
+			else // Found file
+			{
+				// If this is next to last element, next entry is assumed to be a sub-resource name, which we ignore
+				if (idx == (numElems - 1))
+					return current;
+				else
+					break; // Not a valid path
+			}
+		}
+
+		return nullptr;
+	}
+
+	bool ProjectLibrary::isSubresource(const Path& path) const
+	{
+		UINT32 numElems = path.getNumDirectories() + (path.isFile() ? 1 : 0);
+
+		if (numElems <= 1)
+			return false;
+
+		Path filePath = path;
+		filePath.makeParent();
+
+		LibraryEntry* entry = findEntry(filePath);
+		if (entry != nullptr && entry->type == LibraryEntryType::File)
+			return true;
+
+		return false;
+	}
+
+	ProjectResourceMetaPtr ProjectLibrary::findResourceMeta(const Path& path) const
+	{
+		UINT32 numElems = path.getNumDirectories() + (path.isFile() ? 1 : 0);
+
+		// Check if it is a subresource path
+		if(numElems > 1)
+		{
+			Path filePath = path;
+			filePath.makeParent();
+
+			LibraryEntry* entry = findEntry(filePath);
+			if (entry == nullptr)
+				return nullptr;
+
+			// Entry is a subresource
+			if (entry->type == LibraryEntryType::File)
+			{
+				FileEntry* fileEntry = static_cast<FileEntry*>(entry);
+				if (fileEntry->meta == nullptr)
+					return nullptr;
+
+				auto& resourceMetas = fileEntry->meta->getResourceMetaData();
+				for(auto& resMeta : resourceMetas)
+				{
+					if (resMeta->getUniqueName() == path.getWTail())
+						return resMeta;
+				}
+
+				// Found the file but no subresource or meta information
+				return nullptr;
+			}
+			else // Entry not a subresource
+			{
+				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
+				for (auto& child : dirEntry->mChildren)
+				{
+					if (Path::comparePathElem(path.getWTail(), child->elementName))
+					{
+						if (child->type == LibraryEntryType::File)
+						{
+							FileEntry* fileEntry = static_cast<FileEntry*>(child);
+							if (fileEntry->meta == nullptr)
+								return nullptr;
+
+							return fileEntry->meta->getResourceMetaData()[0];
+						}
+					}
+				}
+
+				return nullptr;
+			}
+		}
+
+		// Not a subresource path, load directly
+		{
+			LibraryEntry* entry = findEntry(path);
+			if (entry == nullptr || entry->type == LibraryEntryType::Directory)
+				return nullptr;
+
+			FileEntry* fileEntry = static_cast<FileEntry*>(entry);
+			if (fileEntry->meta == nullptr)
+				return nullptr;
+
+			return fileEntry->meta->getResourceMetaData()[0];
+		}
+	}
+
+	Path ProjectLibrary::uuidToPath(const String& uuid) const
+	{
+		auto iterFind = mUUIDToPath.find(uuid);
+
+		if (iterFind != mUUIDToPath.end())
+			return iterFind->second;
+
+		return Path::BLANK;
+	}
+
+	void ProjectLibrary::createEntry(const HResource& resource, const Path& path)
+	{
+		if (resource == nullptr)
+			return;
+
+		Path assetPath = path;
+		if (path.isAbsolute())
+		{
+			if (!getResourcesFolder().includes(path))
+				return;
+
+			assetPath = path.getRelative(getResourcesFolder());
+		}
+
+		LibraryEntry* existingEntry = findEntry(assetPath);
+		if (existingEntry != nullptr)
+		{
+			LOGWRN("Resource already exists at the specified path : " + assetPath.toString() + ". Unable to save.");
+			return;
+		}
+
+		resource->setName(path.getWFilename(false));
+
+		Path absPath = assetPath.getAbsolute(getResourcesFolder());
+		Resources::instance().save(resource, absPath, false);
+		checkForModifications(absPath);
+	}
+
+	void ProjectLibrary::saveEntry(const HResource& resource)
+	{
+		if (resource == nullptr)
+			return;
+
+		Path filePath = uuidToPath(resource.getUUID());
+		filePath.makeAbsolute(getResourcesFolder());
+
+		Resources::instance().save(resource, filePath, true);
+		checkForModifications(filePath);
+	}
+
+	void ProjectLibrary::createFolderEntry(const Path& path)
+	{
+		Path fullPath = path;
+		if (fullPath.isAbsolute())
+		{
+			if (!mResourcesFolder.includes(fullPath))
+				return;
+		}
+		else
+			fullPath.makeAbsolute(mResourcesFolder);
+
+		if (FileSystem::isDirectory(fullPath))
+			return; // Already exists
+
+		FileSystem::createDir(fullPath);
+		Path parentPath = fullPath.getParent();
+
+		DirectoryEntry* newEntryParent = nullptr;
+		LibraryEntry* newEntryParentLib = findEntry(parentPath);
+		if (newEntryParentLib != nullptr)
+		{
+			assert(newEntryParentLib->type == LibraryEntryType::Directory);
+			newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
+		}
+
+		DirectoryEntry* newHierarchyParent = nullptr;
+		if (newEntryParent == nullptr) // New path parent doesn't exist, so we need to create the hierarchy
+			createInternalParentHierarchy(fullPath, &newHierarchyParent, &newEntryParent);
+
+		addDirectoryInternal(newEntryParent, fullPath);
+	}
+
+	void ProjectLibrary::moveEntry(const Path& oldPath, const Path& newPath, bool overwrite)
+	{
+		Path oldFullPath = oldPath;
+		if (!oldFullPath.isAbsolute())
+			oldFullPath.makeAbsolute(mResourcesFolder);
+
+		Path newFullPath = newPath;
+		if (!newFullPath.isAbsolute())
+			newFullPath.makeAbsolute(mResourcesFolder);
+
+		Path parentPath = newFullPath.getParent();
+		if (!FileSystem::isDirectory(parentPath))
+		{
+			LOGWRN("Move operation failed. Destination directory \"" + parentPath.toString() + "\" doesn't exist.");
+			return;
+		}
+
+		if(FileSystem::isFile(oldFullPath) || FileSystem::isDirectory(oldFullPath))
+			FileSystem::move(oldFullPath, newFullPath, overwrite);
+
+		Path oldMetaPath = getMetaPath(oldFullPath);
+		Path newMetaPath = getMetaPath(newFullPath);
+
+		LibraryEntry* oldEntry = findEntry(oldFullPath);
+		if(oldEntry != nullptr) // Moving from the Resources folder
+		{
+			// Moved outside of Resources, delete entry & meta file
+			if (!mResourcesFolder.includes(newFullPath))
+			{
+				if(oldEntry->type == LibraryEntryType::File)
+					deleteResourceInternal(static_cast<FileEntry*>(oldEntry));
+				else if(oldEntry->type == LibraryEntryType::Directory)
+					deleteDirectoryInternal(static_cast<DirectoryEntry*>(oldEntry));
+			}
+			else // Just moving internally
+			{
+				onEntryRemoved(oldEntry->path);
+
+				FileEntry* fileEntry = nullptr;
+				if (oldEntry->type == LibraryEntryType::File)
+				{
+					fileEntry = static_cast<FileEntry*>(oldEntry);
+					removeDependencies(fileEntry);
+
+					// Update uuid <-> path mapping
+					if(fileEntry->meta != nullptr)
+					{
+						auto& resourceMetas = fileEntry->meta->getResourceMetaData();
+
+						if (resourceMetas.size() > 0)
+						{
+							mUUIDToPath[resourceMetas[0]->getUUID()] = newFullPath;
+
+							for (UINT32 i = 1; i < (UINT32)resourceMetas.size(); i++)
+							{
+								ProjectResourceMetaPtr resMeta = resourceMetas[i];
+
+								const String& UUID = resMeta->getUUID();
+								mUUIDToPath[UUID] = newFullPath + resMeta->getUniqueName();
+							}
+						}
+					}
+				}
+
+				if(FileSystem::isFile(oldMetaPath))
+					FileSystem::move(oldMetaPath, newMetaPath);
+
+				DirectoryEntry* parent = oldEntry->parent;
+				auto findIter = std::find(parent->mChildren.begin(), parent->mChildren.end(), oldEntry);
+				if(findIter != parent->mChildren.end())
+					parent->mChildren.erase(findIter);
+
+				Path parentPath = newFullPath.getParent();
+
+				DirectoryEntry* newEntryParent = nullptr;
+				LibraryEntry* newEntryParentLib = findEntry(parentPath);
+				if(newEntryParentLib != nullptr)
+				{
+					assert(newEntryParentLib->type == LibraryEntryType::Directory);
+					newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
+				}
+
+				DirectoryEntry* newHierarchyParent = nullptr;
+				if(newEntryParent == nullptr) // New path parent doesn't exist, so we need to create the hierarchy
+					createInternalParentHierarchy(newFullPath, &newHierarchyParent, &newEntryParent);
+
+				newEntryParent->mChildren.push_back(oldEntry);
+				oldEntry->parent = newEntryParent;
+				oldEntry->path = newFullPath;
+				oldEntry->elementName = newFullPath.getWTail();
+
+				if(oldEntry->type == LibraryEntryType::Directory) // Update child paths
+				{
+					Stack<LibraryEntry*> todo;
+					todo.push(oldEntry);
+
+					while(!todo.empty())
+					{
+						LibraryEntry* curEntry = todo.top();
+						todo.pop();
+
+						DirectoryEntry* curDirEntry = static_cast<DirectoryEntry*>(curEntry);
+						for(auto& child : curDirEntry->mChildren)
+						{
+							child->path = child->parent->path;
+							child->path.append(child->elementName);
+
+							if(child->type == LibraryEntryType::Directory)
+								todo.push(child);
+						}
+					}
+				}
+
+				onEntryAdded(oldEntry->path);
+
+				if (fileEntry != nullptr)
+				{
+					reimportDependants(oldFullPath);
+					reimportDependants(newFullPath);
+				}
+			}
+		}
+		else // Moving from outside of the Resources folder (likely adding a new resource)
+		{
+			checkForModifications(newFullPath);
+		}
+	}
+
+	void ProjectLibrary::copyEntry(const Path& oldPath, const Path& newPath, bool overwrite)
+	{
+		Path oldFullPath = oldPath;
+		if (!oldFullPath.isAbsolute())
+			oldFullPath.makeAbsolute(mResourcesFolder);
+
+		Path newFullPath = newPath;
+		if (!newFullPath.isAbsolute())
+			newFullPath.makeAbsolute(mResourcesFolder);
+
+		if (!FileSystem::exists(oldFullPath))
+			return;
+
+		FileSystem::copy(oldFullPath, newFullPath, overwrite);
+
+		// Copying a file/folder outside of the Resources folder, no special handling needed
+		if (!mResourcesFolder.includes(newFullPath))
+			return;
+
+		Path parentPath = newFullPath.getParent();
+
+		DirectoryEntry* newEntryParent = nullptr;
+		LibraryEntry* newEntryParentLib = findEntry(parentPath);
+		if (newEntryParentLib != nullptr)
+		{
+			assert(newEntryParentLib->type == LibraryEntryType::Directory);
+			newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
+		}
+
+		// If the source is outside of Resources folder, just plain import the copy
+		LibraryEntry* oldEntry = findEntry(oldFullPath);
+		if (oldEntry == nullptr)
+		{
+			checkForModifications(newFullPath);
+			return;
+		}
+
+		// Both source and destination are within Resources folder, need to preserve import options on the copies
+		LibraryEntry* newEntry = nullptr;
+		if (FileSystem::isFile(newFullPath))
+		{
+			assert(oldEntry->type == LibraryEntryType::File);
+			FileEntry* oldResEntry = static_cast<FileEntry*>(oldEntry);
+
+			ImportOptionsPtr importOptions;
+			if (oldResEntry->meta != nullptr)
+				importOptions = oldResEntry->meta->getImportOptions();
+
+			newEntry = addResourceInternal(newEntryParent, newFullPath, importOptions, true);
+		}
+		else
+		{
+			assert(oldEntry->type == LibraryEntryType::File);
+			DirectoryEntry* oldDirEntry = static_cast<DirectoryEntry*>(oldEntry);
+
+			DirectoryEntry* newDirEntry = addDirectoryInternal(newEntryParent, newFullPath);
+			newEntry = newDirEntry;
+
+			Stack<std::tuple<DirectoryEntry*, DirectoryEntry*>> todo;
+			todo.push(std::make_tuple(oldDirEntry, newDirEntry));
+
+			while (!todo.empty())
+			{
+				auto current = todo.top();
+				todo.pop();
+
+				DirectoryEntry* sourceDir = std::get<0>(current);
+				DirectoryEntry* destDir = std::get<1>(current);
+
+				for (auto& child : sourceDir->mChildren)
+				{
+					Path childDestPath = destDir->path;
+					childDestPath.append(child->path.getWTail());
+
+					if (child->type == LibraryEntryType::File)
+					{
+						FileEntry* childResEntry = static_cast<FileEntry*>(child);
+
+						ImportOptionsPtr importOptions;
+						if (childResEntry->meta != nullptr)
+							importOptions = childResEntry->meta->getImportOptions();
+
+						addResourceInternal(destDir, childDestPath, importOptions, true);
+					}
+					else // Directory
+					{
+						DirectoryEntry* childSourceDirEntry = static_cast<DirectoryEntry*>(child);
+						DirectoryEntry* childDestDirEntry = addDirectoryInternal(destDir, childDestPath);
+
+						todo.push(std::make_tuple(childSourceDirEntry, childSourceDirEntry));
+					}
+				}
+			}
+		}
+	}
+
+	void ProjectLibrary::deleteEntry(const Path& path)
+	{
+		Path fullPath = path;
+		if (!fullPath.isAbsolute())
+			fullPath.makeAbsolute(mResourcesFolder);
+
+		if(FileSystem::exists(fullPath))
+			FileSystem::remove(fullPath);
+
+		LibraryEntry* entry = findEntry(fullPath);
+		if(entry != nullptr)
+		{
+			if(entry->type == LibraryEntryType::File)
+				deleteResourceInternal(static_cast<FileEntry*>(entry));
+			else if(entry->type == LibraryEntryType::Directory)
+				deleteDirectoryInternal(static_cast<DirectoryEntry*>(entry));
+		}
+	}
+
+	void ProjectLibrary::reimport(const Path& path, const ImportOptionsPtr& importOptions, bool forceReimport)
+	{
+		LibraryEntry* entry = findEntry(path);
+		if (entry != nullptr)
+		{
+			if (entry->type == LibraryEntryType::File)
+			{
+				FileEntry* resEntry = static_cast<FileEntry*>(entry);
+				reimportResourceInternal(resEntry, importOptions, forceReimport);
+			}
+		}
+	}
+
+	void ProjectLibrary::setIncludeInBuild(const Path& path, bool include)
+	{
+		LibraryEntry* entry = findEntry(path);
+
+		if (entry == nullptr || entry->type == LibraryEntryType::Directory)
+			return;
+
+		FileEntry* resEntry = static_cast<FileEntry*>(entry);
+		if (resEntry->meta == nullptr)
+			return;
+
+		resEntry->meta->setIncludeInBuild(include);
+
+		Path metaPath = resEntry->path;
+		metaPath.setFilename(metaPath.getWFilename() + L".meta");
+
+		FileEncoder fs(metaPath);
+		fs.encode(resEntry->meta.get());
+	}
+
+	Vector<ProjectLibrary::FileEntry*> ProjectLibrary::getResourcesForBuild() const
+	{
+		Vector<FileEntry*> output;
+
+		Stack<DirectoryEntry*> todo;
+		todo.push(mRootEntry);
+
+		while (!todo.empty())
+		{
+			DirectoryEntry* directory = todo.top();
+			todo.pop();
+
+			for (auto& child : directory->mChildren)
+			{
+				if (child->type == LibraryEntryType::File)
+				{
+					FileEntry* resEntry = static_cast<FileEntry*>(child);
+					if (resEntry->meta != nullptr && resEntry->meta->getIncludeInBuild())
+						output.push_back(resEntry);
+				}
+				else if (child->type == LibraryEntryType::Directory)
+				{
+					todo.push(static_cast<DirectoryEntry*>(child));
+				}
+			}
+		}
+
+		return output;
+	}
+
+	HResource ProjectLibrary::load(const Path& path)
+	{
+		ProjectResourceMetaPtr meta = findResourceMeta(path);
+		if (meta == nullptr)
+			return HResource();
+
+		String resUUID = meta->getUUID();
+		return gResources().loadFromUUID(resUUID);
+	}
+
+	void ProjectLibrary::createInternalParentHierarchy(const Path& fullPath, DirectoryEntry** newHierarchyRoot, DirectoryEntry** newHierarchyLeaf)
+	{
+		Path parentPath = fullPath;
+
+		DirectoryEntry* newEntryParent = nullptr;
+		Stack<Path> parentPaths;
+		do 
+		{
+			Path newParentPath = parentPath.getParent();
+
+			if(newParentPath == parentPath)
+				break;
+
+			LibraryEntry* newEntryParentLib = findEntry(newParentPath);
+			if(newEntryParentLib != nullptr)
+			{
+				assert(newEntryParentLib->type == LibraryEntryType::Directory);
+				newEntryParent = static_cast<DirectoryEntry*>(newEntryParentLib);
+
+				break;
+			}
+
+			parentPaths.push(newParentPath);
+			parentPath = newParentPath;
+
+		} while (true);
+
+		assert(newEntryParent != nullptr); // Must exist
+
+		if(newHierarchyRoot != nullptr)
+			*newHierarchyRoot = newEntryParent;
+
+		while(!parentPaths.empty())
+		{
+			Path curPath = parentPaths.top();
+			parentPaths.pop();
+
+			newEntryParent = addDirectoryInternal(newEntryParent, curPath);
+		}
+
+		if(newHierarchyLeaf != nullptr)
+			*newHierarchyLeaf = newEntryParent;
+	}
+
+	Path ProjectLibrary::getMetaPath(const Path& path) const
+	{
+		Path metaPath = path;
+		metaPath.setFilename(metaPath.getWFilename() + L".meta");
+
+		return metaPath;
+	}
+
+	bool ProjectLibrary::isMeta(const Path& fullPath) const
+	{
+		return fullPath.getWExtension() == L".meta";
+	}
+
+	bool ProjectLibrary::isNative(const Path& path) const
+	{
+		WString extension = path.getWExtension();
+
+		return extension == L".asset" || extension == L".prefab";
+	}
+
+	void ProjectLibrary::unloadLibrary()
+	{
+		if (!mIsLoaded)
+			return;
+
+		mProjectFolder = Path::BLANK;
+		mResourcesFolder = Path::BLANK;
+
+		clearEntries();
+		mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
+
+		mDependencies.clear();
+		gResources().unregisterResourceManifest(mResourceManifest);
+		mResourceManifest = nullptr;
+		mIsLoaded = false;
+	}
+
+	void ProjectLibrary::makeEntriesRelative()
+	{
+		// Make all paths relative before saving
+		std::function<void(LibraryEntry*, const Path&)> makeRelative =
+			[&](LibraryEntry* entry, const Path& root)
+		{
+			entry->path.makeRelative(root);
+
+			if (entry->type == LibraryEntryType::Directory)
+			{
+				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
+				for (auto& child : dirEntry->mChildren)
+					makeRelative(child, root);
+			}
+		};
+
+		Path root = getResourcesFolder();
+		makeRelative(mRootEntry, root);
+	}
+
+	void ProjectLibrary::makeEntriesAbsolute()
+	{
+		std::function<void(LibraryEntry*, const Path&)> makeAbsolute =
+			[&](LibraryEntry* entry, const Path& root)
+		{
+			entry->path.makeAbsolute(root);
+
+			if (entry->type == LibraryEntryType::Directory)
+			{
+				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
+				for (auto& child : dirEntry->mChildren)
+					makeAbsolute(child, root);
+			}
+		};
+
+		Path root = getResourcesFolder();
+		makeAbsolute(mRootEntry, root);
+	}
+
+	void ProjectLibrary::saveLibrary()
+	{
+		if (!mIsLoaded)
+			return;
+
+		// Make all paths relative before saving
+		makeEntriesRelative();		
+		std::shared_ptr<ProjectLibraryEntries> libEntries = ProjectLibraryEntries::create(*mRootEntry);
+
+		Path libraryEntriesPath = mProjectFolder;
+		libraryEntriesPath.append(PROJECT_INTERNAL_DIR);
+		libraryEntriesPath.append(LIBRARY_ENTRIES_FILENAME);
+
+		FileEncoder fs(libraryEntriesPath);
+		fs.encode(libEntries.get());
+
+		// Restore absolute entry paths
+		makeEntriesAbsolute();
+
+		Path resourceManifestPath = mProjectFolder;
+		resourceManifestPath.append(PROJECT_INTERNAL_DIR);
+		resourceManifestPath.append(RESOURCE_MANIFEST_FILENAME);
+
+		ResourceManifest::save(mResourceManifest, resourceManifestPath, mProjectFolder);
+	}
+
+	void ProjectLibrary::loadLibrary()
+	{
+		unloadLibrary();
+
+		mProjectFolder = gEditorApplication().getProjectPath();
+		mResourcesFolder = mProjectFolder;
+		mResourcesFolder.append(RESOURCES_DIR);
+
+		mRootEntry = bs_new<DirectoryEntry>(mResourcesFolder, mResourcesFolder.getWTail(), nullptr);
+
+		Path libraryEntriesPath = mProjectFolder;
+		libraryEntriesPath.append(PROJECT_INTERNAL_DIR);
+		libraryEntriesPath.append(LIBRARY_ENTRIES_FILENAME);
+
+		if(FileSystem::exists(libraryEntriesPath))
+		{
+			FileDecoder fs(libraryEntriesPath);
+			std::shared_ptr<ProjectLibraryEntries> libEntries = std::static_pointer_cast<ProjectLibraryEntries>(fs.decode());
+
+			*mRootEntry = libEntries->getRootEntry();
+			for(auto& child : mRootEntry->mChildren)
+				child->parent = mRootEntry;
+
+			mRootEntry->parent = nullptr;
+		}
+
+		// Entries are stored relative to project folder, but we want their absolute paths now
+		makeEntriesAbsolute();
+
+		// Load resource manifest
+		Path resourceManifestPath = mProjectFolder;
+		resourceManifestPath.append(PROJECT_INTERNAL_DIR);
+		resourceManifestPath.append(RESOURCE_MANIFEST_FILENAME);
+
+		if (FileSystem::exists(resourceManifestPath))
+			mResourceManifest = ResourceManifest::load(resourceManifestPath, mProjectFolder);
+		else
+			mResourceManifest = ResourceManifest::create("ProjectLibrary");
+
+		gResources().registerResourceManifest(mResourceManifest);
+
+		// Load all meta files
+		Stack<DirectoryEntry*> todo;
+		todo.push(mRootEntry);
+
+		Vector<LibraryEntry*> deletedEntries;
+
+		while(!todo.empty())
+		{
+			DirectoryEntry* curDir = todo.top();
+			todo.pop();
+
+			for(auto& child : curDir->mChildren)
+			{
+				if(child->type == LibraryEntryType::File)
+				{
+					FileEntry* resEntry = static_cast<FileEntry*>(child);
+					
+					if (FileSystem::isFile(resEntry->path))
+					{
+						if (resEntry->meta == nullptr)
+						{
+							Path metaPath = resEntry->path;
+							metaPath.setFilename(metaPath.getWFilename() + L".meta");
+
+							if (FileSystem::isFile(metaPath))
+							{
+								FileDecoder fs(metaPath);
+								std::shared_ptr<IReflectable> loadedMeta = fs.decode();
+
+								if (loadedMeta != nullptr && loadedMeta->isDerivedFrom(ProjectFileMeta::getRTTIStatic()))
+								{
+									ProjectFileMetaPtr fileMeta = std::static_pointer_cast<ProjectFileMeta>(loadedMeta);
+									resEntry->meta = fileMeta;
+								}
+							}
+						}
+
+						if (resEntry->meta != nullptr)
+						{
+							auto& resourceMetas = resEntry->meta->getResourceMetaData();
+
+							if (resourceMetas.size() > 0)
+							{
+								mUUIDToPath[resourceMetas[0]->getUUID()] = resEntry->path;
+
+								for (UINT32 i = 1; i < (UINT32)resourceMetas.size(); i++)
+								{
+									ProjectResourceMetaPtr entry = resourceMetas[i];
+									mUUIDToPath[entry->getUUID()] = resEntry->path + entry->getUniqueName();
+								}
+							}
+						}
+
+						addDependencies(resEntry);
+					}
+					else
+						deletedEntries.push_back(resEntry);
+				}
+				else if(child->type == LibraryEntryType::Directory)
+				{
+					if (FileSystem::isDirectory(child->path))
+						todo.push(static_cast<DirectoryEntry*>(child));
+					else
+						deletedEntries.push_back(child);
+				}
+			}
+		}
+
+		// Remove entries that no longer have corresponding files
+		for (auto& deletedEntry : deletedEntries)
+		{
+			if (deletedEntry->type == LibraryEntryType::File)
+			{
+				FileEntry* resEntry = static_cast<FileEntry*>(deletedEntry);
+				deleteResourceInternal(resEntry);
+			}
+			else
+			{
+				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(deletedEntry);
+				deleteDirectoryInternal(dirEntry);
+			}
+		}
+
+		// Clean up internal library folder from obsolete files
+		Path internalResourcesFolder = mProjectFolder;
+		internalResourcesFolder.append(INTERNAL_RESOURCES_DIR);
+
+		Vector<Path> toDelete;
+		auto processFile = [&](const Path& file)
+		{
+			String uuid = file.getFilename(false);
+			if (mUUIDToPath.find(uuid) == mUUIDToPath.end())
+			{
+				mResourceManifest->unregisterResource(uuid);
+				toDelete.push_back(file);
+			}
+
+			return true;
+		};
+
+		FileSystem::iterate(internalResourcesFolder, processFile);
+
+		for (auto& entry : toDelete)
+			FileSystem::remove(entry);
+
+		mIsLoaded = true;
+	}
+
+	void ProjectLibrary::clearEntries()
+	{
+		if (mRootEntry == nullptr)
+			return;
+
+		std::function<void(LibraryEntry*)> deleteRecursive =
+			[&](LibraryEntry* entry)
+		{
+			if (entry->type == LibraryEntryType::Directory)
+			{
+				DirectoryEntry* dirEntry = static_cast<DirectoryEntry*>(entry);
+
+				for (auto& child : dirEntry->mChildren)
+					deleteRecursive(child);
+			}
+
+			bs_delete(entry);
+		};
+
+		deleteRecursive(mRootEntry);
+		mRootEntry = nullptr;
+	}
+
+	Vector<Path> ProjectLibrary::getImportDependencies(const FileEntry* entry)
+	{
+		Vector<Path> output;
+
+		if (entry->meta == nullptr)
+			return output;
+
+		auto& resourceMetas = entry->meta->getResourceMetaData();
+		for(auto& resMeta : resourceMetas)
+		{
+			if (resMeta->getTypeID() == TID_Shader)
+			{
+				SPtr<ShaderMetaData> metaData = std::static_pointer_cast<ShaderMetaData>(resMeta->getResourceMetaData());
+
+				for (auto& include : metaData->includes)
+					output.push_back(include);
+			}
+		}
+
+		return output;
+	}
+
+	void ProjectLibrary::addDependencies(const FileEntry* entry)
+	{
+		Vector<Path> dependencies = getImportDependencies(entry);
+		for (auto& dependency : dependencies)
+			mDependencies[dependency].push_back(entry->path);
+	}
+
+	void ProjectLibrary::removeDependencies(const FileEntry* entry)
+	{
+		Vector<Path> dependencies = getImportDependencies(entry);
+		for (auto& dependency : dependencies)
+		{
+			Vector<Path>& curDependencies = mDependencies[dependency];
+			auto iterRemove = std::remove_if(curDependencies.begin(), curDependencies.end(),
+				[&](const Path& x)
+			{
+				return x == entry->path;
+			});
+
+			curDependencies.erase(iterRemove, curDependencies.end());
+		}
+	}
+
+	void ProjectLibrary::reimportDependants(const Path& entryPath)
+	{
+		auto iterFind = mDependencies.find(entryPath);
+		if (iterFind == mDependencies.end())
+			return;
+
+		// Make a copy since we might modify this list during reimport
+		Vector<Path> dependencies = iterFind->second;
+		for (auto& dependency : dependencies)
+		{
+			LibraryEntry* entry = findEntry(dependency);
+			if (entry != nullptr && entry->type == LibraryEntryType::File)
+			{
+				FileEntry* resEntry = static_cast<FileEntry*>(entry);
+
+				ImportOptionsPtr importOptions;
+				if (resEntry->meta != nullptr)
+					importOptions = resEntry->meta->getImportOptions();
+
+				reimportResourceInternal(resEntry, importOptions, true);
+			}
+		}
+	}
+
+	BS_ED_EXPORT ProjectLibrary& gProjectLibrary()
+	{
+		return ProjectLibrary::instance();
+	}
 }

+ 2 - 2
Source/BansheeEngine/Source/BsShapeMeshes3D.cpp

@@ -195,8 +195,8 @@ namespace BansheeEngine
 	{
 		assert(linePoints.size() % 2 == 0);
 
-		assert((vertexOffset + linePoints.size() * 2) <= meshData->getNumVertices());
-		assert((indexOffset + linePoints.size() * 2) <= meshData->getNumIndices());
+		assert((vertexOffset + linePoints.size()) <= meshData->getNumVertices());
+		assert((indexOffset + linePoints.size()) <= meshData->getNumIndices());
 
 		UINT32 curVertOffset = vertexOffset;
 		UINT32 curIdxOffset = indexOffset;

+ 75 - 58
Source/BansheePhysX/Include/BsPhysXMesh.h

@@ -1,59 +1,76 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPhysXPrerequisites.h"
-#include "BsPhysicsMesh.h"
-#include "PxMaterial.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup PhysX
-	 *  @{
-	 */
-
-	/** PhysX implementation of a PhysicsMesh. */
-	class PhysXMesh : public PhysicsMesh
-	{
-	public:
-		PhysXMesh(const MeshDataPtr& meshData, PhysicsMeshType type);
-
-		/** @copydoc PhysicsMesh::getMeshData */
-		MeshDataPtr getMeshData() const override;
-
-		/** 
-		 * Returns the internal PhysX representation of a triangle mesh. Caller must ensure the physics mesh type is 
-		 * triangle. 
-		 */
-		physx::PxTriangleMesh* _getTriangle() const { assert(mType == PhysicsMeshType::Triangle); return mTriangleMesh; }
-
-		/** 
-		 * Returns the internal PhysX representation of a convex mesh. Caller must ensure the physics mesh type is 
-		 * convex. 
-		 */
-		physx::PxConvexMesh* _getConvex() const { assert(mType == PhysicsMeshType::Convex); return mConvexMesh; }
-
-	private:
-		/** @copydoc PhysicsMesh::initialize() */
-		void initialize() override;
-
-		/** @copydoc PhysicsMesh::initialize() */
-		void destroy() override;
-
-		physx::PxTriangleMesh* mTriangleMesh = nullptr;
-		physx::PxConvexMesh* mConvexMesh = nullptr;
-
-		UINT8* mCookedData = nullptr;
-		UINT32 mCookedDataSize = 0;
-
-		/************************************************************************/
-		/* 								SERIALIZATION                      		*/
-		/************************************************************************/
-	public:
-		friend class PhysXMeshRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPhysXPrerequisites.h"
+#include "BsPhysicsMesh.h"
+#include "PxMaterial.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup PhysX
+	 *  @{
+	 */
+
+	/** PhysX implementation of a PhysicsMesh. */
+	class PhysXMesh : public PhysicsMesh
+	{
+	public:
+		PhysXMesh(const MeshDataPtr& meshData, PhysicsMeshType type);
+
+	private:
+		/** @copydoc PhysicsMesh::initialize() */
+		void initialize() override;
+
+		/** @copydoc PhysicsMesh::initialize() */
+		void destroy() override;
+
+		// Note: Must not have its own RTTI type, it's important it shares the same type ID as PhysicsMesh so the
+		// system knows to recognize it. Use FPhysicsMesh instead.
+	};
+
+	/** PhysX implementation of the PhysicsMesh foundation, FPhysicsMesh. */
+	class FPhysXMesh : public FPhysicsMesh
+	{
+	public:
+		FPhysXMesh(const MeshDataPtr& meshData, PhysicsMeshType type);
+		~FPhysXMesh();
+
+		/** @copydoc PhysicsMesh::getMeshData */
+		MeshDataPtr getMeshData() const override;
+
+		/** 
+		 * Returns the internal PhysX representation of a triangle mesh. Caller must ensure the physics mesh type is 
+		 * triangle. 
+		 */
+		physx::PxTriangleMesh* _getTriangle() const { assert(mType == PhysicsMeshType::Triangle); return mTriangleMesh; }
+
+		/** 
+		 * Returns the internal PhysX representation of a convex mesh. Caller must ensure the physics mesh type is 
+		 * convex. 
+		 */
+		physx::PxConvexMesh* _getConvex() const { assert(mType == PhysicsMeshType::Convex); return mConvexMesh; }
+
+	private:
+		/** Creates the internal triangle/convex mesh */
+		void initialize();
+
+		physx::PxTriangleMesh* mTriangleMesh = nullptr;
+		physx::PxConvexMesh* mConvexMesh = nullptr;
+
+		UINT8* mCookedData = nullptr;
+		UINT32 mCookedDataSize = 0;
+
+		/************************************************************************/
+		/* 								SERIALIZATION                      		*/
+		/************************************************************************/
+	public:
+		FPhysXMesh(); // Serialization only
+
+		friend class FPhysXMeshRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }

+ 70 - 69
Source/BansheePhysX/Include/BsPhysXMeshRTTI.h

@@ -1,70 +1,71 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPhysXPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsPhysXMesh.h"
-
-namespace BansheeEngine
-{
-	/** @cond RTTI */
-	/** @addtogroup RTTI-Impl-PhysX
-	 *  @{
-	 */
-
-	class BS_PHYSX_EXPORT PhysXMeshRTTI : public RTTIType<PhysXMesh, PhysicsMesh, PhysXMeshRTTI>
-	{
-	private:
-		ManagedDataBlock getCookedData(PhysXMesh* obj)
-		{
-			ManagedDataBlock dataBlock((UINT8*)obj->mCookedData, obj->mCookedDataSize);
-			return dataBlock;
-		}
-
-		void setCookedData(PhysXMesh* obj, ManagedDataBlock val)
-		{
-			// Nothing to do here, the pointer we provided in allocateCookedData() already belongs to PhysXMesh
-			// so the data is already written
-		}
-
-		static UINT8* allocateCookedData(PhysXMesh* obj, UINT32 numBytes)
-		{
-			obj->mCookedData = (UINT8*)bs_alloc(numBytes);
-			obj->mCookedDataSize = numBytes;
-
-			return obj->mCookedData;
-		}
-	public:
-		PhysXMeshRTTI()
-		{
-			addDataBlockField("mCookedData", 0, 
-				&PhysXMeshRTTI::getCookedData, &PhysXMeshRTTI::setCookedData, 0, &PhysXMeshRTTI::allocateCookedData);
-		}
-
-		void onDeserializationEnded(IReflectable* obj) override
-		{
-			PhysXMesh* mesh = static_cast<PhysXMesh*>(obj);
-			mesh->initialize();
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "PhysXMesh";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_PhysXMesh;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return PhysicsMesh::_createPtr(nullptr, PhysicsMeshType::Convex);
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPhysXPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsPhysXMesh.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-PhysX
+	 *  @{
+	 */
+
+	class BS_PHYSX_EXPORT FPhysXMeshRTTI : public RTTIType<FPhysXMesh, FPhysicsMesh, FPhysXMeshRTTI>
+	{
+	private:
+		ManagedDataBlock getCookedData(FPhysXMesh* obj)
+		{
+			ManagedDataBlock dataBlock((UINT8*)obj->mCookedData, obj->mCookedDataSize);
+			return dataBlock;
+		}
+
+		void setCookedData(FPhysXMesh* obj, ManagedDataBlock val)
+		{
+			// Nothing to do here, the pointer we provided in allocateCookedData() already belongs to PhysXMesh
+			// so the data is already written
+		}
+
+		static UINT8* allocateCookedData(FPhysXMesh* obj, UINT32 numBytes)
+		{
+			obj->mCookedData = (UINT8*)bs_alloc(numBytes);
+			obj->mCookedDataSize = numBytes;
+
+			return obj->mCookedData;
+		}
+	public:
+		FPhysXMeshRTTI()
+		{
+			addDataBlockField("mCookedData", 0, 
+				&FPhysXMeshRTTI::getCookedData, &FPhysXMeshRTTI::setCookedData, 0, &FPhysXMeshRTTI::allocateCookedData);
+		}
+
+		/** @copydoc IReflectable::onDeserializationEnded */
+		void onDeserializationEnded(IReflectable* obj) override
+		{
+			FPhysXMesh* mesh = static_cast<FPhysXMesh*>(obj);
+			mesh->initialize();
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "FPhysXMesh";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_FPhysXMesh;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<FPhysXMesh>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }

+ 1 - 1
Source/BansheePhysX/Include/BsPhysXPrerequisites.h

@@ -50,7 +50,7 @@ namespace BansheeEngine
 	/**	Type IDs used by the RTTI system for the PhysX library. */
 	enum TypeID_BansheeEditor
 	{
-		TID_PhysXMesh = 100000,
+		TID_FPhysXMesh = 100000,
 	};
 
 	/** Converts a Banshee vector to a PhysX vector. */

+ 11 - 11
Source/BansheePhysX/Source/BsPhysX.cpp

@@ -111,7 +111,7 @@ namespace BansheeEngine
 				case 2:
 					ss << "PhysX error (" << errorCode << "): " << message << " at " << file << ":" << line;
 					LOGERR(ss.str());
-					BS_ASSERT(false); // Halt execution on debug builds when error occurrs
+					BS_ASSERT(false); // Halt execution on debug builds when error occurs
 					break;
 				}
 			}
@@ -839,10 +839,10 @@ namespace BansheeEngine
 		if (mesh == nullptr)
 			return false;
 
-		PhysXMesh* physxMesh = static_cast<PhysXMesh*>(mesh.get());
-		if (physxMesh->getType() != PhysicsMeshType::Convex)
+		if (mesh->getType() != PhysicsMeshType::Convex)
 			return false;
 
+		FPhysXMesh* physxMesh = static_cast<FPhysXMesh*>(mesh->_getInternal());
 		PxConvexMeshGeometry geometry(physxMesh->_getConvex());
 		PxTransform transform = toPxTransform(position, rotation);
 
@@ -896,10 +896,10 @@ namespace BansheeEngine
 		if (mesh == nullptr)
 			return Vector<PhysicsQueryHit>(0);
 
-		PhysXMesh* physxMesh = static_cast<PhysXMesh*>(mesh.get());
-		if (physxMesh->getType() != PhysicsMeshType::Convex)
+		if (mesh->getType() != PhysicsMeshType::Convex)
 			return Vector<PhysicsQueryHit>(0);
 
+		FPhysXMesh* physxMesh = static_cast<FPhysXMesh*>(mesh->_getInternal());
 		PxConvexMeshGeometry geometry(physxMesh->_getConvex());
 		PxTransform transform = toPxTransform(position, rotation);
 
@@ -952,10 +952,10 @@ namespace BansheeEngine
 		if (mesh == nullptr)
 			return false;
 
-		PhysXMesh* physxMesh = static_cast<PhysXMesh*>(mesh.get());
-		if (physxMesh->getType() != PhysicsMeshType::Convex)
+		if (mesh->getType() != PhysicsMeshType::Convex)
 			return false;
 
+		FPhysXMesh* physxMesh = static_cast<FPhysXMesh*>(mesh->_getInternal());
 		PxConvexMeshGeometry geometry(physxMesh->_getConvex());
 		PxTransform transform = toPxTransform(position, rotation);
 
@@ -994,10 +994,10 @@ namespace BansheeEngine
 		if (mesh == nullptr)
 			return Vector<Collider*>(0);
 
-		PhysXMesh* physxMesh = static_cast<PhysXMesh*>(mesh.get());
-		if (physxMesh->getType() != PhysicsMeshType::Convex)
+		if (mesh->getType() != PhysicsMeshType::Convex)
 			return Vector<Collider*>(0);
 
+		FPhysXMesh* physxMesh = static_cast<FPhysXMesh*>(mesh->_getInternal());
 		PxConvexMeshGeometry geometry(physxMesh->_getConvex());
 		PxTransform transform = toPxTransform(position, rotation);
 
@@ -1035,10 +1035,10 @@ namespace BansheeEngine
 		if (mesh == nullptr)
 			return false;
 
-		PhysXMesh* physxMesh = static_cast<PhysXMesh*>(mesh.get());
-		if (physxMesh->getType() != PhysicsMeshType::Convex)
+		if (mesh->getType() != PhysicsMeshType::Convex)
 			return false;
 
+		FPhysXMesh* physxMesh = static_cast<FPhysXMesh*>(mesh->_getInternal());
 		PxConvexMeshGeometry geometry(physxMesh->_getConvex());
 		PxTransform transform = toPxTransform(position, rotation);
 

+ 396 - 374
Source/BansheePhysX/Source/BsPhysXMesh.cpp

@@ -1,375 +1,397 @@
-#include "BsPhysXMesh.h"
-#include "BsPhysXMeshRTTI.h"
-#include "BsMeshData.h"
-#include "BsVertexDataDesc.h"
-#include "BsPhysX.h"
-#include "BsAABox.h"
-#include "foundation\PxAllocatorCallback.h"
-#include "geometry\PxTriangleMesh.h"
-#include "geometry\PxConvexMesh.h"
-#include "cooking\PxConvexMeshDesc.h"
-#include "extensions\PxDefaultStreams.h"
-
-using namespace physx;
-
-namespace BansheeEngine
-{
-	/**
-	 * Attempts to cook a convex mesh from the provided mesh data. Assumes the mesh data is not null and contains vertex
-	 * positions as well as face indices. If the method returns true the resulting convex mesh will be output in the @p
-	 * data buffer, and its size in @p size. The data buffer will be allocated used the generic allocator and is up to the
-	 * caller to free it.
-	 */
-	bool cookConvex(PxCooking* cooking, const MeshDataPtr& meshData, UINT8** data, UINT32& size)
-	{
-		VertexDataDescPtr vertexDesc = meshData->getVertexDesc();
-
-		// Generate hull polygons
-		PxSimpleTriangleMesh meshDesc;
-		meshDesc.points.count = meshData->getNumVertices();
-		meshDesc.points.stride = vertexDesc->getVertexStride();
-		meshDesc.points.data = meshData->getElementData(VES_POSITION);
-
-		meshDesc.triangles.count = meshData->getNumIndices() / 3;
-		meshDesc.triangles.stride = 3 * sizeof(PxU32);
-
-		IndexType indexType = meshData->getIndexType();
-		if (indexType == IT_32BIT)
-		{
-			meshDesc.triangles.stride = 4;
-			meshDesc.triangles.data = meshData->getIndices32();
-		}
-		else
-		{
-			meshDesc.triangles.stride = 2;
-			meshDesc.triangles.data = meshData->getIndices16();
-			meshDesc.flags |= PxMeshFlag::e16_BIT_INDICES;
-		}
-
-		PxAllocatorCallback& allocator = PxGetFoundation().getAllocatorCallback();
-
-		PxU32 numVertices = 0;
-		PxU32 numIndices = 0;
-		PxU32 numPolygons = 0;
-		PxVec3* vertices = nullptr;
-		PxU32* indices = nullptr;
-		PxHullPolygon* polygons = nullptr;
-
-		bool gotPolygons = cooking->computeHullPolygons(meshDesc, allocator,
-			numVertices, vertices, numIndices, indices, numPolygons, polygons);
-
-		// If we have polygons try to create hull directly from them
-		if(gotPolygons)
-		{
-			PxConvexMeshDesc convexPolyDesc;
-			convexPolyDesc.points.count = numVertices;
-			convexPolyDesc.points.stride = sizeof(PxVec3);
-			convexPolyDesc.points.data = vertices;
-
-			convexPolyDesc.indices.count = numIndices;
-			convexPolyDesc.indices.stride = sizeof(PxU32);
-			convexPolyDesc.indices.data = indices;
-
-			convexPolyDesc.polygons.count = numPolygons;
-			convexPolyDesc.polygons.stride = sizeof(PxHullPolygon);
-			convexPolyDesc.polygons.data = polygons;
-
-			PxDefaultMemoryOutputStream output;
-			if (cooking->cookConvexMesh(convexPolyDesc, output))
-			{
-				size = output.getSize();
-				*data = (UINT8*)bs_alloc(size);
-
-				memcpy(*data, output.getData(), size);
-
-				allocator.deallocate(vertices);
-				allocator.deallocate(indices);
-				allocator.deallocate(polygons);
-
-				return true;
-			}
-
-			allocator.deallocate(vertices);
-			allocator.deallocate(indices);
-			allocator.deallocate(polygons);
-		}
-
-		// Try to create hull from points
-		PxConvexMeshDesc convexDesc;
-		convexDesc.points.count = meshData->getNumVertices();
-		convexDesc.points.stride = vertexDesc->getVertexStride();
-		convexDesc.points.data = meshData->getElementData(VES_POSITION);
-		convexDesc.flags |= PxConvexFlag::eCOMPUTE_CONVEX;
-
-		PxDefaultMemoryOutputStream output;
-		if (cooking->cookConvexMesh(convexDesc, output))
-		{
-			size = output.getSize();
-			*data = (UINT8*)bs_alloc(size);
-
-			memcpy(*data, output.getData(), size);
-			return true;
-		}
-
-		// Try inflating the convex mesh
-		convexDesc.flags |= PxConvexFlag::eINFLATE_CONVEX;
-		if (cooking->cookConvexMesh(convexDesc, output))
-		{
-			size = output.getSize();
-			*data = (UINT8*)bs_alloc(size);
-
-			memcpy(*data, output.getData(), size);
-			return true;
-		}
-
-		// Nothing works, just compute an AABB
-		AABox box;
-
-		auto vertIter = meshData->getVec3DataIter(VES_POSITION);
-		do
-		{
-			box.merge(vertIter.getValue());
-		}
-		while (vertIter.moveNext());
-
-		Vector3 aabbVerts[8];
-		aabbVerts[0] = box.getCorner(AABox::FAR_LEFT_BOTTOM);
-		aabbVerts[1] = box.getCorner(AABox::FAR_RIGHT_BOTTOM);
-		aabbVerts[2] = box.getCorner(AABox::FAR_RIGHT_TOP);
-		aabbVerts[3] = box.getCorner(AABox::FAR_LEFT_TOP);
-
-		aabbVerts[4] = box.getCorner(AABox::NEAR_LEFT_BOTTOM);
-		aabbVerts[5] = box.getCorner(AABox::NEAR_RIGHT_BOTTOM);
-		aabbVerts[6] = box.getCorner(AABox::NEAR_RIGHT_TOP);
-		aabbVerts[7] = box.getCorner(AABox::NEAR_LEFT_TOP);
-
-		convexDesc.points.count = 8;
-		convexDesc.points.stride = sizeof(Vector3);
-		convexDesc.points.data = &aabbVerts[0];
-		convexDesc.flags &= ~PxConvexFlag::eINFLATE_CONVEX;
-
-		if (cooking->cookConvexMesh(convexDesc, output))
-		{
-			size = output.getSize();
-			*data = (UINT8*)bs_alloc(size);
-
-			memcpy(*data, output.getData(), size);
-			return true;
-		}
-
-		return false;
-	}
-
-	/**
-	 * Attempts to cook a triangle or convex mesh from the provided mesh data. Will log a warning and return false if it is
-	 * unable to cook the mesh. If the method returns true the resulting convex mesh will be output in the @p data buffer,
-	 * and its size in @p size. The data buffer will be allocated used the generic allocator and is up to the caller to 
-	 * free it.
-	 */
-	bool cookMesh(const MeshDataPtr& meshData, PhysicsMeshType type, UINT8** data, UINT32& size)
-	{
-		if (meshData == nullptr)
-			return false;
-
-		PxCooking* cooking = gPhysX().getCooking();
-		if (cooking == nullptr)
-		{
-			LOGWRN("Attempting to cook a physics mesh but cooking is not enabled globally.");
-			return false;
-		}
-
-		VertexDataDescPtr vertexDesc = meshData->getVertexDesc();
-		if (!vertexDesc->hasElement(VES_POSITION))
-		{
-			LOGWRN("Provided PhysicsMesh mesh data has no vertex positions.");
-			return false;
-		}
-
-		if (type == PhysicsMeshType::Convex)
-		{
-			if(!cookConvex(cooking, meshData, data, size))
-			{
-				LOGWRN("Failed cooking a convex mesh. Perpahs it is too complex? Maximum number of convex vertices is 256.");
-				return false;
-			}
-		}
-		else
-		{
-			PxTriangleMeshDesc meshDesc;
-			meshDesc.points.count = meshData->getNumVertices();
-			meshDesc.points.stride = vertexDesc->getVertexStride();
-			meshDesc.points.data = meshData->getElementData(VES_POSITION);
-
-			meshDesc.triangles.count = meshData->getNumIndices() / 3;
-			meshDesc.triangles.stride = 3 * sizeof(PxU32);
-
-			IndexType indexType = meshData->getIndexType();
-			if (indexType == IT_32BIT)
-			{
-				meshDesc.triangles.stride = 4;
-				meshDesc.triangles.data = meshData->getIndices32();
-			}
-			else
-			{
-				meshDesc.triangles.stride = 2;
-				meshDesc.triangles.data = meshData->getIndices16();
-				meshDesc.flags |= PxMeshFlag::e16_BIT_INDICES;
-			}
-
-			PxDefaultMemoryOutputStream output;
-			if (!cooking->cookTriangleMesh(meshDesc, output))
-				return false;
-
-			size = output.getSize();
-			*data = (UINT8*)bs_alloc(size);
-
-			memcpy(*data, output.getData(), size);
-		}
-
-		return true;
-	}
-
-	PhysXMesh::PhysXMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
-		:PhysicsMesh(meshData, type)
-	{ }
-
-	void PhysXMesh::initialize()
-	{
-		// Perform cooking if needed
-		if (mInitMeshData != nullptr)
-			cookMesh(mInitMeshData, mType, &mCookedData, mCookedDataSize);
-
-		if (mCookedData != nullptr && mCookedDataSize > 0)
-		{
-			PxPhysics* physx = gPhysX().getPhysX();
-
-			PxDefaultMemoryInputData input(mCookedData, mCookedDataSize);
-			if (mType == PhysicsMeshType::Convex)
-				mConvexMesh = physx->createConvexMesh(input);
-			else
-				mTriangleMesh = physx->createTriangleMesh(input);
-		}
-
-		PhysicsMesh::initialize();
-	}
-
-	void PhysXMesh::destroy()
-	{
-		if(mCookedData != nullptr)
-		{
-			bs_free(mCookedData);
-
-			mCookedData = nullptr;
-			mCookedDataSize = 0;
-		}
-
-		if(mTriangleMesh != nullptr)
-		{
-			mTriangleMesh->release();
-			mTriangleMesh = nullptr;
-		}
-
-		if (mConvexMesh != nullptr)
-		{
-			mConvexMesh->release();
-			mConvexMesh = nullptr;
-		}
-
-		PhysicsMesh::destroy();
-	}
-
-	MeshDataPtr PhysXMesh::getMeshData() const
-	{
-		VertexDataDescPtr vertexDesc = VertexDataDesc::create();
-		vertexDesc->addVertElem(VET_FLOAT3, VES_POSITION);
-
-		if (mConvexMesh == nullptr && mTriangleMesh == nullptr)
-			return MeshData::create(0, 0, vertexDesc);
-
-		UINT32 numVertices = 0;
-		UINT32 numIndices = 0;
-
-		if(mConvexMesh != nullptr)
-		{
-			numVertices = mConvexMesh->getNbVertices();
-
-			UINT32 numPolygons = mConvexMesh->getNbPolygons();
-			for (UINT32 i = 0; i < numPolygons; i++)
-			{
-				PxHullPolygon face;
-				bool status = mConvexMesh->getPolygonData(i, face);
-				assert(status);
-
-				numIndices += (face.mNbVerts - 2) * 3;
-			}
-		}
-		else // Triangle
-		{
-			numVertices = mTriangleMesh->getNbVertices();
-			numIndices = mTriangleMesh->getNbTriangles() * 3;
-		}
-
-		MeshDataPtr meshData = MeshData::create(numVertices, numIndices, vertexDesc);
-
-		auto posIter = meshData->getVec3DataIter(VES_POSITION);
-		UINT32* outIndices = meshData->getIndices32();
-
-		if (mConvexMesh != nullptr)
-		{
-			const PxVec3* convexVertices = mConvexMesh->getVertices();
-			const UINT8* convexIndices = mConvexMesh->getIndexBuffer();
-
-			UINT32 numPolygons = mConvexMesh->getNbPolygons();
-			UINT32 offset = 0;
-			for (UINT32 i = 0; i < numPolygons; i++)
-			{
-				PxHullPolygon face;
-				bool status = mConvexMesh->getPolygonData(i, face);
-				assert(status);
-
-				const PxU8* faceIndices = convexIndices + face.mIndexBase;
-				for (UINT32 j = 0; j < face.mNbVerts; j++)
-					posIter.addValue(fromPxVector(convexVertices[faceIndices[j]]));
-
-				for (UINT32 j = 2; j < face.mNbVerts; j++)
-				{
-					*outIndices++ = offset;
-					*outIndices++ = offset + j;
-					*outIndices++ = offset + j - 1;
-				}
-
-				offset += face.mNbVerts;
-			}
-		}
-		else
-		{
-			const PxVec3* vertices = mTriangleMesh->getVertices();
-			for (UINT32 i = 0; i < numVertices; i++)
-				posIter.addValue(fromPxVector(vertices[i]));
-
-			if(mTriangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES)
-			{
-				const UINT16* indices = (const UINT16*)mTriangleMesh->getTriangles();
-				for (UINT32 i = 0; i < numIndices; i++)
-					outIndices[i] = (UINT32)indices[i];
-			}
-			else
-			{
-				const UINT32* indices = (const UINT32*)mTriangleMesh->getTriangles();
-				memcpy(outIndices, indices, numIndices * sizeof(UINT32));
-			}
-		}
-
-		return meshData;
-	}
-
-	RTTITypeBase* PhysXMesh::getRTTIStatic()
-	{
-		return PhysXMeshRTTI::instance();
-	}
-
-	RTTITypeBase* PhysXMesh::getRTTI() const
-	{
-		return getRTTIStatic();
-	}
+#include "BsPhysXMesh.h"
+#include "BsPhysXMeshRTTI.h"
+#include "BsMeshData.h"
+#include "BsVertexDataDesc.h"
+#include "BsPhysX.h"
+#include "BsAABox.h"
+#include "foundation\PxAllocatorCallback.h"
+#include "geometry\PxTriangleMesh.h"
+#include "geometry\PxConvexMesh.h"
+#include "cooking\PxConvexMeshDesc.h"
+#include "extensions\PxDefaultStreams.h"
+
+using namespace physx;
+
+namespace BansheeEngine
+{
+	/**
+	 * Attempts to cook a convex mesh from the provided mesh data. Assumes the mesh data is not null and contains vertex
+	 * positions as well as face indices. If the method returns true the resulting convex mesh will be output in the @p
+	 * data buffer, and its size in @p size. The data buffer will be allocated used the generic allocator and is up to the
+	 * caller to free it.
+	 */
+	bool cookConvex(PxCooking* cooking, const MeshDataPtr& meshData, UINT8** data, UINT32& size)
+	{
+		VertexDataDescPtr vertexDesc = meshData->getVertexDesc();
+
+		// Generate hull polygons
+		PxSimpleTriangleMesh meshDesc;
+		meshDesc.points.count = meshData->getNumVertices();
+		meshDesc.points.stride = vertexDesc->getVertexStride();
+		meshDesc.points.data = meshData->getElementData(VES_POSITION);
+
+		meshDesc.triangles.count = meshData->getNumIndices() / 3;
+		meshDesc.triangles.stride = 3 * sizeof(PxU32);
+
+		IndexType indexType = meshData->getIndexType();
+		if (indexType == IT_32BIT)
+		{
+			meshDesc.triangles.stride = 4;
+			meshDesc.triangles.data = meshData->getIndices32();
+		}
+		else
+		{
+			meshDesc.triangles.stride = 2;
+			meshDesc.triangles.data = meshData->getIndices16();
+			meshDesc.flags |= PxMeshFlag::e16_BIT_INDICES;
+		}
+
+		PxAllocatorCallback& allocator = PxGetFoundation().getAllocatorCallback();
+
+		PxU32 numVertices = 0;
+		PxU32 numIndices = 0;
+		PxU32 numPolygons = 0;
+		PxVec3* vertices = nullptr;
+		PxU32* indices = nullptr;
+		PxHullPolygon* polygons = nullptr;
+
+		bool gotPolygons = cooking->computeHullPolygons(meshDesc, allocator,
+			numVertices, vertices, numIndices, indices, numPolygons, polygons);
+
+		// If we have polygons try to create hull directly from them
+		if(gotPolygons)
+		{
+			PxConvexMeshDesc convexPolyDesc;
+			convexPolyDesc.points.count = numVertices;
+			convexPolyDesc.points.stride = sizeof(PxVec3);
+			convexPolyDesc.points.data = vertices;
+
+			convexPolyDesc.indices.count = numIndices;
+			convexPolyDesc.indices.stride = sizeof(PxU32);
+			convexPolyDesc.indices.data = indices;
+
+			convexPolyDesc.polygons.count = numPolygons;
+			convexPolyDesc.polygons.stride = sizeof(PxHullPolygon);
+			convexPolyDesc.polygons.data = polygons;
+
+			PxDefaultMemoryOutputStream output;
+			if (cooking->cookConvexMesh(convexPolyDesc, output))
+			{
+				size = output.getSize();
+				*data = (UINT8*)bs_alloc(size);
+
+				memcpy(*data, output.getData(), size);
+
+				allocator.deallocate(vertices);
+				allocator.deallocate(indices);
+				allocator.deallocate(polygons);
+
+				return true;
+			}
+
+			allocator.deallocate(vertices);
+			allocator.deallocate(indices);
+			allocator.deallocate(polygons);
+		}
+
+		// Try to create hull from points
+		PxConvexMeshDesc convexDesc;
+		convexDesc.points.count = meshData->getNumVertices();
+		convexDesc.points.stride = vertexDesc->getVertexStride();
+		convexDesc.points.data = meshData->getElementData(VES_POSITION);
+		convexDesc.flags |= PxConvexFlag::eCOMPUTE_CONVEX;
+
+		PxDefaultMemoryOutputStream output;
+		if (cooking->cookConvexMesh(convexDesc, output))
+		{
+			size = output.getSize();
+			*data = (UINT8*)bs_alloc(size);
+
+			memcpy(*data, output.getData(), size);
+			return true;
+		}
+
+		// Try inflating the convex mesh
+		convexDesc.flags |= PxConvexFlag::eINFLATE_CONVEX;
+		if (cooking->cookConvexMesh(convexDesc, output))
+		{
+			size = output.getSize();
+			*data = (UINT8*)bs_alloc(size);
+
+			memcpy(*data, output.getData(), size);
+			return true;
+		}
+
+		// Nothing works, just compute an AABB
+		AABox box;
+
+		auto vertIter = meshData->getVec3DataIter(VES_POSITION);
+		do
+		{
+			box.merge(vertIter.getValue());
+		}
+		while (vertIter.moveNext());
+
+		Vector3 aabbVerts[8];
+		aabbVerts[0] = box.getCorner(AABox::FAR_LEFT_BOTTOM);
+		aabbVerts[1] = box.getCorner(AABox::FAR_RIGHT_BOTTOM);
+		aabbVerts[2] = box.getCorner(AABox::FAR_RIGHT_TOP);
+		aabbVerts[3] = box.getCorner(AABox::FAR_LEFT_TOP);
+
+		aabbVerts[4] = box.getCorner(AABox::NEAR_LEFT_BOTTOM);
+		aabbVerts[5] = box.getCorner(AABox::NEAR_RIGHT_BOTTOM);
+		aabbVerts[6] = box.getCorner(AABox::NEAR_RIGHT_TOP);
+		aabbVerts[7] = box.getCorner(AABox::NEAR_LEFT_TOP);
+
+		convexDesc.points.count = 8;
+		convexDesc.points.stride = sizeof(Vector3);
+		convexDesc.points.data = &aabbVerts[0];
+		convexDesc.flags &= ~PxConvexFlag::eINFLATE_CONVEX;
+
+		if (cooking->cookConvexMesh(convexDesc, output))
+		{
+			size = output.getSize();
+			*data = (UINT8*)bs_alloc(size);
+
+			memcpy(*data, output.getData(), size);
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Attempts to cook a triangle or convex mesh from the provided mesh data. Will log a warning and return false if it is
+	 * unable to cook the mesh. If the method returns true the resulting convex mesh will be output in the @p data buffer,
+	 * and its size in @p size. The data buffer will be allocated used the generic allocator and is up to the caller to 
+	 * free it.
+	 */
+	bool cookMesh(const MeshDataPtr& meshData, PhysicsMeshType type, UINT8** data, UINT32& size)
+	{
+		if (meshData == nullptr)
+			return false;
+
+		PxCooking* cooking = gPhysX().getCooking();
+		if (cooking == nullptr)
+		{
+			LOGWRN("Attempting to cook a physics mesh but cooking is not enabled globally.");
+			return false;
+		}
+
+		VertexDataDescPtr vertexDesc = meshData->getVertexDesc();
+		if (!vertexDesc->hasElement(VES_POSITION))
+		{
+			LOGWRN("Provided PhysicsMesh mesh data has no vertex positions.");
+			return false;
+		}
+
+		if (type == PhysicsMeshType::Convex)
+		{
+			if(!cookConvex(cooking, meshData, data, size))
+			{
+				LOGWRN("Failed cooking a convex mesh. Perpahs it is too complex? Maximum number of convex vertices is 256.");
+				return false;
+			}
+		}
+		else
+		{
+			PxTriangleMeshDesc meshDesc;
+			meshDesc.points.count = meshData->getNumVertices();
+			meshDesc.points.stride = vertexDesc->getVertexStride();
+			meshDesc.points.data = meshData->getElementData(VES_POSITION);
+
+			meshDesc.triangles.count = meshData->getNumIndices() / 3;
+			
+			IndexType indexType = meshData->getIndexType();
+			if (indexType == IT_32BIT)
+			{
+				meshDesc.triangles.stride = 3 * sizeof(PxU32);
+				meshDesc.triangles.data = meshData->getIndices32();
+			}
+			else
+			{
+				meshDesc.triangles.stride = 3 * sizeof(PxU16);
+				meshDesc.triangles.data = meshData->getIndices16();
+				meshDesc.flags |= PxMeshFlag::e16_BIT_INDICES;
+			}
+
+			PxDefaultMemoryOutputStream output;
+			if (!cooking->cookTriangleMesh(meshDesc, output))
+				return false;
+
+			size = output.getSize();
+			*data = (UINT8*)bs_alloc(size);
+
+			memcpy(*data, output.getData(), size);
+		}
+
+		return true;
+	}
+
+	PhysXMesh::PhysXMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
+		:PhysicsMesh(meshData, type)
+	{ }
+
+	void PhysXMesh::initialize()
+	{
+		if(mInternal == nullptr) // Could be not-null if we're deserializing
+			mInternal = bs_shared_ptr_new<FPhysXMesh>(mInitMeshData, mType);
+
+		PhysicsMesh::initialize();
+	}
+
+	void PhysXMesh::destroy()
+	{
+		mInternal = nullptr;
+
+		PhysicsMesh::destroy();
+	}
+
+	FPhysXMesh::FPhysXMesh()
+		:FPhysicsMesh(nullptr, PhysicsMeshType::Convex)
+	{
+		
+	}
+
+	FPhysXMesh::FPhysXMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
+		:FPhysicsMesh(meshData, type)
+	{
+		// Perform cooking if needed
+		if (meshData != nullptr)
+			cookMesh(meshData, mType, &mCookedData, mCookedDataSize);
+
+		initialize();
+	}
+
+	FPhysXMesh::~FPhysXMesh()
+	{
+		if (mCookedData != nullptr)
+		{
+			bs_free(mCookedData);
+
+			mCookedData = nullptr;
+			mCookedDataSize = 0;
+		}
+
+		if (mTriangleMesh != nullptr)
+		{
+			mTriangleMesh->release();
+			mTriangleMesh = nullptr;
+		}
+
+		if (mConvexMesh != nullptr)
+		{
+			mConvexMesh->release();
+			mConvexMesh = nullptr;
+		}
+	}
+
+	void FPhysXMesh::initialize()
+	{
+		if (mCookedData != nullptr && mCookedDataSize > 0)
+		{
+			PxPhysics* physx = gPhysX().getPhysX();
+
+			PxDefaultMemoryInputData input(mCookedData, mCookedDataSize);
+			if (mType == PhysicsMeshType::Convex)
+				mConvexMesh = physx->createConvexMesh(input);
+			else
+				mTriangleMesh = physx->createTriangleMesh(input);
+		}
+	}
+
+	MeshDataPtr FPhysXMesh::getMeshData() const
+	{
+		VertexDataDescPtr vertexDesc = VertexDataDesc::create();
+		vertexDesc->addVertElem(VET_FLOAT3, VES_POSITION);
+
+		if (mConvexMesh == nullptr && mTriangleMesh == nullptr)
+			return MeshData::create(0, 0, vertexDesc);
+
+		UINT32 numVertices = 0;
+		UINT32 numIndices = 0;
+
+		if(mConvexMesh != nullptr)
+		{
+			numVertices = mConvexMesh->getNbVertices();
+
+			UINT32 numPolygons = mConvexMesh->getNbPolygons();
+			for (UINT32 i = 0; i < numPolygons; i++)
+			{
+				PxHullPolygon face;
+				bool status = mConvexMesh->getPolygonData(i, face);
+				assert(status);
+
+				numIndices += (face.mNbVerts - 2) * 3;
+			}
+		}
+		else // Triangle
+		{
+			numVertices = mTriangleMesh->getNbVertices();
+			numIndices = mTriangleMesh->getNbTriangles() * 3;
+		}
+
+		MeshDataPtr meshData = MeshData::create(numVertices, numIndices, vertexDesc);
+
+		auto posIter = meshData->getVec3DataIter(VES_POSITION);
+		UINT32* outIndices = meshData->getIndices32();
+
+		if (mConvexMesh != nullptr)
+		{
+			const PxVec3* convexVertices = mConvexMesh->getVertices();
+			const UINT8* convexIndices = mConvexMesh->getIndexBuffer();
+
+			UINT32 numPolygons = mConvexMesh->getNbPolygons();
+			UINT32 offset = 0;
+			for (UINT32 i = 0; i < numPolygons; i++)
+			{
+				PxHullPolygon face;
+				bool status = mConvexMesh->getPolygonData(i, face);
+				assert(status);
+
+				const PxU8* faceIndices = convexIndices + face.mIndexBase;
+				for (UINT32 j = 0; j < face.mNbVerts; j++)
+					posIter.addValue(fromPxVector(convexVertices[faceIndices[j]]));
+
+				for (UINT32 j = 2; j < face.mNbVerts; j++)
+				{
+					*outIndices++ = offset;
+					*outIndices++ = offset + j;
+					*outIndices++ = offset + j - 1;
+				}
+
+				offset += face.mNbVerts;
+			}
+		}
+		else
+		{
+			const PxVec3* vertices = mTriangleMesh->getVertices();
+			for (UINT32 i = 0; i < numVertices; i++)
+				posIter.addValue(fromPxVector(vertices[i]));
+
+			if(mTriangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES)
+			{
+				const UINT16* indices = (const UINT16*)mTriangleMesh->getTriangles();
+				for (UINT32 i = 0; i < numIndices; i++)
+					outIndices[i] = (UINT32)indices[i];
+			}
+			else
+			{
+				const UINT32* indices = (const UINT32*)mTriangleMesh->getTriangles();
+				memcpy(outIndices, indices, numIndices * sizeof(UINT32));
+			}
+		}
+
+		return meshData;
+	}
+
+	RTTITypeBase* FPhysXMesh::getRTTIStatic()
+	{
+		return FPhysXMeshRTTI::instance();
+	}
+
+	RTTITypeBase* FPhysXMesh::getRTTI() const
+	{
+		return getRTTIStatic();
+	}
 }

+ 70 - 70
Source/BansheePhysX/Source/BsPhysXMeshCollider.cpp

@@ -1,71 +1,71 @@
-#include "BsPhysXMeshCollider.h"
-#include "BsPhysX.h"
-#include "PxPhysics.h"
-#include "BsFPhysXCollider.h"
-#include "BsPhysXMesh.h"
-
-using namespace physx;
-
-namespace BansheeEngine
-{
-	PhysXMeshCollider::PhysXMeshCollider(PxPhysics* physx, const Vector3& position, const Quaternion& rotation)
-	{
-		PxConvexMeshGeometry geometry;
-
-		PxShape* shape = physx->createShape(geometry, *gPhysX().getDefaultMaterial(), true);
-		shape->setLocalPose(toPxTransform(position, rotation));
-		shape->userData = this;
-
-		mInternal = bs_new<FPhysXCollider>(shape);
-	}
-
-	PhysXMeshCollider::~PhysXMeshCollider()
-	{
-		bs_delete(mInternal);
-	}
-
-	void PhysXMeshCollider::setScale(const Vector3& scale)
-	{
-		MeshCollider::setScale(scale);
-		applyGeometry();
-	}
-
-	void PhysXMeshCollider::onMeshChanged()
-	{
-		applyGeometry();
-	}
-
-	void PhysXMeshCollider::applyGeometry()
-	{
-		if (!mMesh.isLoaded())
-		{
-			PxConvexMeshGeometry geometry;
-			getInternal()->_getShape()->setGeometry(geometry);
-			return;
-		}
-
-		SPtr<PhysXMesh> physxMesh = std::static_pointer_cast<PhysXMesh>(mMesh.getInternalPtr());
-
-		if (physxMesh->getType() == PhysicsMeshType::Convex)
-		{
-			PxConvexMeshGeometry geometry;
-			geometry.scale = PxMeshScale(toPxVector(getScale()), PxIdentity);
-			geometry.convexMesh = physxMesh->_getConvex();
-
-			getInternal()->_getShape()->setGeometry(geometry);
-		}
-		else // Triangle
-		{
-			PxTriangleMeshGeometry geometry;
-			geometry.scale = PxMeshScale(toPxVector(getScale()), PxIdentity);
-			geometry.triangleMesh = physxMesh->_getTriangle();
-
-			getInternal()->_getShape()->setGeometry(geometry);
-		}
-	}
-
-	FPhysXCollider* PhysXMeshCollider::getInternal() const
-	{
-		return static_cast<FPhysXCollider*>(mInternal);
-	}
+#include "BsPhysXMeshCollider.h"
+#include "BsPhysX.h"
+#include "PxPhysics.h"
+#include "BsFPhysXCollider.h"
+#include "BsPhysXMesh.h"
+
+using namespace physx;
+
+namespace BansheeEngine
+{
+	PhysXMeshCollider::PhysXMeshCollider(PxPhysics* physx, const Vector3& position, const Quaternion& rotation)
+	{
+		PxConvexMeshGeometry geometry;
+
+		PxShape* shape = physx->createShape(geometry, *gPhysX().getDefaultMaterial(), true);
+		shape->setLocalPose(toPxTransform(position, rotation));
+		shape->userData = this;
+
+		mInternal = bs_new<FPhysXCollider>(shape);
+	}
+
+	PhysXMeshCollider::~PhysXMeshCollider()
+	{
+		bs_delete(mInternal);
+	}
+
+	void PhysXMeshCollider::setScale(const Vector3& scale)
+	{
+		MeshCollider::setScale(scale);
+		applyGeometry();
+	}
+
+	void PhysXMeshCollider::onMeshChanged()
+	{
+		applyGeometry();
+	}
+
+	void PhysXMeshCollider::applyGeometry()
+	{
+		if (!mMesh.isLoaded())
+		{
+			PxConvexMeshGeometry geometry;
+			getInternal()->_getShape()->setGeometry(geometry);
+			return;
+		}
+
+		FPhysXMesh* physxMesh = static_cast<FPhysXMesh*>(mMesh->_getInternal());
+
+		if (mMesh->getType() == PhysicsMeshType::Convex)
+		{
+			PxConvexMeshGeometry geometry;
+			geometry.scale = PxMeshScale(toPxVector(getScale()), PxIdentity);
+			geometry.convexMesh = physxMesh->_getConvex();
+
+			getInternal()->_getShape()->setGeometry(geometry);
+		}
+		else // Triangle
+		{
+			PxTriangleMeshGeometry geometry;
+			geometry.scale = PxMeshScale(toPxVector(getScale()), PxIdentity);
+			geometry.triangleMesh = physxMesh->_getTriangle();
+
+			getInternal()->_getShape()->setGeometry(geometry);
+		}
+	}
+
+	FPhysXCollider* PhysXMeshCollider::getInternal() const
+	{
+		return static_cast<FPhysXCollider*>(mInternal);
+	}
 }

+ 1 - 0
Source/MBansheeEditor/Library/LibraryWindow.cs

@@ -155,6 +155,7 @@ namespace BansheeEditor
         private void OnInitialize()
         {
             ProjectLibrary.OnEntryAdded += OnEntryChanged;
+            ProjectLibrary.OnEntryImported += OnEntryChanged;
             ProjectLibrary.OnEntryRemoved += OnEntryChanged;
 
             GUILayoutY contentLayout = GUI.AddLayoutY();