Przeglądaj źródła

More work on improving documentation for doxygen generation

BearishSun 9 lat temu
rodzic
commit
c363f99124
100 zmienionych plików z 6834 dodań i 6892 usunięć
  1. 54 54
      Source/BansheeEditor/Include/BsBuildDataRTTI.h
  2. 139 136
      Source/BansheeEditor/Include/BsCodeEditor.h
  3. 1 3
      Source/BansheeEditor/Include/BsDockManager.h
  4. 108 110
      Source/BansheeEditor/Include/BsDockManagerLayout.h
  5. 150 150
      Source/BansheeEditor/Include/BsDockManagerLayoutRTTI.h
  6. 51 53
      Source/BansheeEditor/Include/BsDropDownWindowManager.h
  7. 40 7
      Source/BansheeEditor/Include/BsEditorPrerequisites.h
  8. 129 129
      Source/BansheeEditor/Include/BsEditorSettingsRTTI.h
  9. 28 30
      Source/BansheeEditor/Include/BsEditorShaderIncludeHandler.h
  10. 95 95
      Source/BansheeEditor/Include/BsEditorTestSuite.h
  11. 1 3
      Source/BansheeEditor/Include/BsEditorWidget.h
  12. 165 167
      Source/BansheeEditor/Include/BsEditorWidgetContainer.h
  13. 67 69
      Source/BansheeEditor/Include/BsEditorWidgetLayout.h
  14. 112 112
      Source/BansheeEditor/Include/BsEditorWidgetLayoutRTTI.h
  15. 1 3
      Source/BansheeEditor/Include/BsEditorWidgetManager.h
  16. 54 56
      Source/BansheeEditor/Include/BsEditorWindowManager.h
  17. 226 228
      Source/BansheeEditor/Include/BsGUIMenuBar.h
  18. 1 3
      Source/BansheeEditor/Include/BsGUIResourceTreeView.h
  19. 1 3
      Source/BansheeEditor/Include/BsGUISceneTreeView.h
  20. 1 3
      Source/BansheeEditor/Include/BsGUIStatusBar.h
  21. 116 118
      Source/BansheeEditor/Include/BsGUITabButton.h
  22. 203 205
      Source/BansheeEditor/Include/BsGUITabbedTitleBar.h
  23. 1 3
      Source/BansheeEditor/Include/BsGUITreeView.h
  24. 49 51
      Source/BansheeEditor/Include/BsGUITreeViewEditBox.h
  25. 47 49
      Source/BansheeEditor/Include/BsGUIWindowFrame.h
  26. 66 68
      Source/BansheeEditor/Include/BsGUIWindowFrameWidget.h
  27. 43 43
      Source/BansheeEditor/Include/BsGUIWindowFrameWidgetRTTI.h
  28. 3 2
      Source/BansheeEditor/Include/BsGizmoManager.h
  29. 4 2
      Source/BansheeEditor/Include/BsHandleDrawManager.h
  30. 111 113
      Source/BansheeEditor/Include/BsHandleManager.h
  31. 69 71
      Source/BansheeEditor/Include/BsHandleSliderManager.h
  32. 103 103
      Source/BansheeEditor/Include/BsPlatformInfoRTTI.h
  33. 1 3
      Source/BansheeEditor/Include/BsProjectLibraryEntries.h
  34. 204 204
      Source/BansheeEditor/Include/BsProjectLibraryEntriesRTTI.h
  35. 85 85
      Source/BansheeEditor/Include/BsProjectResourceMetaRTTI.h
  36. 45 45
      Source/BansheeEditor/Include/BsProjectSettingsRTTI.h
  37. 1 3
      Source/BansheeEditor/Include/BsSceneGrid.h
  38. 142 140
      Source/BansheeEditor/Include/BsScenePicking.h
  39. 96 98
      Source/BansheeEditor/Include/BsSelectionRenderer.h
  40. 51 51
      Source/BansheeEditor/Include/BsSettingsRTTI.h
  41. 71 73
      Source/BansheeEditor/Include/Win32/BsVSCodeEditor.h
  42. 4 2
      Source/BansheeEngine/Include/BsBuiltinResources.h
  43. 47 47
      Source/BansheeEngine/Include/BsCCameraRTTI.h
  44. 43 43
      Source/BansheeEngine/Include/BsCGUIWidgetRTTI.h
  45. 47 47
      Source/BansheeEngine/Include/BsCLightRTTI.h
  46. 47 47
      Source/BansheeEngine/Include/BsCRenderableRTTI.h
  47. 2 4
      Source/BansheeEngine/Include/BsCamera.h
  48. 138 138
      Source/BansheeEngine/Include/BsCameraRTTI.h
  49. 1 3
      Source/BansheeEngine/Include/BsDragAndDropManager.h
  50. 111 113
      Source/BansheeEngine/Include/BsDropDownAreaPlacement.h
  51. 28 30
      Source/BansheeEngine/Include/BsEngineShaderIncludeHandler.h
  52. 1 3
      Source/BansheeEngine/Include/BsGUICommandEvent.h
  53. 72 74
      Source/BansheeEngine/Include/BsGUIDimensions.h
  54. 41 43
      Source/BansheeEngine/Include/BsGUIDropDownBoxManager.h
  55. 128 130
      Source/BansheeEngine/Include/BsGUIDropDownContent.h
  56. 1 3
      Source/BansheeEngine/Include/BsGUIDropDownHitBox.h
  57. 250 252
      Source/BansheeEngine/Include/BsGUIDropDownMenu.h
  58. 1 3
      Source/BansheeEngine/Include/BsGUIElementContainer.h
  59. 190 190
      Source/BansheeEngine/Include/BsGUIElementStyleRTTI.h
  60. 54 56
      Source/BansheeEngine/Include/BsGUIHelper.h
  61. 100 102
      Source/BansheeEngine/Include/BsGUIInputCaret.h
  62. 97 99
      Source/BansheeEngine/Include/BsGUIInputSelection.h
  63. 1 3
      Source/BansheeEngine/Include/BsGUIInputTool.h
  64. 71 73
      Source/BansheeEngine/Include/BsGUILayoutData.h
  65. 51 53
      Source/BansheeEngine/Include/BsGUILayoutUtility.h
  66. 1 3
      Source/BansheeEngine/Include/BsGUIManager.h
  67. 1 3
      Source/BansheeEngine/Include/BsGUIMenu.h
  68. 123 123
      Source/BansheeEngine/Include/BsGUISkinRTTI.h
  69. 1 3
      Source/BansheeEngine/Include/BsGUISliderHandle.h
  70. 37 39
      Source/BansheeEngine/Include/BsGUITooltip.h
  71. 36 38
      Source/BansheeEngine/Include/BsGUITooltipManager.h
  72. 37 39
      Source/BansheeEngine/Include/BsGameSettings.h
  73. 66 66
      Source/BansheeEngine/Include/BsGameSettingsRTTI.h
  74. 2 1
      Source/BansheeEngine/Include/BsImageSprite.h
  75. 294 296
      Source/BansheeEngine/Include/BsLight.h
  76. 89 89
      Source/BansheeEngine/Include/BsLightRTTI.h
  77. 1 3
      Source/BansheeEngine/Include/BsPaths.h
  78. 33 35
      Source/BansheeEngine/Include/BsPlainTextImporter.h
  79. 45 45
      Source/BansheeEngine/Include/BsPlainTextRTTI.h
  80. 41 11
      Source/BansheeEngine/Include/BsPrerequisites.h
  81. 275 277
      Source/BansheeEngine/Include/BsProfilerOverlay.h
  82. 43 43
      Source/BansheeEngine/Include/BsProfilerOverlayRTTI.h
  83. 99 101
      Source/BansheeEngine/Include/BsRenderQueue.h
  84. 240 242
      Source/BansheeEngine/Include/BsRenderable.h
  85. 48 50
      Source/BansheeEngine/Include/BsRenderableElement.h
  86. 38 40
      Source/BansheeEngine/Include/BsRenderableHandler.h
  87. 65 65
      Source/BansheeEngine/Include/BsRenderableRTTI.h
  88. 66 68
      Source/BansheeEngine/Include/BsRenderer.h
  89. 1 3
      Source/BansheeEngine/Include/BsRendererMaterial.h
  90. 1 3
      Source/BansheeEngine/Include/BsRendererMaterialManager.h
  91. 132 134
      Source/BansheeEngine/Include/BsRendererUtility.h
  92. 140 142
      Source/BansheeEngine/Include/BsSceneManager.h
  93. 45 45
      Source/BansheeEngine/Include/BsScriptCodeImportOptionsRTTI.h
  94. 36 38
      Source/BansheeEngine/Include/BsScriptCodeImporter.h
  95. 49 49
      Source/BansheeEngine/Include/BsScriptCodeRTTI.h
  96. 1 3
      Source/BansheeEngine/Include/BsScriptManager.h
  97. 1 3
      Source/BansheeEngine/Include/BsShortcutKey.h
  98. 39 41
      Source/BansheeEngine/Include/BsShortcutManager.h
  99. 193 195
      Source/BansheeEngine/Include/BsSprite.h
  100. 54 54
      Source/BansheeEngine/Include/BsSpriteTextureRTTI.h

+ 54 - 54
Source/BansheeEditor/Include/BsBuildDataRTTI.h

@@ -1,55 +1,55 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsBuildManager.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class BuildDataRTTI : public RTTIType <BuildData, IReflectable, BuildDataRTTI>
-	{
-	private:
-		SPtr<PlatformInfo> getPlatformInfo(BuildData* obj, UINT32 idx) { return obj->platformData[idx]; }
-		void setPlatformInfo(BuildData* obj, UINT32 idx, SPtr<PlatformInfo> val) { obj->platformData[idx] = val; }
-		UINT32 getPlatformInfoArraySize(BuildData* obj) { return (UINT32)obj->platformData.size(); }
-		void setPlatformInfoArraySize(BuildData* obj, UINT32 size) { obj->platformData.resize(size); }
-
-		PlatformType& getActivePlatform(BuildData* obj) { return obj->activePlatform; }
-		void setActivePlatform(BuildData* obj, PlatformType& val) { obj->activePlatform = val; }
-
-	public:
-		BuildDataRTTI()
-		{
-			addReflectablePtrArrayField("platformData", 0, &BuildDataRTTI::getPlatformInfo, &BuildDataRTTI::getPlatformInfoArraySize,
-				&BuildDataRTTI::setPlatformInfo, &BuildDataRTTI::setPlatformInfoArraySize);
-
-			addPlainField("activePlatform", 1, &BuildDataRTTI::getActivePlatform, &BuildDataRTTI::setActivePlatform);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "BuildData";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_BuildData;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<BuildData>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsBuildManager.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class BuildDataRTTI : public RTTIType <BuildData, IReflectable, BuildDataRTTI>
+	{
+	private:
+		SPtr<PlatformInfo> getPlatformInfo(BuildData* obj, UINT32 idx) { return obj->platformData[idx]; }
+		void setPlatformInfo(BuildData* obj, UINT32 idx, SPtr<PlatformInfo> val) { obj->platformData[idx] = val; }
+		UINT32 getPlatformInfoArraySize(BuildData* obj) { return (UINT32)obj->platformData.size(); }
+		void setPlatformInfoArraySize(BuildData* obj, UINT32 size) { obj->platformData.resize(size); }
+
+		PlatformType& getActivePlatform(BuildData* obj) { return obj->activePlatform; }
+		void setActivePlatform(BuildData* obj, PlatformType& val) { obj->activePlatform = val; }
+
+	public:
+		BuildDataRTTI()
+		{
+			addReflectablePtrArrayField("platformData", 0, &BuildDataRTTI::getPlatformInfo, &BuildDataRTTI::getPlatformInfoArraySize,
+				&BuildDataRTTI::setPlatformInfo, &BuildDataRTTI::setPlatformInfoArraySize);
+
+			addPlainField("activePlatform", 1, &BuildDataRTTI::getActivePlatform, &BuildDataRTTI::setActivePlatform);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "BuildData";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_BuildData;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<BuildData>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 139 - 136
Source/BansheeEditor/Include/BsCodeEditor.h

@@ -1,137 +1,140 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsModule.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup CodeEditor
-	 *  @{
-	 */
-
-	 /** @cond INTERNAL */
-
-	class CodeEditor;
-	class CodeEditorFactory;
-
-	/** Contains data about a reference to a project in an external editor solution. */
-	struct BS_ED_EXPORT CodeProjectReference
-	{
-		WString name;
-		Path path;
-	};
-
-	/**	Contains data about a single project in an external editor solution. */
-	struct BS_ED_EXPORT CodeProjectData
-	{
-		WString name;
-		Vector<Path> codeFiles;
-		Vector<Path> nonCodeFiles;
-		WString defines;
-		Vector<CodeProjectReference> assemblyReferences;
-		Vector<CodeProjectReference> projectReferences;
-	};
-
-	/**	Contains data about an external editor solution, including all projects contained. */
-	struct BS_ED_EXPORT CodeSolutionData
-	{
-		WString name;
-		Vector<CodeProjectData> projects;
-	};
-
-	/** @endcond */
-
-	/**
-	 * Handles connectivity of the editor with external code editing tools. The system provides methods for interacting with
-	 * external tools but the exact tool used depends on the currently active setting.
-	 */
-	class BS_ED_EXPORT CodeEditorManager : public Module<CodeEditorManager>
-	{
-	public:
-		CodeEditorManager();
-		~CodeEditorManager();
-
-		/**	Returns a list of all available code editors for this platform. */
-		const Vector<CodeEditorType>& getAvailableEditors() const { return mEditors; }
-
-		/**
-		 * Changes the active code editor. All further operations on this object will be executed using this editor. If the
-		 * specified editor is not valid for this platform, no change will be made.
-		 */
-		void setActive(CodeEditorType editor);
-
-		/**	Returns the currently active code editor. */
-		CodeEditorType getActive() const { return mActiveEditorType; }
-
-		/**
-		 * Opens a code file in the active external editor. 
-		 *
-		 * @param[in]	path		Path to the code file to open, can be absolute or relative to project resources folder.
-		 *							The file should be part of a solution in the active editor.
-		 * @param[in]	lineNumber	Line number to focus on once the file is opened. Might not be supported by all editors.
-		 */
-		void openFile(const Path& path, UINT32 lineNumber) const;
-
-		/**
-		 * Synchronizes all code files and assemblies in the active project and updates the project solution for the active
-		 * editor. Each project can only have one solution per editor.
-		 */
-		void syncSolution() const;
-
-	private:
-		/**	Returns the absolute path at which the external editor solution file should be stored. */
-		Path getSolutionPath() const;
-
-		CodeEditor* mActiveEditor;
-		CodeEditorType mActiveEditorType;
-		Map<CodeEditorType, CodeEditorFactory*> mFactoryPerEditor;
-		Vector<CodeEditorType> mEditors;
-		Vector<CodeEditorFactory*> mFactories;
-	};
-
-	/** @cond INTERNAL */
-
-	/**
-	 * Interface that classes interacting with external code editors needs to implement.
-	 *
-	 * @see		CodeEditorManager
-	 */
-	class BS_ED_EXPORT CodeEditor
-	{
-	public:
-		virtual ~CodeEditor() { }
-
-		/** @copydoc CodeEditorManager::openFile */
-		virtual void openFile(const Path& solutionPath, const Path& path, UINT32 lineNumber) const = 0;
-
-		/** @copydoc CodeEditorManager::syncSolution */
-		virtual void syncSolution(const CodeSolutionData& data, const Path& outputPath) const = 0;
-	};
-
-	/**
-	 * Interface for factory that creates a specific implementation(s) of a code editor.
-	 *
-	 * @see		CodeEditor
-	 */
-	class BS_ED_EXPORT CodeEditorFactory
-	{
-	public:
-		virtual ~CodeEditorFactory() { }
-
-		/**	Returns a list of code editors supported by this factory. */
-		virtual const Vector<CodeEditorType>& getAvailableEditors() const = 0;
-
-		/**
-		 * Creates a specific implementation of a code editor.
-		 *
-		 * @param[in]	editor	Type of editor to create. Make sure to provide a valid value returned by 
-		 *						getAvailableEditors().
-		 */
-		virtual CodeEditor* create(CodeEditorType editor) const = 0;
-	};
-
-	/** @endcond */
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsModule.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup CodeEditor-Internal
+	 *  @{
+	 */
+
+	class CodeEditor;
+	class CodeEditorFactory;
+
+	/** Contains data about a reference to a project in an external editor solution. */
+	struct BS_ED_EXPORT CodeProjectReference
+	{
+		WString name;
+		Path path;
+	};
+
+	/**	Contains data about a single project in an external editor solution. */
+	struct BS_ED_EXPORT CodeProjectData
+	{
+		WString name;
+		Vector<Path> codeFiles;
+		Vector<Path> nonCodeFiles;
+		WString defines;
+		Vector<CodeProjectReference> assemblyReferences;
+		Vector<CodeProjectReference> projectReferences;
+	};
+
+	/**	Contains data about an external editor solution, including all projects contained. */
+	struct BS_ED_EXPORT CodeSolutionData
+	{
+		WString name;
+		Vector<CodeProjectData> projects;
+	};
+
+	/** @} */
+	/** @addtogroup CodeEditor
+	 *  @{
+	 */
+
+	/**
+	 * Handles connectivity of the editor with external code editing tools. The system provides methods for interacting with
+	 * external tools but the exact tool used depends on the currently active setting.
+	 */
+	class BS_ED_EXPORT CodeEditorManager : public Module<CodeEditorManager>
+	{
+	public:
+		CodeEditorManager();
+		~CodeEditorManager();
+
+		/**	Returns a list of all available code editors for this platform. */
+		const Vector<CodeEditorType>& getAvailableEditors() const { return mEditors; }
+
+		/**
+		 * Changes the active code editor. All further operations on this object will be executed using this editor. If the
+		 * specified editor is not valid for this platform, no change will be made.
+		 */
+		void setActive(CodeEditorType editor);
+
+		/**	Returns the currently active code editor. */
+		CodeEditorType getActive() const { return mActiveEditorType; }
+
+		/**
+		 * Opens a code file in the active external editor. 
+		 *
+		 * @param[in]	path		Path to the code file to open, can be absolute or relative to project resources folder.
+		 *							The file should be part of a solution in the active editor.
+		 * @param[in]	lineNumber	Line number to focus on once the file is opened. Might not be supported by all editors.
+		 */
+		void openFile(const Path& path, UINT32 lineNumber) const;
+
+		/**
+		 * Synchronizes all code files and assemblies in the active project and updates the project solution for the active
+		 * editor. Each project can only have one solution per editor.
+		 */
+		void syncSolution() const;
+
+	private:
+		/**	Returns the absolute path at which the external editor solution file should be stored. */
+		Path getSolutionPath() const;
+
+		CodeEditor* mActiveEditor;
+		CodeEditorType mActiveEditorType;
+		Map<CodeEditorType, CodeEditorFactory*> mFactoryPerEditor;
+		Vector<CodeEditorType> mEditors;
+		Vector<CodeEditorFactory*> mFactories;
+	};
+
+	/** @} */
+	/** @addtogroup CodeEditor-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Interface that classes interacting with external code editors needs to implement.
+	 *
+	 * @see		CodeEditorManager
+	 */
+	class BS_ED_EXPORT CodeEditor
+	{
+	public:
+		virtual ~CodeEditor() { }
+
+		/** @copydoc CodeEditorManager::openFile */
+		virtual void openFile(const Path& solutionPath, const Path& path, UINT32 lineNumber) const = 0;
+
+		/** @copydoc CodeEditorManager::syncSolution */
+		virtual void syncSolution(const CodeSolutionData& data, const Path& outputPath) const = 0;
+	};
+
+	/**
+	 * Interface for factory that creates a specific implementation(s) of a code editor.
+	 *
+	 * @see		CodeEditor
+	 */
+	class BS_ED_EXPORT CodeEditorFactory
+	{
+	public:
+		virtual ~CodeEditorFactory() { }
+
+		/**	Returns a list of code editors supported by this factory. */
+		virtual const Vector<CodeEditorType>& getAvailableEditors() const = 0;
+
+		/**
+		 * Creates a specific implementation of a code editor.
+		 *
+		 * @param[in]	editor	Type of editor to create. Make sure to provide a valid value returned by 
+		 *						getAvailableEditors().
+		 */
+		virtual CodeEditor* create(CodeEditorType editor) const = 0;
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsDockManager.h

@@ -8,8 +8,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
+	/** @addtogroup EditorWindow-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -308,5 +307,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 108 - 110
Source/BansheeEditor/Include/BsDockManagerLayout.h

@@ -1,111 +1,109 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsIReflectable.h"
-#include "BsRect2I.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
-	 *  @{
-	 */
-
-	/**
-	 * Used for storing a layout of widgets in a dock manager. 
-	 *
-	 * @see		DockManager
-	 */
-	class DockManagerLayout : public IReflectable
-	{
-	public:
-		/**
-		 * A single entry in the dock layout which may contain references to two other entries (non-leaf) or may contain
-		 * multiple widgets (leaf).
-		 */
-		struct Entry
-		{
-		public:
-			Entry();
-			~Entry();
-
-			/**
-			 * Creates a new leaf entry with the specified widgets.
-			 *
-			 * @param[in]	parent		Parent of this leaf entry. Can be null for root.
-			 * @param[in]	childIdx	Index of this entry in the parents child list. Can be 0 or 1.
-			 * @param[in]	widgetNames	A list of all widgets opened in this entry, listed by name.
-			 */
-			static Entry* createLeaf(Entry* parent, UINT32 childIdx, 
-				const Vector<String>& widgetNames);
-
-			/**
-			 * Creates a new container entry with the specified split data.
-			 *
-			 * @param[in]	parent				Parent of this leaf entry. Can be null for root.
-			 * @param[in]	childIdx			Index of this entry in the parents child list. Can be 0 or 1.
-			 * @param[in]	splitPosition		Determines at what position(in percent) should this container be split. 
-			 * @param[in]	horizontalSplit		Whether the split is horizontal (true) or vertical (false).
-			 */
-			static Entry* createContainer(Entry* parent, UINT32 childIdx, float splitPosition, 
-				bool horizontalSplit);
-
-			Vector<String> widgetNames;
-			bool isLeaf;
-			float splitPosition;
-			bool horizontalSplit;
-
-			Entry* children[2];
-			Entry* parent;
-		};
-
-	public:
-		DockManagerLayout();
-		~DockManagerLayout();
-
-		/**	Returns the root entry in the saved dock manager hierarchy. */
-		Entry& getRootEntry() { return mRootEntry; }
-
-		/**
-		 * Signals whether there is a maximized dock container in the layout.
-		 *
-		 * @param[in]	maximized 	True if maximized.
-		 * @param[in]	widgetName	Name of the widgets on the maximized container.
-		 */
-		void setIsMaximized(bool maximized, const Vector<String>& widgetNames);
-
-		/**	Check if the layout has a maximized container. */
-		bool isMaximized() const { return mIsMaximized; }
-
-		/**	Returns widget names that are in the maximized container, if there is one. */
-		const Vector<String>& getMaximizedWidgetNames() const { return mMaximizedWidgetNames; }
-
-		/**
-		 * Removes widgets that can no longer be found (their names no longer reference a widget), and removes containers
-		 * with no widgets.
-		 */
-		void pruneInvalidLeaves();
-
-		/**	Makes a deep copy of this object. */
-		DockManagerLayoutPtr clone();
-
-	private:
-		Entry mRootEntry;
-		bool mIsMaximized;
-		Vector<String> mMaximizedWidgetNames;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-
-	public:
-		friend class DockManagerLayoutRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;	
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsIReflectable.h"
+#include "BsRect2I.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup EditorWindow-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Used for storing a layout of widgets in a dock manager. 
+	 *
+	 * @see		DockManager
+	 */
+	class DockManagerLayout : public IReflectable
+	{
+	public:
+		/**
+		 * A single entry in the dock layout which may contain references to two other entries (non-leaf) or may contain
+		 * multiple widgets (leaf).
+		 */
+		struct Entry
+		{
+		public:
+			Entry();
+			~Entry();
+
+			/**
+			 * Creates a new leaf entry with the specified widgets.
+			 *
+			 * @param[in]	parent		Parent of this leaf entry. Can be null for root.
+			 * @param[in]	childIdx	Index of this entry in the parents child list. Can be 0 or 1.
+			 * @param[in]	widgetNames	A list of all widgets opened in this entry, listed by name.
+			 */
+			static Entry* createLeaf(Entry* parent, UINT32 childIdx, 
+				const Vector<String>& widgetNames);
+
+			/**
+			 * Creates a new container entry with the specified split data.
+			 *
+			 * @param[in]	parent				Parent of this leaf entry. Can be null for root.
+			 * @param[in]	childIdx			Index of this entry in the parents child list. Can be 0 or 1.
+			 * @param[in]	splitPosition		Determines at what position(in percent) should this container be split. 
+			 * @param[in]	horizontalSplit		Whether the split is horizontal (true) or vertical (false).
+			 */
+			static Entry* createContainer(Entry* parent, UINT32 childIdx, float splitPosition, 
+				bool horizontalSplit);
+
+			Vector<String> widgetNames;
+			bool isLeaf;
+			float splitPosition;
+			bool horizontalSplit;
+
+			Entry* children[2];
+			Entry* parent;
+		};
+
+	public:
+		DockManagerLayout();
+		~DockManagerLayout();
+
+		/**	Returns the root entry in the saved dock manager hierarchy. */
+		Entry& getRootEntry() { return mRootEntry; }
+
+		/**
+		 * Signals whether there is a maximized dock container in the layout.
+		 *
+		 * @param[in]	maximized 	True if maximized.
+		 * @param[in]	widgetName	Name of the widgets on the maximized container.
+		 */
+		void setIsMaximized(bool maximized, const Vector<String>& widgetNames);
+
+		/**	Check if the layout has a maximized container. */
+		bool isMaximized() const { return mIsMaximized; }
+
+		/**	Returns widget names that are in the maximized container, if there is one. */
+		const Vector<String>& getMaximizedWidgetNames() const { return mMaximizedWidgetNames; }
+
+		/**
+		 * Removes widgets that can no longer be found (their names no longer reference a widget), and removes containers
+		 * with no widgets.
+		 */
+		void pruneInvalidLeaves();
+
+		/**	Makes a deep copy of this object. */
+		DockManagerLayoutPtr clone();
+
+	private:
+		Entry mRootEntry;
+		bool mIsMaximized;
+		Vector<String> mMaximizedWidgetNames;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+
+	public:
+		friend class DockManagerLayoutRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;	
+	};
+
+	/** @} */
 }
 }

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

@@ -1,151 +1,151 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsDockManagerLayout.h"
-#include "BsRTTIType.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class DockManagerLayoutRTTI : public RTTIType<DockManagerLayout, IReflectable, DockManagerLayoutRTTI>
-	{
-	private:
-		DockManagerLayout::Entry& getRootEntry(DockManagerLayout* obj) { return obj->mRootEntry; }
-		void setRootEntry(DockManagerLayout* obj, DockManagerLayout::Entry& val) { obj->mRootEntry = val; } 
-
-		bool& getIsMaximized(DockManagerLayout* obj) { return obj->mIsMaximized; }
-		void setIsMaximized(DockManagerLayout* obj, bool& val) { obj->mIsMaximized = val; }
-
-		Vector<String>& getMaximizedWidgetNames(DockManagerLayout* obj) { return obj->mMaximizedWidgetNames; }
-		void setMaximizedWidgetNames(DockManagerLayout* obj, Vector<String>& val) { obj->mMaximizedWidgetNames = val; }
-
-	public:
-		DockManagerLayoutRTTI()
-		{
-			addPlainField("mRootEntry", 0, &DockManagerLayoutRTTI::getRootEntry, &DockManagerLayoutRTTI::setRootEntry);
-			addPlainField("mIsMaximized", 1, &DockManagerLayoutRTTI::getIsMaximized, &DockManagerLayoutRTTI::setIsMaximized);
-			addPlainField("mMaximizedWidgetNames", 2, &DockManagerLayoutRTTI::getMaximizedWidgetNames, &DockManagerLayoutRTTI::setMaximizedWidgetNames);
-		}
-
-		void onDeserializationEnded(IReflectable* obj) override
-		{
-			DockManagerLayout* layout = static_cast<DockManagerLayout*>(obj);
-
-			Stack<DockManagerLayout::Entry*> todo;
-			todo.push(&layout->mRootEntry);
-
-			while (!todo.empty())
-			{
-				DockManagerLayout::Entry* current = todo.top();
-				todo.pop();
-
-				if (!current->isLeaf)
-				{
-					current->children[0]->parent = current;
-					current->children[1]->parent = current;
-
-					todo.push(current->children[0]);
-					todo.push(current->children[1]);
-				}
-			}
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "DockManagerLayout";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_DockManagerLayout;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<DockManagerLayout>();
-		}
-	};
-
-	template<> struct RTTIPlainType<BansheeEngine::DockManagerLayout::Entry>
-	{	
-		enum { id = BansheeEngine::TID_DockManagerLayoutEntry }; enum { hasDynamicSize = 1 };
-
-		static void toMemory(const BansheeEngine::DockManagerLayout::Entry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			char* memoryStart = memory;
-			memory += sizeof(UINT32);
-			size += sizeof(UINT32);
-
-			memory = rttiWriteElem(data.isLeaf, memory, size);
-			memory = rttiWriteElem(data.horizontalSplit, memory, size);
-			memory = rttiWriteElem(data.splitPosition, memory, size);
-			memory = rttiWriteElem(data.widgetNames, memory, size);
-
-			if(!data.isLeaf)
-			{
-				memory = rttiWriteElem(*data.children[0], memory, size);
-				memory = rttiWriteElem(*data.children[1], memory, size);
-			}
-
-			memcpy(memoryStart, &size, sizeof(UINT32));
-		}
-
-		static UINT32 fromMemory(BansheeEngine::DockManagerLayout::Entry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			memcpy(&size, memory, sizeof(UINT32));
-			memory += sizeof(UINT32);
-
-			memory = rttiReadElem(data.isLeaf, memory);
-			memory = rttiReadElem(data.horizontalSplit, memory);
-			memory = rttiReadElem(data.splitPosition, memory);
-			memory = rttiReadElem(data.widgetNames, memory);
-
-			if(!data.isLeaf)
-			{
-				data.children[0] = bs_new<BansheeEngine::DockManagerLayout::Entry>();
-				data.children[1] = bs_new<BansheeEngine::DockManagerLayout::Entry>();
-
-				memory = rttiReadElem(*data.children[0], memory);
-				memory = rttiReadElem(*data.children[1], memory);
-				
-				data.children[0]->parent = &data;
-				data.children[1]->parent = &data;
-			}
-
-			return size;
-		}
-
-		static UINT32 getDynamicSize(const BansheeEngine::DockManagerLayout::Entry& data)	
-		{ 
-			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.isLeaf) + rttiGetElemSize(data.horizontalSplit) + 
-				rttiGetElemSize(data.splitPosition) + rttiGetElemSize(data.widgetNames);
-
-			if(!data.isLeaf)
-			{
-				dataSize += rttiGetElemSize(*data.children[0]);
-				dataSize += rttiGetElemSize(*data.children[1]);
-			}
-
-#if BS_DEBUG_MODE
-			if(dataSize > std::numeric_limits<UINT32>::max())
-			{
-				__string_throwDataOverflowException();
-			}
-#endif
-
-			return (UINT32)dataSize;
-		}	
-	}; 
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsDockManagerLayout.h"
+#include "BsRTTIType.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class DockManagerLayoutRTTI : public RTTIType<DockManagerLayout, IReflectable, DockManagerLayoutRTTI>
+	{
+	private:
+		DockManagerLayout::Entry& getRootEntry(DockManagerLayout* obj) { return obj->mRootEntry; }
+		void setRootEntry(DockManagerLayout* obj, DockManagerLayout::Entry& val) { obj->mRootEntry = val; } 
+
+		bool& getIsMaximized(DockManagerLayout* obj) { return obj->mIsMaximized; }
+		void setIsMaximized(DockManagerLayout* obj, bool& val) { obj->mIsMaximized = val; }
+
+		Vector<String>& getMaximizedWidgetNames(DockManagerLayout* obj) { return obj->mMaximizedWidgetNames; }
+		void setMaximizedWidgetNames(DockManagerLayout* obj, Vector<String>& val) { obj->mMaximizedWidgetNames = val; }
+
+	public:
+		DockManagerLayoutRTTI()
+		{
+			addPlainField("mRootEntry", 0, &DockManagerLayoutRTTI::getRootEntry, &DockManagerLayoutRTTI::setRootEntry);
+			addPlainField("mIsMaximized", 1, &DockManagerLayoutRTTI::getIsMaximized, &DockManagerLayoutRTTI::setIsMaximized);
+			addPlainField("mMaximizedWidgetNames", 2, &DockManagerLayoutRTTI::getMaximizedWidgetNames, &DockManagerLayoutRTTI::setMaximizedWidgetNames);
+		}
+
+		void onDeserializationEnded(IReflectable* obj) override
+		{
+			DockManagerLayout* layout = static_cast<DockManagerLayout*>(obj);
+
+			Stack<DockManagerLayout::Entry*> todo;
+			todo.push(&layout->mRootEntry);
+
+			while (!todo.empty())
+			{
+				DockManagerLayout::Entry* current = todo.top();
+				todo.pop();
+
+				if (!current->isLeaf)
+				{
+					current->children[0]->parent = current;
+					current->children[1]->parent = current;
+
+					todo.push(current->children[0]);
+					todo.push(current->children[1]);
+				}
+			}
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "DockManagerLayout";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_DockManagerLayout;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<DockManagerLayout>();
+		}
+	};
+
+	template<> struct RTTIPlainType<BansheeEngine::DockManagerLayout::Entry>
+	{	
+		enum { id = BansheeEngine::TID_DockManagerLayoutEntry }; enum { hasDynamicSize = 1 };
+
+		static void toMemory(const BansheeEngine::DockManagerLayout::Entry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			char* memoryStart = memory;
+			memory += sizeof(UINT32);
+			size += sizeof(UINT32);
+
+			memory = rttiWriteElem(data.isLeaf, memory, size);
+			memory = rttiWriteElem(data.horizontalSplit, memory, size);
+			memory = rttiWriteElem(data.splitPosition, memory, size);
+			memory = rttiWriteElem(data.widgetNames, memory, size);
+
+			if(!data.isLeaf)
+			{
+				memory = rttiWriteElem(*data.children[0], memory, size);
+				memory = rttiWriteElem(*data.children[1], memory, size);
+			}
+
+			memcpy(memoryStart, &size, sizeof(UINT32));
+		}
+
+		static UINT32 fromMemory(BansheeEngine::DockManagerLayout::Entry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			memcpy(&size, memory, sizeof(UINT32));
+			memory += sizeof(UINT32);
+
+			memory = rttiReadElem(data.isLeaf, memory);
+			memory = rttiReadElem(data.horizontalSplit, memory);
+			memory = rttiReadElem(data.splitPosition, memory);
+			memory = rttiReadElem(data.widgetNames, memory);
+
+			if(!data.isLeaf)
+			{
+				data.children[0] = bs_new<BansheeEngine::DockManagerLayout::Entry>();
+				data.children[1] = bs_new<BansheeEngine::DockManagerLayout::Entry>();
+
+				memory = rttiReadElem(*data.children[0], memory);
+				memory = rttiReadElem(*data.children[1], memory);
+				
+				data.children[0]->parent = &data;
+				data.children[1]->parent = &data;
+			}
+
+			return size;
+		}
+
+		static UINT32 getDynamicSize(const BansheeEngine::DockManagerLayout::Entry& data)	
+		{ 
+			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.isLeaf) + rttiGetElemSize(data.horizontalSplit) + 
+				rttiGetElemSize(data.splitPosition) + rttiGetElemSize(data.widgetNames);
+
+			if(!data.isLeaf)
+			{
+				dataSize += rttiGetElemSize(*data.children[0]);
+				dataSize += rttiGetElemSize(*data.children[1]);
+			}
+
+#if BS_DEBUG_MODE
+			if(dataSize > std::numeric_limits<UINT32>::max())
+			{
+				__string_throwDataOverflowException();
+			}
+#endif
+
+			return (UINT32)dataSize;
+		}	
+	}; 
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 51 - 53
Source/BansheeEditor/Include/BsDropDownWindowManager.h

@@ -1,54 +1,52 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsModule.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
-	 *  @{
-	 */
-
-	/** Handles opening and closing of a drop down window. Only a single drop down window can be open at a time. */
-	class BS_ED_EXPORT DropDownWindowManager : public Module <DropDownWindowManager>
-	{
-	public:
-		DropDownWindowManager();
-		~DropDownWindowManager();
-
-		/**
-		 * Opens a new drop down window with the specified type and arguments.
-		 *
-		 * @param[in]	parent		Render window parent in which to open the drop down window.
-		 * @param[in]	camera		Camera in which to open the drop down window.
-		 * @param[in]	position	Position relative to the viewport at which to open the drop down window.
-		 * @param[in]	...args		A set of arguments to be passed along to the drop down window constructor.
-		 * @return					An instance of the newly created drop down window.
-		 *
-		 * @note	This method will automatically close any existing drop down windows before opening a new one.
-		 */
-		template<class T, class... Args>
-		T* open(const RenderWindowPtr& parent, const CameraPtr& camera,
-			const Vector2I& position, Args &&...args)
-		{
-			close();
-
-			mOpenWindow = bs_new<T>(parent, camera, position, std::forward<Args>(args)...);
-			return static_cast<T*>(mOpenWindow);
-		}
-
-		/**	Closes a drop down window if one is open. */
-		void close();
-
-		/** To be called once per frame. Internal method. */
-		void update();
-	protected:
-		DropDownWindow* mOpenWindow;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsModule.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup EditorWindow-Internal
+	 *  @{
+	 */
+
+	/** Handles opening and closing of a drop down window. Only a single drop down window can be open at a time. */
+	class BS_ED_EXPORT DropDownWindowManager : public Module <DropDownWindowManager>
+	{
+	public:
+		DropDownWindowManager();
+		~DropDownWindowManager();
+
+		/**
+		 * Opens a new drop down window with the specified type and arguments.
+		 *
+		 * @param[in]	parent		Render window parent in which to open the drop down window.
+		 * @param[in]	camera		Camera in which to open the drop down window.
+		 * @param[in]	position	Position relative to the viewport at which to open the drop down window.
+		 * @param[in]	...args		A set of arguments to be passed along to the drop down window constructor.
+		 * @return					An instance of the newly created drop down window.
+		 *
+		 * @note	This method will automatically close any existing drop down windows before opening a new one.
+		 */
+		template<class T, class... Args>
+		T* open(const RenderWindowPtr& parent, const CameraPtr& camera,
+			const Vector2I& position, Args &&...args)
+		{
+			close();
+
+			mOpenWindow = bs_new<T>(parent, camera, position, std::forward<Args>(args)...);
+			return static_cast<T*>(mOpenWindow);
+		}
+
+		/**	Closes a drop down window if one is open. */
+		void close();
+
+		/** To be called once per frame. Internal method. */
+		void update();
+	protected:
+		DropDownWindow* mOpenWindow;
+	};
+
+	/** @} */
 }
 }

+ 40 - 7
Source/BansheeEditor/Include/BsEditorPrerequisites.h

@@ -9,12 +9,12 @@
  */
  */
 
 
 /** @defgroup Editor Editor
 /** @defgroup Editor Editor
- *	Provides functionality specific to the Banshee Editor.
+ *	Functionality specific to the Banshee Editor.
  *  @{
  *  @{
  */
  */
 
 
 /** @defgroup EditorWindow EditorWindow
 /** @defgroup EditorWindow EditorWindow
- *  Functionality for creating, managing and interacting with editor windows.
+ *  Creating, managing and interacting with editor windows.
  */
  */
 
 
 /** @defgroup Utility-Editor Utility
 /** @defgroup Utility-Editor Utility
@@ -26,27 +26,29 @@
   */
   */
 
 
 /** @defgroup Build Build
 /** @defgroup Build Build
-  *	Functionality for building (publishing) the game from within the editor.
+  *	Building (publishing) the game from within the editor.
   */
   */
 
 
 /** @defgroup CodeEditor CodeEditor
 /** @defgroup CodeEditor CodeEditor
-  *	Functionality for integrating the Banshee Editor with external code editors (for example Visual Studio).
+  *	Integration of the Banshee Editor with external code editors.
   */
   */
 
 
 /** @defgroup Handles Handles
 /** @defgroup Handles Handles
-  *	Functionality creating and interacting with handles (for example move/rotate/scale and custom tools).
+  *	Creating and interacting with handles (scene tools).
   */
   */
 
 
 /** @defgroup Library Library
 /** @defgroup Library Library
   *	Management of all resources (assets) within a project.
   *	Management of all resources (assets) within a project.
   */
   */
 
 
+/** @cond RTTI */
 /** @defgroup RTTI-Impl-Editor RTTI types
 /** @defgroup RTTI-Impl-Editor RTTI types
  *  Types containing RTTI for specific classes.
  *  Types containing RTTI for specific classes.
  */
  */
+/** @endcond */
 
 
 /** @defgroup Scene-Editor Scene
 /** @defgroup Scene-Editor Scene
-  *	Functionality for rendering/interacting with the scene view in editor.
+  *	Rendering/interacting with the scene view in editor.
   */
   */
 
 
 /** @defgroup Settings Settings
 /** @defgroup Settings Settings
@@ -58,13 +60,44 @@
  */
  */
 
 
 /** @defgroup UndoRedo UndoRedo
 /** @defgroup UndoRedo UndoRedo
- *  Provides functionality for undoing and redoing actions within the editor.
+ *  Undoing and redoing actions within the editor.
  */
  */
 
 
 /** @defgroup Application-Editor Application
 /** @defgroup Application-Editor Application
  *  Entry point into the editor application.
  *  Entry point into the editor application.
  */
  */
 
 
+/** @defgroup Internal-Core [INTERNAL]
+ *	Low-level classes and methods not meant for normal use, useful for those that are modifying the engine.
+ *  @{
+ */
+
+/** @defgroup CodeEditor-Internal CodeEditor
+  *	Integration of the Banshee Editor with external code editors.
+  */
+
+/** @defgroup EditorWindow-Internal EditorWindow
+ *  Creating, managing and interacting with editor windows.
+ */
+
+/** @defgroup GUI-Editor-Internal GUI
+  *	Editor specific GUI elements.
+  */
+
+/** @defgroup Handles-Internal Handles
+  *	Creating and interacting with handles (scene tools).
+  */
+
+/** @defgroup Library-Internal Library
+  *	Management of all resources (assets) within a project.
+  */
+
+/** @defgroup Scene-Editor-Internal Scene
+  *	Rendering/interacting with the scene view in editor.
+  */
+
+/** @} */
+
 /** @} */
 /** @} */
 /** @} */
 /** @} */
 
 

+ 129 - 129
Source/BansheeEditor/Include/BsEditorSettingsRTTI.h

@@ -1,130 +1,130 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsEditorSettings.h"
-#include "BsRTTIType.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class EditorSettingsRTTI : public RTTIType <EditorSettings, Settings, EditorSettingsRTTI>
-	{
-	private:
-		BS_PLAIN_MEMBER(mMoveSnapActive);
-		BS_PLAIN_MEMBER(mRotateSnapActive);
-
-		BS_PLAIN_MEMBER(mMoveSnap);
-		BS_PLAIN_MEMBER(mRotationSnap);
-
-		BS_PLAIN_MEMBER(mGridSize);
-		BS_PLAIN_MEMBER(mGridAxisSpacing);
-
-		BS_PLAIN_MEMBER(mActiveSceneTool);
-		BS_PLAIN_MEMBER(mActiveCoordinateMode);
-		BS_PLAIN_MEMBER(mActivePivotMode);
-
-		BS_PLAIN_MEMBER(mHandleSize);
-
-		BS_PLAIN_MEMBER(mLastOpenProject);
-		BS_PLAIN_MEMBER(mAutoLoadLastProject);
-		BS_PLAIN_MEMBER(mRecentProjects);
-
-		BS_PLAIN_MEMBER(mFPSLimit);
-		BS_PLAIN_MEMBER(mMouseSensitivity);
-
-	public:
-		EditorSettingsRTTI()
-		{
-			BS_ADD_PLAIN_FIELD(mMoveSnapActive, 0);
-			BS_ADD_PLAIN_FIELD(mRotateSnapActive, 1);
-
-			BS_ADD_PLAIN_FIELD(mMoveSnap, 2);
-			BS_ADD_PLAIN_FIELD(mRotationSnap, 3);
-
-			BS_ADD_PLAIN_FIELD(mGridSize, 4);
-			BS_ADD_PLAIN_FIELD(mGridAxisSpacing, 5);
-
-			BS_ADD_PLAIN_FIELD(mActiveSceneTool, 6);
-			BS_ADD_PLAIN_FIELD(mActiveCoordinateMode, 7);
-			BS_ADD_PLAIN_FIELD(mActivePivotMode, 8);
-
-			BS_ADD_PLAIN_FIELD(mHandleSize, 9);
-
-			BS_ADD_PLAIN_FIELD(mLastOpenProject, 10);
-			BS_ADD_PLAIN_FIELD(mAutoLoadLastProject, 11);
-			BS_ADD_PLAIN_FIELD(mRecentProjects, 12);
-
-			BS_ADD_PLAIN_FIELD(mFPSLimit, 13);
-			BS_ADD_PLAIN_FIELD(mMouseSensitivity, 14);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "EditorSettings";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_EditorSettings;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<EditorSettings>();
-		}
-	};
-
-	template<> struct RTTIPlainType <RecentProject>
-	{
-		enum { id = TID_RecentProject }; enum { hasDynamicSize = 1 };
-
-		static void toMemory(const RecentProject& data, char* memory)
-		{
-			UINT32 size = 0;
-			char* memoryStart = memory;
-			memory += sizeof(UINT32);
-			size += sizeof(UINT32);
-
-			memory = rttiWriteElem(data.path, memory, size);
-			memory = rttiWriteElem(data.accessTimestamp, memory, size);
-
-			memcpy(memoryStart, &size, sizeof(UINT32));
-		}
-
-		static UINT32 fromMemory(RecentProject& data, char* memory)
-		{
-			UINT32 size = 0;
-			memcpy(&size, memory, sizeof(UINT32));
-			memory += sizeof(UINT32);
-
-			memory = rttiReadElem(data.path, memory);
-			memory = rttiReadElem(data.accessTimestamp, memory);
-
-			return size;
-		}
-
-		static UINT32 getDynamicSize(const RecentProject& data)
-		{
-			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.path) + rttiGetElemSize(data.accessTimestamp);
-
-#if BS_DEBUG_MODE
-			if (dataSize > std::numeric_limits<UINT32>::max())
-			{
-				__string_throwDataOverflowException();
-			}
-#endif
-
-			return (UINT32)dataSize;
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsEditorSettings.h"
+#include "BsRTTIType.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class EditorSettingsRTTI : public RTTIType <EditorSettings, Settings, EditorSettingsRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mMoveSnapActive);
+		BS_PLAIN_MEMBER(mRotateSnapActive);
+
+		BS_PLAIN_MEMBER(mMoveSnap);
+		BS_PLAIN_MEMBER(mRotationSnap);
+
+		BS_PLAIN_MEMBER(mGridSize);
+		BS_PLAIN_MEMBER(mGridAxisSpacing);
+
+		BS_PLAIN_MEMBER(mActiveSceneTool);
+		BS_PLAIN_MEMBER(mActiveCoordinateMode);
+		BS_PLAIN_MEMBER(mActivePivotMode);
+
+		BS_PLAIN_MEMBER(mHandleSize);
+
+		BS_PLAIN_MEMBER(mLastOpenProject);
+		BS_PLAIN_MEMBER(mAutoLoadLastProject);
+		BS_PLAIN_MEMBER(mRecentProjects);
+
+		BS_PLAIN_MEMBER(mFPSLimit);
+		BS_PLAIN_MEMBER(mMouseSensitivity);
+
+	public:
+		EditorSettingsRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mMoveSnapActive, 0);
+			BS_ADD_PLAIN_FIELD(mRotateSnapActive, 1);
+
+			BS_ADD_PLAIN_FIELD(mMoveSnap, 2);
+			BS_ADD_PLAIN_FIELD(mRotationSnap, 3);
+
+			BS_ADD_PLAIN_FIELD(mGridSize, 4);
+			BS_ADD_PLAIN_FIELD(mGridAxisSpacing, 5);
+
+			BS_ADD_PLAIN_FIELD(mActiveSceneTool, 6);
+			BS_ADD_PLAIN_FIELD(mActiveCoordinateMode, 7);
+			BS_ADD_PLAIN_FIELD(mActivePivotMode, 8);
+
+			BS_ADD_PLAIN_FIELD(mHandleSize, 9);
+
+			BS_ADD_PLAIN_FIELD(mLastOpenProject, 10);
+			BS_ADD_PLAIN_FIELD(mAutoLoadLastProject, 11);
+			BS_ADD_PLAIN_FIELD(mRecentProjects, 12);
+
+			BS_ADD_PLAIN_FIELD(mFPSLimit, 13);
+			BS_ADD_PLAIN_FIELD(mMouseSensitivity, 14);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "EditorSettings";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_EditorSettings;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<EditorSettings>();
+		}
+	};
+
+	template<> struct RTTIPlainType <RecentProject>
+	{
+		enum { id = TID_RecentProject }; enum { hasDynamicSize = 1 };
+
+		static void toMemory(const RecentProject& data, char* memory)
+		{
+			UINT32 size = 0;
+			char* memoryStart = memory;
+			memory += sizeof(UINT32);
+			size += sizeof(UINT32);
+
+			memory = rttiWriteElem(data.path, memory, size);
+			memory = rttiWriteElem(data.accessTimestamp, memory, size);
+
+			memcpy(memoryStart, &size, sizeof(UINT32));
+		}
+
+		static UINT32 fromMemory(RecentProject& data, char* memory)
+		{
+			UINT32 size = 0;
+			memcpy(&size, memory, sizeof(UINT32));
+			memory += sizeof(UINT32);
+
+			memory = rttiReadElem(data.path, memory);
+			memory = rttiReadElem(data.accessTimestamp, memory);
+
+			return size;
+		}
+
+		static UINT32 getDynamicSize(const RecentProject& data)
+		{
+			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.path) + rttiGetElemSize(data.accessTimestamp);
+
+#if BS_DEBUG_MODE
+			if (dataSize > std::numeric_limits<UINT32>::max())
+			{
+				__string_throwDataOverflowException();
+			}
+#endif
+
+			return (UINT32)dataSize;
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 28 - 30
Source/BansheeEditor/Include/BsEditorShaderIncludeHandler.h

@@ -1,31 +1,29 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsShaderManager.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Library
-	 *  @{
-	 */
-
-	/**
-	 * Shader include handler for the editor. It uses project library to find the includes, and supports special keywords 
-	 * for built-in includes that reside outside of the project library.
-	 */
-	class BS_ED_EXPORT EditorShaderIncludeHandler : public IShaderIncludeHandler
-	{
-	public:
-		/** @copydoc IShaderIncludeHandler::findInclude */
-		virtual HShaderInclude findInclude(const String& name) const override;
-
-		/** Converts a shader include name or path to a path of the resource containing include data. */
-		static Path toResourcePath(const String& name);
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsShaderManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Library-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Shader include handler for the editor. It uses project library to find the includes, and supports special keywords 
+	 * for built-in includes that reside outside of the project library.
+	 */
+	class BS_ED_EXPORT EditorShaderIncludeHandler : public IShaderIncludeHandler
+	{
+	public:
+		/** @copydoc IShaderIncludeHandler::findInclude */
+		virtual HShaderInclude findInclude(const String& name) const override;
+
+		/** Converts a shader include name or path to a path of the resource containing include data. */
+		static Path toResourcePath(const String& name);
+	};
+
+	/** @} */
 }
 }

+ 95 - 95
Source/BansheeEditor/Include/BsEditorTestSuite.h

@@ -1,96 +1,96 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsTestSuite.h"
-#include "BsComponent.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup Testing-Editor
-	 *  @{
-	 */
-	/** @cond INTERNAL */
-
-	class TestComponentA : public Component
-	{
-	public:
-		HSceneObject ref1;
-		HComponent ref2;
-
-		/************************************************************************/
-		/* 							COMPONENT OVERRIDES                    		*/
-		/************************************************************************/
-
-	protected:
-		friend class SceneObject;
-
-		TestComponentA(const HSceneObject& parent);
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class TestComponentARTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-
-	protected:
-		TestComponentA() {} // Serialization only
-	};
-
-	class TestComponentB : public Component
-	{
-	public:
-		HSceneObject ref1;
-		String val1;
-
-		/************************************************************************/
-		/* 							COMPONENT OVERRIDES                    		*/
-		/************************************************************************/
-
-	protected:
-		friend class SceneObject;
-
-		TestComponentB(const HSceneObject& parent);
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class TestComponentBRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-
-	protected:
-		TestComponentB() {} // Serialization only
-	};
-
-	/** @endcond */
-
-	/**	Contains a set of unit tests for the editor. */
-	class EditorTestSuite : public TestSuite
-	{
-	public:
-		EditorTestSuite();
-
-	private:
-		/**	Tests SceneObject record undo/redo operation. */
-		void SceneObjectRecord_UndoRedo();
-
-		/**	Tests SceneObject delete undo/redo operation. */
-		void SceneObjectDelete_UndoRedo();
-
-		/** Tests native diff by modifiying an object, generating a diff and re-applying the modifications. */
-		void BinaryDiff();
-
-		/** Tests prefab diff by modifiying a prefab, generating a diff and re-applying the modifications. */
-		void TestPrefabDiff();
-
-		/**	Tests the frame allocator. */
-		void TestFrameAlloc();
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsTestSuite.h"
+#include "BsComponent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Testing-Editor
+	 *  @{
+	 */
+	/** @cond TEST */
+
+	class TestComponentA : public Component
+	{
+	public:
+		HSceneObject ref1;
+		HComponent ref2;
+
+		/************************************************************************/
+		/* 							COMPONENT OVERRIDES                    		*/
+		/************************************************************************/
+
+	protected:
+		friend class SceneObject;
+
+		TestComponentA(const HSceneObject& parent);
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class TestComponentARTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		TestComponentA() {} // Serialization only
+	};
+
+	class TestComponentB : public Component
+	{
+	public:
+		HSceneObject ref1;
+		String val1;
+
+		/************************************************************************/
+		/* 							COMPONENT OVERRIDES                    		*/
+		/************************************************************************/
+
+	protected:
+		friend class SceneObject;
+
+		TestComponentB(const HSceneObject& parent);
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class TestComponentBRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		TestComponentB() {} // Serialization only
+	};
+
+	/** @endcond */
+
+	/**	Contains a set of unit tests for the editor. */
+	class EditorTestSuite : public TestSuite
+	{
+	public:
+		EditorTestSuite();
+
+	private:
+		/**	Tests SceneObject record undo/redo operation. */
+		void SceneObjectRecord_UndoRedo();
+
+		/**	Tests SceneObject delete undo/redo operation. */
+		void SceneObjectDelete_UndoRedo();
+
+		/** Tests native diff by modifiying an object, generating a diff and re-applying the modifications. */
+		void BinaryDiff();
+
+		/** Tests prefab diff by modifiying a prefab, generating a diff and re-applying the modifications. */
+		void TestPrefabDiff();
+
+		/**	Tests the frame allocator. */
+		void TestFrameAlloc();
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsEditorWidget.h

@@ -155,8 +155,7 @@ namespace BansheeEngine
 
 
 	/** @} */
 	/** @} */
 
 
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
+	/** @addtogroup EditorWindow-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -210,5 +209,4 @@ namespace BansheeEngine
 	volatile RegisterWidgetOnStart<Type> EditorWidget<Type>::RegisterOnStart;
 	volatile RegisterWidgetOnStart<Type> EditorWidget<Type>::RegisterOnStart;
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 165 - 167
Source/BansheeEditor/Include/BsEditorWidgetContainer.h

@@ -1,168 +1,166 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsEvent.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
-	 *  @{
-	 */
-
-	/**
-	 * A GUI object that contains one or multiple editor widgets. Each widget is represented by a single tab and can be
-	 * activated, deactivated, moved or dragged off.
-	 */
-	class BS_ED_EXPORT EditorWidgetContainer
-	{
-	public:
-		EditorWidgetContainer(GUIWidget* parent, EditorWindowBase* parentEditorWindow);
-		virtual ~EditorWidgetContainer();
-
-		/**	Adds a new widget to the container, adding a new tab to the end of the tab bar. */
-		void add(EditorWidgetBase& widget);
-
-		/**	Removes a widget from the container. */
-		void remove(EditorWidgetBase& widget);
-
-		/**
-		 * Inserts a widget at the specified index, adding a new tab at that position.
-		 *
-		 * @param[in]	idx		Sequential index where to insert the widget.
-		 * @param[in]	widget	Widget to insert.
-		 */
-		void insert(UINT32 idx, EditorWidgetBase& widget);
-
-		/**	Checks if the container already contains the provided widget. */
-		bool contains(EditorWidgetBase& widget);
-
-		/**	Sets the size of the container in pixels. This also modifies the size of all child widgets. */
-		void setSize(UINT32 width, UINT32 height);
-
-		/**
-		 * Sets the position of the container, relative to the parent GUI widget. This also modifies the position of all
-		 * child widgets.
-		 */
-		void setPosition(INT32 x, INT32 y);
-
-		/**	Returns the number of widgets currently docked in this container. */
-		UINT32 getNumWidgets() const { return (UINT32)mWidgets.size(); }
-
-		/**
-		 * Returns a widget at the specified index.
-		 *
-		 * @param[in]	idx		Sequential index of the widget to retrieve.
-		 */
-		EditorWidgetBase* getWidget(UINT32 idx) const;
-
-		/**	Returns a widget that is currently visible (its tab is active). */
-		EditorWidgetBase* getActiveWidget() const;
-
-		/**	Returns the parent GUI widget the container is using to render the GUI on. */
-		GUIWidget& getParentWidget() const { return *mParent; }
-
-		/**	Returns the parent editor window the container is docked in. */
-		EditorWindowBase* getParentWindow() const { return mParentWindow; }
-
-		/** Returns bounds not including the tabbed title bar. These are the bounds available to child widget GUI. */
-		Rect2I getContentBounds() const;
-
-		/**	Returns a list of areas that can be dragged off. These are normally areas represented by tab buttons. */
-		Vector<Rect2I> getDraggableAreas() const;
-
-		/**	Called once per frame. Calls update on all docked widgets. */
-		void update();
-
-		/**	Updates the tabbed title bar by refreshing the names of all docked widgets. */
-		void refreshWidgetNames();
-
-		/**	Triggers when a widget is about to be destroyed. */
-		void _notifyWidgetDestroyed(EditorWidgetBase* widget);
-
-		/**
-		 * Returns the size of a widget docked in a window of the specified size. Window and widget sizes are different due
-		 * to the title bar and potentially other window-specific GUI elements.
-		 */
-		static Vector2I windowToWidgetSize(const Vector2I& windowSize);
-
-		/**
-		 * Returns the size of a window required for displaying a widget of the specified size. Window and widget sizes are
-		 * different due to the title bar and potentially other window-specific GUI elements.
-		 */
-		static Vector2I widgetToWindowSize(const Vector2I& widgetSize);
-
-		Event<void()> onWidgetAdded; /**< Triggered whenever a new widget is added to this container. */
-		Event<void()> onWidgetClosed; /**< Triggered whenever a widget docked in this container is closed. */
-		Event<void()> onMaximized; /**< Triggered when the maximize button is clicked. */
-
-		static const UINT32 TitleBarHeight;
-	private:
-		/**	Removes a widget without triggering a widget closed event. */
-		void removeInternal(EditorWidgetBase& widget);
-
-		/**
-		 * Changes the currently active widget to the one at the specified index. Making the widget active means it will be
-		 * visible in the container.
-		 *
-		 * @param[in]	idx		Unique widget index (not sequential).
-		 */
-		void setActiveWidget(UINT32 idx);
-
-		/**
-		 * Triggered when a user clicks on a tab in the tabbed title bar.
-		 *
-		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was activated.
-		 */
-		void tabActivated(UINT32 idx);
-
-		/**
-		 * Triggered when a user closes a tab in the tabbed title bar.
-		 *
-		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was closed.
-		 */
-		void tabClosed(UINT32 idx);
-
-		/**
-		 * Triggered when a user clicks the maximize button on the title bar.
-		 *
-		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was closed.
-		 */
-		void tabMaximized(UINT32 idx);
-
-		/**
-		 * Triggered when a user drags a tab off the tabbed title bar.
-		 *
-		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was dragged off.
-		 */
-		void tabDraggedOff(UINT32 idx);
-
-		/**
-		 * Triggered when a user drags a tab on the tabbed title bar.
-		 *
-		 * @param[in]	idx		Sequential index at the position on which the tab has been dragged on.
-		 */
-		void tabDraggedOn(UINT32 idx);
-
-		/**
-		 * Triggered when the widget drag and drop operation finishes.
-		 *
-		 * @param[in]	wasDragProcessed	Signals whether any object handled the drop.
-		 */
-		static void tabDroppedCallback(bool wasDragProcessed);
-
-		EditorWindowBase* mParentWindow;
-		GUITabbedTitleBar* mTitleBar;
-		GUIPanel* mTitleBarPanel;
-		GUIWidget* mParent;
-		INT32 mX, mY;
-		UINT32 mWidth, mHeight;
-		UnorderedMap<UINT32, EditorWidgetBase*> mWidgets;
-		INT32 mActiveWidget;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsEvent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup EditorWindow-Internal
+	 *  @{
+	 */
+
+	/**
+	 * A GUI object that contains one or multiple editor widgets. Each widget is represented by a single tab and can be
+	 * activated, deactivated, moved or dragged off.
+	 */
+	class BS_ED_EXPORT EditorWidgetContainer
+	{
+	public:
+		EditorWidgetContainer(GUIWidget* parent, EditorWindowBase* parentEditorWindow);
+		virtual ~EditorWidgetContainer();
+
+		/**	Adds a new widget to the container, adding a new tab to the end of the tab bar. */
+		void add(EditorWidgetBase& widget);
+
+		/**	Removes a widget from the container. */
+		void remove(EditorWidgetBase& widget);
+
+		/**
+		 * Inserts a widget at the specified index, adding a new tab at that position.
+		 *
+		 * @param[in]	idx		Sequential index where to insert the widget.
+		 * @param[in]	widget	Widget to insert.
+		 */
+		void insert(UINT32 idx, EditorWidgetBase& widget);
+
+		/**	Checks if the container already contains the provided widget. */
+		bool contains(EditorWidgetBase& widget);
+
+		/**	Sets the size of the container in pixels. This also modifies the size of all child widgets. */
+		void setSize(UINT32 width, UINT32 height);
+
+		/**
+		 * Sets the position of the container, relative to the parent GUI widget. This also modifies the position of all
+		 * child widgets.
+		 */
+		void setPosition(INT32 x, INT32 y);
+
+		/**	Returns the number of widgets currently docked in this container. */
+		UINT32 getNumWidgets() const { return (UINT32)mWidgets.size(); }
+
+		/**
+		 * Returns a widget at the specified index.
+		 *
+		 * @param[in]	idx		Sequential index of the widget to retrieve.
+		 */
+		EditorWidgetBase* getWidget(UINT32 idx) const;
+
+		/**	Returns a widget that is currently visible (its tab is active). */
+		EditorWidgetBase* getActiveWidget() const;
+
+		/**	Returns the parent GUI widget the container is using to render the GUI on. */
+		GUIWidget& getParentWidget() const { return *mParent; }
+
+		/**	Returns the parent editor window the container is docked in. */
+		EditorWindowBase* getParentWindow() const { return mParentWindow; }
+
+		/** Returns bounds not including the tabbed title bar. These are the bounds available to child widget GUI. */
+		Rect2I getContentBounds() const;
+
+		/**	Returns a list of areas that can be dragged off. These are normally areas represented by tab buttons. */
+		Vector<Rect2I> getDraggableAreas() const;
+
+		/**	Called once per frame. Calls update on all docked widgets. */
+		void update();
+
+		/**	Updates the tabbed title bar by refreshing the names of all docked widgets. */
+		void refreshWidgetNames();
+
+		/**	Triggers when a widget is about to be destroyed. */
+		void _notifyWidgetDestroyed(EditorWidgetBase* widget);
+
+		/**
+		 * Returns the size of a widget docked in a window of the specified size. Window and widget sizes are different due
+		 * to the title bar and potentially other window-specific GUI elements.
+		 */
+		static Vector2I windowToWidgetSize(const Vector2I& windowSize);
+
+		/**
+		 * Returns the size of a window required for displaying a widget of the specified size. Window and widget sizes are
+		 * different due to the title bar and potentially other window-specific GUI elements.
+		 */
+		static Vector2I widgetToWindowSize(const Vector2I& widgetSize);
+
+		Event<void()> onWidgetAdded; /**< Triggered whenever a new widget is added to this container. */
+		Event<void()> onWidgetClosed; /**< Triggered whenever a widget docked in this container is closed. */
+		Event<void()> onMaximized; /**< Triggered when the maximize button is clicked. */
+
+		static const UINT32 TitleBarHeight;
+	private:
+		/**	Removes a widget without triggering a widget closed event. */
+		void removeInternal(EditorWidgetBase& widget);
+
+		/**
+		 * Changes the currently active widget to the one at the specified index. Making the widget active means it will be
+		 * visible in the container.
+		 *
+		 * @param[in]	idx		Unique widget index (not sequential).
+		 */
+		void setActiveWidget(UINT32 idx);
+
+		/**
+		 * Triggered when a user clicks on a tab in the tabbed title bar.
+		 *
+		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was activated.
+		 */
+		void tabActivated(UINT32 idx);
+
+		/**
+		 * Triggered when a user closes a tab in the tabbed title bar.
+		 *
+		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was closed.
+		 */
+		void tabClosed(UINT32 idx);
+
+		/**
+		 * Triggered when a user clicks the maximize button on the title bar.
+		 *
+		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was closed.
+		 */
+		void tabMaximized(UINT32 idx);
+
+		/**
+		 * Triggered when a user drags a tab off the tabbed title bar.
+		 *
+		 * @param[in]	idx		Unique widget index (not sequential) of the tab that was dragged off.
+		 */
+		void tabDraggedOff(UINT32 idx);
+
+		/**
+		 * Triggered when a user drags a tab on the tabbed title bar.
+		 *
+		 * @param[in]	idx		Sequential index at the position on which the tab has been dragged on.
+		 */
+		void tabDraggedOn(UINT32 idx);
+
+		/**
+		 * Triggered when the widget drag and drop operation finishes.
+		 *
+		 * @param[in]	wasDragProcessed	Signals whether any object handled the drop.
+		 */
+		static void tabDroppedCallback(bool wasDragProcessed);
+
+		EditorWindowBase* mParentWindow;
+		GUITabbedTitleBar* mTitleBar;
+		GUIPanel* mTitleBarPanel;
+		GUIWidget* mParent;
+		INT32 mX, mY;
+		UINT32 mWidth, mHeight;
+		UnorderedMap<UINT32, EditorWidgetBase*> mWidgets;
+		INT32 mActiveWidget;
+	};
+
+	/** @} */
 }
 }

+ 67 - 69
Source/BansheeEditor/Include/BsEditorWidgetLayout.h

@@ -1,70 +1,68 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsIReflectable.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
-	 *  @{
-	 */
-
-	/** Contains stored positions and sizes of all editor widgets, whether docked or floating. */
-	class EditorWidgetLayout : public IReflectable
-	{
-	public:
-		/**	An entry representing widgets and area of a single widget container. */
-		struct Entry
-		{
-		public:
-			Entry();
-			~Entry();
-
-			Vector<String> widgetNames; /**< Unique names of all widgets in the container. */
-			bool isDocked; /**< Whether the container is floating in its own window or docked. */
-			INT32 x, y; /**< Position of the container relative to parent window or dock manager. */
-			UINT32 width, height; /**< Size of the container. */
-		};
-
-	private:
-		struct PrivatelyConstruct {};
-
-	public:
-		EditorWidgetLayout(const DockManagerLayoutPtr& dockLayout);
-		EditorWidgetLayout(const PrivatelyConstruct& dummy);
-
-		/**
-		 * Returns saved representations of all widget containers. Each entry contains information about a single widget
-		 * container.
-		 */
-		Vector<Entry>& getEntries() { return mEntries; }
-
-		/**	Returns dock layout that contains data about how were widget containers docked in the dock manager. */
-		const DockManagerLayoutPtr& getDockLayout() const { return mDockLayout; }
-
-		/**	Sets whether the main editor window is maximized. */
-		void setIsMainWindowMaximized(bool maximized) { mMaximized = maximized; }
-
-		/**	Checks whether the main editor window was maximized. */
-		bool getIsMainWindowMaximized() const { return mMaximized; }
-
-	private:
-		Vector<Entry> mEntries;
-		DockManagerLayoutPtr mDockLayout;
-		bool mMaximized;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class EditorWidgetLayoutRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;	
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsIReflectable.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup EditorWindow-Internal
+	 *  @{
+	 */
+
+	/** Contains stored positions and sizes of all editor widgets, whether docked or floating. */
+	class EditorWidgetLayout : public IReflectable
+	{
+	public:
+		/**	An entry representing widgets and area of a single widget container. */
+		struct Entry
+		{
+		public:
+			Entry();
+			~Entry();
+
+			Vector<String> widgetNames; /**< Unique names of all widgets in the container. */
+			bool isDocked; /**< Whether the container is floating in its own window or docked. */
+			INT32 x, y; /**< Position of the container relative to parent window or dock manager. */
+			UINT32 width, height; /**< Size of the container. */
+		};
+
+	private:
+		struct PrivatelyConstruct {};
+
+	public:
+		EditorWidgetLayout(const DockManagerLayoutPtr& dockLayout);
+		EditorWidgetLayout(const PrivatelyConstruct& dummy);
+
+		/**
+		 * Returns saved representations of all widget containers. Each entry contains information about a single widget
+		 * container.
+		 */
+		Vector<Entry>& getEntries() { return mEntries; }
+
+		/**	Returns dock layout that contains data about how were widget containers docked in the dock manager. */
+		const DockManagerLayoutPtr& getDockLayout() const { return mDockLayout; }
+
+		/**	Sets whether the main editor window is maximized. */
+		void setIsMainWindowMaximized(bool maximized) { mMaximized = maximized; }
+
+		/**	Checks whether the main editor window was maximized. */
+		bool getIsMainWindowMaximized() const { return mMaximized; }
+
+	private:
+		Vector<Entry> mEntries;
+		DockManagerLayoutPtr mDockLayout;
+		bool mMaximized;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class EditorWidgetLayoutRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;	
+	};
+
+	/** @} */
 }
 }

+ 112 - 112
Source/BansheeEditor/Include/BsEditorWidgetLayoutRTTI.h

@@ -1,113 +1,113 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsEditorWidgetLayout.h"
-#include "BsDockManagerLayout.h"
-#include "BsRTTIType.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class EditorWidgetLayoutRTTI : public RTTIType<EditorWidgetLayout, IReflectable, EditorWidgetLayoutRTTI>
-	{
-	private:
-		EditorWidgetLayout::Entry& getEntry(EditorWidgetLayout* obj, UINT32 idx) { return obj->mEntries[idx]; }
-		void setEntry(EditorWidgetLayout* obj, UINT32 idx, EditorWidgetLayout::Entry& val) { obj->mEntries[idx] = val; } 
-		UINT32 getEntriesArraySize(EditorWidgetLayout* obj) { return (UINT32)obj->mEntries.size(); }
-		void setEntriesArraySize(EditorWidgetLayout* obj, UINT32 size) { obj->mEntries.resize(size); }
-
-		DockManagerLayoutPtr getDockLayout(EditorWidgetLayout* obj) { return obj->mDockLayout; }
-		void setDockLayout(EditorWidgetLayout* obj, DockManagerLayoutPtr val) { obj->mDockLayout = val; }
-
-		bool& getIsMainWindowMaximized(EditorWidgetLayout* obj) { return obj->mMaximized; }
-		void setIsMainWindowMaximized(EditorWidgetLayout* obj, bool& val) { obj->mMaximized = val; }
-
-	public:
-		EditorWidgetLayoutRTTI()
-		{
-			addPlainArrayField("mRootEntry", 0, &EditorWidgetLayoutRTTI::getEntry, &EditorWidgetLayoutRTTI::getEntriesArraySize, 
-				&EditorWidgetLayoutRTTI::setEntry, &EditorWidgetLayoutRTTI::setEntriesArraySize);
-
-			addReflectablePtrField("mDockLayout", 1, &EditorWidgetLayoutRTTI::getDockLayout, &EditorWidgetLayoutRTTI::setDockLayout);
-			addPlainField("mMaximized", 2, &EditorWidgetLayoutRTTI::getIsMainWindowMaximized, &EditorWidgetLayoutRTTI::setIsMainWindowMaximized);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "EditorWidgetLayout";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_EditorWidgetLayout;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<EditorWidgetLayout>(EditorWidgetLayout::PrivatelyConstruct());
-		}
-	};
-
-	template<> struct RTTIPlainType<BansheeEngine::EditorWidgetLayout::Entry>
-	{	
-		enum { id = BansheeEngine::TID_EditorWidgetLayoutEntry }; enum { hasDynamicSize = 1 };
-
-		static void toMemory(const BansheeEngine::EditorWidgetLayout::Entry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			char* memoryStart = memory;
-			memory += sizeof(UINT32);
-			size += sizeof(UINT32);
-
-			memory = rttiWriteElem(data.widgetNames, memory, size);
-			memory = rttiWriteElem(data.isDocked, memory, size);
-			memory = rttiWriteElem(data.x, memory, size);
-			memory = rttiWriteElem(data.y, memory, size);
-			memory = rttiWriteElem(data.width, memory, size);
-			memory = rttiWriteElem(data.height, memory, size);
-
-			memcpy(memoryStart, &size, sizeof(UINT32));
-		}
-
-		static UINT32 fromMemory(BansheeEngine::EditorWidgetLayout::Entry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			memcpy(&size, memory, sizeof(UINT32));
-			memory += sizeof(UINT32);
-
-			memory = rttiReadElem(data.widgetNames, memory);
-			memory = rttiReadElem(data.isDocked, memory);
-			memory = rttiReadElem(data.x, memory);
-			memory = rttiReadElem(data.y, memory);
-			memory = rttiReadElem(data.width, memory);
-			memory = rttiReadElem(data.height, memory);
-
-			return size;
-		}
-
-		static UINT32 getDynamicSize(const BansheeEngine::EditorWidgetLayout::Entry& data)	
-		{ 
-			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.widgetNames) + rttiGetElemSize(data.isDocked) + 
-				rttiGetElemSize(data.x) + rttiGetElemSize(data.y) + rttiGetElemSize(data.width) + rttiGetElemSize(data.height);
-
-#if BS_DEBUG_MODE
-			if(dataSize > std::numeric_limits<UINT32>::max())
-			{
-				__string_throwDataOverflowException();
-			}
-#endif
-
-			return (UINT32)dataSize;
-		}	
-	}; 
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsEditorWidgetLayout.h"
+#include "BsDockManagerLayout.h"
+#include "BsRTTIType.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class EditorWidgetLayoutRTTI : public RTTIType<EditorWidgetLayout, IReflectable, EditorWidgetLayoutRTTI>
+	{
+	private:
+		EditorWidgetLayout::Entry& getEntry(EditorWidgetLayout* obj, UINT32 idx) { return obj->mEntries[idx]; }
+		void setEntry(EditorWidgetLayout* obj, UINT32 idx, EditorWidgetLayout::Entry& val) { obj->mEntries[idx] = val; } 
+		UINT32 getEntriesArraySize(EditorWidgetLayout* obj) { return (UINT32)obj->mEntries.size(); }
+		void setEntriesArraySize(EditorWidgetLayout* obj, UINT32 size) { obj->mEntries.resize(size); }
+
+		DockManagerLayoutPtr getDockLayout(EditorWidgetLayout* obj) { return obj->mDockLayout; }
+		void setDockLayout(EditorWidgetLayout* obj, DockManagerLayoutPtr val) { obj->mDockLayout = val; }
+
+		bool& getIsMainWindowMaximized(EditorWidgetLayout* obj) { return obj->mMaximized; }
+		void setIsMainWindowMaximized(EditorWidgetLayout* obj, bool& val) { obj->mMaximized = val; }
+
+	public:
+		EditorWidgetLayoutRTTI()
+		{
+			addPlainArrayField("mRootEntry", 0, &EditorWidgetLayoutRTTI::getEntry, &EditorWidgetLayoutRTTI::getEntriesArraySize, 
+				&EditorWidgetLayoutRTTI::setEntry, &EditorWidgetLayoutRTTI::setEntriesArraySize);
+
+			addReflectablePtrField("mDockLayout", 1, &EditorWidgetLayoutRTTI::getDockLayout, &EditorWidgetLayoutRTTI::setDockLayout);
+			addPlainField("mMaximized", 2, &EditorWidgetLayoutRTTI::getIsMainWindowMaximized, &EditorWidgetLayoutRTTI::setIsMainWindowMaximized);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "EditorWidgetLayout";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_EditorWidgetLayout;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<EditorWidgetLayout>(EditorWidgetLayout::PrivatelyConstruct());
+		}
+	};
+
+	template<> struct RTTIPlainType<BansheeEngine::EditorWidgetLayout::Entry>
+	{	
+		enum { id = BansheeEngine::TID_EditorWidgetLayoutEntry }; enum { hasDynamicSize = 1 };
+
+		static void toMemory(const BansheeEngine::EditorWidgetLayout::Entry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			char* memoryStart = memory;
+			memory += sizeof(UINT32);
+			size += sizeof(UINT32);
+
+			memory = rttiWriteElem(data.widgetNames, memory, size);
+			memory = rttiWriteElem(data.isDocked, memory, size);
+			memory = rttiWriteElem(data.x, memory, size);
+			memory = rttiWriteElem(data.y, memory, size);
+			memory = rttiWriteElem(data.width, memory, size);
+			memory = rttiWriteElem(data.height, memory, size);
+
+			memcpy(memoryStart, &size, sizeof(UINT32));
+		}
+
+		static UINT32 fromMemory(BansheeEngine::EditorWidgetLayout::Entry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			memcpy(&size, memory, sizeof(UINT32));
+			memory += sizeof(UINT32);
+
+			memory = rttiReadElem(data.widgetNames, memory);
+			memory = rttiReadElem(data.isDocked, memory);
+			memory = rttiReadElem(data.x, memory);
+			memory = rttiReadElem(data.y, memory);
+			memory = rttiReadElem(data.width, memory);
+			memory = rttiReadElem(data.height, memory);
+
+			return size;
+		}
+
+		static UINT32 getDynamicSize(const BansheeEngine::EditorWidgetLayout::Entry& data)	
+		{ 
+			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.widgetNames) + rttiGetElemSize(data.isDocked) + 
+				rttiGetElemSize(data.x) + rttiGetElemSize(data.y) + rttiGetElemSize(data.width) + rttiGetElemSize(data.height);
+
+#if BS_DEBUG_MODE
+			if(dataSize > std::numeric_limits<UINT32>::max())
+			{
+				__string_throwDataOverflowException();
+			}
+#endif
+
+			return (UINT32)dataSize;
+		}	
+	}; 
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsEditorWidgetManager.h

@@ -7,8 +7,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
+	/** @addtogroup EditorWindow-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -95,5 +94,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 54 - 56
Source/BansheeEditor/Include/BsEditorWindowManager.h

@@ -1,57 +1,55 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsModule.h"
-#include "BsEvent.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup EditorWindow
-	 *  @{
-	 */
-
-	/** Manages that handles creation, destruction and updates of editor windows. */
-	class BS_ED_EXPORT EditorWindowManager : public Module<EditorWindowManager>
-	{
-	public:
-		EditorWindowManager();
-		~EditorWindowManager();
-
-		/**
-		 * Creates the main editor window using a previously created render window. If a main window already exists, this
-		 * will return the existing instance.
-		 */
-		MainEditorWindow* createMain(const RenderWindowPtr& parentRenderWindow);
-
-		/**	Creates a new editor window. There is no limit on the number of editor windows. */
-		EditorWindow* create();
-
-		/**	Notifies the manager that a new editor window was created. */
-		void registerWindow(EditorWindowBase* window);
-
-		/**	Schedules the window for destruction. Actual destruction will happen on next update. */
-		void destroy(EditorWindowBase* window);
-
-		/**	Returns the main editor window, or null if one doesn't exist. */
-		MainEditorWindow* getMainWindow() const { return mMainWindow; }
-
-		/**	Update to be called once per frame. Calls update on all active editor windows. */
-		void update();
-
-		/**	Checks if any editor window has keyboard focus. */
-		bool hasFocus() const;
-	protected:
-		MainEditorWindow* mMainWindow;
-
-		Vector<EditorWindowBase*> mEditorWindows;
-		Vector<EditorWindowBase*> mScheduledForDestruction;
-
-		Vector<EditorWindowBase*> mEditorWindowsSnapshot;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsModule.h"
+#include "BsEvent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup EditorWindow-Internal
+	 *  @{
+	 */
+
+	/** Manages that handles creation, destruction and updates of editor windows. */
+	class BS_ED_EXPORT EditorWindowManager : public Module<EditorWindowManager>
+	{
+	public:
+		EditorWindowManager();
+		~EditorWindowManager();
+
+		/**
+		 * Creates the main editor window using a previously created render window. If a main window already exists, this
+		 * will return the existing instance.
+		 */
+		MainEditorWindow* createMain(const RenderWindowPtr& parentRenderWindow);
+
+		/**	Creates a new editor window. There is no limit on the number of editor windows. */
+		EditorWindow* create();
+
+		/**	Notifies the manager that a new editor window was created. */
+		void registerWindow(EditorWindowBase* window);
+
+		/**	Schedules the window for destruction. Actual destruction will happen on next update. */
+		void destroy(EditorWindowBase* window);
+
+		/**	Returns the main editor window, or null if one doesn't exist. */
+		MainEditorWindow* getMainWindow() const { return mMainWindow; }
+
+		/**	Update to be called once per frame. Calls update on all active editor windows. */
+		void update();
+
+		/**	Checks if any editor window has keyboard focus. */
+		bool hasFocus() const;
+	protected:
+		MainEditorWindow* mMainWindow;
+
+		Vector<EditorWindowBase*> mEditorWindows;
+		Vector<EditorWindowBase*> mScheduledForDestruction;
+
+		Vector<EditorWindowBase*> mEditorWindowsSnapshot;
+	};
+
+	/** @} */
 }
 }

+ 226 - 228
Source/BansheeEditor/Include/BsGUIMenuBar.h

@@ -1,229 +1,227 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsShortcutKey.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
-	 *  @{
-	 */
-
-	/**
-	 * A menu bar GUI element that contains a horizontal list of elements that can each be expanded into a hierarchical 
-	 * sub-menus, as well as a list of tool bar buttons.
-	 * 			
-	 * Contents of the menu and tool bar are customizable.
-	 *
-	 * The menu bar also displays the minimize, maximize and close buttons for the window.
-	 */
-	class BS_ED_EXPORT GUIMenuBar
-	{
-		/**	Contains data about the top level menu elements. */
-		struct GUIMenuBarData
-		{
-			WString name;
-			GUIMenu* menu;
-			GUIButton* button;
-			GUIFixedSpace* space;
-			INT32 priority;
-		};
-
-		/**	Contains data about a single tool bar element. */
-		struct GUIToolBarData
-		{
-			String name;
-			INT32 priority;
-			GUIButton* button;
-			GUITexture* separator;
-			GUIFixedSpace* space;
-		};
-
-	public:
-		/**	Returns the style type for the menu bar background. */
-		static const String& getBackgroundStyleType();
-
-		/**	Returns the style type for the menu bar line draw under the menu items. */
-		static const String& getLineStyleType();
-
-		/**	Returns the style type for the menu bar logo. */
-		static const String& getLogoStyleType();
-
-		/**	Returns the style type for the menu bar menu item buttons. */
-		static const String& getMenuItemButtonStyleType();
-
-		/**	Returns the style type for tool bar buttons. */
-		static const String& getToolBarButtonStyleType();
-
-		/**	Returns the style type for the tool bar button separator. */
-		static const String& getToolBarSeparatorStyleType();
-
-		/**
-		 * Constructs a new menu bar.
-		 *
-		 * @param[in]	parent			Parent GUI widget the menu bar will be docked in.
-		 * @param[in]	parentWindow	Window to trigger the min/max/close events on.
-		 */
-		GUIMenuBar(GUIWidget* parent, RenderWindow* parentWindow);
-		virtual ~GUIMenuBar();
-
-		/**	Sets the area of the menu bar, in pixels relative to the parent GUI widget. */
-		void setArea(INT32 x, INT32 y, UINT32 width, UINT32 height);
-
-		/**
-		 * Adds a new menu item to the menu bar. 
-		 *
-		 * @param[in]	path		Path to the menu item. Each element of the path must be separated using "/". 
-		 *							First element of the path will create the top level menu, and any further element
-		 *							will create a new sub-menu. Last element will be the interactable element.
-		 * @param[in]	callback	Callback to trigger when user click on the interactable element (last element in the 
-		 *							provided path). Can be null.
-		 * @param[in]	priority	Determines where is the element positioned compared to other elements in the same 
-		 *							sub-menu. Higher priority elements get placed higher up in the sub-menu. This only
-		 *							applies to the last element. If you need to customize its parent element priority call
-		 *							this method with with their specific paths.
-		 * @param[in]	shortcut	Keyboard shortcut key to display next to the interactable element, and register with the
-		 *							global shortcut manager.
-		 */
-		GUIMenuItem* addMenuItem(const WString& path, std::function<void()> callback, INT32 priority = 0, 
-			const ShortcutKey& shortcut = ShortcutKey::NONE);
-
-		/**
-		 * Adds a menu item separator element at the specified path. The separator is added as a child of the path.
-		 *
-		 * @param[in]	path		Parent path of the sub-menu to add the separator.
-		 * @param[in]	priority	Determines where is the separator positioned compared to other elements in the same 
-		 *							sub-menu. Higher priority elements get placed higher up in the sub-menu.
-		 */
-		GUIMenuItem* addMenuItemSeparator(const WString& path, INT32 priority = 0);
-
-		/**	Returns an existing menu item at the specified path, or null if one cannot be found. */
-		GUIMenuItem* getMenuItem(const WString& path);
-
-		/**
-		 * Removes a menu item from the specified path. If this path points to a sub-menu entire sub-menu will be removed.
-		 */
-		void removeMenuItem(const WString& path);
-
-		/**	Removes the specified menu item. */
-		void removeMenuItem(GUIMenuItem* item);
-
-		/**
-		 * Adds a new button to the tool bar.
-		 *
-		 * @param[in]	name		Unique name of the button that can be used for identifiying it.
-		 * @param[in]	content 	Content to display on the button.
-		 * @param[in]	callback	Callback to trigger when the button is pressed.
-		 * @param[in]	priority	Determines where is the button positioned compared to other elements on the tool bar.
-		 * 							Higher priority elements get placed before lower priority ones.
-		 */
-		void addToolBarButton(const String& name, const GUIContent& content, std::function<void()> callback, INT32 priority = 0);
-
-		/**
-		 * Toggles an existing toolbar button into an on or off state which changes the visuals of the button.
-		 *
-		 * @param[in]	name	Name of the existing button to toggle.
-		 * @param[in]	on		True to toggle on, false to toggle off (default).
-		 */
-		void toggleToolbarButton(const String& name, bool on);
-
-		/**
-		 * Adds a new separator element to the tool bar.
-		 *
-		 * @param[in]	name		Unique name of the separator that can be used for identifiying it.
-		 * @param[in]	priority	Determines where is the separator positioned compared to other elements on the tool bar.
-		 * 							Higher priority elements get placed before lower priority ones.
-		 */
-		void addToolBarSeparator(const String& name, INT32 priority = 0);
-
-		/**
-		 * Removes an element from the tool bar.
-		 *
-		 * @param[in]	name	Unique name of the element to remove.
-		 */
-		void removeToolBarButton(const String& name);
-	private:
-		/**	Finds a top level sub-menu with the specified name. */
-		const GUIMenuBarData* getSubMenu(const WString& name) const;
-
-		/**	Adds a new top level sub-menu button. */
-		GUIMenuBarData* addNewButton(const WString& name, INT32 priority);
-
-		/**
-		 * Attempts to remove the first element from the specified path. First element returned in specified in @p pathRoot,
-		 * and original @p path is modified so it no longer includes the first element.
-		 *
-		 * @return	False if first element doesn't exist, true otherwise.
-		 */
-		bool stripPath(WString& path, WString& pathRoot) const;
-
-		/**
-		 * Registers a shortcut with the global shortcut manager. Pressing the shortcut will trigger the provided callback.
-		 */
-		void registerShortcut(const WString& path, const ShortcutKey& shortcut, std::function<void()> callback);
-
-		/**	Unregisters a shortcut assigned to the provided path from the global shortcut manager. */
-		void unregisterShortcut(const WString& path);
-
-		/**	Opens a top level sub-menu with the provided name. */
-		void openSubMenu(const WString& name);
-
-		/**	Closes any currently active sub-menu. */
-		void closeSubMenu();
-
-		/**
-		 * Triggered when a sub-menu is open and a user hovers over another top level sub-menu button.
-		 *
-		 * @param[in]	name	Name of the sub-menu the user is hovering over.
-		 */
-		void onSubMenuHover(const WString& name);
-
-		/**	Triggered when a sub-menu is closed. */
-		void onSubMenuClosed();
-
-		/**	Triggered when the minimize button is clicked. Minimizes the attached window. */
-		void onMinimizeClicked();
-
-		/**	Triggered when the maximize button is clicked. Maximizes the attached window. */
-		void onMaximizeClicked();
-
-		/**	Triggered when the close button is clicked. Closes the attached window. */
-		void onCloseClicked();
-
-		/**
-		 * Refreshes the OS client area that allow the window to be dragged by dragging the empty areas on the menu bar.
-		 * Should be called when top level button configuration changes or menu bar area changes.
-		 */
-		void refreshNonClientAreas();
-
-		static const UINT32 NUM_ELEMENTS_AFTER_CONTENT;
-		static const UINT32 ELEMENT_SPACING;
-
-		RenderWindow* mParentWindow;
-		GUIWidget* mParentWidget;
-		GUIPanel* mMainPanel;
-		GUIPanel* mBgPanel;
-		GUILayout* mMenuItemLayout;
-		GUILayout* mToolBarLayout;
-		GUITexture* mBgTexture;
-		GUITexture* mLogoTexture;
-		GUITexture* mSplitterLine;
-
-		GUIButton* mMinBtn;
-		GUIButton* mMaxBtn;
-		GUIButton* mCloseBtn;
-
-		Vector<GUIMenuBarData> mChildMenus;
-		UnorderedMap<WString, ShortcutKey> mEntryShortcuts;
-		Vector<GUIToolBarData> mToolbarElements;
-
-		GUIButton* mSubMenuButton;
-		bool mSubMenuOpen;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsShortcutKey.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Editor-Internal
+	 *  @{
+	 */
+
+	/**
+	 * A menu bar GUI element that contains a horizontal list of elements that can each be expanded into a hierarchical 
+	 * sub-menus, as well as a list of tool bar buttons.
+	 * 			
+	 * Contents of the menu and tool bar are customizable.
+	 *
+	 * The menu bar also displays the minimize, maximize and close buttons for the window.
+	 */
+	class BS_ED_EXPORT GUIMenuBar
+	{
+		/**	Contains data about the top level menu elements. */
+		struct GUIMenuBarData
+		{
+			WString name;
+			GUIMenu* menu;
+			GUIButton* button;
+			GUIFixedSpace* space;
+			INT32 priority;
+		};
+
+		/**	Contains data about a single tool bar element. */
+		struct GUIToolBarData
+		{
+			String name;
+			INT32 priority;
+			GUIButton* button;
+			GUITexture* separator;
+			GUIFixedSpace* space;
+		};
+
+	public:
+		/**	Returns the style type for the menu bar background. */
+		static const String& getBackgroundStyleType();
+
+		/**	Returns the style type for the menu bar line draw under the menu items. */
+		static const String& getLineStyleType();
+
+		/**	Returns the style type for the menu bar logo. */
+		static const String& getLogoStyleType();
+
+		/**	Returns the style type for the menu bar menu item buttons. */
+		static const String& getMenuItemButtonStyleType();
+
+		/**	Returns the style type for tool bar buttons. */
+		static const String& getToolBarButtonStyleType();
+
+		/**	Returns the style type for the tool bar button separator. */
+		static const String& getToolBarSeparatorStyleType();
+
+		/**
+		 * Constructs a new menu bar.
+		 *
+		 * @param[in]	parent			Parent GUI widget the menu bar will be docked in.
+		 * @param[in]	parentWindow	Window to trigger the min/max/close events on.
+		 */
+		GUIMenuBar(GUIWidget* parent, RenderWindow* parentWindow);
+		virtual ~GUIMenuBar();
+
+		/**	Sets the area of the menu bar, in pixels relative to the parent GUI widget. */
+		void setArea(INT32 x, INT32 y, UINT32 width, UINT32 height);
+
+		/**
+		 * Adds a new menu item to the menu bar. 
+		 *
+		 * @param[in]	path		Path to the menu item. Each element of the path must be separated using "/". 
+		 *							First element of the path will create the top level menu, and any further element
+		 *							will create a new sub-menu. Last element will be the interactable element.
+		 * @param[in]	callback	Callback to trigger when user click on the interactable element (last element in the 
+		 *							provided path). Can be null.
+		 * @param[in]	priority	Determines where is the element positioned compared to other elements in the same 
+		 *							sub-menu. Higher priority elements get placed higher up in the sub-menu. This only
+		 *							applies to the last element. If you need to customize its parent element priority call
+		 *							this method with with their specific paths.
+		 * @param[in]	shortcut	Keyboard shortcut key to display next to the interactable element, and register with the
+		 *							global shortcut manager.
+		 */
+		GUIMenuItem* addMenuItem(const WString& path, std::function<void()> callback, INT32 priority = 0, 
+			const ShortcutKey& shortcut = ShortcutKey::NONE);
+
+		/**
+		 * Adds a menu item separator element at the specified path. The separator is added as a child of the path.
+		 *
+		 * @param[in]	path		Parent path of the sub-menu to add the separator.
+		 * @param[in]	priority	Determines where is the separator positioned compared to other elements in the same 
+		 *							sub-menu. Higher priority elements get placed higher up in the sub-menu.
+		 */
+		GUIMenuItem* addMenuItemSeparator(const WString& path, INT32 priority = 0);
+
+		/**	Returns an existing menu item at the specified path, or null if one cannot be found. */
+		GUIMenuItem* getMenuItem(const WString& path);
+
+		/**
+		 * Removes a menu item from the specified path. If this path points to a sub-menu entire sub-menu will be removed.
+		 */
+		void removeMenuItem(const WString& path);
+
+		/**	Removes the specified menu item. */
+		void removeMenuItem(GUIMenuItem* item);
+
+		/**
+		 * Adds a new button to the tool bar.
+		 *
+		 * @param[in]	name		Unique name of the button that can be used for identifiying it.
+		 * @param[in]	content 	Content to display on the button.
+		 * @param[in]	callback	Callback to trigger when the button is pressed.
+		 * @param[in]	priority	Determines where is the button positioned compared to other elements on the tool bar.
+		 * 							Higher priority elements get placed before lower priority ones.
+		 */
+		void addToolBarButton(const String& name, const GUIContent& content, std::function<void()> callback, INT32 priority = 0);
+
+		/**
+		 * Toggles an existing toolbar button into an on or off state which changes the visuals of the button.
+		 *
+		 * @param[in]	name	Name of the existing button to toggle.
+		 * @param[in]	on		True to toggle on, false to toggle off (default).
+		 */
+		void toggleToolbarButton(const String& name, bool on);
+
+		/**
+		 * Adds a new separator element to the tool bar.
+		 *
+		 * @param[in]	name		Unique name of the separator that can be used for identifiying it.
+		 * @param[in]	priority	Determines where is the separator positioned compared to other elements on the tool bar.
+		 * 							Higher priority elements get placed before lower priority ones.
+		 */
+		void addToolBarSeparator(const String& name, INT32 priority = 0);
+
+		/**
+		 * Removes an element from the tool bar.
+		 *
+		 * @param[in]	name	Unique name of the element to remove.
+		 */
+		void removeToolBarButton(const String& name);
+	private:
+		/**	Finds a top level sub-menu with the specified name. */
+		const GUIMenuBarData* getSubMenu(const WString& name) const;
+
+		/**	Adds a new top level sub-menu button. */
+		GUIMenuBarData* addNewButton(const WString& name, INT32 priority);
+
+		/**
+		 * Attempts to remove the first element from the specified path. First element returned in specified in @p pathRoot,
+		 * and original @p path is modified so it no longer includes the first element.
+		 *
+		 * @return	False if first element doesn't exist, true otherwise.
+		 */
+		bool stripPath(WString& path, WString& pathRoot) const;
+
+		/**
+		 * Registers a shortcut with the global shortcut manager. Pressing the shortcut will trigger the provided callback.
+		 */
+		void registerShortcut(const WString& path, const ShortcutKey& shortcut, std::function<void()> callback);
+
+		/**	Unregisters a shortcut assigned to the provided path from the global shortcut manager. */
+		void unregisterShortcut(const WString& path);
+
+		/**	Opens a top level sub-menu with the provided name. */
+		void openSubMenu(const WString& name);
+
+		/**	Closes any currently active sub-menu. */
+		void closeSubMenu();
+
+		/**
+		 * Triggered when a sub-menu is open and a user hovers over another top level sub-menu button.
+		 *
+		 * @param[in]	name	Name of the sub-menu the user is hovering over.
+		 */
+		void onSubMenuHover(const WString& name);
+
+		/**	Triggered when a sub-menu is closed. */
+		void onSubMenuClosed();
+
+		/**	Triggered when the minimize button is clicked. Minimizes the attached window. */
+		void onMinimizeClicked();
+
+		/**	Triggered when the maximize button is clicked. Maximizes the attached window. */
+		void onMaximizeClicked();
+
+		/**	Triggered when the close button is clicked. Closes the attached window. */
+		void onCloseClicked();
+
+		/**
+		 * Refreshes the OS client area that allow the window to be dragged by dragging the empty areas on the menu bar.
+		 * Should be called when top level button configuration changes or menu bar area changes.
+		 */
+		void refreshNonClientAreas();
+
+		static const UINT32 NUM_ELEMENTS_AFTER_CONTENT;
+		static const UINT32 ELEMENT_SPACING;
+
+		RenderWindow* mParentWindow;
+		GUIWidget* mParentWidget;
+		GUIPanel* mMainPanel;
+		GUIPanel* mBgPanel;
+		GUILayout* mMenuItemLayout;
+		GUILayout* mToolBarLayout;
+		GUITexture* mBgTexture;
+		GUITexture* mLogoTexture;
+		GUITexture* mSplitterLine;
+
+		GUIButton* mMinBtn;
+		GUIButton* mMaxBtn;
+		GUIButton* mCloseBtn;
+
+		Vector<GUIMenuBarData> mChildMenus;
+		UnorderedMap<WString, ShortcutKey> mEntryShortcuts;
+		Vector<GUIToolBarData> mToolbarElements;
+
+		GUIButton* mSubMenuButton;
+		bool mSubMenuOpen;
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsGUIResourceTreeView.h

@@ -10,8 +10,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
+	/** @addtogroup GUI-Editor-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -223,5 +222,4 @@ namespace BansheeEngine
 	typedef ServiceLocator<GUIResourceTreeView> ResourceTreeViewLocator;
 	typedef ServiceLocator<GUIResourceTreeView> ResourceTreeViewLocator;
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsGUISceneTreeView.h

@@ -9,8 +9,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
+	/** @addtogroup GUI-Editor-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -200,5 +199,4 @@ namespace BansheeEngine
 	typedef ServiceLocator<GUISceneTreeView> SceneTreeViewLocator;
 	typedef ServiceLocator<GUISceneTreeView> SceneTreeViewLocator;
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsGUIStatusBar.h

@@ -7,8 +7,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
+	/** @addtogroup GUI-Editor-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -108,5 +107,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 116 - 118
Source/BansheeEditor/Include/BsGUITabButton.h

@@ -1,119 +1,117 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsGUIToggle.h"
-#include "BsGUIToggleGroup.h"
-#include "BsImageSprite.h"
-#include "BsEvent.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
-	 *  @{
-	 */
-
-	/**
-	 * Specialization of a GUIToggle element used for displaying tabs in a GUITabbedTitleBar. Aside from being toggleable
-	 * these buttons also track drag and drop operations.
-	 */
-	class GUITabButton : public GUIToggle
-	{
-	public:
-		/** Returns type name of the GUI element used for finding GUI element styles.  */
-		static const String& getGUITypeName();
-
-		/**
-		 * Creates a new GUI tab button element.
-		 *
-		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
-		 * @param[in]	index			Unique index that can be used for identifying a tab.
-		 * @param[in]	text			Label to display in the button.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const HString& text, 
-			const String& styleName = StringUtil::BLANK);
-
-		/**
-		 * Creates a new GUI tab button element.
-		 *
-		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
-		 * @param[in]	index			Unique index that can be used for identifying a tab.
-		 * @param[in]	text			Label to display in the button.
-		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
-		 *								This will override any similar options set by style.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const HString& text, 
-			const GUIOptions& options, const String& styleName = StringUtil::BLANK);
-	
-		/**
-		 * Creates a new GUI tab button element.
-		 *
-		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
-		 * @param[in]	index			Unique index that can be used for identifying a tab.
-		 * @param[in]	content			Content to display in the button.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, 
-			const String& styleName = StringUtil::BLANK);
-
-		/**
-		 * Creates a new GUI tab button element.
-		 *
-		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
-		 * @param[in]	index			Unique index that can be used for identifying a tab.
-		 * @param[in]	content			Content to display in the button.
-		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
-		 *								This will override any similar options set by style.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, 
-			const GUIOptions& options, const String& styleName = StringUtil::BLANK);
-
-		/**	Returns the unique index for this tab button. */
-		UINT32 getIndex() const { return mIndex; }
-
-		/** @copydoc GUIToggle::toggleOn */
-		void toggleOn() override;
-
-		/** @copydoc GUIToggle::toggleOff */
-		void toggleOff() override;
-
-		/** Changes the button state to dragged or not dragged, resulting primarily in a visual change. */
-		void _setDraggedState(bool active);
-
-		/**
-		 * Triggered when the user starts dragging the tab button. Reported parameters are the unique index of the tab and
-		 * pointer position relative to parent GUIWidget.
-		 */
-		Event<void(UINT32, const Vector2I&)> onDragged; 
-
-		/**
-		 * Triggered when the user ends dragging the tab button. Reported parameters are the unique index of the tab and
-		 * pointer position relative to parent GUIWidget.
-		 */
-		Event<void(UINT32, const Vector2I&)> onDragEnd;
-	protected:
-		GUITabButton(const String& styleName, const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, const GUIDimensions& dimensions);
-
-		/** @copydoc GUIElement::_mouseEvent */
-		virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
-
-		UINT32 mIndex;
-		Vector2I mDragStartPosition;
-		bool mDraggedState;
-		GUIElementState mInactiveState;
-
-		static const UINT32 DRAG_MIN_DISTANCE;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsGUIToggle.h"
+#include "BsGUIToggleGroup.h"
+#include "BsImageSprite.h"
+#include "BsEvent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Editor-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Specialization of a GUIToggle element used for displaying tabs in a GUITabbedTitleBar. Aside from being toggleable
+	 * these buttons also track drag and drop operations.
+	 */
+	class GUITabButton : public GUIToggle
+	{
+	public:
+		/** Returns type name of the GUI element used for finding GUI element styles.  */
+		static const String& getGUITypeName();
+
+		/**
+		 * Creates a new GUI tab button element.
+		 *
+		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
+		 * @param[in]	index			Unique index that can be used for identifying a tab.
+		 * @param[in]	text			Label to display in the button.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const HString& text, 
+			const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * Creates a new GUI tab button element.
+		 *
+		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
+		 * @param[in]	index			Unique index that can be used for identifying a tab.
+		 * @param[in]	text			Label to display in the button.
+		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
+		 *								This will override any similar options set by style.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const HString& text, 
+			const GUIOptions& options, const String& styleName = StringUtil::BLANK);
+	
+		/**
+		 * Creates a new GUI tab button element.
+		 *
+		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
+		 * @param[in]	index			Unique index that can be used for identifying a tab.
+		 * @param[in]	content			Content to display in the button.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, 
+			const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * Creates a new GUI tab button element.
+		 *
+		 * @param[in]	toggleGroup		A toggle group that forms a link between related tab buttons.
+		 * @param[in]	index			Unique index that can be used for identifying a tab.
+		 * @param[in]	content			Content to display in the button.
+		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
+		 *								This will override any similar options set by style.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUITabButton* create(const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, 
+			const GUIOptions& options, const String& styleName = StringUtil::BLANK);
+
+		/**	Returns the unique index for this tab button. */
+		UINT32 getIndex() const { return mIndex; }
+
+		/** @copydoc GUIToggle::toggleOn */
+		void toggleOn() override;
+
+		/** @copydoc GUIToggle::toggleOff */
+		void toggleOff() override;
+
+		/** Changes the button state to dragged or not dragged, resulting primarily in a visual change. */
+		void _setDraggedState(bool active);
+
+		/**
+		 * Triggered when the user starts dragging the tab button. Reported parameters are the unique index of the tab and
+		 * pointer position relative to parent GUIWidget.
+		 */
+		Event<void(UINT32, const Vector2I&)> onDragged; 
+
+		/**
+		 * Triggered when the user ends dragging the tab button. Reported parameters are the unique index of the tab and
+		 * pointer position relative to parent GUIWidget.
+		 */
+		Event<void(UINT32, const Vector2I&)> onDragEnd;
+	protected:
+		GUITabButton(const String& styleName, const GUIToggleGroupPtr& toggleGroup, UINT32 index, const GUIContent& content, const GUIDimensions& dimensions);
+
+		/** @copydoc GUIElement::_mouseEvent */
+		virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
+
+		UINT32 mIndex;
+		Vector2I mDragStartPosition;
+		bool mDraggedState;
+		GUIElementState mInactiveState;
+
+		static const UINT32 DRAG_MIN_DISTANCE;
+	};
+
+	/** @} */
 }
 }

+ 203 - 205
Source/BansheeEditor/Include/BsGUITabbedTitleBar.h

@@ -1,206 +1,204 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsGUIElementContainer.h"
-#include "BsRect2I.h"
-#include "BsEvent.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
-	 *  @{
-	 */
-
-	/**
-	 * Tabbed title bar to be used in editor windows. Displays tabs that can be activated, reordered by dragging, or
-	 * dragged off and on to/on other title bars.
-	 */
-	class GUITabbedTitleBar : public GUIElementContainer
-	{
-	public:
-		/** Returns type name of the GUI element used for finding GUI element styles. */
-		static const String& getGUITypeName();
-
-		/**
-		 * Creates a new GUI foldout element.
-		 *
-		 * @param[in]	backgroundStyle		GUI style to display the background in. Keep as blank for default.
-		 * @param[in]	backgroundStyle		GUI style to display the tab buttons in. Keep as blank for default.
-		 * @param[in]	maxBtnStyle			GUI style to display the maximize button in. Keep as blank for default.
-		 * @param[in]	closeBtnStyle		GUI style to display the close button in. Keep as blank for default.
-		 */
-		static GUITabbedTitleBar* create(const String& backgroundStyle = StringUtil::BLANK, const String& tabBtnStyle = StringUtil::BLANK, 
-			const String& maxBtnStyle = StringUtil::BLANK, const String& closeBtnStyle = StringUtil::BLANK);
-
-		/**
-		 * Creates a new GUI foldout element.
-		 *
-		 *
-		 * @param[in]	options				Options that allow you to control how is the element positioned and sized.
-		 *									This will override any similar options set by style.
-		 * @param[in]	backgroundStyle		GUI style to display the background in. Keep as blank for default.
-		 * @param[in]	backgroundStyle		GUI style to display the tab buttons in. Keep as blank for default.
-		 * @param[in]	maxBtnStyle			GUI style to display the maximize button in. Keep as blank for default.
-		 * @param[in]	closeBtnStyle		GUI style to display the close button in. Keep as blank for default.
-		 */
-		static GUITabbedTitleBar* create(const GUIOptions& options,
-			const String& backgroundStyle = StringUtil::BLANK, const String& tabBtnStyle = StringUtil::BLANK, 
-			const String& maxBtnStyle = StringUtil::BLANK, const String& closeBtnStyle = StringUtil::BLANK);
-
-		/**
-		 * Adds a new tab to the end of the tab list.
-		 *
-		 * @param[in]	name	Title to display on the tab button.
-		 * @return				A unique index (not sequential) that you may use for later identifying the tab.
-		 */
-		UINT32 addTab(const HString& name);
-
-		/**
-		 * Inserts a new tab button at the specified position.
-		 *
-		 * @param[in]	position	Sequential index to insert the tab button in. This will be clamped to a valid range.
-		 * @param[in]	name		Title to display on the tab button.
-		 * @return					A unique index (not sequential) that you may use for later identifying the tab.
-		 */
-		UINT32 insertTab(UINT32 position, const HString& name);
-
-		/**	Removes the tab button with the specified unique index. */
-		void removeTab(UINT32 uniqueIdx);
-
-		/**	Activates the tab button with the specified unique index. */
-		void setActive(UINT32 uniqueIdx);
-
-		/**	Finds the unique tab index from the provided sequential tab position. */
-		UINT32 getTabIdx(UINT32 position) const;
-
-		/**	Returns the total number of display tab buttons. */
-		UINT32 getNumTabs() const { return (UINT32)mTabButtons.size(); }
-
-		/**	Changes the displayed title for a tab with the specified index. */
-		void updateTabName(UINT32 uniqueIdx, const HString& name);
-
-		/**
-		 * Calculates areas between the tab buttons and other GUI elements on the title bar. These areas are normally used
-		 * for setting up valid areas the user can click on and drag the window the title bar belongs to.
-		 */
-		Vector<Rect2I> calcDraggableAreas(INT32 x, INT32 y, UINT32 width, UINT32 height) const;
-
-		/** Triggered when the active tab changes. Provided parameter is the unique index of the activated tab. */
-		Event<void(UINT32)> onTabActivated; 
-
-		/**	Triggered when a tab is closed. Provided parameter is the unique index of the closed tab. */
-		Event<void(UINT32)> onTabClosed;
-
-		/**
-		 * Triggered when a tab maximize button is clicked. Provided parameter is the unique index of the
-		 * maximized/restored tab.
-		 */
-		Event<void(UINT32)> onTabMaximized;
-
-		/**
-		 * Triggered when a tab gets dragged off the title bar. Provided parameter is the unique index of the activated tab.
-		 */
-		Event<void(UINT32)> onTabDraggedOff;
-
-		/**
-		 * Triggered when a new tab gets dragged on the title bar. Provided parameter is the sequential index of the
-		 * activated tab.
-		 */
-		Event<void(UINT32)> onTabDraggedOn;
-
-	protected:
-		GUITabbedTitleBar(const String& backgroundStyle, const String& tabBtnStyle, 
-			const String& minBtnStyle, const String& closeBtnStyle, const GUIDimensions& dimensions);
-
-		virtual ~GUITabbedTitleBar();
-
-		/** @copydoc GUIElementContainer::updateClippedBounds */
-		void updateClippedBounds() override;
-
-		/** @copydoc GUIElementContainer::_getOptimalSize */
-		Vector2I _getOptimalSize() const override;
-
-		/** @copydoc GUIElementContainer::_updateLayoutInternal */
-		void _updateLayoutInternal(const GUILayoutData& data) override;
-
-		/** @copydoc GUIElementContainer::_mouseEvent */
-		virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
-
-		/**
-		 * Starts the internal drag and drop operation.
-		 *
-		 * @param[in]	seqIdx			Sequential index of the dragged tab.
-		 * @param[in]	startDragPos	Pointer position of where the drag originated, relative to parent widget.
-		 */
-		void startDrag(UINT32 seqIdx, const Vector2I& startDragPos);
-
-		/**	Ends the internal drag and drop operation started with startDrag(). */
-		void endDrag();
-
-		/**
-		 * Triggered when a tab button is toggled on or off.
-		 *
-		 * @param[in]	tabIdx		Unique index of the tab.
-		 * @param[in]	toggledOn	Wether the tab was activated or deactivated.
-		 */
-		void tabToggled(UINT32 tabIdx, bool toggledOn);
-
-		/**	Triggered when the close button is pressed. */
-		void tabClosed();
-
-		/**	Triggered when the maximize button is pressed. */
-		void tabMaximize();
-
-		/**
-		 * Triggered every frame while a tab button is being dragged.
-		 *
-		 * @param[in]	tabIdx	Unique index of the dragged tab.
-		 * @param[in]	dragPos	Position of the pointer, relative to parent widget.
-		 */
-		void tabDragged(UINT32 tabIdx, const Vector2I& dragPos);
-
-		/**
-		 * Triggered when a drag operation on a tab button ends.
-		 *
-		 * @param[in]	tabIdx	Unique index of the dragged tab.
-		 * @param[in]	dragPos	Position of the pointer, relative to parent widget.
-		 */
-		void tabDragEnd(UINT32 tabIdx, const Vector2I& dragPos);
-
-		/** Converts unique tab index to a sequential index corresponding to the tab's position in the title bar. */
-		INT32 uniqueIdxToSeqIdx(UINT32 uniqueIdx) const;
-
-		static const INT32 TAB_SPACING;
-		static const INT32 FIRST_TAB_OFFSET;
-		static const INT32 OPTION_BTN_SPACING;
-		static const INT32 OPTION_BTN_RIGHT_OFFSET;
-
-		Vector<GUITabButton*> mTabButtons;
-
-		UINT32 mUniqueTabIdx;
-		UINT32 mActiveTabIdx;
-		GUITexture* mBackgroundImage;
-		GUIButton* mMaxBtn;
-		GUIButton* mCloseBtn;
-		GUIToggleGroupPtr mTabToggleGroup;
-
-		EditorWidgetBase* mTempDraggedWidget;
-		UINT32 mTempDraggedTabIdx;
-
-		bool mDragInProgress;
-		GUITabButton* mDraggedBtn;
-		INT32 mDragBtnOffset;
-		INT32 mInitialDragOffset;
-
-		String mBackgroundStyle;
-		String mCloseBtnStyle;
-		String mMaximizeBtnStyle;
-		String mTabBtnStyle;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsGUIElementContainer.h"
+#include "BsRect2I.h"
+#include "BsEvent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Editor-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Tabbed title bar to be used in editor windows. Displays tabs that can be activated, reordered by dragging, or
+	 * dragged off and on to/on other title bars.
+	 */
+	class GUITabbedTitleBar : public GUIElementContainer
+	{
+	public:
+		/** Returns type name of the GUI element used for finding GUI element styles. */
+		static const String& getGUITypeName();
+
+		/**
+		 * Creates a new GUI foldout element.
+		 *
+		 * @param[in]	backgroundStyle		GUI style to display the background in. Keep as blank for default.
+		 * @param[in]	backgroundStyle		GUI style to display the tab buttons in. Keep as blank for default.
+		 * @param[in]	maxBtnStyle			GUI style to display the maximize button in. Keep as blank for default.
+		 * @param[in]	closeBtnStyle		GUI style to display the close button in. Keep as blank for default.
+		 */
+		static GUITabbedTitleBar* create(const String& backgroundStyle = StringUtil::BLANK, const String& tabBtnStyle = StringUtil::BLANK, 
+			const String& maxBtnStyle = StringUtil::BLANK, const String& closeBtnStyle = StringUtil::BLANK);
+
+		/**
+		 * Creates a new GUI foldout element.
+		 *
+		 *
+		 * @param[in]	options				Options that allow you to control how is the element positioned and sized.
+		 *									This will override any similar options set by style.
+		 * @param[in]	backgroundStyle		GUI style to display the background in. Keep as blank for default.
+		 * @param[in]	backgroundStyle		GUI style to display the tab buttons in. Keep as blank for default.
+		 * @param[in]	maxBtnStyle			GUI style to display the maximize button in. Keep as blank for default.
+		 * @param[in]	closeBtnStyle		GUI style to display the close button in. Keep as blank for default.
+		 */
+		static GUITabbedTitleBar* create(const GUIOptions& options,
+			const String& backgroundStyle = StringUtil::BLANK, const String& tabBtnStyle = StringUtil::BLANK, 
+			const String& maxBtnStyle = StringUtil::BLANK, const String& closeBtnStyle = StringUtil::BLANK);
+
+		/**
+		 * Adds a new tab to the end of the tab list.
+		 *
+		 * @param[in]	name	Title to display on the tab button.
+		 * @return				A unique index (not sequential) that you may use for later identifying the tab.
+		 */
+		UINT32 addTab(const HString& name);
+
+		/**
+		 * Inserts a new tab button at the specified position.
+		 *
+		 * @param[in]	position	Sequential index to insert the tab button in. This will be clamped to a valid range.
+		 * @param[in]	name		Title to display on the tab button.
+		 * @return					A unique index (not sequential) that you may use for later identifying the tab.
+		 */
+		UINT32 insertTab(UINT32 position, const HString& name);
+
+		/**	Removes the tab button with the specified unique index. */
+		void removeTab(UINT32 uniqueIdx);
+
+		/**	Activates the tab button with the specified unique index. */
+		void setActive(UINT32 uniqueIdx);
+
+		/**	Finds the unique tab index from the provided sequential tab position. */
+		UINT32 getTabIdx(UINT32 position) const;
+
+		/**	Returns the total number of display tab buttons. */
+		UINT32 getNumTabs() const { return (UINT32)mTabButtons.size(); }
+
+		/**	Changes the displayed title for a tab with the specified index. */
+		void updateTabName(UINT32 uniqueIdx, const HString& name);
+
+		/**
+		 * Calculates areas between the tab buttons and other GUI elements on the title bar. These areas are normally used
+		 * for setting up valid areas the user can click on and drag the window the title bar belongs to.
+		 */
+		Vector<Rect2I> calcDraggableAreas(INT32 x, INT32 y, UINT32 width, UINT32 height) const;
+
+		/** Triggered when the active tab changes. Provided parameter is the unique index of the activated tab. */
+		Event<void(UINT32)> onTabActivated; 
+
+		/**	Triggered when a tab is closed. Provided parameter is the unique index of the closed tab. */
+		Event<void(UINT32)> onTabClosed;
+
+		/**
+		 * Triggered when a tab maximize button is clicked. Provided parameter is the unique index of the
+		 * maximized/restored tab.
+		 */
+		Event<void(UINT32)> onTabMaximized;
+
+		/**
+		 * Triggered when a tab gets dragged off the title bar. Provided parameter is the unique index of the activated tab.
+		 */
+		Event<void(UINT32)> onTabDraggedOff;
+
+		/**
+		 * Triggered when a new tab gets dragged on the title bar. Provided parameter is the sequential index of the
+		 * activated tab.
+		 */
+		Event<void(UINT32)> onTabDraggedOn;
+
+	protected:
+		GUITabbedTitleBar(const String& backgroundStyle, const String& tabBtnStyle, 
+			const String& minBtnStyle, const String& closeBtnStyle, const GUIDimensions& dimensions);
+
+		virtual ~GUITabbedTitleBar();
+
+		/** @copydoc GUIElementContainer::updateClippedBounds */
+		void updateClippedBounds() override;
+
+		/** @copydoc GUIElementContainer::_getOptimalSize */
+		Vector2I _getOptimalSize() const override;
+
+		/** @copydoc GUIElementContainer::_updateLayoutInternal */
+		void _updateLayoutInternal(const GUILayoutData& data) override;
+
+		/** @copydoc GUIElementContainer::_mouseEvent */
+		virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
+
+		/**
+		 * Starts the internal drag and drop operation.
+		 *
+		 * @param[in]	seqIdx			Sequential index of the dragged tab.
+		 * @param[in]	startDragPos	Pointer position of where the drag originated, relative to parent widget.
+		 */
+		void startDrag(UINT32 seqIdx, const Vector2I& startDragPos);
+
+		/**	Ends the internal drag and drop operation started with startDrag(). */
+		void endDrag();
+
+		/**
+		 * Triggered when a tab button is toggled on or off.
+		 *
+		 * @param[in]	tabIdx		Unique index of the tab.
+		 * @param[in]	toggledOn	Wether the tab was activated or deactivated.
+		 */
+		void tabToggled(UINT32 tabIdx, bool toggledOn);
+
+		/**	Triggered when the close button is pressed. */
+		void tabClosed();
+
+		/**	Triggered when the maximize button is pressed. */
+		void tabMaximize();
+
+		/**
+		 * Triggered every frame while a tab button is being dragged.
+		 *
+		 * @param[in]	tabIdx	Unique index of the dragged tab.
+		 * @param[in]	dragPos	Position of the pointer, relative to parent widget.
+		 */
+		void tabDragged(UINT32 tabIdx, const Vector2I& dragPos);
+
+		/**
+		 * Triggered when a drag operation on a tab button ends.
+		 *
+		 * @param[in]	tabIdx	Unique index of the dragged tab.
+		 * @param[in]	dragPos	Position of the pointer, relative to parent widget.
+		 */
+		void tabDragEnd(UINT32 tabIdx, const Vector2I& dragPos);
+
+		/** Converts unique tab index to a sequential index corresponding to the tab's position in the title bar. */
+		INT32 uniqueIdxToSeqIdx(UINT32 uniqueIdx) const;
+
+		static const INT32 TAB_SPACING;
+		static const INT32 FIRST_TAB_OFFSET;
+		static const INT32 OPTION_BTN_SPACING;
+		static const INT32 OPTION_BTN_RIGHT_OFFSET;
+
+		Vector<GUITabButton*> mTabButtons;
+
+		UINT32 mUniqueTabIdx;
+		UINT32 mActiveTabIdx;
+		GUITexture* mBackgroundImage;
+		GUIButton* mMaxBtn;
+		GUIButton* mCloseBtn;
+		GUIToggleGroupPtr mTabToggleGroup;
+
+		EditorWidgetBase* mTempDraggedWidget;
+		UINT32 mTempDraggedTabIdx;
+
+		bool mDragInProgress;
+		GUITabButton* mDraggedBtn;
+		INT32 mDragBtnOffset;
+		INT32 mInitialDragOffset;
+
+		String mBackgroundStyle;
+		String mCloseBtnStyle;
+		String mMaximizeBtnStyle;
+		String mTabBtnStyle;
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsGUITreeView.h

@@ -9,8 +9,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
+	/** @addtogroup GUI-Editor-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -322,5 +321,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 49 - 51
Source/BansheeEditor/Include/BsGUITreeViewEditBox.h

@@ -1,52 +1,50 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsGUIInputBox.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
-	 *  @{
-	 */
-
-	/** Input box used for renaming elements in a TreeView. */
-	class GUITreeViewEditBox : public GUIInputBox
-	{
-	public:
-		/** Returns type name of the GUI element used for finding GUI element styles.  */
-		static const String& getGUITypeName();
-
-		/**
-		 * Creates a new GUI tree view edito box element.
-		 *
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUITreeViewEditBox* create(const String& styleName = StringUtil::BLANK);
-
-		/**
-		 * Creates a new GUI tree view edito box element.
-		 *
-		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
-		 *								This will override any similar options set by style.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUITreeViewEditBox* create(const GUIOptions& options, const String& styleName = StringUtil::BLANK);
-
-		Event<void()> onInputConfirmed; /**< Triggered when the user confirms the input in the edit box. */
-		Event<void()> onInputCanceled; /**< Triggered when the user cancels the input in the edit box. */
-		Event<void()> onFocusLost; /**< Triggered when the user clicks outside of the editor box. */
-	private:
-		GUITreeViewEditBox(const String& styleName, const GUIDimensions& dimensions);
-
-		/** @copydoc GUIElement::_commandEvent */
-		virtual bool _commandEvent(const GUICommandEvent& ev) override;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsGUIInputBox.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Editor-Internal
+	 *  @{
+	 */
+
+	/** Input box used for renaming elements in a TreeView. */
+	class GUITreeViewEditBox : public GUIInputBox
+	{
+	public:
+		/** Returns type name of the GUI element used for finding GUI element styles.  */
+		static const String& getGUITypeName();
+
+		/**
+		 * Creates a new GUI tree view edito box element.
+		 *
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUITreeViewEditBox* create(const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * Creates a new GUI tree view edito box element.
+		 *
+		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
+		 *								This will override any similar options set by style.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUITreeViewEditBox* create(const GUIOptions& options, const String& styleName = StringUtil::BLANK);
+
+		Event<void()> onInputConfirmed; /**< Triggered when the user confirms the input in the edit box. */
+		Event<void()> onInputCanceled; /**< Triggered when the user cancels the input in the edit box. */
+		Event<void()> onFocusLost; /**< Triggered when the user clicks outside of the editor box. */
+	private:
+		GUITreeViewEditBox(const String& styleName, const GUIDimensions& dimensions);
+
+		/** @copydoc GUIElement::_commandEvent */
+		virtual bool _commandEvent(const GUICommandEvent& ev) override;
+	};
+
+	/** @} */
 }
 }

+ 47 - 49
Source/BansheeEditor/Include/BsGUIWindowFrame.h

@@ -1,50 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsGUITexture.h"
-#include "BsImageSprite.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
-	 *  @{
-	 */
-
-	/**	GUI element used for displaying a border on an editor window edge. */
-	class GUIWindowFrame : public GUITexture
-	{
-	public:
-		/** Returns type name of the GUI element used for finding GUI element styles. */
-		static const String& getGUITypeName();
-
-		/**
-		 * Creates a new GUI window frame element.
-		 *
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUIWindowFrame* create(const String& styleName = StringUtil::BLANK);
-
-		/**
-		 * Creates a new GUI window frame element.
-		 *
-		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
-		 *								This will override any similar options set by style.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default style is used.
-		 */
-		static GUIWindowFrame* create(const GUIOptions& options, const String& styleName = StringUtil::BLANK);
-
-		/**	Sets whether the frame should be displayed in focus or unfocused state. */
-		void setFocused(bool focused);
-	protected:
-		~GUIWindowFrame();
-		GUIWindowFrame(const String& styleName, const GUIDimensions& dimensions);
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsGUITexture.h"
+#include "BsImageSprite.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Editor-Internal
+	 *  @{
+	 */
+
+	/**	GUI element used for displaying a border on an editor window edge. */
+	class GUIWindowFrame : public GUITexture
+	{
+	public:
+		/** Returns type name of the GUI element used for finding GUI element styles. */
+		static const String& getGUITypeName();
+
+		/**
+		 * Creates a new GUI window frame element.
+		 *
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUIWindowFrame* create(const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * Creates a new GUI window frame element.
+		 *
+		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
+		 *								This will override any similar options set by style.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default style is used.
+		 */
+		static GUIWindowFrame* create(const GUIOptions& options, const String& styleName = StringUtil::BLANK);
+
+		/**	Sets whether the frame should be displayed in focus or unfocused state. */
+		void setFocused(bool focused);
+	protected:
+		~GUIWindowFrame();
+		GUIWindowFrame(const String& styleName, const GUIDimensions& dimensions);
+	};
+
+	/** @} */
 }
 }

+ 66 - 68
Source/BansheeEditor/Include/BsGUIWindowFrameWidget.h

@@ -1,69 +1,67 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsCGUIWidget.h"
-#include "BsEvent.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI-Editor
-	 *  @{
-	 */
-
-	/**
-	 * A GUIWidget specialization that when attached to a window will create a window border, window background and provide 
-	 * resize functionality.
-	 */
-	class WindowFrameWidget : public CGUIWidget
-	{
-	public:
-		/**
-		 * Constructs a new window frame.
-		 *
-		 * @param[in]	parent			Parent SceneObject to attach the Component to.
-		 * @param[in]	allowResize		Should the widget set up resize handles that can be dragged by the user.
-		 * @param[in]	camera			Camera to draw the GUI elements in.
-		 * @param[in]	ownerWindow		Window that the frame widget will act on.
-		 * @param[in]	skin			GUI skin used for the GUI child elements.
-		 */
-		WindowFrameWidget(const HSceneObject& parent, bool allowResize, const CameraPtr& camera, RenderWindow* ownerWindow, 
-			const HGUISkin& skin);
-		virtual ~WindowFrameWidget();
-
-	protected:
-		/** @copydoc GUIWidget::ownerWindowFocusChanged */
-		void ownerWindowFocusChanged() override;
-
-		/** @copydoc GUIWidget::ownerTargetResized */
-		void ownerTargetResized() override;
-
-		/**
-		 * Updates the non-client areas that notify the OS where the interactable elements used for window resize 
-		 * operations are. This should be called after any resize operations.
-		 */
-		void refreshNonClientAreas() const;
-
-		static const UINT32 RESIZE_BORDER_WIDTH;
-
-		bool mAllowResize;
-		GUIPanel* mWindowFramePanel;
-		RenderWindow* mParentWindow;
-		GUIWindowFrame* mWindowFrame;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class CWindowFrameWidgetRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-
-		WindowFrameWidget() { } // Serialization only
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsCGUIWidget.h"
+#include "BsEvent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Editor-Internal
+	 *  @{
+	 */
+
+	/**
+	 * A GUIWidget specialization that when attached to a window will create a window border, window background and provide 
+	 * resize functionality.
+	 */
+	class WindowFrameWidget : public CGUIWidget
+	{
+	public:
+		/**
+		 * Constructs a new window frame.
+		 *
+		 * @param[in]	parent			Parent SceneObject to attach the Component to.
+		 * @param[in]	allowResize		Should the widget set up resize handles that can be dragged by the user.
+		 * @param[in]	camera			Camera to draw the GUI elements in.
+		 * @param[in]	ownerWindow		Window that the frame widget will act on.
+		 * @param[in]	skin			GUI skin used for the GUI child elements.
+		 */
+		WindowFrameWidget(const HSceneObject& parent, bool allowResize, const CameraPtr& camera, RenderWindow* ownerWindow, 
+			const HGUISkin& skin);
+		virtual ~WindowFrameWidget();
+
+	protected:
+		/** @copydoc GUIWidget::ownerWindowFocusChanged */
+		void ownerWindowFocusChanged() override;
+
+		/** @copydoc GUIWidget::ownerTargetResized */
+		void ownerTargetResized() override;
+
+		/**
+		 * Updates the non-client areas that notify the OS where the interactable elements used for window resize 
+		 * operations are. This should be called after any resize operations.
+		 */
+		void refreshNonClientAreas() const;
+
+		static const UINT32 RESIZE_BORDER_WIDTH;
+
+		bool mAllowResize;
+		GUIPanel* mWindowFramePanel;
+		RenderWindow* mParentWindow;
+		GUIWindowFrame* mWindowFrame;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CWindowFrameWidgetRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+
+		WindowFrameWidget() { } // Serialization only
+	};
+
+	/** @} */
 }
 }

+ 43 - 43
Source/BansheeEditor/Include/BsGUIWindowFrameWidgetRTTI.h

@@ -1,44 +1,44 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGUIWindowFrameWidget.h"
-#include "BsGameObjectRTTI.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class BS_ED_EXPORT WindowFrameWidgetRTTI : public RTTIType <WindowFrameWidget, CGUIWidget, WindowFrameWidgetRTTI>
-	{
-	private:
-
-	public:
-		WindowFrameWidgetRTTI()
-		{ }
-
-		const String& getRTTIName() override
-		{
-			static String name = "WindowFrameWidget";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_WindowFrameWidget;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<WindowFrameWidget>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsGUIWindowFrameWidget.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class BS_ED_EXPORT WindowFrameWidgetRTTI : public RTTIType <WindowFrameWidget, CGUIWidget, WindowFrameWidgetRTTI>
+	{
+	private:
+
+	public:
+		WindowFrameWidgetRTTI()
+		{ }
+
+		const String& getRTTIName() override
+		{
+			static String name = "WindowFrameWidget";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_WindowFrameWidget;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<WindowFrameWidget>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 3 - 2
Source/BansheeEditor/Include/BsGizmoManager.h

@@ -471,7 +471,9 @@ namespace BansheeEngine
 		Vector<SortedIconData> mSortedIconData;
 		Vector<SortedIconData> mSortedIconData;
 	};
 	};
 
 
-	/** @cond INTERNAL */
+	/** @addtogroup Scene-Editor-Internal
+	 *  @{
+	 */
 
 
 	/**
 	/**
 	 * Core thread version of the gizmo manager that handles most of the rendering of meshes provided by the gizmo manager.
 	 * Core thread version of the gizmo manager that handles most of the rendering of meshes provided by the gizmo manager.
@@ -615,6 +617,5 @@ namespace BansheeEngine
 		AlphaPickingMaterialData mAlphaPickingMaterial;
 		AlphaPickingMaterialData mAlphaPickingMaterial;
 	};
 	};
 
 
-	/** @endcond */
 	/** @} */
 	/** @} */
 }
 }

+ 4 - 2
Source/BansheeEditor/Include/BsHandleDrawManager.h

@@ -194,7 +194,10 @@ namespace BansheeEngine
 		DrawHelper* mDrawHelper;
 		DrawHelper* mDrawHelper;
 	};
 	};
 
 
-	/** @cond INTERNAL */
+	/** @} */
+	/** @addtogroup Handles-Internal
+	 *  @{
+	 */
 
 
 	/** Core thread specific portion of the HandleDrawManager that handles actual rendering. */
 	/** Core thread specific portion of the HandleDrawManager that handles actual rendering. */
 	class BS_ED_EXPORT HandleDrawManagerCore
 	class BS_ED_EXPORT HandleDrawManagerCore
@@ -296,6 +299,5 @@ namespace BansheeEngine
 		ClearAlphaMaterialData mClearMaterial;
 		ClearAlphaMaterialData mClearMaterial;
 	};
 	};
 
 
-	/** @endcond */
 	/** @} */
 	/** @} */
 }
 }

+ 111 - 113
Source/BansheeEditor/Include/BsHandleManager.h

@@ -1,114 +1,112 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsModule.h"
-#include "BsDegree.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Handles
-	 *  @{
-	 */
-
-	/** The central place for interacting with and drawing handles. */
-	class BS_ED_EXPORT HandleManager : public Module<HandleManager>
-	{
-	public:
-		HandleManager();
-		virtual ~HandleManager();
-
-		/** 
-		 * Triggers handle pre-input callbacks. Must be called before all updateInput() calls and followed by endInput(). 
-		 * This should be called once per frame.
-		 */
-		void beginInput();
-
-		/**
-		 * To be called every frame. Updates interactable handle sliders based on provided input. Make sure to call 
-		 * beginInput() before this method, followed by endInput() when done.
-		 *
-		 * @param[in]	camera		Camera that the input positions are relative to.
-		 * @param[in]	inputPos	Position of the pointer, relative to the provided camera viewport.
-		 * @param[in]	inputDelta	Determines pointer movement since last call to this method.
-		 */
-		void updateInput(const CameraPtr& camera, const Vector2I& inputPos, const Vector2I& inputDelta);
-
-		/** 
-		 * Triggers handle post-input callbacks. Must be called after all updateInput() calls and after beginInput().
-		 * This should be called once per frame.
-		 */
-		void endInput();
-
-		/**
-		 * To be called every frame. Queues handles for drawing.
-		 *
-		 * @param[in]	camera		Camera to draw the handles to.
-		 */
-		void draw(const CameraPtr& camera);
-
-		/**
-		 * Select a handle slider at the specified location, if there is any under the pointer. Makes the selected slider 
-		 * active and draggable.
-		 *
-		 * @param[in]	camera		Camera that the input positions are relative to, and destination to draw the handles to.
-		 * @param[in]	inputPos	Position of the pointer, relative to the provided camera viewport.
-		 */
-		void trySelect(const CameraPtr& camera, const Vector2I& inputPos);
-
-		/**	Clears the currently selected/active handle slider for the specified camera. */
-		void clearSelection(const CameraPtr& camera);
-
-		/**	Is any handle slider selected/active on the specified camera. */
-		bool isHandleActive(const CameraPtr& camera) const;
-
-		/** Returns the manager that can be used for interacting with handle sliders. */
-		HandleSliderManager& getSliderManager() const { return *mSliderManager; }
-
-		/** Returns the manager that can be used for drawing handle geometry. */
-		HandleDrawManager& getDrawManager() const { return *mDrawManager; }
-
-		/**	
-		 * Returns the uniform size for a handle rendered in @p camera, at the world position @p handlePos. The handles 
-		 * will be scaled so that they appear the same size regardless of distance from camera.
-		 */
-		float getHandleSize(const CameraPtr& camera, const Vector3& handlePos) const;
-
-		/** Sets the default handle size. This controls the uniform scale returned from getHandleSize() method. */
-		void setDefaultHandleSize(float value) { mDefaultHandleSize = value; }
-
-		/** Sets editor settings that will be used for controlling various handle behaviour. */
-		void setSettings(const EditorSettingsPtr& settings);
-
-	protected:
-		/** Updates the internal properties from editor settings. */
-		void updateFromEditorSettings();
-
-		/** Called during handle update. Allows handle sliders to be created or destroyed before any input is handled. */
-		virtual void triggerPreInput() = 0;
-
-		/**
-		 * Called during handle update after handle input is processed. Allows implementation to respond to delta values 
-		 * calculated in sliders due to input.
-		 */
-		virtual void triggerPostInput() = 0;
-
-		/** Called during handle update. Allows implementation to queue handle draw commands. */
-		virtual void queueDrawCommands() = 0;
-
-		HandleSliderManager* mSliderManager;
-		HandleDrawManager* mDrawManager;
-
-		float mDefaultHandleSize = 20.0f;
-		bool mInputStarted;
-
-		EditorSettingsPtr mSettings;
-		UINT32 mSettingsHash;
-		UINT64 mLastDrawFrameIdx;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsModule.h"
+#include "BsDegree.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Handles-Internal
+	 *  @{
+	 */
+
+	/** The central place for interacting with and drawing handles. */
+	class BS_ED_EXPORT HandleManager : public Module<HandleManager>
+	{
+	public:
+		HandleManager();
+		virtual ~HandleManager();
+
+		/** 
+		 * Triggers handle pre-input callbacks. Must be called before all updateInput() calls and followed by endInput(). 
+		 * This should be called once per frame.
+		 */
+		void beginInput();
+
+		/**
+		 * To be called every frame. Updates interactable handle sliders based on provided input. Make sure to call 
+		 * beginInput() before this method, followed by endInput() when done.
+		 *
+		 * @param[in]	camera		Camera that the input positions are relative to.
+		 * @param[in]	inputPos	Position of the pointer, relative to the provided camera viewport.
+		 * @param[in]	inputDelta	Determines pointer movement since last call to this method.
+		 */
+		void updateInput(const CameraPtr& camera, const Vector2I& inputPos, const Vector2I& inputDelta);
+
+		/** 
+		 * Triggers handle post-input callbacks. Must be called after all updateInput() calls and after beginInput().
+		 * This should be called once per frame.
+		 */
+		void endInput();
+
+		/**
+		 * To be called every frame. Queues handles for drawing.
+		 *
+		 * @param[in]	camera		Camera to draw the handles to.
+		 */
+		void draw(const CameraPtr& camera);
+
+		/**
+		 * Select a handle slider at the specified location, if there is any under the pointer. Makes the selected slider 
+		 * active and draggable.
+		 *
+		 * @param[in]	camera		Camera that the input positions are relative to, and destination to draw the handles to.
+		 * @param[in]	inputPos	Position of the pointer, relative to the provided camera viewport.
+		 */
+		void trySelect(const CameraPtr& camera, const Vector2I& inputPos);
+
+		/**	Clears the currently selected/active handle slider for the specified camera. */
+		void clearSelection(const CameraPtr& camera);
+
+		/**	Is any handle slider selected/active on the specified camera. */
+		bool isHandleActive(const CameraPtr& camera) const;
+
+		/** Returns the manager that can be used for interacting with handle sliders. */
+		HandleSliderManager& getSliderManager() const { return *mSliderManager; }
+
+		/** Returns the manager that can be used for drawing handle geometry. */
+		HandleDrawManager& getDrawManager() const { return *mDrawManager; }
+
+		/**	
+		 * Returns the uniform size for a handle rendered in @p camera, at the world position @p handlePos. The handles 
+		 * will be scaled so that they appear the same size regardless of distance from camera.
+		 */
+		float getHandleSize(const CameraPtr& camera, const Vector3& handlePos) const;
+
+		/** Sets the default handle size. This controls the uniform scale returned from getHandleSize() method. */
+		void setDefaultHandleSize(float value) { mDefaultHandleSize = value; }
+
+		/** Sets editor settings that will be used for controlling various handle behaviour. */
+		void setSettings(const EditorSettingsPtr& settings);
+
+	protected:
+		/** Updates the internal properties from editor settings. */
+		void updateFromEditorSettings();
+
+		/** Called during handle update. Allows handle sliders to be created or destroyed before any input is handled. */
+		virtual void triggerPreInput() = 0;
+
+		/**
+		 * Called during handle update after handle input is processed. Allows implementation to respond to delta values 
+		 * calculated in sliders due to input.
+		 */
+		virtual void triggerPostInput() = 0;
+
+		/** Called during handle update. Allows implementation to queue handle draw commands. */
+		virtual void queueDrawCommands() = 0;
+
+		HandleSliderManager* mSliderManager;
+		HandleDrawManager* mDrawManager;
+
+		float mDefaultHandleSize = 20.0f;
+		bool mInputStarted;
+
+		EditorSettingsPtr mSettings;
+		UINT32 mSettingsHash;
+		UINT64 mLastDrawFrameIdx;
+	};
+
+	/** @} */
 }
 }

+ 69 - 71
Source/BansheeEditor/Include/BsHandleSliderManager.h

@@ -1,72 +1,70 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Handles
-	 *  @{
-	 */
-
-	/** Controls all instantiated HandleSlider%s. */
-	class BS_ED_EXPORT HandleSliderManager
-	{
-		/** Contains active/hover sliders for each camera. */
-		struct StatePerCamera
-		{
-			HandleSlider* activeSlider = nullptr;
-			HandleSlider* hoverSlider = nullptr;
-		};
-
-	public:
-		/**
-		 * Updates all underlying sliders, changing their state and dragging them depending on their state and pointer 
-		 * movement.
-		 *
-		 * @param[in]	camera		Camera through which we're interacting with sliders.
-		 * @param[in]	inputPos	Position of the pointer.
-		 * @param[in]	inputDelta	Movement of the pointer since last frame.
-		 */
-		void update(const CameraPtr& camera, const Vector2I& inputPos, const Vector2I& inputDelta);
-
-		/**
-		 * Attempts to select (activate) a slider at the specified position.
-		 *
-		 * @param[in]	camera		Camera through which we're interacting with sliders.
-		 * @param[in]	inputPos	Position of the pointer.
-		 */
-		void trySelect(const CameraPtr& camera, const Vector2I& inputPos);
-
-		/** Clears the active slider (deactivates it) for the specified camera. */
-		void clearSelection(const CameraPtr& camera);
-
-		/** Checks is any slider active for the specified camera. */
-		bool isSliderActive(const CameraPtr& camera) const;
-
-		/** Registers a new instantiated slider. */
-		void _registerSlider(HandleSlider* slider);
-
-		/**	Unregisters a previously instantiated slider. */
-		void _unregisterSlider(HandleSlider* slider);
-
-	private:
-
-		/**
-		 * Attempts to find slider at the specified position.
-		 *
-		 * @param[in]	camera		Camera through which we're interacting with sliders.
-		 * @param[in]	inputPos	Position of the pointer.
-		 * @return					Slider if we're intersecting with one, or null otherwise.
-		 */
-		HandleSlider* findUnderCursor(const CameraPtr& camera, const Vector2I& inputPos) const;
-
-		UnorderedMap<UINT64, StatePerCamera> mStates;
-		UnorderedSet<HandleSlider*> mSliders;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Handles-Internal
+	 *  @{
+	 */
+
+	/** Controls all instantiated HandleSlider%s. */
+	class BS_ED_EXPORT HandleSliderManager
+	{
+		/** Contains active/hover sliders for each camera. */
+		struct StatePerCamera
+		{
+			HandleSlider* activeSlider = nullptr;
+			HandleSlider* hoverSlider = nullptr;
+		};
+
+	public:
+		/**
+		 * Updates all underlying sliders, changing their state and dragging them depending on their state and pointer 
+		 * movement.
+		 *
+		 * @param[in]	camera		Camera through which we're interacting with sliders.
+		 * @param[in]	inputPos	Position of the pointer.
+		 * @param[in]	inputDelta	Movement of the pointer since last frame.
+		 */
+		void update(const CameraPtr& camera, const Vector2I& inputPos, const Vector2I& inputDelta);
+
+		/**
+		 * Attempts to select (activate) a slider at the specified position.
+		 *
+		 * @param[in]	camera		Camera through which we're interacting with sliders.
+		 * @param[in]	inputPos	Position of the pointer.
+		 */
+		void trySelect(const CameraPtr& camera, const Vector2I& inputPos);
+
+		/** Clears the active slider (deactivates it) for the specified camera. */
+		void clearSelection(const CameraPtr& camera);
+
+		/** Checks is any slider active for the specified camera. */
+		bool isSliderActive(const CameraPtr& camera) const;
+
+		/** Registers a new instantiated slider. */
+		void _registerSlider(HandleSlider* slider);
+
+		/**	Unregisters a previously instantiated slider. */
+		void _unregisterSlider(HandleSlider* slider);
+
+	private:
+
+		/**
+		 * Attempts to find slider at the specified position.
+		 *
+		 * @param[in]	camera		Camera through which we're interacting with sliders.
+		 * @param[in]	inputPos	Position of the pointer.
+		 * @return					Slider if we're intersecting with one, or null otherwise.
+		 */
+		HandleSlider* findUnderCursor(const CameraPtr& camera, const Vector2I& inputPos) const;
+
+		UnorderedMap<UINT64, StatePerCamera> mStates;
+		UnorderedSet<HandleSlider*> mSliders;
+	};
+
+	/** @} */
 }
 }

+ 103 - 103
Source/BansheeEditor/Include/BsPlatformInfoRTTI.h

@@ -1,104 +1,104 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsPlatformInfo.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class BS_ED_EXPORT PlatformInfoRTTI : public RTTIType <PlatformInfo, IReflectable, PlatformInfoRTTI>
-	{
-	private:
-		WString& getDefines(PlatformInfo* obj) { return obj->defines; }
-		void setDefines(PlatformInfo* obj, WString& val) { obj->defines = val; }
-
-		PlatformType& getType(PlatformInfo* obj) { return obj->type; }
-		void setType(PlatformInfo* obj, PlatformType& val) { obj->type = val; }
-
-		WeakResourceHandle<Prefab>& getMainScene(PlatformInfo* obj) { return obj->mainScene; }
-		void setMainScene(PlatformInfo* obj, WeakResourceHandle<Prefab>& val) { obj->mainScene = val; }
-
-		bool& getFullscreen(PlatformInfo* obj) { return obj->fullscreen; }
-		void setFullscreen(PlatformInfo* obj, bool& val) { obj->fullscreen = val; }
-
-		UINT32& getWindowedWidth(PlatformInfo* obj) { return obj->windowedWidth; }
-		void setWindowedWidth(PlatformInfo* obj, UINT32& val) { obj->windowedWidth = val; }
-
-		UINT32& getWindowedHeight(PlatformInfo* obj) { return obj->windowedHeight; }
-		void setWindowedHeight(PlatformInfo* obj, UINT32& val) { obj->windowedHeight = val; }
-
-		bool& getDebug(PlatformInfo* obj) { return obj->debug; }
-		void setDebug(PlatformInfo* obj, bool& val) { obj->debug = val; }
-
-	public:
-		PlatformInfoRTTI()
-		{
-			addPlainField("defines", 0, &PlatformInfoRTTI::getDefines, &PlatformInfoRTTI::setDefines);
-			addPlainField("type", 1, &PlatformInfoRTTI::getType, &PlatformInfoRTTI::setType);
-			addReflectableField("mainScene", 2, &PlatformInfoRTTI::getMainScene, &PlatformInfoRTTI::setMainScene);
-			addPlainField("fullscreen", 3, &PlatformInfoRTTI::getFullscreen, &PlatformInfoRTTI::setFullscreen);
-			addPlainField("windowedWidth", 4, &PlatformInfoRTTI::getWindowedWidth, &PlatformInfoRTTI::setWindowedWidth);
-			addPlainField("windowedHeight", 5, &PlatformInfoRTTI::getWindowedHeight, &PlatformInfoRTTI::setWindowedHeight);
-			addPlainField("debug", 6, &PlatformInfoRTTI::getDebug, &PlatformInfoRTTI::setDebug);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "PlatformInfo";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_PlatformInfo;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<PlatformInfo>();
-		}
-	};
-
-	class BS_ED_EXPORT WinPlatformInfoRTTI : public RTTIType <WinPlatformInfo, PlatformInfo, WinPlatformInfoRTTI>
-	{
-	private:
-		WeakResourceHandle<Texture>& getIcon(WinPlatformInfo* obj) { return obj->icon; }
-		void setIcon(WinPlatformInfo* obj, WeakResourceHandle<Texture>& val) { obj->icon = val; }
-
-		WString& getTitlebarText(WinPlatformInfo* obj) { return obj->titlebarText; }
-		void setTitlebarText(WinPlatformInfo* obj, WString& val) { obj->titlebarText = val; }
-
-	public:
-		WinPlatformInfoRTTI()
-		{
-			addReflectableField("icon", 9, &WinPlatformInfoRTTI::getIcon, &WinPlatformInfoRTTI::setIcon);
-			addPlainField("titlebarText", 10, &WinPlatformInfoRTTI::getTitlebarText, &WinPlatformInfoRTTI::setTitlebarText);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "WinPlatformInfo";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_WinPlatformInfo;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<WinPlatformInfo>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsPlatformInfo.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class BS_ED_EXPORT PlatformInfoRTTI : public RTTIType <PlatformInfo, IReflectable, PlatformInfoRTTI>
+	{
+	private:
+		WString& getDefines(PlatformInfo* obj) { return obj->defines; }
+		void setDefines(PlatformInfo* obj, WString& val) { obj->defines = val; }
+
+		PlatformType& getType(PlatformInfo* obj) { return obj->type; }
+		void setType(PlatformInfo* obj, PlatformType& val) { obj->type = val; }
+
+		WeakResourceHandle<Prefab>& getMainScene(PlatformInfo* obj) { return obj->mainScene; }
+		void setMainScene(PlatformInfo* obj, WeakResourceHandle<Prefab>& val) { obj->mainScene = val; }
+
+		bool& getFullscreen(PlatformInfo* obj) { return obj->fullscreen; }
+		void setFullscreen(PlatformInfo* obj, bool& val) { obj->fullscreen = val; }
+
+		UINT32& getWindowedWidth(PlatformInfo* obj) { return obj->windowedWidth; }
+		void setWindowedWidth(PlatformInfo* obj, UINT32& val) { obj->windowedWidth = val; }
+
+		UINT32& getWindowedHeight(PlatformInfo* obj) { return obj->windowedHeight; }
+		void setWindowedHeight(PlatformInfo* obj, UINT32& val) { obj->windowedHeight = val; }
+
+		bool& getDebug(PlatformInfo* obj) { return obj->debug; }
+		void setDebug(PlatformInfo* obj, bool& val) { obj->debug = val; }
+
+	public:
+		PlatformInfoRTTI()
+		{
+			addPlainField("defines", 0, &PlatformInfoRTTI::getDefines, &PlatformInfoRTTI::setDefines);
+			addPlainField("type", 1, &PlatformInfoRTTI::getType, &PlatformInfoRTTI::setType);
+			addReflectableField("mainScene", 2, &PlatformInfoRTTI::getMainScene, &PlatformInfoRTTI::setMainScene);
+			addPlainField("fullscreen", 3, &PlatformInfoRTTI::getFullscreen, &PlatformInfoRTTI::setFullscreen);
+			addPlainField("windowedWidth", 4, &PlatformInfoRTTI::getWindowedWidth, &PlatformInfoRTTI::setWindowedWidth);
+			addPlainField("windowedHeight", 5, &PlatformInfoRTTI::getWindowedHeight, &PlatformInfoRTTI::setWindowedHeight);
+			addPlainField("debug", 6, &PlatformInfoRTTI::getDebug, &PlatformInfoRTTI::setDebug);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "PlatformInfo";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_PlatformInfo;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<PlatformInfo>();
+		}
+	};
+
+	class BS_ED_EXPORT WinPlatformInfoRTTI : public RTTIType <WinPlatformInfo, PlatformInfo, WinPlatformInfoRTTI>
+	{
+	private:
+		WeakResourceHandle<Texture>& getIcon(WinPlatformInfo* obj) { return obj->icon; }
+		void setIcon(WinPlatformInfo* obj, WeakResourceHandle<Texture>& val) { obj->icon = val; }
+
+		WString& getTitlebarText(WinPlatformInfo* obj) { return obj->titlebarText; }
+		void setTitlebarText(WinPlatformInfo* obj, WString& val) { obj->titlebarText = val; }
+
+	public:
+		WinPlatformInfoRTTI()
+		{
+			addReflectableField("icon", 9, &WinPlatformInfoRTTI::getIcon, &WinPlatformInfoRTTI::setIcon);
+			addPlainField("titlebarText", 10, &WinPlatformInfoRTTI::getTitlebarText, &WinPlatformInfoRTTI::setTitlebarText);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "WinPlatformInfo";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_WinPlatformInfo;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<WinPlatformInfo>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsProjectLibraryEntries.h

@@ -8,8 +8,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup Library
+	/** @addtogroup Library-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -52,5 +51,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 204 - 204
Source/BansheeEditor/Include/BsProjectLibraryEntriesRTTI.h

@@ -1,205 +1,205 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsProjectLibraryEntries.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class ProjectLibraryEntriesRTTI : public RTTIType<ProjectLibraryEntries, IReflectable, ProjectLibraryEntriesRTTI>
-	{
-	private:
-		ProjectLibrary::DirectoryEntry& getRootElement(ProjectLibraryEntries* obj) { return obj->mRootEntry; }
-		void setRootElement(ProjectLibraryEntries* obj, ProjectLibrary::DirectoryEntry& val) { obj->mRootEntry = val; } 
-
-	public:
-		ProjectLibraryEntriesRTTI()
-		{
-			addPlainField("mRootElement", 0, &ProjectLibraryEntriesRTTI::getRootElement, &ProjectLibraryEntriesRTTI::setRootElement);
-		}
-
-		virtual const String& getRTTIName()
-		{
-			static String name = "ProjectLibraryEntries";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId()
-		{
-			return TID_ProjectLibraryEntries;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject()
-		{
-			return ProjectLibraryEntries::createEmpty();
-		}
-	};
-
-	template<> struct RTTIPlainType<BansheeEngine::ProjectLibrary::FileEntry>
-	{	
-		enum { id = BansheeEngine::TID_ProjectLibraryResEntry }; enum { hasDynamicSize = 1 };
-
-		static void toMemory(const BansheeEngine::ProjectLibrary::FileEntry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			char* memoryStart = memory;
-			memory += sizeof(UINT32);
-			size += sizeof(UINT32);
-
-			UINT32 type = (UINT32)data.type;
-			memory = rttiWriteElem(type, memory, size);
-			memory = rttiWriteElem(data.path, memory, size);
-			memory = rttiWriteElem(data.elementName, memory, size);
-			memory = rttiWriteElem(data.lastUpdateTime, memory, size);
-
-			memcpy(memoryStart, &size, sizeof(UINT32));
-		}
-
-		static UINT32 fromMemory(BansheeEngine::ProjectLibrary::FileEntry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			memcpy(&size, memory, sizeof(UINT32));
-			memory += sizeof(UINT32);
-
-			UINT32 type;
-			memory = rttiReadElem(type, memory);
-			data.type = (BansheeEngine::ProjectLibrary::LibraryEntryType)type;
-
-			memory = rttiReadElem(data.path, memory);
-			memory = rttiReadElem(data.elementName, memory);
-			memory = rttiReadElem(data.lastUpdateTime, memory);
-
-			return size;
-		}
-
-		static UINT32 getDynamicSize(const BansheeEngine::ProjectLibrary::FileEntry& data)	
-		{ 
-			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.type) + rttiGetElemSize(data.path) + rttiGetElemSize(data.elementName) +
-				rttiGetElemSize(data.lastUpdateTime);
-
-#if BS_DEBUG_MODE
-			if(dataSize > std::numeric_limits<UINT32>::max())
-			{
-				__string_throwDataOverflowException();
-			}
-#endif
-
-			return (UINT32)dataSize;
-		}	
-	}; 
-
-	template<> struct RTTIPlainType<BansheeEngine::ProjectLibrary::DirectoryEntry>
-	{	
-		enum { id = BansheeEngine::TID_ProjectLibraryDirEntry }; enum { hasDynamicSize = 1 };
-
-		static void toMemory(const BansheeEngine::ProjectLibrary::DirectoryEntry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			char* memoryStart = memory;
-			memory += sizeof(UINT32);
-			size += sizeof(UINT32);
-
-			memory = rttiWriteElem(data.type, memory, size);
-			memory = rttiWriteElem(data.path, memory, size);
-			memory = rttiWriteElem(data.elementName, memory, size);
-
-			UINT32 numChildren = (UINT32)data.mChildren.size();
-			memory = rttiWriteElem(numChildren, memory, size);
-
-			for(auto& child : data.mChildren)
-			{
-				if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::File)
-				{
-					BansheeEngine::ProjectLibrary::FileEntry* childResEntry = static_cast<BansheeEngine::ProjectLibrary::FileEntry*>(child);
-					memory = rttiWriteElem(*childResEntry, memory, size);
-				}
-				else if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::Directory)
-				{
-					BansheeEngine::ProjectLibrary::DirectoryEntry* childDirEntry = static_cast<BansheeEngine::ProjectLibrary::DirectoryEntry*>(child);
-					memory = rttiWriteElem(*childDirEntry, memory, size);
-				}
-			}
-
-			memcpy(memoryStart, &size, sizeof(UINT32));
-		}
-
-		static UINT32 fromMemory(BansheeEngine::ProjectLibrary::DirectoryEntry& data, char* memory)
-		{ 
-			UINT32 size = 0;
-			memcpy(&size, memory, sizeof(UINT32));
-			memory += sizeof(UINT32);
-
-			memory = rttiReadElem(data.type, memory);
-			memory = rttiReadElem(data.path, memory);
-			memory = rttiReadElem(data.elementName, memory);
-
-			UINT32 numChildren = 0;
-			memory = rttiReadElem(numChildren, memory);
-
-			for(UINT32 i = 0; i < numChildren; i++)
-			{
-				BansheeEngine::ProjectLibrary::LibraryEntryType childType = BansheeEngine::ProjectLibrary::LibraryEntryType::File;
-				rttiReadElem(childType, memory + sizeof(UINT32)); // Skip ahead to get type
-
-				if(childType == BansheeEngine::ProjectLibrary::LibraryEntryType::File)
-				{
-					BansheeEngine::ProjectLibrary::FileEntry* childResEntry = bs_new<BansheeEngine::ProjectLibrary::FileEntry>(); // Note: Assumes that ProjectLibrary takes care of the cleanup
-					memory = rttiReadElem(*childResEntry, memory);
-
-					childResEntry->parent = &data;
-					data.mChildren.push_back(childResEntry);
-				}
-				else if(childType == BansheeEngine::ProjectLibrary::LibraryEntryType::Directory)
-				{
-					BansheeEngine::ProjectLibrary::DirectoryEntry* childDirEntry = bs_new<BansheeEngine::ProjectLibrary::DirectoryEntry>(); // Note: Assumes that ProjectLibrary takes care of the cleanup
-					memory = rttiReadElem(*childDirEntry, memory);
-
-					childDirEntry->parent = &data;
-					data.mChildren.push_back(childDirEntry);
-				}
-			}
-
-			return size;
-		}
-
-		static UINT32 getDynamicSize(const BansheeEngine::ProjectLibrary::DirectoryEntry& data)	
-		{ 
-			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.type) + rttiGetElemSize(data.path) + rttiGetElemSize(data.elementName);
-
-			dataSize += sizeof(UINT32);
-
-			for(auto& child : data.mChildren)
-			{
-				if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::File)
-				{
-					BansheeEngine::ProjectLibrary::FileEntry* childResEntry = static_cast<BansheeEngine::ProjectLibrary::FileEntry*>(child);
-					dataSize += rttiGetElemSize(*childResEntry);
-				}
-				else if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::Directory)
-				{
-					BansheeEngine::ProjectLibrary::DirectoryEntry* childDirEntry = static_cast<BansheeEngine::ProjectLibrary::DirectoryEntry*>(child);
-					dataSize += rttiGetElemSize(*childDirEntry);
-				}
-			}
-
-#if BS_DEBUG_MODE
-			if(dataSize > std::numeric_limits<UINT32>::max())
-			{
-				__string_throwDataOverflowException();
-			}
-#endif
-
-			return (UINT32)dataSize;
-		}	
-	}; 
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsProjectLibraryEntries.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class ProjectLibraryEntriesRTTI : public RTTIType<ProjectLibraryEntries, IReflectable, ProjectLibraryEntriesRTTI>
+	{
+	private:
+		ProjectLibrary::DirectoryEntry& getRootElement(ProjectLibraryEntries* obj) { return obj->mRootEntry; }
+		void setRootElement(ProjectLibraryEntries* obj, ProjectLibrary::DirectoryEntry& val) { obj->mRootEntry = val; } 
+
+	public:
+		ProjectLibraryEntriesRTTI()
+		{
+			addPlainField("mRootElement", 0, &ProjectLibraryEntriesRTTI::getRootElement, &ProjectLibraryEntriesRTTI::setRootElement);
+		}
+
+		virtual const String& getRTTIName()
+		{
+			static String name = "ProjectLibraryEntries";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId()
+		{
+			return TID_ProjectLibraryEntries;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject()
+		{
+			return ProjectLibraryEntries::createEmpty();
+		}
+	};
+
+	template<> struct RTTIPlainType<BansheeEngine::ProjectLibrary::FileEntry>
+	{	
+		enum { id = BansheeEngine::TID_ProjectLibraryResEntry }; enum { hasDynamicSize = 1 };
+
+		static void toMemory(const BansheeEngine::ProjectLibrary::FileEntry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			char* memoryStart = memory;
+			memory += sizeof(UINT32);
+			size += sizeof(UINT32);
+
+			UINT32 type = (UINT32)data.type;
+			memory = rttiWriteElem(type, memory, size);
+			memory = rttiWriteElem(data.path, memory, size);
+			memory = rttiWriteElem(data.elementName, memory, size);
+			memory = rttiWriteElem(data.lastUpdateTime, memory, size);
+
+			memcpy(memoryStart, &size, sizeof(UINT32));
+		}
+
+		static UINT32 fromMemory(BansheeEngine::ProjectLibrary::FileEntry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			memcpy(&size, memory, sizeof(UINT32));
+			memory += sizeof(UINT32);
+
+			UINT32 type;
+			memory = rttiReadElem(type, memory);
+			data.type = (BansheeEngine::ProjectLibrary::LibraryEntryType)type;
+
+			memory = rttiReadElem(data.path, memory);
+			memory = rttiReadElem(data.elementName, memory);
+			memory = rttiReadElem(data.lastUpdateTime, memory);
+
+			return size;
+		}
+
+		static UINT32 getDynamicSize(const BansheeEngine::ProjectLibrary::FileEntry& data)	
+		{ 
+			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.type) + rttiGetElemSize(data.path) + rttiGetElemSize(data.elementName) +
+				rttiGetElemSize(data.lastUpdateTime);
+
+#if BS_DEBUG_MODE
+			if(dataSize > std::numeric_limits<UINT32>::max())
+			{
+				__string_throwDataOverflowException();
+			}
+#endif
+
+			return (UINT32)dataSize;
+		}	
+	}; 
+
+	template<> struct RTTIPlainType<BansheeEngine::ProjectLibrary::DirectoryEntry>
+	{	
+		enum { id = BansheeEngine::TID_ProjectLibraryDirEntry }; enum { hasDynamicSize = 1 };
+
+		static void toMemory(const BansheeEngine::ProjectLibrary::DirectoryEntry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			char* memoryStart = memory;
+			memory += sizeof(UINT32);
+			size += sizeof(UINT32);
+
+			memory = rttiWriteElem(data.type, memory, size);
+			memory = rttiWriteElem(data.path, memory, size);
+			memory = rttiWriteElem(data.elementName, memory, size);
+
+			UINT32 numChildren = (UINT32)data.mChildren.size();
+			memory = rttiWriteElem(numChildren, memory, size);
+
+			for(auto& child : data.mChildren)
+			{
+				if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::File)
+				{
+					BansheeEngine::ProjectLibrary::FileEntry* childResEntry = static_cast<BansheeEngine::ProjectLibrary::FileEntry*>(child);
+					memory = rttiWriteElem(*childResEntry, memory, size);
+				}
+				else if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::Directory)
+				{
+					BansheeEngine::ProjectLibrary::DirectoryEntry* childDirEntry = static_cast<BansheeEngine::ProjectLibrary::DirectoryEntry*>(child);
+					memory = rttiWriteElem(*childDirEntry, memory, size);
+				}
+			}
+
+			memcpy(memoryStart, &size, sizeof(UINT32));
+		}
+
+		static UINT32 fromMemory(BansheeEngine::ProjectLibrary::DirectoryEntry& data, char* memory)
+		{ 
+			UINT32 size = 0;
+			memcpy(&size, memory, sizeof(UINT32));
+			memory += sizeof(UINT32);
+
+			memory = rttiReadElem(data.type, memory);
+			memory = rttiReadElem(data.path, memory);
+			memory = rttiReadElem(data.elementName, memory);
+
+			UINT32 numChildren = 0;
+			memory = rttiReadElem(numChildren, memory);
+
+			for(UINT32 i = 0; i < numChildren; i++)
+			{
+				BansheeEngine::ProjectLibrary::LibraryEntryType childType = BansheeEngine::ProjectLibrary::LibraryEntryType::File;
+				rttiReadElem(childType, memory + sizeof(UINT32)); // Skip ahead to get type
+
+				if(childType == BansheeEngine::ProjectLibrary::LibraryEntryType::File)
+				{
+					BansheeEngine::ProjectLibrary::FileEntry* childResEntry = bs_new<BansheeEngine::ProjectLibrary::FileEntry>(); // Note: Assumes that ProjectLibrary takes care of the cleanup
+					memory = rttiReadElem(*childResEntry, memory);
+
+					childResEntry->parent = &data;
+					data.mChildren.push_back(childResEntry);
+				}
+				else if(childType == BansheeEngine::ProjectLibrary::LibraryEntryType::Directory)
+				{
+					BansheeEngine::ProjectLibrary::DirectoryEntry* childDirEntry = bs_new<BansheeEngine::ProjectLibrary::DirectoryEntry>(); // Note: Assumes that ProjectLibrary takes care of the cleanup
+					memory = rttiReadElem(*childDirEntry, memory);
+
+					childDirEntry->parent = &data;
+					data.mChildren.push_back(childDirEntry);
+				}
+			}
+
+			return size;
+		}
+
+		static UINT32 getDynamicSize(const BansheeEngine::ProjectLibrary::DirectoryEntry& data)	
+		{ 
+			UINT64 dataSize = sizeof(UINT32) + rttiGetElemSize(data.type) + rttiGetElemSize(data.path) + rttiGetElemSize(data.elementName);
+
+			dataSize += sizeof(UINT32);
+
+			for(auto& child : data.mChildren)
+			{
+				if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::File)
+				{
+					BansheeEngine::ProjectLibrary::FileEntry* childResEntry = static_cast<BansheeEngine::ProjectLibrary::FileEntry*>(child);
+					dataSize += rttiGetElemSize(*childResEntry);
+				}
+				else if(child->type == BansheeEngine::ProjectLibrary::LibraryEntryType::Directory)
+				{
+					BansheeEngine::ProjectLibrary::DirectoryEntry* childDirEntry = static_cast<BansheeEngine::ProjectLibrary::DirectoryEntry*>(child);
+					dataSize += rttiGetElemSize(*childDirEntry);
+				}
+			}
+
+#if BS_DEBUG_MODE
+			if(dataSize > std::numeric_limits<UINT32>::max())
+			{
+				__string_throwDataOverflowException();
+			}
+#endif
+
+			return (UINT32)dataSize;
+		}	
+	}; 
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 85 - 85
Source/BansheeEditor/Include/BsProjectResourceMetaRTTI.h

@@ -1,86 +1,86 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsProjectResourceMeta.h"
-#include "BsResourceMetaData.h"
-#include "BsImportOptions.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class ProjectResourceMetaRTTI : public RTTIType<ProjectResourceMeta, IReflectable, ProjectResourceMetaRTTI>
-	{
-	private:
-		BS_PLAIN_MEMBER(mName)
-		BS_PLAIN_MEMBER(mUUID)
-		BS_PLAIN_MEMBER(mTypeId)
-		BS_REFLPTR_MEMBER(mResourceMeta)
-			
-	public:
-		ProjectResourceMetaRTTI()
-		{
-			BS_ADD_PLAIN_FIELD(mName, 0);
-			BS_ADD_PLAIN_FIELD(mUUID, 1);
-			BS_ADD_PLAIN_FIELD(mTypeId, 2);
-			BS_ADD_REFLPTR_FIELD(mResourceMeta, 3);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "ProjectResourceMeta";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_ProjectResourceMeta;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return ProjectResourceMeta::createEmpty();
-		}
-	};
-
-	class ProjectFileMetaRTTI : public RTTIType<ProjectFileMeta, IReflectable, ProjectFileMetaRTTI>
-	{
-	private:
-		BS_REFLPTR_MEMBER(mImportOptions)
-		BS_PLAIN_MEMBER(mIncludeInBuild)
-		BS_REFLPTR_MEMBER_VEC(mResourceMetaData)
-
-	public:
-		ProjectFileMetaRTTI()
-		{
-			BS_ADD_REFLPTR_FIELD(mImportOptions, 1);
-			BS_ADD_PLAIN_FIELD(mIncludeInBuild, 4);
-			BS_ADD_REFLPTR_FIELD_ARR(mResourceMetaData, 5);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "ProjectFileMeta";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_ProjectFileMeta;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return ProjectFileMeta::createEmpty();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsProjectResourceMeta.h"
+#include "BsResourceMetaData.h"
+#include "BsImportOptions.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class ProjectResourceMetaRTTI : public RTTIType<ProjectResourceMeta, IReflectable, ProjectResourceMetaRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mName)
+		BS_PLAIN_MEMBER(mUUID)
+		BS_PLAIN_MEMBER(mTypeId)
+		BS_REFLPTR_MEMBER(mResourceMeta)
+			
+	public:
+		ProjectResourceMetaRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mName, 0);
+			BS_ADD_PLAIN_FIELD(mUUID, 1);
+			BS_ADD_PLAIN_FIELD(mTypeId, 2);
+			BS_ADD_REFLPTR_FIELD(mResourceMeta, 3);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ProjectResourceMeta";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ProjectResourceMeta;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			return ProjectResourceMeta::createEmpty();
+		}
+	};
+
+	class ProjectFileMetaRTTI : public RTTIType<ProjectFileMeta, IReflectable, ProjectFileMetaRTTI>
+	{
+	private:
+		BS_REFLPTR_MEMBER(mImportOptions)
+		BS_PLAIN_MEMBER(mIncludeInBuild)
+		BS_REFLPTR_MEMBER_VEC(mResourceMetaData)
+
+	public:
+		ProjectFileMetaRTTI()
+		{
+			BS_ADD_REFLPTR_FIELD(mImportOptions, 1);
+			BS_ADD_PLAIN_FIELD(mIncludeInBuild, 4);
+			BS_ADD_REFLPTR_FIELD_ARR(mResourceMetaData, 5);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ProjectFileMeta";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ProjectFileMeta;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			return ProjectFileMeta::createEmpty();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 45 - 45
Source/BansheeEditor/Include/BsProjectSettingsRTTI.h

@@ -1,46 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsProjectSettings.h"
-#include "BsRTTIType.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class ProjectSettingsRTTI : public RTTIType <ProjectSettings, Settings, ProjectSettingsRTTI>
-	{
-	private:
-		BS_PLAIN_MEMBER(mLastOpenScene);
-
-	public:
-		ProjectSettingsRTTI()
-		{
-			BS_ADD_PLAIN_FIELD(mLastOpenScene, 0);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "ProjectSettings";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_ProjectSettings;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ProjectSettings>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsProjectSettings.h"
+#include "BsRTTIType.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class ProjectSettingsRTTI : public RTTIType <ProjectSettings, Settings, ProjectSettingsRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mLastOpenScene);
+
+	public:
+		ProjectSettingsRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mLastOpenScene, 0);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ProjectSettings";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ProjectSettings;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ProjectSettings>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEditor/Include/BsSceneGrid.h

@@ -9,8 +9,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup Scene-Editor
+	/** @addtogroup Scene-Editor-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -136,5 +135,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 142 - 140
Source/BansheeEditor/Include/BsScenePicking.h

@@ -1,141 +1,143 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsModule.h"
-#include "BsMatrix4.h"
-#include "BsGpuParam.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup Scene-Editor
-	 *  @{
-	 */
-
-	class ScenePickingCore;
-
-	/**	Handles picking of scene objects with a pointer in scene view. */
-	class BS_ED_EXPORT ScenePicking : public Module<ScenePicking>
-	{
-		/**	Contains information about a single pickable item (mesh). */
-		struct RenderablePickData
-		{
-			SPtr<MeshCore> mesh;
-			UINT32 index;
-			Matrix4 wvpTransform;
-			bool alpha;
-			CullingMode cullMode;
-			HTexture mainTexture;
-		};
-
-	public:
-		ScenePicking();
-		~ScenePicking();
-
-		/**
-		 * Attempts to find a single nearest scene object under the provided position and area.
-		 *
-		 * @param[in]	cam			Camera to perform the picking from.
-		 * @param[in]	position	Pointer position relative to the camera viewport, in pixels.
-		 * @param[in]	area		Width/height of the checked area in pixels. Use (1, 1) if you want the exact position
-		 *							under the pointer.
-		 * @return					Nearest SceneObject under the provided area, or an empty handle if no object is found.
-		 */
-		HSceneObject pickClosestObject(const CameraPtr& cam, const Vector2I& position, const Vector2I& area);
-
-		/**
-		 * Attempts to find all scene objects under the provided position and area. This does not mean objects occluded by
-		 * other objects.
-		 *
-		 * @param[in]	cam			Camera to perform the picking from.
-		 * @param[in]	position	Pointer position relative to the camera viewport, in pixels.
-		 * @param[in]	area		Width/height of the checked area in pixels. Use (1, 1) if you want the exact position
-		 *							under the pointer.
-		 * @return					A list of SceneObject%s under the provided area.
-		 */
-		Vector<HSceneObject> pickObjects(const CameraPtr& cam, const Vector2I& position, const Vector2I& area);
-
-	private:
-		friend class ScenePickingCore;
-
-		typedef Set<RenderablePickData, std::function<bool(const RenderablePickData&, const RenderablePickData&)>> RenderableSet;
-
-		/**	Encodes a pickable object identifier to a unique color. */
-		static Color encodeIndex(UINT32 index);
-
-		/** Decodes a color into a unique object identifier. Color should have initially been encoded with encodeIndex(). */
-		static UINT32 decodeIndex(Color color);
-
-		ScenePickingCore* mCore;
-	};
-
-	/** @cond INTERNAL */
-
-	/** Core thread version of the ScenePicking manager. Handles actual rendering. */
-	class ScenePickingCore
-	{
-		/** A list of materials and their parameters to be used for rendering of pickable objects. */
-		struct MaterialData
-		{
-			SPtr<MaterialCore> mMatPickingCore;
-			SPtr<MaterialCore> mMatPickingAlphaCore;
-
-			SPtr<GpuParamsCore> mParamPickingVertParams;
-			SPtr<GpuParamsCore> mParamPickingFragParams;
-			SPtr<GpuParamsCore> mParamPickingAlphaVertParams;
-			SPtr<GpuParamsCore> mParamPickingAlphaFragParams;
-
-			GpuParamMat4Core mParamPickingWVP;
-			GpuParamMat4Core mParamPickingAlphaWVP;
-			GpuParamColorCore mParamPickingColor;
-			GpuParamColorCore mParamPickingAlphaColor;
-			GpuParamTextureCore mParamPickingAlphaTexture;
-		};
-
-	public:
-		/**	Initializes the manager. Must be called right after construction. */
-		void initialize();
-
-		/**	Destroys the manager. Must be called right before destruction. */
-		void destroy();
-
-		/**
-		 * Sets up the viewport, materials and their parameters as needed for picking. Also renders all the provided
-		 * renderable objects. Must be followed by corePickingEnd(). You may call other methods after this one, but you must
-		 * ensure they render proper unique pickable colors that can be resolved to SceneObject%s later.
-		 *
-		 * @param[in]	target			Render target to render to.
-		 * @param[in]	viewportArea	Normalized area of the render target to render in.
-		 * @param[in]	renderables		A set of pickable Renderable objects to render.
-		 * @param[in]	position		Position of the pointer where to pick objects, in pixels relative to viewport.
-		 * @param[in]	area			Width/height of the area to pick objects, in pixels.
-		 */
-		void corePickingBegin(const SPtr<RenderTargetCore>& target, const Rect2& viewportArea, 
-			const ScenePicking::RenderableSet& renderables, const Vector2I& position, const Vector2I& area);
-		
-		/**
-		 * Ends picking operation started by ::corePickingBegin. Render target is resolved and objects in the picked area
-		 * are returned.
-		 *
-		 * @param[in]	target			Render target we're rendering to.
-		 * @param[in]	viewportArea	Normalized area of the render target we're rendering in.
-		 * @param[in]	position		Position of the pointer where to pick objects, in pixels relative to viewport.
-		 * @param[in]	area			Width/height of the area to pick objects, in pixels.
-		 * @param[out]	asyncOp			Async operation handle that when complete will contain the results of the picking
-		 *								operation in the form of Vector<SelectedObject>.
-		 */
-		void corePickingEnd(const SPtr<RenderTargetCore>& target, const Rect2& viewportArea, const Vector2I& position,
-			const Vector2I& area, AsyncOp& asyncOp);
-
-	private:
-		friend class ScenePicking;
-
-		static const float ALPHA_CUTOFF;
-
-		MaterialData mMaterialData[3];
-	};
-
-	/** @endcond */
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsModule.h"
+#include "BsMatrix4.h"
+#include "BsGpuParam.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Scene-Editor
+	 *  @{
+	 */
+
+	class ScenePickingCore;
+
+	/**	Handles picking of scene objects with a pointer in scene view. */
+	class BS_ED_EXPORT ScenePicking : public Module<ScenePicking>
+	{
+		/**	Contains information about a single pickable item (mesh). */
+		struct RenderablePickData
+		{
+			SPtr<MeshCore> mesh;
+			UINT32 index;
+			Matrix4 wvpTransform;
+			bool alpha;
+			CullingMode cullMode;
+			HTexture mainTexture;
+		};
+
+	public:
+		ScenePicking();
+		~ScenePicking();
+
+		/**
+		 * Attempts to find a single nearest scene object under the provided position and area.
+		 *
+		 * @param[in]	cam			Camera to perform the picking from.
+		 * @param[in]	position	Pointer position relative to the camera viewport, in pixels.
+		 * @param[in]	area		Width/height of the checked area in pixels. Use (1, 1) if you want the exact position
+		 *							under the pointer.
+		 * @return					Nearest SceneObject under the provided area, or an empty handle if no object is found.
+		 */
+		HSceneObject pickClosestObject(const CameraPtr& cam, const Vector2I& position, const Vector2I& area);
+
+		/**
+		 * Attempts to find all scene objects under the provided position and area. This does not mean objects occluded by
+		 * other objects.
+		 *
+		 * @param[in]	cam			Camera to perform the picking from.
+		 * @param[in]	position	Pointer position relative to the camera viewport, in pixels.
+		 * @param[in]	area		Width/height of the checked area in pixels. Use (1, 1) if you want the exact position
+		 *							under the pointer.
+		 * @return					A list of SceneObject%s under the provided area.
+		 */
+		Vector<HSceneObject> pickObjects(const CameraPtr& cam, const Vector2I& position, const Vector2I& area);
+
+	private:
+		friend class ScenePickingCore;
+
+		typedef Set<RenderablePickData, std::function<bool(const RenderablePickData&, const RenderablePickData&)>> RenderableSet;
+
+		/**	Encodes a pickable object identifier to a unique color. */
+		static Color encodeIndex(UINT32 index);
+
+		/** Decodes a color into a unique object identifier. Color should have initially been encoded with encodeIndex(). */
+		static UINT32 decodeIndex(Color color);
+
+		ScenePickingCore* mCore;
+	};
+
+	/** @} */
+	/** @addtogroup Scene-Editor-Internal
+	 *  @{
+	 */
+
+	/** Core thread version of the ScenePicking manager. Handles actual rendering. */
+	class ScenePickingCore
+	{
+		/** A list of materials and their parameters to be used for rendering of pickable objects. */
+		struct MaterialData
+		{
+			SPtr<MaterialCore> mMatPickingCore;
+			SPtr<MaterialCore> mMatPickingAlphaCore;
+
+			SPtr<GpuParamsCore> mParamPickingVertParams;
+			SPtr<GpuParamsCore> mParamPickingFragParams;
+			SPtr<GpuParamsCore> mParamPickingAlphaVertParams;
+			SPtr<GpuParamsCore> mParamPickingAlphaFragParams;
+
+			GpuParamMat4Core mParamPickingWVP;
+			GpuParamMat4Core mParamPickingAlphaWVP;
+			GpuParamColorCore mParamPickingColor;
+			GpuParamColorCore mParamPickingAlphaColor;
+			GpuParamTextureCore mParamPickingAlphaTexture;
+		};
+
+	public:
+		/**	Initializes the manager. Must be called right after construction. */
+		void initialize();
+
+		/**	Destroys the manager. Must be called right before destruction. */
+		void destroy();
+
+		/**
+		 * Sets up the viewport, materials and their parameters as needed for picking. Also renders all the provided
+		 * renderable objects. Must be followed by corePickingEnd(). You may call other methods after this one, but you must
+		 * ensure they render proper unique pickable colors that can be resolved to SceneObject%s later.
+		 *
+		 * @param[in]	target			Render target to render to.
+		 * @param[in]	viewportArea	Normalized area of the render target to render in.
+		 * @param[in]	renderables		A set of pickable Renderable objects to render.
+		 * @param[in]	position		Position of the pointer where to pick objects, in pixels relative to viewport.
+		 * @param[in]	area			Width/height of the area to pick objects, in pixels.
+		 */
+		void corePickingBegin(const SPtr<RenderTargetCore>& target, const Rect2& viewportArea, 
+			const ScenePicking::RenderableSet& renderables, const Vector2I& position, const Vector2I& area);
+		
+		/**
+		 * Ends picking operation started by ::corePickingBegin. Render target is resolved and objects in the picked area
+		 * are returned.
+		 *
+		 * @param[in]	target			Render target we're rendering to.
+		 * @param[in]	viewportArea	Normalized area of the render target we're rendering in.
+		 * @param[in]	position		Position of the pointer where to pick objects, in pixels relative to viewport.
+		 * @param[in]	area			Width/height of the area to pick objects, in pixels.
+		 * @param[out]	asyncOp			Async operation handle that when complete will contain the results of the picking
+		 *								operation in the form of Vector<SelectedObject>.
+		 */
+		void corePickingEnd(const SPtr<RenderTargetCore>& target, const Rect2& viewportArea, const Vector2I& position,
+			const Vector2I& area, AsyncOp& asyncOp);
+
+	private:
+		friend class ScenePicking;
+
+		static const float ALPHA_CUTOFF;
+
+		MaterialData mMaterialData[3];
+	};
+
+	/** @} */
 }
 }

+ 96 - 98
Source/BansheeEditor/Include/BsSelectionRenderer.h

@@ -1,99 +1,97 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsColor.h"
-#include "BsMatrix4.h"
-#include "BsGpuParam.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Scene-Editor
-	 *  @{
-	 */
-
-	class SelectionRendererCore;
-
-	/**	Handles rendering of the selected SceneObject%s overlay. */
-	class BS_ED_EXPORT SelectionRenderer
-	{
-		/**	Contains data about a selected mesh. */
-		struct ObjectData
-		{
-			SPtr<MeshCoreBase> mesh;
-			Matrix4 worldTfrm;
-		};
-
-	public:
-		SelectionRenderer();
-		~SelectionRenderer();
-
-		/** Called once per frame. Updates the overlay depending on current selection. */
-		void update(const CameraPtr& camera);
-
-	private:
-		friend class SelectionRendererCore;
-
-		/**
-		 * Initializes the core thread counterpart of the selection renderer.
-		 *
-		 * @param[in]	mat		Material used for selection rendering.
-		 */
-		void initializeCore(const SPtr<MaterialCore>& mat);
-
-		/**
-		 * Destroys the core thread counterpart of the selection renderer.
-		 *
-		 * @param[in]	core	Previously constructed core thread selection renderer instance.
-		 */
-		void destroyCore(SelectionRendererCore* core);
-
-		std::atomic<SelectionRendererCore*> mCore;
-	};
-
-	/** Core thread version of the selection renderer, that handles actual rendering. */
-	class SelectionRendererCore
-	{
-		friend class SelectionRenderer;
-		
-		struct PrivatelyConstuct { };
-
-	public:
-		SelectionRendererCore(const PrivatelyConstuct& dummy);
-		~SelectionRendererCore();
-
-	private:
-		/**
-		 * Initializes the selection renderer. Should be called right after construction.
-		 *
-		 * @param[in]	mat	Material used for selection rendering.
-		 */
-		void initialize(const SPtr<MaterialCore>& mat);
-
-		/** Triggered by the Renderer when the overlay should be rendered. */
-		void render();
-
-		/**
-		 * Updates the internal data that determines what will be rendered on the next render() call.
-		 *
-		 * @param[in]	camera		Camera to render the selection overlay in.
-		 * @param[in]	objects		A set of objects to render with the selection overlay.
-		 */
-		void updateData(const SPtr<CameraCore>& camera, const Vector<SelectionRenderer::ObjectData>& objects);
-
-		Vector<SelectionRenderer::ObjectData> mObjects;
-		SPtr<CameraCore> mCamera;
-
-		// Immutable
-		SPtr<MaterialCore> mMaterial;
-		GpuParamMat4Core mMatWorldViewProj;
-		GpuParamColorCore mColor;
-
-		static const Color SELECTION_COLOR;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsColor.h"
+#include "BsMatrix4.h"
+#include "BsGpuParam.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Scene-Editor-Internal
+	 *  @{
+	 */
+
+	class SelectionRendererCore;
+
+	/**	Handles rendering of the selected SceneObject%s overlay. */
+	class BS_ED_EXPORT SelectionRenderer
+	{
+		/**	Contains data about a selected mesh. */
+		struct ObjectData
+		{
+			SPtr<MeshCoreBase> mesh;
+			Matrix4 worldTfrm;
+		};
+
+	public:
+		SelectionRenderer();
+		~SelectionRenderer();
+
+		/** Called once per frame. Updates the overlay depending on current selection. */
+		void update(const CameraPtr& camera);
+
+	private:
+		friend class SelectionRendererCore;
+
+		/**
+		 * Initializes the core thread counterpart of the selection renderer.
+		 *
+		 * @param[in]	mat		Material used for selection rendering.
+		 */
+		void initializeCore(const SPtr<MaterialCore>& mat);
+
+		/**
+		 * Destroys the core thread counterpart of the selection renderer.
+		 *
+		 * @param[in]	core	Previously constructed core thread selection renderer instance.
+		 */
+		void destroyCore(SelectionRendererCore* core);
+
+		std::atomic<SelectionRendererCore*> mCore;
+	};
+
+	/** Core thread version of the selection renderer, that handles actual rendering. */
+	class SelectionRendererCore
+	{
+		friend class SelectionRenderer;
+		
+		struct PrivatelyConstuct { };
+
+	public:
+		SelectionRendererCore(const PrivatelyConstuct& dummy);
+		~SelectionRendererCore();
+
+	private:
+		/**
+		 * Initializes the selection renderer. Should be called right after construction.
+		 *
+		 * @param[in]	mat	Material used for selection rendering.
+		 */
+		void initialize(const SPtr<MaterialCore>& mat);
+
+		/** Triggered by the Renderer when the overlay should be rendered. */
+		void render();
+
+		/**
+		 * Updates the internal data that determines what will be rendered on the next render() call.
+		 *
+		 * @param[in]	camera		Camera to render the selection overlay in.
+		 * @param[in]	objects		A set of objects to render with the selection overlay.
+		 */
+		void updateData(const SPtr<CameraCore>& camera, const Vector<SelectionRenderer::ObjectData>& objects);
+
+		Vector<SelectionRenderer::ObjectData> mObjects;
+		SPtr<CameraCore> mCamera;
+
+		// Immutable
+		SPtr<MaterialCore> mMaterial;
+		GpuParamMat4Core mMatWorldViewProj;
+		GpuParamColorCore mColor;
+
+		static const Color SELECTION_COLOR;
+	};
+
+	/** @} */
 }
 }

+ 51 - 51
Source/BansheeEditor/Include/BsSettingsRTTI.h

@@ -1,52 +1,52 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsSettings.h"
-#include "BsRTTIType.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Editor
-	 *  @{
-	 */
-
-	class SettingsRTTI : public RTTIType <Settings, IReflectable, SettingsRTTI>
-	{
-	private:
-		BS_PLAIN_MEMBER(mFloatProperties);
-		BS_PLAIN_MEMBER(mIntProperties);
-		BS_PLAIN_MEMBER(mBoolProperties);
-		BS_PLAIN_MEMBER(mStringProperties);
-
-	public:
-		SettingsRTTI()
-		{
-			BS_ADD_PLAIN_FIELD(mFloatProperties, 13);
-			BS_ADD_PLAIN_FIELD(mIntProperties, 14);
-			BS_ADD_PLAIN_FIELD(mBoolProperties, 15);
-			BS_ADD_PLAIN_FIELD(mStringProperties, 16);
-		}
-
-		virtual const String& getRTTIName() override
-		{
-			static String name = "Settings";
-			return name;
-		}
-
-		virtual UINT32 getRTTIId() override
-		{
-			return TID_Settings;
-		}
-
-		virtual std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<Settings>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsSettings.h"
+#include "BsRTTIType.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Editor
+	 *  @{
+	 */
+
+	class SettingsRTTI : public RTTIType <Settings, IReflectable, SettingsRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mFloatProperties);
+		BS_PLAIN_MEMBER(mIntProperties);
+		BS_PLAIN_MEMBER(mBoolProperties);
+		BS_PLAIN_MEMBER(mStringProperties);
+
+	public:
+		SettingsRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mFloatProperties, 13);
+			BS_ADD_PLAIN_FIELD(mIntProperties, 14);
+			BS_ADD_PLAIN_FIELD(mBoolProperties, 15);
+			BS_ADD_PLAIN_FIELD(mStringProperties, 16);
+		}
+
+		virtual const String& getRTTIName() override
+		{
+			static String name = "Settings";
+			return name;
+		}
+
+		virtual UINT32 getRTTIId() override
+		{
+			return TID_Settings;
+		}
+
+		virtual std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<Settings>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 71 - 73
Source/BansheeEditor/Include/Win32/BsVSCodeEditor.h

@@ -1,74 +1,72 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsCodeEditor.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup CodeEditor
-	 *  @{
-	 */
-
-	/** Recognized types of Microsoft Visual Studio versions recognized by VSCodeEditor. */
-	enum class VisualStudioVersion
-	{
-		VS2008,
-		VS2010,
-		VS2012,
-		VS2013,
-		VS2015
-	};
-
-	/**	Code editor implementation that handles interacting with Microsoft Visual Studio. */
-	class BS_ED_EXPORT VSCodeEditor : public CodeEditor
-	{
-	public:
-		VSCodeEditor(VisualStudioVersion version, const Path& execPath, const WString& CLSID);
-
-		/** @copydoc CodeEditor::openFile */
-		void openFile(const Path& solutionPath, const Path& filePath, UINT32 lineNumber) const override;
-
-		/** @copydoc CodeEditor::syncSolution */
-		void syncSolution(const CodeSolutionData& data, const Path& outputPath) const override;
-
-	private:
-		VisualStudioVersion mVersion;
-		Path mExecPath;
-		WString mCLSID;
-	};
-
-	/** Code editor factory used for creating specific instances of the Visual Studio code editor object. */
-	class BS_ED_EXPORT VSCodeEditorFactory : public CodeEditorFactory
-	{
-	public:
-		VSCodeEditorFactory();
-
-		/** @copydoc CodeEditorFactory::getAvailableEditors */
-		const Vector<CodeEditorType>& getAvailableEditors() const override { return mAvailableEditors; }
-
-		/** @copydoc CodeEditorFactory::create */
-		CodeEditor* create(CodeEditorType editor) const override;
-
-	private:
-		/**	Contains detailed information about a specific Visual Studio version. */
-		struct VSVersionInfo
-		{
-			WString name;
-			Path execPath;
-			WString CLSID;
-			VisualStudioVersion version;
-		};
-
-		/**	Returns a list of Visual Studio versions installed on this machine. */
-		Map<CodeEditorType, VSVersionInfo> getAvailableVersions() const;
-
-		Map<CodeEditorType, VSVersionInfo> mAvailableVersions;
-		Vector<CodeEditorType> mAvailableEditors;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsCodeEditor.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup CodeEditor-Internal
+	 *  @{
+	 */
+
+	/** Recognized types of Microsoft Visual Studio versions recognized by VSCodeEditor. */
+	enum class VisualStudioVersion
+	{
+		VS2008,
+		VS2010,
+		VS2012,
+		VS2013,
+		VS2015
+	};
+
+	/**	Code editor implementation that handles interacting with Microsoft Visual Studio. */
+	class BS_ED_EXPORT VSCodeEditor : public CodeEditor
+	{
+	public:
+		VSCodeEditor(VisualStudioVersion version, const Path& execPath, const WString& CLSID);
+
+		/** @copydoc CodeEditor::openFile */
+		void openFile(const Path& solutionPath, const Path& filePath, UINT32 lineNumber) const override;
+
+		/** @copydoc CodeEditor::syncSolution */
+		void syncSolution(const CodeSolutionData& data, const Path& outputPath) const override;
+
+	private:
+		VisualStudioVersion mVersion;
+		Path mExecPath;
+		WString mCLSID;
+	};
+
+	/** Code editor factory used for creating specific instances of the Visual Studio code editor object. */
+	class BS_ED_EXPORT VSCodeEditorFactory : public CodeEditorFactory
+	{
+	public:
+		VSCodeEditorFactory();
+
+		/** @copydoc CodeEditorFactory::getAvailableEditors */
+		const Vector<CodeEditorType>& getAvailableEditors() const override { return mAvailableEditors; }
+
+		/** @copydoc CodeEditorFactory::create */
+		CodeEditor* create(CodeEditorType editor) const override;
+
+	private:
+		/**	Contains detailed information about a specific Visual Studio version. */
+		struct VSVersionInfo
+		{
+			WString name;
+			Path execPath;
+			WString CLSID;
+			VisualStudioVersion version;
+		};
+
+		/**	Returns a list of Visual Studio versions installed on this machine. */
+		Map<CodeEditorType, VSVersionInfo> getAvailableVersions() const;
+
+		Map<CodeEditorType, VSVersionInfo> mAvailableVersions;
+		Vector<CodeEditorType> mAvailableEditors;
+	};
+
+	/** @} */
 }
 }

+ 4 - 2
Source/BansheeEngine/Include/BsBuiltinResources.h

@@ -305,7 +305,10 @@ namespace BansheeEngine
 		static const WString TextureNormalFile;
 		static const WString TextureNormalFile;
 	};
 	};
 
 
-	/** @cond INTERNAL */
+	/** @} */
+	/** @addtogroup Resources-Engine-Internal
+	 *  @{
+	 */
 
 
 	/**	Provides various methods commonly used for managing builtin resources. */
 	/**	Provides various methods commonly used for managing builtin resources. */
 	class BS_EXPORT BuiltinResourcesHelper
 	class BS_EXPORT BuiltinResourcesHelper
@@ -341,5 +344,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 47 - 47
Source/BansheeEngine/Include/BsCCameraRTTI.h

@@ -1,48 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsCCamera.h"
-#include "BsGameObjectRTTI.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT CCameraRTTI : public RTTIType<CCamera, Component, CCameraRTTI>
-	{
-	private:
-		CameraPtr getInternal(CCamera* obj) { return obj->mInternal; }
-		void setInternal(CCamera* obj, CameraPtr val) { obj->mInternal = val; }
-
-	public:
-		CCameraRTTI()
-		{
-			addReflectablePtrField("mInternal", 0, &CCameraRTTI::getInternal, &CCameraRTTI::setInternal);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "CCamera";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_CCamera;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<CCamera>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCCamera.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT CCameraRTTI : public RTTIType<CCamera, Component, CCameraRTTI>
+	{
+	private:
+		CameraPtr getInternal(CCamera* obj) { return obj->mInternal; }
+		void setInternal(CCamera* obj, CameraPtr val) { obj->mInternal = val; }
+
+	public:
+		CCameraRTTI()
+		{
+			addReflectablePtrField("mInternal", 0, &CCameraRTTI::getInternal, &CCameraRTTI::setInternal);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CCamera";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CCamera;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CCamera>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 43 - 43
Source/BansheeEngine/Include/BsCGUIWidgetRTTI.h

@@ -1,44 +1,44 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsCGUIWidget.h"
-#include "BsGameObjectRTTI.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT CGUIWidgetRTTI : public RTTIType <CGUIWidget, Component, CGUIWidgetRTTI>
-	{
-	private:
-
-	public:
-		CGUIWidgetRTTI()
-		{ }
-
-		const String& getRTTIName() override
-		{
-			static String name = "CGUIWidget";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_CGUIWidget;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<CGUIWidget>();
-		}
-	};
-
-	/** @} */
-	/** @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 "BsCGUIWidget.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT CGUIWidgetRTTI : public RTTIType <CGUIWidget, Component, CGUIWidgetRTTI>
+	{
+	private:
+
+	public:
+		CGUIWidgetRTTI()
+		{ }
+
+		const String& getRTTIName() override
+		{
+			static String name = "CGUIWidget";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CGUIWidget;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CGUIWidget>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 47 - 47
Source/BansheeEngine/Include/BsCLightRTTI.h

@@ -1,48 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsCLight.h"
-#include "BsGameObjectRTTI.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT CLightRTTI : public RTTIType <CLight, Component, CLightRTTI>
-	{
-	private:
-		SPtr<Light> getInternal(CLight* obj) { return obj->mInternal; }
-		void setInternal(CLight* obj, SPtr<Light> val) { obj->mInternal = val; }
-
-	public:
-		CLightRTTI()
-		{
-			addReflectablePtrField("mInternal", 0, &CLightRTTI::getInternal, &CLightRTTI::setInternal);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "CLight";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_CLight;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<CLight>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCLight.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT CLightRTTI : public RTTIType <CLight, Component, CLightRTTI>
+	{
+	private:
+		SPtr<Light> getInternal(CLight* obj) { return obj->mInternal; }
+		void setInternal(CLight* obj, SPtr<Light> val) { obj->mInternal = val; }
+
+	public:
+		CLightRTTI()
+		{
+			addReflectablePtrField("mInternal", 0, &CLightRTTI::getInternal, &CLightRTTI::setInternal);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CLight";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CLight;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CLight>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 47 - 47
Source/BansheeEngine/Include/BsCRenderableRTTI.h

@@ -1,48 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsCRenderable.h"
-#include "BsGameObjectRTTI.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT CRenderableRTTI : public RTTIType<CRenderable, Component, CRenderableRTTI>
-	{
-	private:
-		RenderablePtr getInternal(CRenderable* obj) { return obj->mInternal; }
-		void setInternal(CRenderable* obj, RenderablePtr val) { obj->mInternal = val; }
-
-	public:
-		CRenderableRTTI()
-		{
-			addReflectablePtrField("mInternal", 0, &CRenderableRTTI::getInternal, &CRenderableRTTI::setInternal);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "CRenderable";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_CRenderable;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<CRenderable>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCRenderable.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT CRenderableRTTI : public RTTIType<CRenderable, Component, CRenderableRTTI>
+	{
+	private:
+		RenderablePtr getInternal(CRenderable* obj) { return obj->mInternal; }
+		void setInternal(CRenderable* obj, RenderablePtr val) { obj->mInternal = val; }
+
+	public:
+		CRenderableRTTI()
+		{
+			addReflectablePtrField("mInternal", 0, &CRenderableRTTI::getInternal, &CRenderableRTTI::setInternal);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CRenderable";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CRenderable;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CRenderable>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 2 - 4
Source/BansheeEngine/Include/BsCamera.h

@@ -16,8 +16,7 @@
 
 
 namespace BansheeEngine 
 namespace BansheeEngine 
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
+	/** @addtogroup Renderer-Engine-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -457,7 +456,7 @@ namespace BansheeEngine
      };
      };
 
 
 	/** @} */
 	/** @} */
-	/** @addtogroup Renderer-Engine
+	/** @addtogroup Renderer-Engine-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -564,5 +563,4 @@ namespace BansheeEngine
      };
      };
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

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

@@ -1,139 +1,139 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsCamera.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT CameraRTTI : public RTTIType <Camera, IReflectable, CameraRTTI>
-	{
-	private:
-		ViewportPtr getViewport(Camera* obj) { return obj->mViewport; }
-		void setViewport(Camera* obj, ViewportPtr val) { obj->mViewport = val; }
-
-		UINT64& getLayers(Camera* obj) { return obj->mLayers; }
-		void setLayers(Camera* obj, UINT64& val) { obj->mLayers = val; }
-
-		UINT32& getFlags(Camera* obj) { return obj->mCameraFlags; }
-		void setFlags(Camera* obj, UINT32& val) { obj->mCameraFlags = val; }
-
-		Vector3& getPosition(Camera* obj) { return obj->mPosition; }
-		void setPosition(Camera* obj, Vector3& val) { obj->mPosition = val; }
-
-		Quaternion& getRotation(Camera* obj) { return obj->mRotation; }
-		void setRotation(Camera* obj, Quaternion& val) { obj->mRotation = val; }
-
-		ProjectionType& getProjType(Camera* obj) { return obj->mProjType; }
-		void setProjType(Camera* obj, ProjectionType& val) { obj->mProjType = val; }
-
-		Radian& getHorzFOV(Camera* obj) { return obj->mHorzFOV; }
-		void setHorzFOV(Camera* obj, Radian& val) { obj->mHorzFOV = val; }
-
-		float& getFarDist(Camera* obj) { return obj->mFarDist; }
-		void setFarDist(Camera* obj, float& val) { obj->mFarDist = val; }
-
-		float& getNearDist(Camera* obj) { return obj->mNearDist; }
-		void setNearDist(Camera* obj, float& val) { obj->mNearDist = val; }
-
-		float& getAspect(Camera* obj) { return obj->mAspect; }
-		void setAspect(Camera* obj, float& val) { obj->mAspect = val; }
-
-		float& getOrthoHeight(Camera* obj) { return obj->mOrthoHeight; }
-		void setOrthoHeight(Camera* obj, float& val) { obj->mOrthoHeight = val; }
-
-		INT32& getPriority(Camera* obj) { return obj->mPriority; }
-		void setPriority(Camera* obj, INT32& val) { obj->mPriority = val; }
-
-		bool& getCustomViewMatrix(Camera* obj) { return obj->mCustomViewMatrix; }
-		void setCustomViewMatrix(Camera* obj, bool& val) { obj->mCustomViewMatrix = val; }
-
-		bool& getCustomProjMatrix(Camera* obj) { return obj->mCustomProjMatrix; }
-		void setCustomProjMatrix(Camera* obj, bool& val) { obj->mCustomProjMatrix = val; }
-
-		bool& getFrustumManual(Camera* obj) { return obj->mFrustumExtentsManuallySet; }
-		void setFrustumManual(Camera* obj, bool& val) { obj->mFrustumExtentsManuallySet = val; }
-
-		Matrix4& getProjMatrix(Camera* obj) { return obj->mProjMatrix; }
-		void setProjMatrix(Camera* obj, Matrix4& val) { obj->mProjMatrix = val; }
-
-		Matrix4& getProjMatrixRS(Camera* obj) { return obj->mProjMatrixRS; }
-		void setProjMatrixRS(Camera* obj, Matrix4& val) { obj->mProjMatrixRS = val; }
-
-		Matrix4& getViewMatrix(Camera* obj) { return obj->mViewMatrix; }
-		void setViewMatrix(Camera* obj, Matrix4& val) { obj->mViewMatrix = val; }
-
-		float& getLeft(Camera* obj) { return obj->mLeft; }
-		void setLeft(Camera* obj, float& val) { obj->mLeft = val; }
-
-		float& getRight(Camera* obj) { return obj->mRight; }
-		void setRight(Camera* obj, float& val) { obj->mRight = val; }
-
-		float& getTop(Camera* obj) { return obj->mTop; }
-		void setTop(Camera* obj, float& val) { obj->mTop = val; }
-
-		float& getBottom(Camera* obj) { return obj->mBottom; }
-		void setBottom(Camera* obj, float& val) { obj->mBottom = val; }
-
-	public:
-		CameraRTTI()
-		{
-			addReflectablePtrField("mViewport", 0, &CameraRTTI::getViewport, &CameraRTTI::setViewport);
-			addPlainField("mLayers", 1, &CameraRTTI::getLayers, &CameraRTTI::setLayers);
-			addPlainField("mPosition", 2, &CameraRTTI::getPosition, &CameraRTTI::setPosition);
-			addPlainField("mRotation", 3, &CameraRTTI::getRotation, &CameraRTTI::setRotation);
-			addPlainField("mProjType", 4, &CameraRTTI::getProjType, &CameraRTTI::setProjType);
-			addPlainField("mHorzFOV", 5, &CameraRTTI::getHorzFOV, &CameraRTTI::setHorzFOV);
-			addPlainField("mFarDist", 6, &CameraRTTI::getFarDist, &CameraRTTI::setFarDist);
-			addPlainField("mNearDist", 7, &CameraRTTI::getNearDist, &CameraRTTI::setNearDist);
-			addPlainField("mAspect", 8, &CameraRTTI::getAspect, &CameraRTTI::setAspect);
-			addPlainField("mOrthoHeight", 9, &CameraRTTI::getOrthoHeight, &CameraRTTI::setOrthoHeight);
-			addPlainField("mPriority", 10, &CameraRTTI::getPriority, &CameraRTTI::setPriority);
-			addPlainField("mCustomViewMatrix", 11, &CameraRTTI::getCustomViewMatrix, &CameraRTTI::setCustomViewMatrix);
-			addPlainField("mCustomProjMatrix", 12, &CameraRTTI::getCustomProjMatrix, &CameraRTTI::setCustomProjMatrix);
-			addPlainField("mFrustumExtentsManuallySet", 13, &CameraRTTI::getFrustumManual, &CameraRTTI::setFrustumManual);
-			addPlainField("mProjMatrixRS", 15, &CameraRTTI::getProjMatrixRS, &CameraRTTI::setProjMatrixRS);
-			addPlainField("mProjMatrix", 16, &CameraRTTI::getProjMatrix, &CameraRTTI::setProjMatrix);
-			addPlainField("mViewMatrix", 17, &CameraRTTI::getViewMatrix, &CameraRTTI::setViewMatrix);
-			addPlainField("mLeft", 18, &CameraRTTI::getLeft, &CameraRTTI::setLeft);
-			addPlainField("mRight", 19, &CameraRTTI::getRight, &CameraRTTI::setRight);
-			addPlainField("mTop", 20, &CameraRTTI::getTop, &CameraRTTI::setTop);
-			addPlainField("mBottom", 21, &CameraRTTI::getBottom, &CameraRTTI::setBottom);
-			addPlainField("mFlags", 22, &CameraRTTI::getFlags, &CameraRTTI::setFlags);
-		}
-
-		void onDeserializationEnded(IReflectable* obj) override
-		{
-			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
-			// but since this specific type is used in Components we delay initialization until Component
-			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
-			// purposes (you'll need to call initialize manually).
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "Camera";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_Camera;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return Camera::createEmpty();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCamera.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT CameraRTTI : public RTTIType <Camera, IReflectable, CameraRTTI>
+	{
+	private:
+		ViewportPtr getViewport(Camera* obj) { return obj->mViewport; }
+		void setViewport(Camera* obj, ViewportPtr val) { obj->mViewport = val; }
+
+		UINT64& getLayers(Camera* obj) { return obj->mLayers; }
+		void setLayers(Camera* obj, UINT64& val) { obj->mLayers = val; }
+
+		UINT32& getFlags(Camera* obj) { return obj->mCameraFlags; }
+		void setFlags(Camera* obj, UINT32& val) { obj->mCameraFlags = val; }
+
+		Vector3& getPosition(Camera* obj) { return obj->mPosition; }
+		void setPosition(Camera* obj, Vector3& val) { obj->mPosition = val; }
+
+		Quaternion& getRotation(Camera* obj) { return obj->mRotation; }
+		void setRotation(Camera* obj, Quaternion& val) { obj->mRotation = val; }
+
+		ProjectionType& getProjType(Camera* obj) { return obj->mProjType; }
+		void setProjType(Camera* obj, ProjectionType& val) { obj->mProjType = val; }
+
+		Radian& getHorzFOV(Camera* obj) { return obj->mHorzFOV; }
+		void setHorzFOV(Camera* obj, Radian& val) { obj->mHorzFOV = val; }
+
+		float& getFarDist(Camera* obj) { return obj->mFarDist; }
+		void setFarDist(Camera* obj, float& val) { obj->mFarDist = val; }
+
+		float& getNearDist(Camera* obj) { return obj->mNearDist; }
+		void setNearDist(Camera* obj, float& val) { obj->mNearDist = val; }
+
+		float& getAspect(Camera* obj) { return obj->mAspect; }
+		void setAspect(Camera* obj, float& val) { obj->mAspect = val; }
+
+		float& getOrthoHeight(Camera* obj) { return obj->mOrthoHeight; }
+		void setOrthoHeight(Camera* obj, float& val) { obj->mOrthoHeight = val; }
+
+		INT32& getPriority(Camera* obj) { return obj->mPriority; }
+		void setPriority(Camera* obj, INT32& val) { obj->mPriority = val; }
+
+		bool& getCustomViewMatrix(Camera* obj) { return obj->mCustomViewMatrix; }
+		void setCustomViewMatrix(Camera* obj, bool& val) { obj->mCustomViewMatrix = val; }
+
+		bool& getCustomProjMatrix(Camera* obj) { return obj->mCustomProjMatrix; }
+		void setCustomProjMatrix(Camera* obj, bool& val) { obj->mCustomProjMatrix = val; }
+
+		bool& getFrustumManual(Camera* obj) { return obj->mFrustumExtentsManuallySet; }
+		void setFrustumManual(Camera* obj, bool& val) { obj->mFrustumExtentsManuallySet = val; }
+
+		Matrix4& getProjMatrix(Camera* obj) { return obj->mProjMatrix; }
+		void setProjMatrix(Camera* obj, Matrix4& val) { obj->mProjMatrix = val; }
+
+		Matrix4& getProjMatrixRS(Camera* obj) { return obj->mProjMatrixRS; }
+		void setProjMatrixRS(Camera* obj, Matrix4& val) { obj->mProjMatrixRS = val; }
+
+		Matrix4& getViewMatrix(Camera* obj) { return obj->mViewMatrix; }
+		void setViewMatrix(Camera* obj, Matrix4& val) { obj->mViewMatrix = val; }
+
+		float& getLeft(Camera* obj) { return obj->mLeft; }
+		void setLeft(Camera* obj, float& val) { obj->mLeft = val; }
+
+		float& getRight(Camera* obj) { return obj->mRight; }
+		void setRight(Camera* obj, float& val) { obj->mRight = val; }
+
+		float& getTop(Camera* obj) { return obj->mTop; }
+		void setTop(Camera* obj, float& val) { obj->mTop = val; }
+
+		float& getBottom(Camera* obj) { return obj->mBottom; }
+		void setBottom(Camera* obj, float& val) { obj->mBottom = val; }
+
+	public:
+		CameraRTTI()
+		{
+			addReflectablePtrField("mViewport", 0, &CameraRTTI::getViewport, &CameraRTTI::setViewport);
+			addPlainField("mLayers", 1, &CameraRTTI::getLayers, &CameraRTTI::setLayers);
+			addPlainField("mPosition", 2, &CameraRTTI::getPosition, &CameraRTTI::setPosition);
+			addPlainField("mRotation", 3, &CameraRTTI::getRotation, &CameraRTTI::setRotation);
+			addPlainField("mProjType", 4, &CameraRTTI::getProjType, &CameraRTTI::setProjType);
+			addPlainField("mHorzFOV", 5, &CameraRTTI::getHorzFOV, &CameraRTTI::setHorzFOV);
+			addPlainField("mFarDist", 6, &CameraRTTI::getFarDist, &CameraRTTI::setFarDist);
+			addPlainField("mNearDist", 7, &CameraRTTI::getNearDist, &CameraRTTI::setNearDist);
+			addPlainField("mAspect", 8, &CameraRTTI::getAspect, &CameraRTTI::setAspect);
+			addPlainField("mOrthoHeight", 9, &CameraRTTI::getOrthoHeight, &CameraRTTI::setOrthoHeight);
+			addPlainField("mPriority", 10, &CameraRTTI::getPriority, &CameraRTTI::setPriority);
+			addPlainField("mCustomViewMatrix", 11, &CameraRTTI::getCustomViewMatrix, &CameraRTTI::setCustomViewMatrix);
+			addPlainField("mCustomProjMatrix", 12, &CameraRTTI::getCustomProjMatrix, &CameraRTTI::setCustomProjMatrix);
+			addPlainField("mFrustumExtentsManuallySet", 13, &CameraRTTI::getFrustumManual, &CameraRTTI::setFrustumManual);
+			addPlainField("mProjMatrixRS", 15, &CameraRTTI::getProjMatrixRS, &CameraRTTI::setProjMatrixRS);
+			addPlainField("mProjMatrix", 16, &CameraRTTI::getProjMatrix, &CameraRTTI::setProjMatrix);
+			addPlainField("mViewMatrix", 17, &CameraRTTI::getViewMatrix, &CameraRTTI::setViewMatrix);
+			addPlainField("mLeft", 18, &CameraRTTI::getLeft, &CameraRTTI::setLeft);
+			addPlainField("mRight", 19, &CameraRTTI::getRight, &CameraRTTI::setRight);
+			addPlainField("mTop", 20, &CameraRTTI::getTop, &CameraRTTI::setTop);
+			addPlainField("mBottom", 21, &CameraRTTI::getBottom, &CameraRTTI::setBottom);
+			addPlainField("mFlags", 22, &CameraRTTI::getFlags, &CameraRTTI::setFlags);
+		}
+
+		void onDeserializationEnded(IReflectable* obj) override
+		{
+			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
+			// but since this specific type is used in Components we delay initialization until Component
+			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
+			// purposes (you'll need to call initialize manually).
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "Camera";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_Camera;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return Camera::createEmpty();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsDragAndDropManager.h

@@ -10,8 +10,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -121,5 +120,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 111 - 113
Source/BansheeEngine/Include/BsDropDownAreaPlacement.h

@@ -1,114 +1,112 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsVector2I.h"
-#include "BsRect2I.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**
-	 * Determines how will the drop down box be positioned. Usually the system will attempt to position the drop box in a 
-	 * way so all elements can fit, and this class allows you to specify some limitations on how that works. 
-	 * 			
-	 * @note	For example, list boxes usually want drop down boxes to be placed above or below them, while
-	 * 			context menus may want to have them placed around a single point in any direction.
-	 */
-	class BS_EXPORT DropDownAreaPlacement
-	{
-	public:
-		/**	Determines how will the drop down box be positioned. */
-		enum class Type
-		{
-			Position,
-			BoundsVert,
-			BoundsHorz,
-			BoundsAll
-		};
-
-		/**
-		 * Preferred horizontal direction of the placement bounds, either to the left or to the right of the wanted 
-		 * position/bounds.
-		 */
-		enum class HorzDir
-		{
-			Left, Right
-		};
-
-		/**
-		 * Preferred horizontal direction of the placement bounds, either upward or downward of the wanted position/bounds.
-		 */
-		enum class VertDir
-		{
-			Up, Down
-		};
-
-		DropDownAreaPlacement() { }
-
-		/**
-		 * Drop down box will be placed at the specified position. By default the system prefers the top left corner of the
-		 * box to correspond to the position, but if other corners offer more space for the contents, those will be used 
-		 * instead.
-		 */
-		static DropDownAreaPlacement aroundPosition(const Vector2I& position);
-
-		/**
-		 * Drop down box will be placed at the specified bounds. Box will be horizontally aligned to the left of the 
-		 * provided bounds. Vertically system prefers placing the box at the bottom of the bounds, but may choose to align
-		 * it with the top of the bounds if it offers more space for the contents.
-		 */
-		static DropDownAreaPlacement aroundBoundsVert(const Rect2I& bounds);
-		
-		/**
-		 * Drop down box will be placed at the specified bounds. Box will be vertically aligned to the top of the provided
-		 * bounds. Horizontally system prefers placing the box at the right of the bounds, but may choose to align it with
-		 * the left of the bounds if it offers more space for the contents.
-		 */
-		static DropDownAreaPlacement aroundBoundsHorz(const Rect2I& bounds);
-
-		/**
-		 * Drop down box will be placed at the specified bounds. Box will be vertically aligned to the top or bottom of the
-		 * provided bounds, with bottom being preferred. Horizontally system prefers placing the box at the right of the
-		 * bounds, but may choose to align it with the left of the bounds if it offers more space for the contents.
-		 */
-		static DropDownAreaPlacement aroundBounds(const Rect2I& bounds);
-
-		/**	Returns drop down box positioning type. */
-		Type getType() const { return mType; }
-
-		/** Returns bounds around which to position the drop down box if one of the bounds positioning types is used. */
-		const Rect2I& getBounds() const { return mBounds; }
-
-		/**	Returns position around which to position the drop down box if position positioning type is used. */
-		const Vector2I& getPosition() const { return mPosition; }
-
-		/**
-		 * Calculates the optimal bounds to place an element of the specified size, within the available area using the 
-		 * internal data as a guide.
-		 *
-		 * @param[in]	width			Width of the element to try to position, in pixels.
-		 * @param[in]	height			Height of the element to try to position, in pixels.
-		 * @param[in]	availableArea	Available area to try to position the element in, in pixels.
-		 * @param[in]	horzDir			Output parameter that signals the preferred horizontal direction of the bounds 
-		 *								(left or right).
-		 * @param[in]	vertDir			Output parameter that signals the preferred vertical direction of the bounds 
-		 *								(up or down).
-		 */
-		Rect2I getOptimalBounds(UINT32 width, UINT32 height, const Rect2I& availableArea, HorzDir& horzDir, 
-			VertDir& vertDir) const;
-
-	private:
-		Type mType;
-		Rect2I mBounds;
-		Vector2I mPosition;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsVector2I.h"
+#include "BsRect2I.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Determines how will the drop down box be positioned. Usually the system will attempt to position the drop box in a 
+	 * way so all elements can fit, and this class allows you to specify some limitations on how that works. 
+	 * 			
+	 * @note	For example, list boxes usually want drop down boxes to be placed above or below them, while
+	 * 			context menus may want to have them placed around a single point in any direction.
+	 */
+	class BS_EXPORT DropDownAreaPlacement
+	{
+	public:
+		/**	Determines how will the drop down box be positioned. */
+		enum class Type
+		{
+			Position,
+			BoundsVert,
+			BoundsHorz,
+			BoundsAll
+		};
+
+		/**
+		 * Preferred horizontal direction of the placement bounds, either to the left or to the right of the wanted 
+		 * position/bounds.
+		 */
+		enum class HorzDir
+		{
+			Left, Right
+		};
+
+		/**
+		 * Preferred horizontal direction of the placement bounds, either upward or downward of the wanted position/bounds.
+		 */
+		enum class VertDir
+		{
+			Up, Down
+		};
+
+		DropDownAreaPlacement() { }
+
+		/**
+		 * Drop down box will be placed at the specified position. By default the system prefers the top left corner of the
+		 * box to correspond to the position, but if other corners offer more space for the contents, those will be used 
+		 * instead.
+		 */
+		static DropDownAreaPlacement aroundPosition(const Vector2I& position);
+
+		/**
+		 * Drop down box will be placed at the specified bounds. Box will be horizontally aligned to the left of the 
+		 * provided bounds. Vertically system prefers placing the box at the bottom of the bounds, but may choose to align
+		 * it with the top of the bounds if it offers more space for the contents.
+		 */
+		static DropDownAreaPlacement aroundBoundsVert(const Rect2I& bounds);
+		
+		/**
+		 * Drop down box will be placed at the specified bounds. Box will be vertically aligned to the top of the provided
+		 * bounds. Horizontally system prefers placing the box at the right of the bounds, but may choose to align it with
+		 * the left of the bounds if it offers more space for the contents.
+		 */
+		static DropDownAreaPlacement aroundBoundsHorz(const Rect2I& bounds);
+
+		/**
+		 * Drop down box will be placed at the specified bounds. Box will be vertically aligned to the top or bottom of the
+		 * provided bounds, with bottom being preferred. Horizontally system prefers placing the box at the right of the
+		 * bounds, but may choose to align it with the left of the bounds if it offers more space for the contents.
+		 */
+		static DropDownAreaPlacement aroundBounds(const Rect2I& bounds);
+
+		/**	Returns drop down box positioning type. */
+		Type getType() const { return mType; }
+
+		/** Returns bounds around which to position the drop down box if one of the bounds positioning types is used. */
+		const Rect2I& getBounds() const { return mBounds; }
+
+		/**	Returns position around which to position the drop down box if position positioning type is used. */
+		const Vector2I& getPosition() const { return mPosition; }
+
+		/**
+		 * Calculates the optimal bounds to place an element of the specified size, within the available area using the 
+		 * internal data as a guide.
+		 *
+		 * @param[in]	width			Width of the element to try to position, in pixels.
+		 * @param[in]	height			Height of the element to try to position, in pixels.
+		 * @param[in]	availableArea	Available area to try to position the element in, in pixels.
+		 * @param[in]	horzDir			Output parameter that signals the preferred horizontal direction of the bounds 
+		 *								(left or right).
+		 * @param[in]	vertDir			Output parameter that signals the preferred vertical direction of the bounds 
+		 *								(up or down).
+		 */
+		Rect2I getOptimalBounds(UINT32 width, UINT32 height, const Rect2I& availableArea, HorzDir& horzDir, 
+			VertDir& vertDir) const;
+
+	private:
+		Type mType;
+		Rect2I mBounds;
+		Vector2I mPosition;
+	};
+
+	/** @} */
 }
 }

+ 28 - 30
Source/BansheeEngine/Include/BsEngineShaderIncludeHandler.h

@@ -1,31 +1,29 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsShaderManager.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Resources-Engine
-	 *  @{
-	 */
-
-	/**
-	 * Shader include handler for the engine. It loads includes relative to the application working directory and supports
-	 * special $ENGINE$ folder for built-in includes.
-	 */
-	class BS_EXPORT EngineShaderIncludeHandler : public IShaderIncludeHandler
-	{
-	public:
-		/** @copydoc IShaderIncludeHandler::findInclude */
-		virtual HShaderInclude findInclude(const String& name) const override;
-
-		/** Converts a shader include name or path to a path of the resource containing include data. */
-		static Path toResourcePath(const String& name);
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsShaderManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Resources-Engine-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Shader include handler for the engine. It loads includes relative to the application working directory and supports
+	 * special $ENGINE$ folder for built-in includes.
+	 */
+	class BS_EXPORT EngineShaderIncludeHandler : public IShaderIncludeHandler
+	{
+	public:
+		/** @copydoc IShaderIncludeHandler::findInclude */
+		virtual HShaderInclude findInclude(const String& name) const override;
+
+		/** Converts a shader include name or path to a path of the resource containing include data. */
+		static Path toResourcePath(const String& name);
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsGUICommandEvent.h

@@ -6,8 +6,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -55,5 +54,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 72 - 74
Source/BansheeEngine/Include/BsGUIDimensions.h

@@ -1,75 +1,73 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsVector2I.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	Contains valid size range for a GUI element in a GUI layout. */
-	struct BS_EXPORT LayoutSizeRange
-	{
-		Vector2I optimal;
-		Vector2I min;
-		Vector2I max;
-	};
-
-	/**	Flags that identify the type of data stored in a GUIDimensions structure. */
-	enum GUIDimensionFlags
-	{
-		GUIDF_FixedWidth = 0x01, 
-		GUIDF_FixedHeight = 0x02, 
-		GUIDF_OverWidth = 0x04, 
-		GUIDF_OverHeight = 0x08
-	};
-
-	/**	Options that control how an element is positioned and sized. */
-	struct BS_EXPORT GUIDimensions
-	{
-		/**	Creates new default layout options. */
-		static GUIDimensions create();
-
-		/**	Creates layout options with user defined options. */
-		static GUIDimensions create(const GUIOptions& options);
-
-		GUIDimensions();
-
-		/**
-		 * Updates layout options from the provided style. If user has not manually set a specific layout property, that
-		 * property will be inherited from style.
-		 */
-		void updateWithStyle(const GUIElementStyle* style);
-
-		/**
-		 * Calculates size range for a GUI element using this layout.
-		 *
-		 * @param[in]	optimal	Preferred size of the GUI element.
-		 */
-		LayoutSizeRange calculateSizeRange(const Vector2I& optimal) const;
-
-		/**	Checks do the dimensions override the style height. */
-		bool overridenHeight() const { return (flags & GUIDF_OverHeight) != 0; }
-
-		/**	Checks do the dimensions override the style width. */
-		bool overridenWidth() const { return (flags & GUIDF_OverWidth) != 0; }
-
-		/**	Checks do the dimensions contain fixed width. */
-		bool fixedWidth() const { return (flags & GUIDF_FixedWidth) != 0; }
-
-		/**	Checks do the dimensions contain fixed height. */
-		bool fixedHeight() const { return (flags & GUIDF_FixedHeight) != 0; }
-
-		INT32 x, y;
-		UINT32 minWidth, maxWidth, minHeight, maxHeight;
-		UINT32 flags;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsVector2I.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	Contains valid size range for a GUI element in a GUI layout. */
+	struct BS_EXPORT LayoutSizeRange
+	{
+		Vector2I optimal;
+		Vector2I min;
+		Vector2I max;
+	};
+
+	/**	Flags that identify the type of data stored in a GUIDimensions structure. */
+	enum GUIDimensionFlags
+	{
+		GUIDF_FixedWidth = 0x01, 
+		GUIDF_FixedHeight = 0x02, 
+		GUIDF_OverWidth = 0x04, 
+		GUIDF_OverHeight = 0x08
+	};
+
+	/**	Options that control how an element is positioned and sized. */
+	struct BS_EXPORT GUIDimensions
+	{
+		/**	Creates new default layout options. */
+		static GUIDimensions create();
+
+		/**	Creates layout options with user defined options. */
+		static GUIDimensions create(const GUIOptions& options);
+
+		GUIDimensions();
+
+		/**
+		 * Updates layout options from the provided style. If user has not manually set a specific layout property, that
+		 * property will be inherited from style.
+		 */
+		void updateWithStyle(const GUIElementStyle* style);
+
+		/**
+		 * Calculates size range for a GUI element using this layout.
+		 *
+		 * @param[in]	optimal	Preferred size of the GUI element.
+		 */
+		LayoutSizeRange calculateSizeRange(const Vector2I& optimal) const;
+
+		/**	Checks do the dimensions override the style height. */
+		bool overridenHeight() const { return (flags & GUIDF_OverHeight) != 0; }
+
+		/**	Checks do the dimensions override the style width. */
+		bool overridenWidth() const { return (flags & GUIDF_OverWidth) != 0; }
+
+		/**	Checks do the dimensions contain fixed width. */
+		bool fixedWidth() const { return (flags & GUIDF_FixedWidth) != 0; }
+
+		/**	Checks do the dimensions contain fixed height. */
+		bool fixedHeight() const { return (flags & GUIDF_FixedHeight) != 0; }
+
+		INT32 x, y;
+		UINT32 minWidth, maxWidth, minHeight, maxHeight;
+		UINT32 flags;
+	};
+
+	/** @} */
 }
 }

+ 41 - 43
Source/BansheeEngine/Include/BsGUIDropDownBoxManager.h

@@ -1,44 +1,42 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsGUIDropDownMenu.h"
-#include "BsModule.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	Manages opening and closing of a drop down box. */
-	class BS_EXPORT GUIDropDownBoxManager : public Module<GUIDropDownBoxManager>
-	{
-	public:
-		~GUIDropDownBoxManager();
-
-		/**
-		 * Opens a new drop down box at the specified location, look and elements. This will close any previously open drop
-		 * down box.
-		 *
-		 * @param[in]	desc				Various parameters for initializing the drop down box.
-		 * @param[in]	type				Specific type of drop down box to display.
-		 * @param[in]	onClosedCallback	Callback triggered when drop down box is closed.
-		 */
-		GameObjectHandle<GUIDropDownMenu> openDropDownBox(const DROP_DOWN_BOX_DESC& desc, 
-			GUIDropDownType type, std::function<void()> onClosedCallback);
-
-		/**	Closes the currently active drop down box (if any). */
-		void closeDropDownBox();
-
-	private:
-		HSceneObject mDropDownSO;
-		GameObjectHandle<GUIDropDownMenu> mDropDownBox;
-		std::function<void()> mOnClosedCallback;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsGUIDropDownMenu.h"
+#include "BsModule.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	Manages opening and closing of a drop down box. */
+	class BS_EXPORT GUIDropDownBoxManager : public Module<GUIDropDownBoxManager>
+	{
+	public:
+		~GUIDropDownBoxManager();
+
+		/**
+		 * Opens a new drop down box at the specified location, look and elements. This will close any previously open drop
+		 * down box.
+		 *
+		 * @param[in]	desc				Various parameters for initializing the drop down box.
+		 * @param[in]	type				Specific type of drop down box to display.
+		 * @param[in]	onClosedCallback	Callback triggered when drop down box is closed.
+		 */
+		GameObjectHandle<GUIDropDownMenu> openDropDownBox(const DROP_DOWN_BOX_DESC& desc, 
+			GUIDropDownType type, std::function<void()> onClosedCallback);
+
+		/**	Closes the currently active drop down box (if any). */
+		void closeDropDownBox();
+
+	private:
+		HSceneObject mDropDownSO;
+		GameObjectHandle<GUIDropDownMenu> mDropDownBox;
+		std::function<void()> mOnClosedCallback;
+	};
+
+	/** @} */
 }
 }

+ 128 - 130
Source/BansheeEngine/Include/BsGUIDropDownContent.h

@@ -1,131 +1,129 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsGUIElementContainer.h"
-#include "BsGUIDropDownMenu.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	GUI element that is used for representing entries in a drop down menu. */
-	class BS_EXPORT GUIDropDownContent : public GUIElementContainer
-	{
-		/**	Contains various GUI elements used for displaying a single menu entry. */
-		struct VisibleElement
-		{
-			UINT32 idx = 0;
-			GUIButtonBase* button = nullptr;
-			GUITexture* separator = nullptr;
-			GUILabel* shortcutLabel = nullptr;
-		};
-
-	public:
-		/** Returns type name of the GUI element used for finding GUI element styles.  */
-		static const String& getGUITypeName();
-
-		/**
-		 * Creates a new drop down contents element.
-		 *
-		 * @param[in]	parent			Parent sub-menu that owns the drop down contents.
-		 * @param[in]	dropDownData	Data that will be used for initializing the child entries.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default button style is used.
-		 */
-		static GUIDropDownContent* create(GUIDropDownMenu::DropDownSubMenu* parent, const GUIDropDownData& dropDownData,
-			const String& style = StringUtil::BLANK);
-
-		/**
-		 * Creates a new drop down contents element.
-		 *
-		 * @param[in]	parent			Parent sub-menu that owns the drop down contents.
-		 * @param[in]	dropDownData	Data that will be used for initializing the child entries.
-		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
-		 *								This will override any similar options set by style.
-		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
-		 *								GUIWidget the element is used on. If not specified default button style is used.
-		 */
-		static GUIDropDownContent* create(GUIDropDownMenu::DropDownSubMenu* parent, const GUIDropDownData& dropDownData, 
-			const GUIOptions& options, const String& style = StringUtil::BLANK);
-
-		/**
-		 * Changes the range of the displayed elements. 
-		 *
-		 * @note	This must be called at least once after creation.
-		 */
-		void setRange(UINT32 start, UINT32 end);
-
-		/**	Returns height of a menu element at the specified index, in pixels. */
-		UINT32 getElementHeight(UINT32 idx) const;
-
-		/**
-		 * Enables or disables keyboard focus. When keyboard focus is enabled the contents will respond to keyboard events.
-		 */
-		void setKeyboardFocus(bool focus);
-
-		static const String ENTRY_TOGGLE_STYLE_TYPE;
-		static const String ENTRY_STYLE_TYPE;
-		static const String ENTRY_EXP_STYLE_TYPE;
-		static const String SEPARATOR_STYLE_TYPE;
-	protected:
-		GUIDropDownContent(GUIDropDownMenu::DropDownSubMenu* parent, const GUIDropDownData& dropDownData, 
-			const String& style, const GUIDimensions& dimensions);
-		~GUIDropDownContent() override;
-
-		/**	Get localized name of a menu item element with the specified index. */
-		HString getElementLocalizedName(UINT32 idx) const;
-
-		/** @copydoc GUIElementContainer::_getOptimalSize */
-		Vector2I _getOptimalSize() const override;
-
-		/** @copydoc GUIElementContainer::_updateLayoutInternal */
-		void _updateLayoutInternal(const GUILayoutData& data) override;
-
-		/** @copydoc GUIElementContainer::styleUpdated */
-		void styleUpdated() override;
-
-		/** @copydoc GUIElementContainer::_commandEvent */
-		bool _commandEvent(const GUICommandEvent& ev) override;
-
-		/** @copydoc GUIElementContainer::_mouseEvent */
-		bool _mouseEvent(const GUIMouseEvent& ev) override;
-
-		/**
-		 * Marks the element with the specified index as selected.
-		 * 		
-		 * @param[in]	Index of the displayed element (indexing visible elements).
-		 */
-		void setSelected(UINT32 idx);
-
-		/**
-		 * Selects the next available non-separator entry.
-		 * 			
-		 * @param[in]	Index of the menu element.
-		 */
-		void selectNext(UINT32 startIdx);
-
-		/**
-		 * Selects the previous available non-separator entry.
-		 * 			
-		 * @param[in]	Index of the menu element.
-		 */
-		void selectPrevious(UINT32 startIdx);
-
-		GUIDropDownData mDropDownData;
-		Vector<bool> mStates;
-		Vector<VisibleElement> mVisibleElements;
-		UINT32 mSelectedIdx;
-		UINT32 mRangeStart, mRangeEnd;
-		GUIDropDownMenu::DropDownSubMenu* mParent;
-		bool mKeyboardFocus;
-		bool mIsToggle;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsGUIElementContainer.h"
+#include "BsGUIDropDownMenu.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	GUI element that is used for representing entries in a drop down menu. */
+	class BS_EXPORT GUIDropDownContent : public GUIElementContainer
+	{
+		/**	Contains various GUI elements used for displaying a single menu entry. */
+		struct VisibleElement
+		{
+			UINT32 idx = 0;
+			GUIButtonBase* button = nullptr;
+			GUITexture* separator = nullptr;
+			GUILabel* shortcutLabel = nullptr;
+		};
+
+	public:
+		/** Returns type name of the GUI element used for finding GUI element styles.  */
+		static const String& getGUITypeName();
+
+		/**
+		 * Creates a new drop down contents element.
+		 *
+		 * @param[in]	parent			Parent sub-menu that owns the drop down contents.
+		 * @param[in]	dropDownData	Data that will be used for initializing the child entries.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default button style is used.
+		 */
+		static GUIDropDownContent* create(GUIDropDownMenu::DropDownSubMenu* parent, const GUIDropDownData& dropDownData,
+			const String& style = StringUtil::BLANK);
+
+		/**
+		 * Creates a new drop down contents element.
+		 *
+		 * @param[in]	parent			Parent sub-menu that owns the drop down contents.
+		 * @param[in]	dropDownData	Data that will be used for initializing the child entries.
+		 * @param[in]	options			Options that allow you to control how is the element positioned and sized.
+		 *								This will override any similar options set by style.
+		 * @param[in]	styleName		Optional style to use for the element. Style will be retrieved from GUISkin of the
+		 *								GUIWidget the element is used on. If not specified default button style is used.
+		 */
+		static GUIDropDownContent* create(GUIDropDownMenu::DropDownSubMenu* parent, const GUIDropDownData& dropDownData, 
+			const GUIOptions& options, const String& style = StringUtil::BLANK);
+
+		/**
+		 * Changes the range of the displayed elements. 
+		 *
+		 * @note	This must be called at least once after creation.
+		 */
+		void setRange(UINT32 start, UINT32 end);
+
+		/**	Returns height of a menu element at the specified index, in pixels. */
+		UINT32 getElementHeight(UINT32 idx) const;
+
+		/**
+		 * Enables or disables keyboard focus. When keyboard focus is enabled the contents will respond to keyboard events.
+		 */
+		void setKeyboardFocus(bool focus);
+
+		static const String ENTRY_TOGGLE_STYLE_TYPE;
+		static const String ENTRY_STYLE_TYPE;
+		static const String ENTRY_EXP_STYLE_TYPE;
+		static const String SEPARATOR_STYLE_TYPE;
+	protected:
+		GUIDropDownContent(GUIDropDownMenu::DropDownSubMenu* parent, const GUIDropDownData& dropDownData, 
+			const String& style, const GUIDimensions& dimensions);
+		~GUIDropDownContent() override;
+
+		/**	Get localized name of a menu item element with the specified index. */
+		HString getElementLocalizedName(UINT32 idx) const;
+
+		/** @copydoc GUIElementContainer::_getOptimalSize */
+		Vector2I _getOptimalSize() const override;
+
+		/** @copydoc GUIElementContainer::_updateLayoutInternal */
+		void _updateLayoutInternal(const GUILayoutData& data) override;
+
+		/** @copydoc GUIElementContainer::styleUpdated */
+		void styleUpdated() override;
+
+		/** @copydoc GUIElementContainer::_commandEvent */
+		bool _commandEvent(const GUICommandEvent& ev) override;
+
+		/** @copydoc GUIElementContainer::_mouseEvent */
+		bool _mouseEvent(const GUIMouseEvent& ev) override;
+
+		/**
+		 * Marks the element with the specified index as selected.
+		 * 		
+		 * @param[in]	Index of the displayed element (indexing visible elements).
+		 */
+		void setSelected(UINT32 idx);
+
+		/**
+		 * Selects the next available non-separator entry.
+		 * 			
+		 * @param[in]	Index of the menu element.
+		 */
+		void selectNext(UINT32 startIdx);
+
+		/**
+		 * Selects the previous available non-separator entry.
+		 * 			
+		 * @param[in]	Index of the menu element.
+		 */
+		void selectPrevious(UINT32 startIdx);
+
+		GUIDropDownData mDropDownData;
+		Vector<bool> mStates;
+		Vector<VisibleElement> mVisibleElements;
+		UINT32 mSelectedIdx;
+		UINT32 mRangeStart, mRangeEnd;
+		GUIDropDownMenu::DropDownSubMenu* mParent;
+		bool mKeyboardFocus;
+		bool mIsToggle;
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsGUIDropDownHitBox.h

@@ -7,8 +7,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -74,5 +73,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 250 - 252
Source/BansheeEngine/Include/BsGUIDropDownMenu.h

@@ -1,253 +1,251 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsCGUIWidget.h"
-#include "BsRect2I.h"
-#include "BsDropDownAreaPlacement.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	Contains items used for initializing one level in a drop down box hierarchy. */
-	struct BS_EXPORT GUIDropDownData
-	{
-		Vector<GUIDropDownDataEntry> entries;
-		Vector<bool> states;
-		UnorderedMap<WString, HString> localizedNames;
-	};
-
-	/**	A set of parameters used for initializing a drop down box. */
-	struct DROP_DOWN_BOX_DESC
-	{
-		CameraPtr camera; /**< Camera on which to open the drop down box. */
-		DropDownAreaPlacement placement; /**< Determines how is the drop down box positioned in the visible area. */
-		GUIDropDownData dropDownData; /**< Data to use for initializing menu items of the drop down box. */
-		HGUISkin skin; /**< Skin to use for drop down box GUI elements. */
-		/** Additional bounds that control what is considered the inside or the outside of the drop down box. */
-		Vector<Rect2I> additionalBounds;
-	};
-
-	/**	Represents a single entry in a drop down box. */
-	class BS_EXPORT GUIDropDownDataEntry
-	{
-		enum class Type
-		{
-			Separator,
-			Entry,
-			SubMenu
-		};
-
-	public:
-		/**	Creates a new separator entry. */
-		static GUIDropDownDataEntry separator();
-
-		/** Creates a new button entry with the specified callback that is triggered when button is selected. */
-		static GUIDropDownDataEntry button(const WString& label, std::function<void()> callback, 
-			const WString& shortcutTag = StringUtil::WBLANK);
-
-		/** Creates a new sub-menu entry that will open the provided drop down data sub-menu when activated. */
-		static GUIDropDownDataEntry subMenu(const WString& label, const GUIDropDownData& data);
-
-		/**	Check is the entry a separator. */
-		bool isSeparator() const { return mType == Type::Separator; }
-
-		/**	Check is the entry a sub menu. */
-		bool isSubMenu() const { return mType == Type::SubMenu; }
-
-		/**	Returns display label of the entry (if an entry is a button or a sub-menu). */
-		const WString& getLabel() const { return mLabel; }
-
-		/**	Returns the shortcut key combination string that is to be displayed along the entry label. */
-		const WString& getShortcutTag() const { return mShortcutTag; }
-
-		/**	Returns a button callback if the entry (if an entry is a button). */
-		std::function<void()> getCallback() const { return mCallback; }
-
-		/**	Returns sub-menu data that is used for creating a sub-menu (if an entry is a sub-menu). */
-		const GUIDropDownData& getSubMenuData() const { return mChildData; }
-	private:
-		GUIDropDownDataEntry() { }
-
-		std::function<void()> mCallback;
-		GUIDropDownData mChildData;
-		WString mLabel;
-		WString mShortcutTag;
-		Type mType; 
-	};
-
-	/**	Type of drop down box types. */
-	enum class GUIDropDownType
-	{
-		ListBox,
-		MultiListBox,
-		ContextMenu,
-		MenuBar
-	};
-
-	/**	This is a generic GUI drop down box class that can be used for: list boxes, menu bars or context menus. */
-	class BS_EXPORT GUIDropDownMenu : public CGUIWidget
-	{
-	public:
-		/**
-		 * Creates a new drop down box widget.
-		 *
-		 * @param[in]	parent	Parent scene object to attach the drop down box to.
-		 * @param[in]	desc	Various parameters that control the drop down menu features and content.
-		 * @param[in]	type	Specific type of drop down box to display.
-		 */
-		GUIDropDownMenu(const HSceneObject& parent, const DROP_DOWN_BOX_DESC& desc, GUIDropDownType type);
-		~GUIDropDownMenu();
-
-	private:
-		/**	Contains data about a single drop down box sub-menu. */
-		struct DropDownSubMenu
-		{
-			/**	Represents a single sub-menu page. */
-			struct PageInfo
-			{
-				UINT32 idx;
-				UINT32 start;
-				UINT32 end;
-				UINT32 height;
-			};
-
-		public:
-			/**
-			 * Creates a new drop down box sub-menu.
-			 *
-			 * @param[in]	owner			Owner drop down box this sub menu belongs to.
-			 * @param[in]	parent			Parent sub-menu. Can be null.
-			 * @param[in]	placement		Determines how is the sub-menu positioned in the visible area.
-			 * @param[in]	availableBounds	Available bounds (in pixels) in which the sub-menu may be opened.
-			 * @param[in]	dropDownData	Data to use for initializing menu items of the sub-menu.
-			 * @param[in]	skin			Skin to use for sub-menu GUI elements.
-			 * @param[in]	depthOffset		How much to offset the sub-menu depth. We want deeper levels of the sub-menu
-			 *								hierarchy to be in front of lower levels, so you should increase this value for
-			 *								each level of the sub-menu hierarchy.
-			 */
-			DropDownSubMenu(GUIDropDownMenu* owner, DropDownSubMenu* parent, const DropDownAreaPlacement& placement, 
-				const Rect2I& availableBounds, const GUIDropDownData& dropDownData, GUIDropDownType type, UINT32 depthOffset);
-			~DropDownSubMenu();
-
-			/**	Recreates all internal GUI elements for the entries of the current sub-menu page. */
-			void updateGUIElements();
-
-			/**	Moves the sub-menu to the previous page and displays its elements, if available. */
-			void scrollDown();
-
-			/**	Moves the sub-menu to the next page and displays its elements, if available. */
-			void scrollUp();
-
-			/**	Moves the sub-menu to the first page and displays its elements. */
-			void scrollToTop();
-
-			/**	Moves the sub-menu to the last page and displays its elements. */
-			void scrollToBottom();
-
-			/**	Calculates ranges for all the pages of the sub-menu. */
-			Vector<PageInfo> getPageInfos() const;
-
-			/**
-			 * Called when the user activates an element with the specified index.
-			 *
-			 * @param[in]	bounds	Bounds of the GUI element that is used as a visual representation of this drop down 
-			 *						element.
-			 */
-			void elementActivated(UINT32 idx, const Rect2I& bounds);
-
-			/**
-			 * Called when the user selects an element with the specified index.
-			 * 
-			 * @param[in]	idx		Index of the element that was selected.
-			 */
-			void elementSelected(UINT32 idx);
-
-			/**	Called when the user wants to close the currently open sub-menu. */
-			void closeSubMenu();
-
-			/**	Closes this sub-menu. */
-			void close();
-
-			/**	Returns the type of the displayed drop down menu. */
-			GUIDropDownType getType() const { return mType; }
-
-			/**	Returns actual visible bounds of the sub-menu. */
-			Rect2I getVisibleBounds() const { return mVisibleBounds; }
-
-			/**	Returns the drop box object that owns this sub-menu. */
-			GUIDropDownMenu* getOwner() const { return mOwner; }
-
-		public:
-			GUIDropDownMenu* mOwner;
-
-			GUIDropDownType mType;
-			GUIDropDownData mData;
-			UINT32 mPage;
-			INT32 x, y;
-			UINT32 width, height;
-			Rect2I mVisibleBounds;
-			Rect2I mAvailableBounds;
-			UINT32 mDepthOffset;
-			bool mOpenedUpward;
-
-			GUIDropDownContent* mContent;
-			GUITexture* mBackgroundFrame;
-			GUIButton* mScrollUpBtn;
-			GUIButton* mScrollDownBtn;
-			GUITexture* mHandle;
-
-			GUIPanel* mBackgroundPanel;
-			GUIPanel* mContentPanel;
-			GUILayout* mContentLayout;
-			GUIPanel* mSidebarPanel;
-
-			DropDownSubMenu* mParent;
-			DropDownSubMenu* mSubMenu;
-		};
-
-	private:
-		friend class GUIDropDownContent;
-
-		/**	Called when the specified sub-menu is opened. */
-		void notifySubMenuOpened(DropDownSubMenu* subMenu);
-
-		/**	Called when the specified sub-menu is opened. */
-		void notifySubMenuClosed(DropDownSubMenu* subMenu);
-
-		/**	Called when the drop down box loses focus (and should be closed). */
-		void dropDownFocusLost();
-
-		/** @copydoc GUIWidget::onDestroyed */
-		void onDestroyed() override;
-
-	private:
-		static const UINT32 DROP_DOWN_BOX_WIDTH;
-
-		String mScrollUpStyle;
-		String mScrollDownStyle;
-		String mBackgroundStyle;
-		String mContentStyle;
-		String mSideBackgroundStyle;
-		String mHandleStyle;
-
-		DropDownSubMenu* mRootMenu;
-		GUIDropDownHitBox* mFrontHitBox;
-		GUIDropDownHitBox* mBackHitBox;
-
-		// Captures mouse clicks so that we don't trigger elements outside the drop down box when we just want to close it.
-		// (Particular example is clicking on the button that opened the drop down box in the first place. Clicking will cause
-		// the drop down to lose focus and close, but if the button still processes the mouse click it will be immediately opened again)
-		GUIDropDownHitBox* mCaptureHitBox;
-
-		Vector<Rect2I> mAdditionalCaptureBounds;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsCGUIWidget.h"
+#include "BsRect2I.h"
+#include "BsDropDownAreaPlacement.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	Contains items used for initializing one level in a drop down box hierarchy. */
+	struct BS_EXPORT GUIDropDownData
+	{
+		Vector<GUIDropDownDataEntry> entries;
+		Vector<bool> states;
+		UnorderedMap<WString, HString> localizedNames;
+	};
+
+	/**	A set of parameters used for initializing a drop down box. */
+	struct DROP_DOWN_BOX_DESC
+	{
+		CameraPtr camera; /**< Camera on which to open the drop down box. */
+		DropDownAreaPlacement placement; /**< Determines how is the drop down box positioned in the visible area. */
+		GUIDropDownData dropDownData; /**< Data to use for initializing menu items of the drop down box. */
+		HGUISkin skin; /**< Skin to use for drop down box GUI elements. */
+		/** Additional bounds that control what is considered the inside or the outside of the drop down box. */
+		Vector<Rect2I> additionalBounds;
+	};
+
+	/**	Represents a single entry in a drop down box. */
+	class BS_EXPORT GUIDropDownDataEntry
+	{
+		enum class Type
+		{
+			Separator,
+			Entry,
+			SubMenu
+		};
+
+	public:
+		/**	Creates a new separator entry. */
+		static GUIDropDownDataEntry separator();
+
+		/** Creates a new button entry with the specified callback that is triggered when button is selected. */
+		static GUIDropDownDataEntry button(const WString& label, std::function<void()> callback, 
+			const WString& shortcutTag = StringUtil::WBLANK);
+
+		/** Creates a new sub-menu entry that will open the provided drop down data sub-menu when activated. */
+		static GUIDropDownDataEntry subMenu(const WString& label, const GUIDropDownData& data);
+
+		/**	Check is the entry a separator. */
+		bool isSeparator() const { return mType == Type::Separator; }
+
+		/**	Check is the entry a sub menu. */
+		bool isSubMenu() const { return mType == Type::SubMenu; }
+
+		/**	Returns display label of the entry (if an entry is a button or a sub-menu). */
+		const WString& getLabel() const { return mLabel; }
+
+		/**	Returns the shortcut key combination string that is to be displayed along the entry label. */
+		const WString& getShortcutTag() const { return mShortcutTag; }
+
+		/**	Returns a button callback if the entry (if an entry is a button). */
+		std::function<void()> getCallback() const { return mCallback; }
+
+		/**	Returns sub-menu data that is used for creating a sub-menu (if an entry is a sub-menu). */
+		const GUIDropDownData& getSubMenuData() const { return mChildData; }
+	private:
+		GUIDropDownDataEntry() { }
+
+		std::function<void()> mCallback;
+		GUIDropDownData mChildData;
+		WString mLabel;
+		WString mShortcutTag;
+		Type mType; 
+	};
+
+	/**	Type of drop down box types. */
+	enum class GUIDropDownType
+	{
+		ListBox,
+		MultiListBox,
+		ContextMenu,
+		MenuBar
+	};
+
+	/**	This is a generic GUI drop down box class that can be used for: list boxes, menu bars or context menus. */
+	class BS_EXPORT GUIDropDownMenu : public CGUIWidget
+	{
+	public:
+		/**
+		 * Creates a new drop down box widget.
+		 *
+		 * @param[in]	parent	Parent scene object to attach the drop down box to.
+		 * @param[in]	desc	Various parameters that control the drop down menu features and content.
+		 * @param[in]	type	Specific type of drop down box to display.
+		 */
+		GUIDropDownMenu(const HSceneObject& parent, const DROP_DOWN_BOX_DESC& desc, GUIDropDownType type);
+		~GUIDropDownMenu();
+
+	private:
+		/**	Contains data about a single drop down box sub-menu. */
+		struct DropDownSubMenu
+		{
+			/**	Represents a single sub-menu page. */
+			struct PageInfo
+			{
+				UINT32 idx;
+				UINT32 start;
+				UINT32 end;
+				UINT32 height;
+			};
+
+		public:
+			/**
+			 * Creates a new drop down box sub-menu.
+			 *
+			 * @param[in]	owner			Owner drop down box this sub menu belongs to.
+			 * @param[in]	parent			Parent sub-menu. Can be null.
+			 * @param[in]	placement		Determines how is the sub-menu positioned in the visible area.
+			 * @param[in]	availableBounds	Available bounds (in pixels) in which the sub-menu may be opened.
+			 * @param[in]	dropDownData	Data to use for initializing menu items of the sub-menu.
+			 * @param[in]	skin			Skin to use for sub-menu GUI elements.
+			 * @param[in]	depthOffset		How much to offset the sub-menu depth. We want deeper levels of the sub-menu
+			 *								hierarchy to be in front of lower levels, so you should increase this value for
+			 *								each level of the sub-menu hierarchy.
+			 */
+			DropDownSubMenu(GUIDropDownMenu* owner, DropDownSubMenu* parent, const DropDownAreaPlacement& placement, 
+				const Rect2I& availableBounds, const GUIDropDownData& dropDownData, GUIDropDownType type, UINT32 depthOffset);
+			~DropDownSubMenu();
+
+			/**	Recreates all internal GUI elements for the entries of the current sub-menu page. */
+			void updateGUIElements();
+
+			/**	Moves the sub-menu to the previous page and displays its elements, if available. */
+			void scrollDown();
+
+			/**	Moves the sub-menu to the next page and displays its elements, if available. */
+			void scrollUp();
+
+			/**	Moves the sub-menu to the first page and displays its elements. */
+			void scrollToTop();
+
+			/**	Moves the sub-menu to the last page and displays its elements. */
+			void scrollToBottom();
+
+			/**	Calculates ranges for all the pages of the sub-menu. */
+			Vector<PageInfo> getPageInfos() const;
+
+			/**
+			 * Called when the user activates an element with the specified index.
+			 *
+			 * @param[in]	bounds	Bounds of the GUI element that is used as a visual representation of this drop down 
+			 *						element.
+			 */
+			void elementActivated(UINT32 idx, const Rect2I& bounds);
+
+			/**
+			 * Called when the user selects an element with the specified index.
+			 * 
+			 * @param[in]	idx		Index of the element that was selected.
+			 */
+			void elementSelected(UINT32 idx);
+
+			/**	Called when the user wants to close the currently open sub-menu. */
+			void closeSubMenu();
+
+			/**	Closes this sub-menu. */
+			void close();
+
+			/**	Returns the type of the displayed drop down menu. */
+			GUIDropDownType getType() const { return mType; }
+
+			/**	Returns actual visible bounds of the sub-menu. */
+			Rect2I getVisibleBounds() const { return mVisibleBounds; }
+
+			/**	Returns the drop box object that owns this sub-menu. */
+			GUIDropDownMenu* getOwner() const { return mOwner; }
+
+		public:
+			GUIDropDownMenu* mOwner;
+
+			GUIDropDownType mType;
+			GUIDropDownData mData;
+			UINT32 mPage;
+			INT32 x, y;
+			UINT32 width, height;
+			Rect2I mVisibleBounds;
+			Rect2I mAvailableBounds;
+			UINT32 mDepthOffset;
+			bool mOpenedUpward;
+
+			GUIDropDownContent* mContent;
+			GUITexture* mBackgroundFrame;
+			GUIButton* mScrollUpBtn;
+			GUIButton* mScrollDownBtn;
+			GUITexture* mHandle;
+
+			GUIPanel* mBackgroundPanel;
+			GUIPanel* mContentPanel;
+			GUILayout* mContentLayout;
+			GUIPanel* mSidebarPanel;
+
+			DropDownSubMenu* mParent;
+			DropDownSubMenu* mSubMenu;
+		};
+
+	private:
+		friend class GUIDropDownContent;
+
+		/**	Called when the specified sub-menu is opened. */
+		void notifySubMenuOpened(DropDownSubMenu* subMenu);
+
+		/**	Called when the specified sub-menu is opened. */
+		void notifySubMenuClosed(DropDownSubMenu* subMenu);
+
+		/**	Called when the drop down box loses focus (and should be closed). */
+		void dropDownFocusLost();
+
+		/** @copydoc GUIWidget::onDestroyed */
+		void onDestroyed() override;
+
+	private:
+		static const UINT32 DROP_DOWN_BOX_WIDTH;
+
+		String mScrollUpStyle;
+		String mScrollDownStyle;
+		String mBackgroundStyle;
+		String mContentStyle;
+		String mSideBackgroundStyle;
+		String mHandleStyle;
+
+		DropDownSubMenu* mRootMenu;
+		GUIDropDownHitBox* mFrontHitBox;
+		GUIDropDownHitBox* mBackHitBox;
+
+		// Captures mouse clicks so that we don't trigger elements outside the drop down box when we just want to close it.
+		// (Particular example is clicking on the button that opened the drop down box in the first place. Clicking will cause
+		// the drop down to lose focus and close, but if the button still processes the mouse click it will be immediately opened again)
+		GUIDropDownHitBox* mCaptureHitBox;
+
+		Vector<Rect2I> mAdditionalCaptureBounds;
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsGUIElementContainer.h

@@ -7,8 +7,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -40,5 +39,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 190 - 190
Source/BansheeEngine/Include/BsGUIElementStyleRTTI.h

@@ -1,191 +1,191 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGUIElementStyle.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT GUIElementStyleRTTI : public RTTIType <GUIElementStyle, IReflectable, GUIElementStyleRTTI>
-	{
-	private:
-		HFont& getFont(GUIElementStyle* obj) { return obj->font; }
-		void setFont(GUIElementStyle* obj, HFont& val) { obj->font = val; }
-		
-		UINT32& getFontSize(GUIElementStyle* obj) { return obj->fontSize; }
-		void setFontSize(GUIElementStyle* obj, UINT32& val) { obj->fontSize = val; }
-
-		TextHorzAlign& getTextHorzAlign(GUIElementStyle* obj) { return obj->textHorzAlign; }
-		void setTextHorzAlign(GUIElementStyle* obj, TextHorzAlign& val) { obj->textHorzAlign = val; }
-
-		TextVertAlign& getTextVertAlign(GUIElementStyle* obj) { return obj->textVertAlign; }
-		void setTextVertAlign(GUIElementStyle* obj, TextVertAlign& val) { obj->textVertAlign = val; }
-
-		GUIImagePosition& getImagePosition(GUIElementStyle* obj) { return obj->imagePosition; }
-		void setImagePosition(GUIElementStyle* obj, GUIImagePosition& val) { obj->imagePosition = val; }
-
-		bool& getWordWrap(GUIElementStyle* obj) { return obj->wordWrap; }
-		void setWordWrap(GUIElementStyle* obj, bool& val) { obj->wordWrap = val; }
-
-
-		HSpriteTexture& getNormalTexture(GUIElementStyle* obj) { return obj->normal.texture; }
-		void setNormalTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->normal.texture = val; }
-
-		Color& getNormalTextColor(GUIElementStyle* obj) { return obj->normal.textColor; }
-		void setNormalTextColor(GUIElementStyle* obj, Color& val) { obj->normal.textColor = val; }
-
-		HSpriteTexture& getHoverTexture(GUIElementStyle* obj) { return obj->hover.texture; }
-		void setHoverTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->hover.texture = val; }
-
-		Color& getHoverTextColor(GUIElementStyle* obj) { return obj->hover.textColor; }
-		void setHoverTextColor(GUIElementStyle* obj, Color& val) { obj->hover.textColor = val; }
-
-		HSpriteTexture& getActiveTexture(GUIElementStyle* obj) { return obj->active.texture; }
-		void setActiveTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->active.texture = val; }
-
-		Color& getActiveTextColor(GUIElementStyle* obj) { return obj->active.textColor; }
-		void setActiveTextColor(GUIElementStyle* obj, Color& val) { obj->active.textColor = val; }
-
-		HSpriteTexture& getFocusedTexture(GUIElementStyle* obj) { return obj->focused.texture; }
-		void setFocusedTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->focused.texture = val; }
-
-		Color& getFocusedTextColor(GUIElementStyle* obj) { return obj->focused.textColor; }
-		void setFocusedTextColor(GUIElementStyle* obj, Color& val) { obj->focused.textColor = val; }
-
-
-		HSpriteTexture& getNormalOnTexture(GUIElementStyle* obj) { return obj->normalOn.texture; }
-		void setNormalOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->normalOn.texture = val; }
-
-		Color& getNormalOnTextColor(GUIElementStyle* obj) { return obj->normalOn.textColor; }
-		void setNormalOnTextColor(GUIElementStyle* obj, Color& val) { obj->normalOn.textColor = val; }
-
-		HSpriteTexture& getHoverOnTexture(GUIElementStyle* obj) { return obj->hoverOn.texture; }
-		void setHoverOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->hoverOn.texture = val; }
-
-		Color& getHoverOnTextColor(GUIElementStyle* obj) { return obj->hoverOn.textColor; }
-		void setHoverOnTextColor(GUIElementStyle* obj, Color& val) { obj->hoverOn.textColor = val; }
-
-		HSpriteTexture& getActiveOnTexture(GUIElementStyle* obj) { return obj->activeOn.texture; }
-		void setActiveOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->activeOn.texture = val; }
-
-		Color& getActiveOnTextColor(GUIElementStyle* obj) { return obj->activeOn.textColor; }
-		void setActiveOnTextColor(GUIElementStyle* obj, Color& val) { obj->activeOn.textColor = val; }
-
-		HSpriteTexture& getFocusedOnTexture(GUIElementStyle* obj) { return obj->focusedOn.texture; }
-		void setFocusedOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->focusedOn.texture = val; }
-
-		Color& getFocusedOnTextColor(GUIElementStyle* obj) { return obj->focusedOn.textColor; }
-		void setFocusedOnTextColor(GUIElementStyle* obj, Color& val) { obj->focusedOn.textColor = val; }
-
-
-		RectOffset& getBorder(GUIElementStyle* obj) { return obj->border; }
-		void setBorder(GUIElementStyle* obj, RectOffset& val) { obj->border = val; }
-
-		RectOffset& getMargins(GUIElementStyle* obj) { return obj->margins; }
-		void setMargins(GUIElementStyle* obj, RectOffset& val) { obj->margins = val; }
-
-		RectOffset& getContentOffset(GUIElementStyle* obj) { return obj->contentOffset; }
-		void setContentOffset(GUIElementStyle* obj, RectOffset& val) { obj->contentOffset = val; }
-
-		RectOffset& getPadding(GUIElementStyle* obj) { return obj->padding; }
-		void setPadding(GUIElementStyle* obj, RectOffset& val) { obj->padding = val; }
-
-		UINT32& getWidth(GUIElementStyle* obj) { return obj->width; }
-		void setWidth(GUIElementStyle* obj, UINT32& val) { obj->width = val; }
-
-		UINT32& getHeight(GUIElementStyle* obj) { return obj->height; }
-		void setHeight(GUIElementStyle* obj, UINT32& val) { obj->height = val; }
-
-		UINT32& getMinWidth(GUIElementStyle* obj) { return obj->minWidth; }
-		void setMinWidth(GUIElementStyle* obj, UINT32& val) { obj->minWidth = val; }
-
-		UINT32& getMaxWidth(GUIElementStyle* obj) { return obj->maxWidth; }
-		void setMaxWidth(GUIElementStyle* obj, UINT32& val) { obj->maxWidth = val; }
-
-		UINT32& getMinHeight(GUIElementStyle* obj) { return obj->minHeight; }
-		void setMinHeight(GUIElementStyle* obj, UINT32& val) { obj->minHeight = val; }
-
-		UINT32& getMaxHeight(GUIElementStyle* obj) { return obj->maxHeight; }
-		void setMaxHeight(GUIElementStyle* obj, UINT32& val) { obj->maxHeight = val; }
-
-		bool& getFixedWidth(GUIElementStyle* obj) { return obj->fixedWidth; }
-		void setFixedWidth(GUIElementStyle* obj, bool& val) { obj->fixedWidth = val; }
-
-		bool& getFixedHeight(GUIElementStyle* obj) { return obj->fixedHeight; }
-		void setFixedHeight(GUIElementStyle* obj, bool& val) { obj->fixedHeight = val; }
-
-		Map<String, String>& getSubStyles(GUIElementStyle* obj) { return obj->subStyles; }
-		void setSubStyles(GUIElementStyle* obj, Map<String, String>& val) { obj->subStyles = val; }
-
-	public:
-		GUIElementStyleRTTI()
-		{
-			addReflectableField("font", 0, &GUIElementStyleRTTI::getFont, &GUIElementStyleRTTI::setFont);
-			addPlainField("fontSize", 1, &GUIElementStyleRTTI::getFontSize, &GUIElementStyleRTTI::setFontSize);
-			addPlainField("textHorzAlign", 2, &GUIElementStyleRTTI::getTextHorzAlign, &GUIElementStyleRTTI::setTextHorzAlign);
-			addPlainField("textVertAlign", 3, &GUIElementStyleRTTI::getTextVertAlign, &GUIElementStyleRTTI::setTextVertAlign);
-			addPlainField("imagePosition", 4, &GUIElementStyleRTTI::getImagePosition, &GUIElementStyleRTTI::setImagePosition);
-			addPlainField("wordWrap", 5, &GUIElementStyleRTTI::getWordWrap, &GUIElementStyleRTTI::setWordWrap);
-
-			addReflectableField("normalTex", 6, &GUIElementStyleRTTI::getNormalTexture, &GUIElementStyleRTTI::setNormalTexture);
-			addPlainField("normalTextColor", 7, &GUIElementStyleRTTI::getNormalTextColor, &GUIElementStyleRTTI::setNormalTextColor);
-			addReflectableField("hoverTex", 8, &GUIElementStyleRTTI::getHoverTexture, &GUIElementStyleRTTI::setHoverTexture);
-			addPlainField("hoverTextColor", 9, &GUIElementStyleRTTI::getHoverTextColor, &GUIElementStyleRTTI::setHoverTextColor);
-			addReflectableField("activeTex", 10, &GUIElementStyleRTTI::getActiveTexture, &GUIElementStyleRTTI::setActiveTexture);
-			addPlainField("activeTextColor", 11, &GUIElementStyleRTTI::getActiveTextColor, &GUIElementStyleRTTI::setActiveTextColor);
-			addReflectableField("focusedTex", 12, &GUIElementStyleRTTI::getFocusedTexture, &GUIElementStyleRTTI::setFocusedTexture);
-			addPlainField("focusedTextColor", 13, &GUIElementStyleRTTI::getFocusedTextColor, &GUIElementStyleRTTI::setFocusedTextColor);
-
-			addReflectableField("normalOnTex", 14, &GUIElementStyleRTTI::getNormalOnTexture, &GUIElementStyleRTTI::setNormalOnTexture);
-			addPlainField("normalOnTextColor", 15, &GUIElementStyleRTTI::getNormalOnTextColor, &GUIElementStyleRTTI::setNormalOnTextColor);
-			addReflectableField("hoverOnTex", 16, &GUIElementStyleRTTI::getHoverOnTexture, &GUIElementStyleRTTI::setHoverOnTexture);
-			addPlainField("hoverOnTextColor", 17, &GUIElementStyleRTTI::getHoverOnTextColor, &GUIElementStyleRTTI::setHoverOnTextColor);
-			addReflectableField("activeOnTex", 18, &GUIElementStyleRTTI::getActiveOnTexture, &GUIElementStyleRTTI::setActiveOnTexture);
-			addPlainField("activeOnTextColor", 19, &GUIElementStyleRTTI::getActiveOnTextColor, &GUIElementStyleRTTI::setActiveOnTextColor);
-			addReflectableField("focusedOnTex", 20, &GUIElementStyleRTTI::getFocusedOnTexture, &GUIElementStyleRTTI::setFocusedOnTexture);
-			addPlainField("focusedOnTextColor", 21, &GUIElementStyleRTTI::getFocusedOnTextColor, &GUIElementStyleRTTI::setFocusedOnTextColor);
-
-			addPlainField("border", 22, &GUIElementStyleRTTI::getBorder, &GUIElementStyleRTTI::setBorder);
-			addPlainField("margins", 23, &GUIElementStyleRTTI::getMargins, &GUIElementStyleRTTI::setMargins);
-			addPlainField("contentOffset", 24, &GUIElementStyleRTTI::getContentOffset, &GUIElementStyleRTTI::setContentOffset);
-			addPlainField("padding", 25, &GUIElementStyleRTTI::getPadding, &GUIElementStyleRTTI::setPadding);
-
-			addPlainField("width", 26, &GUIElementStyleRTTI::getWidth, &GUIElementStyleRTTI::setWidth);
-			addPlainField("height", 27, &GUIElementStyleRTTI::getHeight, &GUIElementStyleRTTI::setHeight);
-			addPlainField("minWidth", 28, &GUIElementStyleRTTI::getMinWidth, &GUIElementStyleRTTI::setMinWidth);
-			addPlainField("maxWidth", 29, &GUIElementStyleRTTI::getMaxWidth, &GUIElementStyleRTTI::setMaxWidth);
-			addPlainField("minHeight", 30, &GUIElementStyleRTTI::getMinHeight, &GUIElementStyleRTTI::setMinHeight);
-			addPlainField("maxHeight", 31, &GUIElementStyleRTTI::getMaxHeight, &GUIElementStyleRTTI::setMaxHeight);
-			addPlainField("fixedWidth", 32, &GUIElementStyleRTTI::getFixedWidth, &GUIElementStyleRTTI::setFixedWidth);
-			addPlainField("fixedHeight", 33, &GUIElementStyleRTTI::getFixedHeight, &GUIElementStyleRTTI::setFixedHeight);
-
-			addPlainField("subStyles", 34, &GUIElementStyleRTTI::getSubStyles, &GUIElementStyleRTTI::setSubStyles);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "GUIElementStyle";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_GUIElementStyle;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<GUIElementStyle>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsGUIElementStyle.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT GUIElementStyleRTTI : public RTTIType <GUIElementStyle, IReflectable, GUIElementStyleRTTI>
+	{
+	private:
+		HFont& getFont(GUIElementStyle* obj) { return obj->font; }
+		void setFont(GUIElementStyle* obj, HFont& val) { obj->font = val; }
+		
+		UINT32& getFontSize(GUIElementStyle* obj) { return obj->fontSize; }
+		void setFontSize(GUIElementStyle* obj, UINT32& val) { obj->fontSize = val; }
+
+		TextHorzAlign& getTextHorzAlign(GUIElementStyle* obj) { return obj->textHorzAlign; }
+		void setTextHorzAlign(GUIElementStyle* obj, TextHorzAlign& val) { obj->textHorzAlign = val; }
+
+		TextVertAlign& getTextVertAlign(GUIElementStyle* obj) { return obj->textVertAlign; }
+		void setTextVertAlign(GUIElementStyle* obj, TextVertAlign& val) { obj->textVertAlign = val; }
+
+		GUIImagePosition& getImagePosition(GUIElementStyle* obj) { return obj->imagePosition; }
+		void setImagePosition(GUIElementStyle* obj, GUIImagePosition& val) { obj->imagePosition = val; }
+
+		bool& getWordWrap(GUIElementStyle* obj) { return obj->wordWrap; }
+		void setWordWrap(GUIElementStyle* obj, bool& val) { obj->wordWrap = val; }
+
+
+		HSpriteTexture& getNormalTexture(GUIElementStyle* obj) { return obj->normal.texture; }
+		void setNormalTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->normal.texture = val; }
+
+		Color& getNormalTextColor(GUIElementStyle* obj) { return obj->normal.textColor; }
+		void setNormalTextColor(GUIElementStyle* obj, Color& val) { obj->normal.textColor = val; }
+
+		HSpriteTexture& getHoverTexture(GUIElementStyle* obj) { return obj->hover.texture; }
+		void setHoverTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->hover.texture = val; }
+
+		Color& getHoverTextColor(GUIElementStyle* obj) { return obj->hover.textColor; }
+		void setHoverTextColor(GUIElementStyle* obj, Color& val) { obj->hover.textColor = val; }
+
+		HSpriteTexture& getActiveTexture(GUIElementStyle* obj) { return obj->active.texture; }
+		void setActiveTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->active.texture = val; }
+
+		Color& getActiveTextColor(GUIElementStyle* obj) { return obj->active.textColor; }
+		void setActiveTextColor(GUIElementStyle* obj, Color& val) { obj->active.textColor = val; }
+
+		HSpriteTexture& getFocusedTexture(GUIElementStyle* obj) { return obj->focused.texture; }
+		void setFocusedTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->focused.texture = val; }
+
+		Color& getFocusedTextColor(GUIElementStyle* obj) { return obj->focused.textColor; }
+		void setFocusedTextColor(GUIElementStyle* obj, Color& val) { obj->focused.textColor = val; }
+
+
+		HSpriteTexture& getNormalOnTexture(GUIElementStyle* obj) { return obj->normalOn.texture; }
+		void setNormalOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->normalOn.texture = val; }
+
+		Color& getNormalOnTextColor(GUIElementStyle* obj) { return obj->normalOn.textColor; }
+		void setNormalOnTextColor(GUIElementStyle* obj, Color& val) { obj->normalOn.textColor = val; }
+
+		HSpriteTexture& getHoverOnTexture(GUIElementStyle* obj) { return obj->hoverOn.texture; }
+		void setHoverOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->hoverOn.texture = val; }
+
+		Color& getHoverOnTextColor(GUIElementStyle* obj) { return obj->hoverOn.textColor; }
+		void setHoverOnTextColor(GUIElementStyle* obj, Color& val) { obj->hoverOn.textColor = val; }
+
+		HSpriteTexture& getActiveOnTexture(GUIElementStyle* obj) { return obj->activeOn.texture; }
+		void setActiveOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->activeOn.texture = val; }
+
+		Color& getActiveOnTextColor(GUIElementStyle* obj) { return obj->activeOn.textColor; }
+		void setActiveOnTextColor(GUIElementStyle* obj, Color& val) { obj->activeOn.textColor = val; }
+
+		HSpriteTexture& getFocusedOnTexture(GUIElementStyle* obj) { return obj->focusedOn.texture; }
+		void setFocusedOnTexture(GUIElementStyle* obj, HSpriteTexture& val) { obj->focusedOn.texture = val; }
+
+		Color& getFocusedOnTextColor(GUIElementStyle* obj) { return obj->focusedOn.textColor; }
+		void setFocusedOnTextColor(GUIElementStyle* obj, Color& val) { obj->focusedOn.textColor = val; }
+
+
+		RectOffset& getBorder(GUIElementStyle* obj) { return obj->border; }
+		void setBorder(GUIElementStyle* obj, RectOffset& val) { obj->border = val; }
+
+		RectOffset& getMargins(GUIElementStyle* obj) { return obj->margins; }
+		void setMargins(GUIElementStyle* obj, RectOffset& val) { obj->margins = val; }
+
+		RectOffset& getContentOffset(GUIElementStyle* obj) { return obj->contentOffset; }
+		void setContentOffset(GUIElementStyle* obj, RectOffset& val) { obj->contentOffset = val; }
+
+		RectOffset& getPadding(GUIElementStyle* obj) { return obj->padding; }
+		void setPadding(GUIElementStyle* obj, RectOffset& val) { obj->padding = val; }
+
+		UINT32& getWidth(GUIElementStyle* obj) { return obj->width; }
+		void setWidth(GUIElementStyle* obj, UINT32& val) { obj->width = val; }
+
+		UINT32& getHeight(GUIElementStyle* obj) { return obj->height; }
+		void setHeight(GUIElementStyle* obj, UINT32& val) { obj->height = val; }
+
+		UINT32& getMinWidth(GUIElementStyle* obj) { return obj->minWidth; }
+		void setMinWidth(GUIElementStyle* obj, UINT32& val) { obj->minWidth = val; }
+
+		UINT32& getMaxWidth(GUIElementStyle* obj) { return obj->maxWidth; }
+		void setMaxWidth(GUIElementStyle* obj, UINT32& val) { obj->maxWidth = val; }
+
+		UINT32& getMinHeight(GUIElementStyle* obj) { return obj->minHeight; }
+		void setMinHeight(GUIElementStyle* obj, UINT32& val) { obj->minHeight = val; }
+
+		UINT32& getMaxHeight(GUIElementStyle* obj) { return obj->maxHeight; }
+		void setMaxHeight(GUIElementStyle* obj, UINT32& val) { obj->maxHeight = val; }
+
+		bool& getFixedWidth(GUIElementStyle* obj) { return obj->fixedWidth; }
+		void setFixedWidth(GUIElementStyle* obj, bool& val) { obj->fixedWidth = val; }
+
+		bool& getFixedHeight(GUIElementStyle* obj) { return obj->fixedHeight; }
+		void setFixedHeight(GUIElementStyle* obj, bool& val) { obj->fixedHeight = val; }
+
+		Map<String, String>& getSubStyles(GUIElementStyle* obj) { return obj->subStyles; }
+		void setSubStyles(GUIElementStyle* obj, Map<String, String>& val) { obj->subStyles = val; }
+
+	public:
+		GUIElementStyleRTTI()
+		{
+			addReflectableField("font", 0, &GUIElementStyleRTTI::getFont, &GUIElementStyleRTTI::setFont);
+			addPlainField("fontSize", 1, &GUIElementStyleRTTI::getFontSize, &GUIElementStyleRTTI::setFontSize);
+			addPlainField("textHorzAlign", 2, &GUIElementStyleRTTI::getTextHorzAlign, &GUIElementStyleRTTI::setTextHorzAlign);
+			addPlainField("textVertAlign", 3, &GUIElementStyleRTTI::getTextVertAlign, &GUIElementStyleRTTI::setTextVertAlign);
+			addPlainField("imagePosition", 4, &GUIElementStyleRTTI::getImagePosition, &GUIElementStyleRTTI::setImagePosition);
+			addPlainField("wordWrap", 5, &GUIElementStyleRTTI::getWordWrap, &GUIElementStyleRTTI::setWordWrap);
+
+			addReflectableField("normalTex", 6, &GUIElementStyleRTTI::getNormalTexture, &GUIElementStyleRTTI::setNormalTexture);
+			addPlainField("normalTextColor", 7, &GUIElementStyleRTTI::getNormalTextColor, &GUIElementStyleRTTI::setNormalTextColor);
+			addReflectableField("hoverTex", 8, &GUIElementStyleRTTI::getHoverTexture, &GUIElementStyleRTTI::setHoverTexture);
+			addPlainField("hoverTextColor", 9, &GUIElementStyleRTTI::getHoverTextColor, &GUIElementStyleRTTI::setHoverTextColor);
+			addReflectableField("activeTex", 10, &GUIElementStyleRTTI::getActiveTexture, &GUIElementStyleRTTI::setActiveTexture);
+			addPlainField("activeTextColor", 11, &GUIElementStyleRTTI::getActiveTextColor, &GUIElementStyleRTTI::setActiveTextColor);
+			addReflectableField("focusedTex", 12, &GUIElementStyleRTTI::getFocusedTexture, &GUIElementStyleRTTI::setFocusedTexture);
+			addPlainField("focusedTextColor", 13, &GUIElementStyleRTTI::getFocusedTextColor, &GUIElementStyleRTTI::setFocusedTextColor);
+
+			addReflectableField("normalOnTex", 14, &GUIElementStyleRTTI::getNormalOnTexture, &GUIElementStyleRTTI::setNormalOnTexture);
+			addPlainField("normalOnTextColor", 15, &GUIElementStyleRTTI::getNormalOnTextColor, &GUIElementStyleRTTI::setNormalOnTextColor);
+			addReflectableField("hoverOnTex", 16, &GUIElementStyleRTTI::getHoverOnTexture, &GUIElementStyleRTTI::setHoverOnTexture);
+			addPlainField("hoverOnTextColor", 17, &GUIElementStyleRTTI::getHoverOnTextColor, &GUIElementStyleRTTI::setHoverOnTextColor);
+			addReflectableField("activeOnTex", 18, &GUIElementStyleRTTI::getActiveOnTexture, &GUIElementStyleRTTI::setActiveOnTexture);
+			addPlainField("activeOnTextColor", 19, &GUIElementStyleRTTI::getActiveOnTextColor, &GUIElementStyleRTTI::setActiveOnTextColor);
+			addReflectableField("focusedOnTex", 20, &GUIElementStyleRTTI::getFocusedOnTexture, &GUIElementStyleRTTI::setFocusedOnTexture);
+			addPlainField("focusedOnTextColor", 21, &GUIElementStyleRTTI::getFocusedOnTextColor, &GUIElementStyleRTTI::setFocusedOnTextColor);
+
+			addPlainField("border", 22, &GUIElementStyleRTTI::getBorder, &GUIElementStyleRTTI::setBorder);
+			addPlainField("margins", 23, &GUIElementStyleRTTI::getMargins, &GUIElementStyleRTTI::setMargins);
+			addPlainField("contentOffset", 24, &GUIElementStyleRTTI::getContentOffset, &GUIElementStyleRTTI::setContentOffset);
+			addPlainField("padding", 25, &GUIElementStyleRTTI::getPadding, &GUIElementStyleRTTI::setPadding);
+
+			addPlainField("width", 26, &GUIElementStyleRTTI::getWidth, &GUIElementStyleRTTI::setWidth);
+			addPlainField("height", 27, &GUIElementStyleRTTI::getHeight, &GUIElementStyleRTTI::setHeight);
+			addPlainField("minWidth", 28, &GUIElementStyleRTTI::getMinWidth, &GUIElementStyleRTTI::setMinWidth);
+			addPlainField("maxWidth", 29, &GUIElementStyleRTTI::getMaxWidth, &GUIElementStyleRTTI::setMaxWidth);
+			addPlainField("minHeight", 30, &GUIElementStyleRTTI::getMinHeight, &GUIElementStyleRTTI::setMinHeight);
+			addPlainField("maxHeight", 31, &GUIElementStyleRTTI::getMaxHeight, &GUIElementStyleRTTI::setMaxHeight);
+			addPlainField("fixedWidth", 32, &GUIElementStyleRTTI::getFixedWidth, &GUIElementStyleRTTI::setFixedWidth);
+			addPlainField("fixedHeight", 33, &GUIElementStyleRTTI::getFixedHeight, &GUIElementStyleRTTI::setFixedHeight);
+
+			addPlainField("subStyles", 34, &GUIElementStyleRTTI::getSubStyles, &GUIElementStyleRTTI::setSubStyles);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "GUIElementStyle";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_GUIElementStyle;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<GUIElementStyle>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 54 - 56
Source/BansheeEngine/Include/BsGUIHelper.h

@@ -1,57 +1,55 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsTextSprite.h"
-#include "BsGUIContent.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	Contains various helper methods used by GUI. */
-	class BS_EXPORT GUIHelper
-	{
-	public:
-		/**
-		 * Calculates optimal content size by returning the nearest valid size to the provided value.
-		 *
-		 * @param[in]	contentSize		Wanted content size. This will be limited by minimal constraints of the style and 
-		 *								layout options.
-		 * @param[in]	style			Style to use for determining size constraints.
-		 * @param[in]	dimensions		Dimension constraints of a GUI element.
-		 */
-		static Vector2I calcOptimalContentsSize(const Vector2I& contentSize, const GUIElementStyle& style, 
-			const GUIDimensions& dimensions);
-
-		/**
-		 * Calculates optimal content size for the provided content using the provided style and layout options for 
-		 * constraints.
-		 *
-		 * @param[in]	content			Content to calculate size for.
-		 * @param[in]	style			Style to use for determining size constraints.
-		 * @param[in]	dimensions		Dimension constraints of a GUI element.
-		 * @param[in]	state			State of the GUI element in case the content changes according to state.
-		 */
-		static Vector2I calcOptimalContentsSize(const GUIContent& content, const GUIElementStyle& style, 
-			const GUIDimensions& dimensions, GUIElementState state = GUIElementState::Normal);
-
-		/**
-		 * Calculates optimal content size for the provided text using the provided style and layout options for 
-		 * constraints.
-		 *
-		 * @param[in]	text			Text to calculate size for.
-		 * @param[in]	style			Style to use for determining size constraints.
-		 * @param[in]	dimensions		Dimension constraints of a GUI element.
-		 */
-		static Vector2I calcOptimalContentsSize(const WString& text, const GUIElementStyle& style, 
-			const GUIDimensions& dimensions);
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsTextSprite.h"
+#include "BsGUIContent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	Contains various helper methods used by GUI. */
+	class BS_EXPORT GUIHelper
+	{
+	public:
+		/**
+		 * Calculates optimal content size by returning the nearest valid size to the provided value.
+		 *
+		 * @param[in]	contentSize		Wanted content size. This will be limited by minimal constraints of the style and 
+		 *								layout options.
+		 * @param[in]	style			Style to use for determining size constraints.
+		 * @param[in]	dimensions		Dimension constraints of a GUI element.
+		 */
+		static Vector2I calcOptimalContentsSize(const Vector2I& contentSize, const GUIElementStyle& style, 
+			const GUIDimensions& dimensions);
+
+		/**
+		 * Calculates optimal content size for the provided content using the provided style and layout options for 
+		 * constraints.
+		 *
+		 * @param[in]	content			Content to calculate size for.
+		 * @param[in]	style			Style to use for determining size constraints.
+		 * @param[in]	dimensions		Dimension constraints of a GUI element.
+		 * @param[in]	state			State of the GUI element in case the content changes according to state.
+		 */
+		static Vector2I calcOptimalContentsSize(const GUIContent& content, const GUIElementStyle& style, 
+			const GUIDimensions& dimensions, GUIElementState state = GUIElementState::Normal);
+
+		/**
+		 * Calculates optimal content size for the provided text using the provided style and layout options for 
+		 * constraints.
+		 *
+		 * @param[in]	text			Text to calculate size for.
+		 * @param[in]	style			Style to use for determining size constraints.
+		 * @param[in]	dimensions		Dimension constraints of a GUI element.
+		 */
+		static Vector2I calcOptimalContentsSize(const WString& text, const GUIElementStyle& style, 
+			const GUIDimensions& dimensions);
+	};
+
+	/** @} */
 }
 }

+ 100 - 102
Source/BansheeEngine/Include/BsGUIInputCaret.h

@@ -1,103 +1,101 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsGUIInputTool.h"
-#include "BsTextSprite.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/** When paired with a character index determines should the caret be placed before or after it. */
-	enum CaretPos
-	{
-		CARET_BEFORE,
-		CARET_AFTER
-	};
-
-	/** Helper class for dealing with caret for text input boxes and similar controls. */
-	class BS_EXPORT GUIInputCaret : public GUIInputTool
-	{
-	public:
-		GUIInputCaret();
-		~GUIInputCaret();
-
-		/**	Returns sprite used for rendering the caret. */
-		ImageSprite* getSprite() const { return mCaretSprite; }
-
-		/** Returns offset relative to parent widget that determines placement of the caret sprite. */
-		Vector2I getSpriteOffset() const;
-
-		/**
-		 * Returns clip rectangle relative to parent GUI element that determines how is caret sprite clipped.
-		 *
-		 * @param[in]	parentClipRect	Clip rectangle of the parent GUI element. Caret clip rectangle will additionally be
-		 *								clipped by this area. Relative to parent element.
-		 */
-		Rect2I getSpriteClipRect(const Rect2I& parentClipRect) const;
-
-		/**	Rebuilts internal caret sprite using current properties. */
-		void updateSprite();
-
-		/**	Moves caret to the start of text. */
-		void moveCaretToStart();
-
-		/**	Moves caret to the end of text. */
-		void moveCaretToEnd();
-
-		/**	Moves caret one character to the left, if not at start already. */
-		void moveCaretLeft();
-
-		/**	Moves caret one character to the right, if not at end already. */
-		void moveCaretRight();
-
-		/**	Moves caret one line up if possible. */
-		void moveCaretUp();
-
-		/**	Moves caret one line down if possible. */
-		void moveCaretDown();
-
-		/** Moves caret to the character nearest to the specified position. Position is relative to parent widget. */
-		void moveCaretToPos(const Vector2I& pos);
-
-		/**
-		 * Moves the caret to a specific character index.
-		 *
-		 * @param[in]	charIdx		Index of the character to move the caret to.
-		 * @param[in]	caretPos	Whether to place the caret before or after the character.
-		 */
-		void moveCaretToChar(UINT32 charIdx, CaretPos caretPos);
-
-		/**	Returns character index after the current caret position. */
-		UINT32 getCharIdxAtCaretPos() const;
-
-		/**
-		 * Returns current caret position, relative to parent widget. Requires you to provide offset to text the caret is
-		 * used for (also relative to parent widget).
-		 */
-		Vector2I getCaretPosition(const Vector2I& offset) const;
-
-		/**	Returns height of the caret, in pixels. */
-		UINT32 getCaretHeight() const;
-
-		/**	Returns true if the character after the caret is newline. */
-		bool isCaretAtNewline() const;
-
-		/**	Returns maximum valid caret index. */
-		UINT32 getMaxCaretPos() const;
-
-		/**	Returns current caret index (not equal to character index). */
-		UINT32 getCaretPos() const { return mCaretPos; }
-	private:
-		UINT32 mCaretPos;
-		ImageSprite* mCaretSprite;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsGUIInputTool.h"
+#include "BsTextSprite.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/** When paired with a character index determines should the caret be placed before or after it. */
+	enum CaretPos
+	{
+		CARET_BEFORE,
+		CARET_AFTER
+	};
+
+	/** Helper class for dealing with caret for text input boxes and similar controls. */
+	class BS_EXPORT GUIInputCaret : public GUIInputTool
+	{
+	public:
+		GUIInputCaret();
+		~GUIInputCaret();
+
+		/**	Returns sprite used for rendering the caret. */
+		ImageSprite* getSprite() const { return mCaretSprite; }
+
+		/** Returns offset relative to parent widget that determines placement of the caret sprite. */
+		Vector2I getSpriteOffset() const;
+
+		/**
+		 * Returns clip rectangle relative to parent GUI element that determines how is caret sprite clipped.
+		 *
+		 * @param[in]	parentClipRect	Clip rectangle of the parent GUI element. Caret clip rectangle will additionally be
+		 *								clipped by this area. Relative to parent element.
+		 */
+		Rect2I getSpriteClipRect(const Rect2I& parentClipRect) const;
+
+		/**	Rebuilts internal caret sprite using current properties. */
+		void updateSprite();
+
+		/**	Moves caret to the start of text. */
+		void moveCaretToStart();
+
+		/**	Moves caret to the end of text. */
+		void moveCaretToEnd();
+
+		/**	Moves caret one character to the left, if not at start already. */
+		void moveCaretLeft();
+
+		/**	Moves caret one character to the right, if not at end already. */
+		void moveCaretRight();
+
+		/**	Moves caret one line up if possible. */
+		void moveCaretUp();
+
+		/**	Moves caret one line down if possible. */
+		void moveCaretDown();
+
+		/** Moves caret to the character nearest to the specified position. Position is relative to parent widget. */
+		void moveCaretToPos(const Vector2I& pos);
+
+		/**
+		 * Moves the caret to a specific character index.
+		 *
+		 * @param[in]	charIdx		Index of the character to move the caret to.
+		 * @param[in]	caretPos	Whether to place the caret before or after the character.
+		 */
+		void moveCaretToChar(UINT32 charIdx, CaretPos caretPos);
+
+		/**	Returns character index after the current caret position. */
+		UINT32 getCharIdxAtCaretPos() const;
+
+		/**
+		 * Returns current caret position, relative to parent widget. Requires you to provide offset to text the caret is
+		 * used for (also relative to parent widget).
+		 */
+		Vector2I getCaretPosition(const Vector2I& offset) const;
+
+		/**	Returns height of the caret, in pixels. */
+		UINT32 getCaretHeight() const;
+
+		/**	Returns true if the character after the caret is newline. */
+		bool isCaretAtNewline() const;
+
+		/**	Returns maximum valid caret index. */
+		UINT32 getMaxCaretPos() const;
+
+		/**	Returns current caret index (not equal to character index). */
+		UINT32 getCaretPos() const { return mCaretPos; }
+	private:
+		UINT32 mCaretPos;
+		ImageSprite* mCaretSprite;
+	};
+
+	/** @} */
 }
 }

+ 97 - 99
Source/BansheeEngine/Include/BsGUIInputSelection.h

@@ -1,100 +1,98 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsGUIInputTool.h"
-#include "BsTextSprite.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	Helper class for dealing with text selection for text input boxes and similar controls. */
-	class BS_EXPORT GUIInputSelection : public GUIInputTool
-	{
-	public:
-		GUIInputSelection();
-		~GUIInputSelection();
-
-		/**	Returns sprites representing the currently selected areas. */
-		const Vector<ImageSprite*>& getSprites() const { return mSprites; }
-
-		/** Returns how much to offset the sprite with the specified index, relative to the parent widget. */
-		Vector2I GUIInputSelection::getSelectionSpriteOffset(UINT32 spriteIdx) const;
-
-		/**
-		 * Returns clip rectangle relative to parent GUI element for the sprite with the specified index. 
-		 *
-		 * @param[in]	spriteIdx		Index of the sprite to retrieve the clip rectangle for.
-		 * @param[in]	parentClipRect	Clip rectangle of the parent GUI element. Selection clip rectangle will 
-		 *								additionally be clipped by this area. Relative to parent element.
-		 */
-		Rect2I GUIInputSelection::getSelectionSpriteClipRect(UINT32 spriteIdx, const Rect2I& parentClipRect) const;
-
-		/**	Recreates the selection clip sprites. */
-		void updateSprite();
-
-		/**
-		 * Shows the selection using the specified anchor. By default this will select 0 characters so you must manually
-		 * move the selection using moveSelectionToCaret() before anything is considered selected.
-		 *
-		 * @param[in]	anchorCaretPos	Anchor position which to initially select. Anchor position determines selection 
-		 *								area behavior when the input caret moves (determines whether left or right side of
-		 *								the selection will move with the caret).
-		 */
-		void showSelection(UINT32 anchorCaretPos);
-
-		/**	Clears the currently active selection. */
-		void clearSelection();
-
-		/**
-		 * Moves the selection to caret. Selected area will be from the anchor provided in showSelection() to the caret
-		 * position provided here.
-		 */
-		void moveSelectionToCaret(UINT32 caretPos);
-
-		/**	Checks is anything selected. */
-		bool isSelectionEmpty() const;
-
-		/**	Selects all available text. */
-		void selectAll();
-
-		/**
-		 * Starts selection drag at the specified caret position. Call selectionDragUpdate() and selectionDragEnd() as the
-		 * drag operation progresses.
-		 */
-		void selectionDragStart(UINT32 caretPos);
-
-		/**	Updates selection drag at the specified caret position. */
-		void selectionDragUpdate(UINT32 caretPos);
-
-		/**	Stops selection drag. */
-		void selectionDragEnd();
-
-		/**	Gets caret index of selection start. */
-		UINT32 getSelectionStart() const { return mSelectionStart; }
-
-		/**	Gets caret index of selection end. */
-		UINT32 getSelectionEnd() const { return mSelectionEnd; }
-
-	private:
-		/** Returns rectangles describing the currently selected areas. Rectangles are relative to parent GUI element. */
-		Vector<Rect2I> getSelectionRects() const;
-
-	private:
-		UINT32 mSelectionStart;
-		UINT32 mSelectionEnd;
-		UINT32 mSelectionAnchor;
-		UINT32 mSelectionDragAnchor;
-
-		Vector<Rect2I> mSelectionRects;
-		Vector<ImageSprite*> mSprites;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsGUIInputTool.h"
+#include "BsTextSprite.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	Helper class for dealing with text selection for text input boxes and similar controls. */
+	class BS_EXPORT GUIInputSelection : public GUIInputTool
+	{
+	public:
+		GUIInputSelection();
+		~GUIInputSelection();
+
+		/**	Returns sprites representing the currently selected areas. */
+		const Vector<ImageSprite*>& getSprites() const { return mSprites; }
+
+		/** Returns how much to offset the sprite with the specified index, relative to the parent widget. */
+		Vector2I GUIInputSelection::getSelectionSpriteOffset(UINT32 spriteIdx) const;
+
+		/**
+		 * Returns clip rectangle relative to parent GUI element for the sprite with the specified index. 
+		 *
+		 * @param[in]	spriteIdx		Index of the sprite to retrieve the clip rectangle for.
+		 * @param[in]	parentClipRect	Clip rectangle of the parent GUI element. Selection clip rectangle will 
+		 *								additionally be clipped by this area. Relative to parent element.
+		 */
+		Rect2I GUIInputSelection::getSelectionSpriteClipRect(UINT32 spriteIdx, const Rect2I& parentClipRect) const;
+
+		/**	Recreates the selection clip sprites. */
+		void updateSprite();
+
+		/**
+		 * Shows the selection using the specified anchor. By default this will select 0 characters so you must manually
+		 * move the selection using moveSelectionToCaret() before anything is considered selected.
+		 *
+		 * @param[in]	anchorCaretPos	Anchor position which to initially select. Anchor position determines selection 
+		 *								area behavior when the input caret moves (determines whether left or right side of
+		 *								the selection will move with the caret).
+		 */
+		void showSelection(UINT32 anchorCaretPos);
+
+		/**	Clears the currently active selection. */
+		void clearSelection();
+
+		/**
+		 * Moves the selection to caret. Selected area will be from the anchor provided in showSelection() to the caret
+		 * position provided here.
+		 */
+		void moveSelectionToCaret(UINT32 caretPos);
+
+		/**	Checks is anything selected. */
+		bool isSelectionEmpty() const;
+
+		/**	Selects all available text. */
+		void selectAll();
+
+		/**
+		 * Starts selection drag at the specified caret position. Call selectionDragUpdate() and selectionDragEnd() as the
+		 * drag operation progresses.
+		 */
+		void selectionDragStart(UINT32 caretPos);
+
+		/**	Updates selection drag at the specified caret position. */
+		void selectionDragUpdate(UINT32 caretPos);
+
+		/**	Stops selection drag. */
+		void selectionDragEnd();
+
+		/**	Gets caret index of selection start. */
+		UINT32 getSelectionStart() const { return mSelectionStart; }
+
+		/**	Gets caret index of selection end. */
+		UINT32 getSelectionEnd() const { return mSelectionEnd; }
+
+	private:
+		/** Returns rectangles describing the currently selected areas. Rectangles are relative to parent GUI element. */
+		Vector<Rect2I> getSelectionRects() const;
+
+	private:
+		UINT32 mSelectionStart;
+		UINT32 mSelectionEnd;
+		UINT32 mSelectionAnchor;
+		UINT32 mSelectionDragAnchor;
+
+		Vector<Rect2I> mSelectionRects;
+		Vector<ImageSprite*> mSprites;
+	};
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsGUIInputTool.h

@@ -7,8 +7,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -143,5 +142,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 71 - 73
Source/BansheeEngine/Include/BsGUILayoutData.h

@@ -1,74 +1,72 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRect2I.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**
-	 * Contains all attributes that are output by GUI layouts and assigned to GUI elements. This includes element position,
-	 * size and depth.
-	 */
-	struct BS_EXPORT GUILayoutData
-	{
-		GUILayoutData()
-			:depthRangeMin(-1), depthRangeMax(-1), depth(0)
-		{ 
-			setPanelDepth(0);
-		}
-
-		/**	Set widget part of element depth (Most significant part). */
-		void setWidgetDepth(UINT8 widgetDepth)
-		{
-			UINT32 shiftedDepth = widgetDepth << 24;
-
-			depth = shiftedDepth | (depth & 0x00FFFFFF);
-		}
-
-		/** Set panel part of element depth. Less significant than widget depth but more than custom element depth. */
-		void setPanelDepth(INT16 panelDepth)
-		{
-			UINT32 signedDepth = ((INT32)panelDepth + 32768) << 8;
-
-			depth = signedDepth | (depth & 0xFF0000FF);;
-		}
-
-		/**	Retrieve widget part of element depth (Most significant part). */
-		UINT8 getWidgetDepth() const
-		{
-			return (depth >> 24) & 0xFF;
-		}
-
-		/** Retrieve panel part of element depth. Less significant than widget depth but more than custom element depth. */
-		INT16 getPanelDepth() const
-		{
-			return (((INT32)depth >> 8) & 0xFFFF) - 32768;
-		}
-
-		/**	Returns a clip rectangle that is relative to the current bounds. */
-		Rect2I getLocalClipRect() const
-		{
-			Rect2I localClipRect = clipRect;
-			localClipRect.x -= area.x;
-			localClipRect.y -= area.y;
-
-			return localClipRect;
-		}
-
-		Rect2I area;
-		Rect2I clipRect;
-		UINT32 depth;
-		UINT16 depthRangeMin;
-		UINT16 depthRangeMax;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRect2I.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Contains all attributes that are output by GUI layouts and assigned to GUI elements. This includes element position,
+	 * size and depth.
+	 */
+	struct BS_EXPORT GUILayoutData
+	{
+		GUILayoutData()
+			:depthRangeMin(-1), depthRangeMax(-1), depth(0)
+		{ 
+			setPanelDepth(0);
+		}
+
+		/**	Set widget part of element depth (Most significant part). */
+		void setWidgetDepth(UINT8 widgetDepth)
+		{
+			UINT32 shiftedDepth = widgetDepth << 24;
+
+			depth = shiftedDepth | (depth & 0x00FFFFFF);
+		}
+
+		/** Set panel part of element depth. Less significant than widget depth but more than custom element depth. */
+		void setPanelDepth(INT16 panelDepth)
+		{
+			UINT32 signedDepth = ((INT32)panelDepth + 32768) << 8;
+
+			depth = signedDepth | (depth & 0xFF0000FF);;
+		}
+
+		/**	Retrieve widget part of element depth (Most significant part). */
+		UINT8 getWidgetDepth() const
+		{
+			return (depth >> 24) & 0xFF;
+		}
+
+		/** Retrieve panel part of element depth. Less significant than widget depth but more than custom element depth. */
+		INT16 getPanelDepth() const
+		{
+			return (((INT32)depth >> 8) & 0xFFFF) - 32768;
+		}
+
+		/**	Returns a clip rectangle that is relative to the current bounds. */
+		Rect2I getLocalClipRect() const
+		{
+			Rect2I localClipRect = clipRect;
+			localClipRect.x -= area.x;
+			localClipRect.y -= area.y;
+
+			return localClipRect;
+		}
+
+		Rect2I area;
+		Rect2I clipRect;
+		UINT32 depth;
+		UINT16 depthRangeMin;
+		UINT16 depthRangeMax;
+	};
+
+	/** @} */
 }
 }

+ 51 - 53
Source/BansheeEngine/Include/BsGUILayoutUtility.h

@@ -1,53 +1,51 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRect2I.h"
-#include "BsVector2I.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/** Helper class that performs various operations related to GUILayout and GUI element sizing/placement. */
-	class BS_EXPORT GUILayoutUtility
-	{
-	public:
-		/**
-		 * Calculates optimal size of a GUI element. This is the size that allows the GUI element to properly display all of
-		 * its content.
-		 */
-		static Vector2I calcOptimalSize(const GUIElementBase* elem);
-
-		/**
-		 * Calculates the size of elements in a layout of the specified size.
-		 * 
-		 * @param[in]	width				Width of the layout.
-		 * @param[in]	height				Height of the layout.
-		 * @param[in]	layout				Parent layout of the children to calculate the area for.
-		 * @param[in]	updateOptimalSizes	Optimization (doesn't change the results). Set to false if 
-		 *									GUIElementBase::_updateOptimalLayoutSizes was already called and optimal sizes
-		 *									are up to date to avoid recalculating them. (Normally that is true if this is 
-		 *									being called during GUI layout update)
-		 */
-		static Vector2I calcActualSize(UINT32 width, UINT32 height, GUILayout* layout, bool updateOptimalSizes = true);
-
-	private:
-		/**
-		 * Calculates the size of elements in a layout of the specified size. Assumes the layout and all its children
-		 * have updated optimal sizes.
-		 * 
-		 * @param[in]	width				Width of the layout.
-		 * @param[in]	height				Height of the layout.
-		 * @param[in]	layout				Parent layout of the children to calculate the area for.
-		 */
-		static Vector2I calcActualSizeInternal(UINT32 width, UINT32 height, GUILayout* layout);
-	};
-
-	/** @} */
-	/** @endcond */
-}
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRect2I.h"
+#include "BsVector2I.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/** Helper class that performs various operations related to GUILayout and GUI element sizing/placement. */
+	class BS_EXPORT GUILayoutUtility
+	{
+	public:
+		/**
+		 * Calculates optimal size of a GUI element. This is the size that allows the GUI element to properly display all of
+		 * its content.
+		 */
+		static Vector2I calcOptimalSize(const GUIElementBase* elem);
+
+		/**
+		 * Calculates the size of elements in a layout of the specified size.
+		 * 
+		 * @param[in]	width				Width of the layout.
+		 * @param[in]	height				Height of the layout.
+		 * @param[in]	layout				Parent layout of the children to calculate the area for.
+		 * @param[in]	updateOptimalSizes	Optimization (doesn't change the results). Set to false if 
+		 *									GUIElementBase::_updateOptimalLayoutSizes was already called and optimal sizes
+		 *									are up to date to avoid recalculating them. (Normally that is true if this is 
+		 *									being called during GUI layout update)
+		 */
+		static Vector2I calcActualSize(UINT32 width, UINT32 height, GUILayout* layout, bool updateOptimalSizes = true);
+
+	private:
+		/**
+		 * Calculates the size of elements in a layout of the specified size. Assumes the layout and all its children
+		 * have updated optimal sizes.
+		 * 
+		 * @param[in]	width				Width of the layout.
+		 * @param[in]	height				Height of the layout.
+		 * @param[in]	layout				Parent layout of the children to calculate the area for.
+		 */
+		static Vector2I calcActualSizeInternal(UINT32 width, UINT32 height, GUILayout* layout);
+	};
+
+	/** @} */
+}

+ 1 - 3
Source/BansheeEngine/Include/BsGUIManager.h

@@ -16,8 +16,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -470,5 +469,4 @@ namespace BansheeEngine
 	BS_EXPORT GUIManager& gGUIManager();
 	BS_EXPORT GUIManager& gGUIManager();
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsGUIMenu.h

@@ -8,8 +8,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -175,5 +174,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

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

@@ -1,124 +1,124 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGUISkin.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT GUISkinEntry : public IReflectable
-	{
-	public:
-		GUISkinEntry() { }
-		GUISkinEntry(const String& name, const GUIElementStyle& style);
-
-		String name;
-		GUIElementStyle style;
-
-	public:
-		friend class GUISkinEntryRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-	};
-
-	class BS_EXPORT GUISkinEntryRTTI : public RTTIType <GUISkinEntry, IReflectable, GUISkinEntryRTTI>
-	{
-	private:
-		String& getName(GUISkinEntry* obj) { return obj->name; }
-		void setName(GUISkinEntry* obj, String& val) { obj->name = val; }
-
-		GUIElementStyle& getStyle(GUISkinEntry* obj) { return obj->style; }
-		void setStyle(GUISkinEntry* obj, GUIElementStyle& val) { obj->style = val; }
-
-	public:
-		GUISkinEntryRTTI()
-		{
-			addPlainField("name", 0, &GUISkinEntryRTTI::getName, &GUISkinEntryRTTI::setName);
-			addReflectableField("style", 1, &GUISkinEntryRTTI::getStyle, &GUISkinEntryRTTI::setStyle);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "GUISkinEntry";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_GUISkinEntry;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<GUISkinEntry>();
-		}
-	};
-
-	class BS_EXPORT GUISkinRTTI : public RTTIType <GUISkin, Resource, GUISkinRTTI>
-	{
-	private:
-		GUISkinEntry& getStyle(GUISkin* obj, UINT32 idx) 
-		{ 
-			Vector<GUISkinEntry>& entries = any_cast_ref<Vector<GUISkinEntry>>(obj->mRTTIData);
-			
-			return entries[idx];
-		}
-
-		void setStyle(GUISkin* obj, UINT32 idx, GUISkinEntry& val) { obj->mStyles[val.name] = val.style; }
-		UINT32 getStyleArraySize(GUISkin* obj) { return (UINT32)obj->mStyles.size(); }
-		void setStyleArraySize(GUISkin* obj, UINT32 size) { /* Do nothing */ }
-
-	public:
-		GUISkinRTTI()
-		{
-			addReflectableArrayField("mStyles", 0, &GUISkinRTTI::getStyle, &GUISkinRTTI::getStyleArraySize,
-				&GUISkinRTTI::setStyle, &GUISkinRTTI::setStyleArraySize);
-		}
-
-		void onSerializationStarted(IReflectable* obj) override
-		{
-			GUISkin* skin = static_cast<GUISkin*>(obj);
-			Vector<GUISkinEntry> entries;
-
-			for (auto& style : skin->mStyles)
-			{
-				entries.push_back(GUISkinEntry(style.first, style.second));
-			}
-
-			skin->mRTTIData = entries;
-		}
-
-		void onSerializationEnded(IReflectable* obj) override
-		{
-			GUISkin* skin = static_cast<GUISkin*>(obj);
-
-			skin->mRTTIData = nullptr;
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "GUISkin";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_GUISkin;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GUISkin::_createPtr();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsGUISkin.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT GUISkinEntry : public IReflectable
+	{
+	public:
+		GUISkinEntry() { }
+		GUISkinEntry(const String& name, const GUIElementStyle& style);
+
+		String name;
+		GUIElementStyle style;
+
+	public:
+		friend class GUISkinEntryRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+	};
+
+	class BS_EXPORT GUISkinEntryRTTI : public RTTIType <GUISkinEntry, IReflectable, GUISkinEntryRTTI>
+	{
+	private:
+		String& getName(GUISkinEntry* obj) { return obj->name; }
+		void setName(GUISkinEntry* obj, String& val) { obj->name = val; }
+
+		GUIElementStyle& getStyle(GUISkinEntry* obj) { return obj->style; }
+		void setStyle(GUISkinEntry* obj, GUIElementStyle& val) { obj->style = val; }
+
+	public:
+		GUISkinEntryRTTI()
+		{
+			addPlainField("name", 0, &GUISkinEntryRTTI::getName, &GUISkinEntryRTTI::setName);
+			addReflectableField("style", 1, &GUISkinEntryRTTI::getStyle, &GUISkinEntryRTTI::setStyle);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "GUISkinEntry";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_GUISkinEntry;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<GUISkinEntry>();
+		}
+	};
+
+	class BS_EXPORT GUISkinRTTI : public RTTIType <GUISkin, Resource, GUISkinRTTI>
+	{
+	private:
+		GUISkinEntry& getStyle(GUISkin* obj, UINT32 idx) 
+		{ 
+			Vector<GUISkinEntry>& entries = any_cast_ref<Vector<GUISkinEntry>>(obj->mRTTIData);
+			
+			return entries[idx];
+		}
+
+		void setStyle(GUISkin* obj, UINT32 idx, GUISkinEntry& val) { obj->mStyles[val.name] = val.style; }
+		UINT32 getStyleArraySize(GUISkin* obj) { return (UINT32)obj->mStyles.size(); }
+		void setStyleArraySize(GUISkin* obj, UINT32 size) { /* Do nothing */ }
+
+	public:
+		GUISkinRTTI()
+		{
+			addReflectableArrayField("mStyles", 0, &GUISkinRTTI::getStyle, &GUISkinRTTI::getStyleArraySize,
+				&GUISkinRTTI::setStyle, &GUISkinRTTI::setStyleArraySize);
+		}
+
+		void onSerializationStarted(IReflectable* obj) override
+		{
+			GUISkin* skin = static_cast<GUISkin*>(obj);
+			Vector<GUISkinEntry> entries;
+
+			for (auto& style : skin->mStyles)
+			{
+				entries.push_back(GUISkinEntry(style.first, style.second));
+			}
+
+			skin->mRTTIData = entries;
+		}
+
+		void onSerializationEnded(IReflectable* obj) override
+		{
+			GUISkin* skin = static_cast<GUISkin*>(obj);
+
+			skin->mRTTIData = nullptr;
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "GUISkin";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_GUISkin;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GUISkin::_createPtr();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsGUISliderHandle.h

@@ -9,8 +9,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -150,5 +149,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 37 - 39
Source/BansheeEngine/Include/BsGUITooltip.h

@@ -1,40 +1,38 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsCGUIWidget.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	GUI widget that renders a tooltip overlaid over other GUI elements. */
-	class BS_EXPORT GUITooltip : public CGUIWidget
-	{
-	public:
-		/**	Name of the style used for tooltip's background frame. */
-		static String getFrameStyleName();
-
-		/**
-		 * Creates a new tooltip widget.
-		 *
-		 * @param[in]	parent			Parent scene object to attach the tooltip to.
-		 * @param[in]	overlaidWidget	Widget over which to overlay the tooltip.
-		 * @param[in]	position		Position of the tooltip, relative to the overlaid widget position.
-		 * @param[in]	text			Text to display in the tooltip.
-		 */
-		GUITooltip(const HSceneObject& parent, const GUIWidget& overlaidWidget, const Vector2I& position, const WString& text);
-		~GUITooltip();
-
-	private:
-		static const UINT32 TOOLTIP_WIDTH;
-		static const UINT32 CURSOR_SIZE;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsCGUIWidget.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	GUI widget that renders a tooltip overlaid over other GUI elements. */
+	class BS_EXPORT GUITooltip : public CGUIWidget
+	{
+	public:
+		/**	Name of the style used for tooltip's background frame. */
+		static String getFrameStyleName();
+
+		/**
+		 * Creates a new tooltip widget.
+		 *
+		 * @param[in]	parent			Parent scene object to attach the tooltip to.
+		 * @param[in]	overlaidWidget	Widget over which to overlay the tooltip.
+		 * @param[in]	position		Position of the tooltip, relative to the overlaid widget position.
+		 * @param[in]	text			Text to display in the tooltip.
+		 */
+		GUITooltip(const HSceneObject& parent, const GUIWidget& overlaidWidget, const Vector2I& position, const WString& text);
+		~GUITooltip();
+
+	private:
+		static const UINT32 TOOLTIP_WIDTH;
+		static const UINT32 CURSOR_SIZE;
+	};
+
+	/** @} */
 }
 }

+ 36 - 38
Source/BansheeEngine/Include/BsGUITooltipManager.h

@@ -1,39 +1,37 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsModule.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**	Manages displaying tooltips over GUI elements. */
-	class BS_EXPORT GUITooltipManager : public Module<GUITooltipManager>
-	{
-	public:
-		~GUITooltipManager();
-
-		/**
-		 * Shows a tooltip at the specified location. This will replace any previously shown tooltip.
-		 *
-		 * @param[in]	widget		GUI widget over which to display the tooltip.
-		 * @param[in]	position	Position of the tooltip, relative to the parent GUI widget.
-		 * @param[in]	text		Text to display on the tooltip.
-		 */
-		void show(const GUIWidget& widget, const Vector2I& position, const WString& text);
-
-		/**	Hides the currently shown tooltip. */
-		void hide();
-
-	private:
-		HSceneObject mTooltipSO;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsModule.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**	Manages displaying tooltips over GUI elements. */
+	class BS_EXPORT GUITooltipManager : public Module<GUITooltipManager>
+	{
+	public:
+		~GUITooltipManager();
+
+		/**
+		 * Shows a tooltip at the specified location. This will replace any previously shown tooltip.
+		 *
+		 * @param[in]	widget		GUI widget over which to display the tooltip.
+		 * @param[in]	position	Position of the tooltip, relative to the parent GUI widget.
+		 * @param[in]	text		Text to display on the tooltip.
+		 */
+		void show(const GUIWidget& widget, const Vector2I& position, const WString& text);
+
+		/**	Hides the currently shown tooltip. */
+		void hide();
+
+	private:
+		HSceneObject mTooltipSO;
+	};
+
+	/** @} */
 }
 }

+ 37 - 39
Source/BansheeEngine/Include/BsGameSettings.h

@@ -1,40 +1,38 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsIReflectable.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Utility-Engine
-	 *  @{
-	 */
-
-	/**
-	 * Contains settings used for controlling game start-up, as well as persisting various other properties through game
-	 * sessions.
-	 */
-	class BS_EXPORT GameSettings : public IReflectable
-	{
-	public:
-		String mainSceneUUID; /**< Resource UUID of the default scene that is loaded when the application is started. */
-		bool fullscreen = true; /**< If true the application will be started in fullscreen using user's desktop resolution. */
-		bool useDesktopResolution = true; /**< If running in fullscreen should the user's desktop resolution be used instead of the specified resolution. */
-		UINT32 resolutionWidth = 1280; /**< Width of the window. */
-		UINT32 resolutionHeight = 720; /**< Height of the window. */
-		WString titleBarText; /**< Text displayed in window's titlebar. */
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class GameSettingsRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsIReflectable.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Utility-Engine-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Contains settings used for controlling game start-up, as well as persisting various other properties through game
+	 * sessions.
+	 */
+	class BS_EXPORT GameSettings : public IReflectable
+	{
+	public:
+		String mainSceneUUID; /**< Resource UUID of the default scene that is loaded when the application is started. */
+		bool fullscreen = true; /**< If true the application will be started in fullscreen using user's desktop resolution. */
+		bool useDesktopResolution = true; /**< If running in fullscreen should the user's desktop resolution be used instead of the specified resolution. */
+		UINT32 resolutionWidth = 1280; /**< Width of the window. */
+		UINT32 resolutionHeight = 720; /**< Height of the window. */
+		WString titleBarText; /**< Text displayed in window's titlebar. */
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class GameSettingsRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }
 }

+ 66 - 66
Source/BansheeEngine/Include/BsGameSettingsRTTI.h

@@ -1,67 +1,67 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsGameSettings.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT GameSettingsRTTI : public RTTIType <GameSettings, IReflectable, GameSettingsRTTI>
-	{
-	private:
-		String& getMainSceneUUID(GameSettings* obj) { return obj->mainSceneUUID; }
-		void setMainSceneUUID(GameSettings* obj, String& val) { obj->mainSceneUUID = val; }
-
-		bool& getFullscreen(GameSettings* obj) { return obj->fullscreen; }
-		void setFullscreen(GameSettings* obj, bool& val) { obj->fullscreen = val; }
-
-		bool& getUseDesktopResolution(GameSettings* obj) { return obj->useDesktopResolution; }
-		void setUseDesktopResolution(GameSettings* obj, bool& val) { obj->useDesktopResolution = val; }
-
-		UINT32& getResolutionWidth(GameSettings* obj) { return obj->resolutionWidth; }
-		void setResolutionWidth(GameSettings* obj, UINT32& val) { obj->resolutionWidth = val; }
-
-		UINT32& getResolutionHeight(GameSettings* obj) { return obj->resolutionHeight; }
-		void setResolutionHeight(GameSettings* obj, UINT32& val) { obj->resolutionHeight = val; }
-
-		WString& getTitlebarText(GameSettings* obj) { return obj->titleBarText; }
-		void setTitlebarText(GameSettings* obj, WString& val) { obj->titleBarText = val; }
-
-	public:
-		GameSettingsRTTI()
-		{
-			addPlainField("mainSceneUUID", 0, &GameSettingsRTTI::getMainSceneUUID, &GameSettingsRTTI::setMainSceneUUID);
-			addPlainField("fullscreen", 1, &GameSettingsRTTI::getFullscreen, &GameSettingsRTTI::setFullscreen);
-			addPlainField("useDesktopResolution", 2, &GameSettingsRTTI::getUseDesktopResolution, &GameSettingsRTTI::setUseDesktopResolution);
-			addPlainField("resolutionWidth", 3, &GameSettingsRTTI::getResolutionWidth, &GameSettingsRTTI::setResolutionWidth);
-			addPlainField("resolutionHeight", 4, &GameSettingsRTTI::getResolutionHeight, &GameSettingsRTTI::setResolutionHeight);
-			addPlainField("titleBarText", 5, &GameSettingsRTTI::getTitlebarText, &GameSettingsRTTI::setTitlebarText);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "GameSettings";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_GameSettings;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<GameSettings>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsGameSettings.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT GameSettingsRTTI : public RTTIType <GameSettings, IReflectable, GameSettingsRTTI>
+	{
+	private:
+		String& getMainSceneUUID(GameSettings* obj) { return obj->mainSceneUUID; }
+		void setMainSceneUUID(GameSettings* obj, String& val) { obj->mainSceneUUID = val; }
+
+		bool& getFullscreen(GameSettings* obj) { return obj->fullscreen; }
+		void setFullscreen(GameSettings* obj, bool& val) { obj->fullscreen = val; }
+
+		bool& getUseDesktopResolution(GameSettings* obj) { return obj->useDesktopResolution; }
+		void setUseDesktopResolution(GameSettings* obj, bool& val) { obj->useDesktopResolution = val; }
+
+		UINT32& getResolutionWidth(GameSettings* obj) { return obj->resolutionWidth; }
+		void setResolutionWidth(GameSettings* obj, UINT32& val) { obj->resolutionWidth = val; }
+
+		UINT32& getResolutionHeight(GameSettings* obj) { return obj->resolutionHeight; }
+		void setResolutionHeight(GameSettings* obj, UINT32& val) { obj->resolutionHeight = val; }
+
+		WString& getTitlebarText(GameSettings* obj) { return obj->titleBarText; }
+		void setTitlebarText(GameSettings* obj, WString& val) { obj->titleBarText = val; }
+
+	public:
+		GameSettingsRTTI()
+		{
+			addPlainField("mainSceneUUID", 0, &GameSettingsRTTI::getMainSceneUUID, &GameSettingsRTTI::setMainSceneUUID);
+			addPlainField("fullscreen", 1, &GameSettingsRTTI::getFullscreen, &GameSettingsRTTI::setFullscreen);
+			addPlainField("useDesktopResolution", 2, &GameSettingsRTTI::getUseDesktopResolution, &GameSettingsRTTI::setUseDesktopResolution);
+			addPlainField("resolutionWidth", 3, &GameSettingsRTTI::getResolutionWidth, &GameSettingsRTTI::setResolutionWidth);
+			addPlainField("resolutionHeight", 4, &GameSettingsRTTI::getResolutionHeight, &GameSettingsRTTI::setResolutionHeight);
+			addPlainField("titleBarText", 5, &GameSettingsRTTI::getTitlebarText, &GameSettingsRTTI::setTitlebarText);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "GameSettings";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_GameSettings;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<GameSettings>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 2 - 1
Source/BansheeEngine/Include/BsImageSprite.h

@@ -31,7 +31,8 @@ namespace BansheeEngine
 		SpriteTexturePtr texture; /**< Texture to overlay on the sprite. */
 		SpriteTexturePtr texture; /**< Texture to overlay on the sprite. */
 		Color color; /**< Color tint to apply to the sprite. */
 		Color color; /**< Color tint to apply to the sprite. */
 
 
-		/** Borders (in texels) that allow you to control how is the texture scaled. If borders are 0 the texture will be 
+		/** 
+		 * Borders (in texels) that allow you to control how is the texture scaled. If borders are 0 the texture will be 
 		 * scaled uniformly. If they are not null only the area inside the borders will be scaled and the outside are will
 		 * scaled uniformly. If they are not null only the area inside the borders will be scaled and the outside are will
 		 * remain the original size as in the texture. This allows you to implement "Scale9Grid" functionality.
 		 * remain the original size as in the texture. This allows you to implement "Scale9Grid" functionality.
 		 */
 		 */

+ 294 - 296
Source/BansheeEngine/Include/BsLight.h

@@ -1,297 +1,295 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsIReflectable.h"
-#include "BsVector3.h"
-#include "BsQuaternion.h"
-#include "BsColor.h"
-#include "BsSphere.h"
-#include "BsCoreObject.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/** Light type that determines how is light information parsed by the renderer and other systems. */
-	enum class LightType
-	{
-		Directional, 
-		Point, 
-		Spot
-	};
-
-	/**	Signals which portion of a LightInternal is dirty. */
-	enum class LightDirtyFlag
-	{
-		Transform = 0x01,
-		Everything = 0x02
-	};
-
-	/** @} */
-
-	/** @addtogroup Implementation
-	 *  @{
-	 */
-
-	/**
-	 * Illuminates a portion of the scene covered by a light. Base class for both sim and core thread Light implementations.
-	 */
-	class BS_EXPORT LightBase
-	{
-	public:
-		LightBase();
-		LightBase(LightType type, Color color, float intensity, float range, 
-			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
-
-		virtual ~LightBase() { }
-
-		/**	Returns the position of the light, in world space. */
-		Vector3 getPosition() const { return mPosition; }
-
-		/**	Sets the position of the light, in world space. */
-		void setPosition(const Vector3& position) { mPosition = position; _markCoreDirty(); updateBounds(); }
-
-		/**	Returns the rotation of the light, in world space. */
-		Quaternion getRotation() const { return mRotation; }
-
-		/**	Sets the rotation of the light, in world space. */
-		void setRotation(const Quaternion& rotation) { mRotation = rotation; _markCoreDirty(); updateBounds(); }
-
-		/**	Returns the type of the light. */
-		LightType getType() const { return mType; }
-
-		/**	Changes the type of the light. */
-		void setType(LightType type) { mType = type; _markCoreDirty(); updateBounds(); }
-
-		/**	Checks does this light cast shadows when rendered. */
-		bool getCastsShadow() const { return mCastsShadows; }
-
-		/**	Sets whether this light will cast shadows when rendered. */
-		void setCastsShadow(bool castsShadow) { mCastsShadows = castsShadow; _markCoreDirty(); }
-
-		/**	Returns the color emitted from the light. */
-		Color getColor() const { return mColor; }
-
-		/**	Sets the color emitted from the light. */
-		void setColor(const Color& color) { mColor = color; _markCoreDirty(); }
-
-		/**	Returns the maximum range of the light. Light will not affect any geometry past that point. */
-		float getRange() const { return mRange; }
-
-		/**
-		 * Sets the maximum range of the light. Light will not affect any geometry past that point. Value is ignored if
-		 * physically based attenuation is active.
-		 *
-		 * @note	Normally you want to set this at a point where light intensity is too low due to attenuation.
-		 */
-		void setRange(float range);
-
-		/** 
-		 * Checks is physically based attenuation active. If true the range and attenuation of the light are controlled
-		 * by inverse square of distance. If false then the user is allowed to set the range and attenuation is adjusted
-		 * accordingly. 
-		 */
-		bool getPhysicallyBasedAttenuation() const { return mPhysCorrectAtten; }
-
-		/** 
-		 * Activates or deactivates physically based attenuation. If true the range and attenuation of the light are 
-		 * controlled by inverse square of distance. If false then the user is allowed to set the range and attenuation is 
-		 * adjusted accordingly. 
-		 */
-		void setPhysicallyBasedAttenuation(bool enabled);
-
-		/**
-		 * Gets the power of the light source. This is luminous flux for point & spot lights, and radiance for directional 
-		 * lights.
-		 */
-		float getIntensity() const { return mIntensity; }
-
-		/**
-		 * Sets the power of the light source. This will be luminous flux for point & spot lights, and radiance for 
-		 * directional lights.
-		 */
-		void setIntensity(float intensity);
-
-		/**	Gets the total angle covered by a spot light. */
-		Degree getSpotAngle() const { return mSpotAngle; }
-
-		/**	Sets the total angle covered by a spot light. */
-		void setSpotAngle(const Degree& spotAngle) { mSpotAngle = spotAngle; _markCoreDirty(); updateBounds(); }
-
-		/**
-		 * Gets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
-		 * starts quadratically falling off as the angle approaches the total spot angle.
-		 */
-		Degree getSpotFalloffAngle() const { return mSpotFalloffAngle; }
-
-		/**
-		 * Sets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
-		 * starts quadratically falling off as the angle approaches the total spot angle.
-		 */
-		void setSpotFalloffAngle(const Degree& spotFallofAngle) 
-		{ mSpotFalloffAngle = spotFallofAngle; _markCoreDirty(); updateBounds(); }
-
-		/**	Returns world space bounds that completely encompass the light's area of influence. */
-		Sphere getBounds() const { return mBounds; }
-
-		/**
-		 * Returns the radiance of the light source. This is the value that should be used in lighting equations.
-		 *
-		 * @note	
-		 * Ignores the light direction, therefore caller must ensure to properly handle non-uniform emitters like spot 
-		 * lights.
-		 */
-		float getRadiance() const;
-
-		/**	Checks whether the light should be rendered or not. */
-		bool getIsActive() const { return mIsActive; }
-
-		/**	Sets whether the light should be rendered or not. */
-		void setIsActive(bool active) { mIsActive = active; _markCoreDirty(); }
-
-		/** @copydoc CoreObject::markCoreDirty */
-		virtual void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) { }
-
-	protected:
-		/** Updates the internal bounds for the light. Call this whenever a property affecting the bounds changes. */
-		void updateBounds();
-
-		/** Calculates maximum light range based on light intensity. */
-		void updatePhysicallyCorrectRange();
-
-		Vector3 mPosition; /**< World space position. */
-		Quaternion mRotation; /**< World space rotation. */
-
-		LightType mType; /**< Type of light that determines how are the rest of the parameters interpreted. */
-		bool mCastsShadows; /**< Determines whether the light casts shadows. */
-		Color mColor; /**< Color of the light. */
-		float mRange; /**< Cut off range for the light when rendering. */
-		float mIntensity; /**< Power of the light source. This will be luminous flux for point & spot lights, and radiance for directional lights. */
-		Degree mSpotAngle; /**< Total angle covered by a spot light. */
-		Degree mSpotFalloffAngle; /**< Spot light angle at which falloff starts. Must be smaller than total angle. */
-		bool mIsActive; /**< Whether the light should be rendered or not. */
-		Sphere mBounds; /**< Sphere that bounds the light area of influence. */
-		bool mPhysCorrectAtten; /**< Determines is physically based attentuation active. */
-	};
-
-	/** @} */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/**
-	 * Core thread usable version of a light.
-	 *
-	 * @see		LightBase
-	 */
-	class BS_EXPORT LightCore : public CoreObjectCore, public LightBase
-	{
-	public:
-		~LightCore();
-
-		/**	Sets an ID that can be used for uniquely identifying this object by the renderer. */
-		void setRendererId(UINT32 id) { mRendererId = id; }
-
-		/**	Retrieves an ID that can be used for uniquely identifying this object by the renderer. */
-		UINT32 getRendererId() const { return mRendererId; }
-
-		/**	Returns a mesh that represents the light's bounds. */
-		SPtr<MeshCore> getMesh() const;
-
-		static const UINT32 LIGHT_CONE_NUM_SIDES;
-		static const UINT32 LIGHT_CONE_NUM_SLICES;
-	protected:
-		friend class Light;
-
-		LightCore(LightType type, Color color, float intensity, 
-			float range, bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
-
-		/** @copydoc CoreObjectCore::initialize */
-		void initialize() override;
-
-		/** @copydoc CoreObject::syncToCore */
-		void syncToCore(const CoreSyncData& data) override;
-
-		UINT32 mRendererId;
-		SPtr<MeshCore> mMesh;
-	};
-
-	/**
-	 * Sim thread usable version of a light.
-	 *
-	 * @see		LightBase
-	 */
-	class BS_EXPORT Light : public IReflectable, public CoreObject, public LightBase
-	{
-	public:
-		/**	Retrieves an implementation of a light usable only from the core thread. */
-		SPtr<LightCore> getCore() const;
-
-		/** Returns the hash value that can be used to identify if the internal data needs an update. */
-		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
-
-		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
-		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
-
-		/**
-		 * Updates internal transform values from the specified scene object, in case that scene object's transform changed
-		 * since the last call.
-		 *
-		 * @note	Assumes the same scene object will be provided every time.
-		 */
-		void _updateTransform(const HSceneObject& parent);
-
-		/**
-		 * Creates a new light with provided settings.
-		 *
-		 * @param[in]	type				Type of light that determines how are the rest of the parameters interpreted.
-		 * @param[in]	color				Color of the light.
-		 * @param[in]	intensity			Power of the light source. This will be luminous flux for point & spot lights, 
-		 *									and radiance for directional lights.
-		 * @param[in]	range				Cut off range for the light when rendering.
-		 * @param[in]	castsShadows		Determines whether the light casts shadows.
-		 * @param[in]	spotAngle			Total angle covered by a spot light.
-		 * @param[in]	spotFalloffAngle	Spot light angle at which falloff starts. Must be smaller than total angle.
-		 */
-		static SPtr<Light> create(LightType type = LightType::Point, Color color = Color::White,
-			float intensity = 100.0f, float range = 10.0f, bool castsShadows = false,
-			Degree spotAngle = Degree(45), Degree spotFalloffAngle = Degree(40));
-
-	protected:
-		Light(LightType type, Color color, float intensity, float range, 
-			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
-
-		/** @copydoc CoreObject::createCore */
-		SPtr<CoreObjectCore> createCore() const override;
-
-		/** @copydoc CoreObject::markCoreDirty */
-		void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) override;
-
-		/** @copydoc CoreObject::syncToCore */
-		CoreSyncData syncToCore(FrameAlloc* allocator) override;
-
-		/**	Creates a light with without initializing it. Used for serialization. */
-		static SPtr<Light> createEmpty();
-
-		UINT32 mLastUpdateHash;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class LightRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-
-	protected:
-		Light(); // Serialization only
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsIReflectable.h"
+#include "BsVector3.h"
+#include "BsQuaternion.h"
+#include "BsColor.h"
+#include "BsSphere.h"
+#include "BsCoreObject.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/** Light type that determines how is light information parsed by the renderer and other systems. */
+	enum class LightType
+	{
+		Directional, 
+		Point, 
+		Spot
+	};
+
+	/**	Signals which portion of a LightInternal is dirty. */
+	enum class LightDirtyFlag
+	{
+		Transform = 0x01,
+		Everything = 0x02
+	};
+
+	/** @} */
+
+	/** @addtogroup Implementation
+	 *  @{
+	 */
+
+	/**
+	 * Illuminates a portion of the scene covered by a light. Base class for both sim and core thread Light implementations.
+	 */
+	class BS_EXPORT LightBase
+	{
+	public:
+		LightBase();
+		LightBase(LightType type, Color color, float intensity, float range, 
+			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
+
+		virtual ~LightBase() { }
+
+		/**	Returns the position of the light, in world space. */
+		Vector3 getPosition() const { return mPosition; }
+
+		/**	Sets the position of the light, in world space. */
+		void setPosition(const Vector3& position) { mPosition = position; _markCoreDirty(); updateBounds(); }
+
+		/**	Returns the rotation of the light, in world space. */
+		Quaternion getRotation() const { return mRotation; }
+
+		/**	Sets the rotation of the light, in world space. */
+		void setRotation(const Quaternion& rotation) { mRotation = rotation; _markCoreDirty(); updateBounds(); }
+
+		/**	Returns the type of the light. */
+		LightType getType() const { return mType; }
+
+		/**	Changes the type of the light. */
+		void setType(LightType type) { mType = type; _markCoreDirty(); updateBounds(); }
+
+		/**	Checks does this light cast shadows when rendered. */
+		bool getCastsShadow() const { return mCastsShadows; }
+
+		/**	Sets whether this light will cast shadows when rendered. */
+		void setCastsShadow(bool castsShadow) { mCastsShadows = castsShadow; _markCoreDirty(); }
+
+		/**	Returns the color emitted from the light. */
+		Color getColor() const { return mColor; }
+
+		/**	Sets the color emitted from the light. */
+		void setColor(const Color& color) { mColor = color; _markCoreDirty(); }
+
+		/**	Returns the maximum range of the light. Light will not affect any geometry past that point. */
+		float getRange() const { return mRange; }
+
+		/**
+		 * Sets the maximum range of the light. Light will not affect any geometry past that point. Value is ignored if
+		 * physically based attenuation is active.
+		 *
+		 * @note	Normally you want to set this at a point where light intensity is too low due to attenuation.
+		 */
+		void setRange(float range);
+
+		/** 
+		 * Checks is physically based attenuation active. If true the range and attenuation of the light are controlled
+		 * by inverse square of distance. If false then the user is allowed to set the range and attenuation is adjusted
+		 * accordingly. 
+		 */
+		bool getPhysicallyBasedAttenuation() const { return mPhysCorrectAtten; }
+
+		/** 
+		 * Activates or deactivates physically based attenuation. If true the range and attenuation of the light are 
+		 * controlled by inverse square of distance. If false then the user is allowed to set the range and attenuation is 
+		 * adjusted accordingly. 
+		 */
+		void setPhysicallyBasedAttenuation(bool enabled);
+
+		/**
+		 * Gets the power of the light source. This is luminous flux for point & spot lights, and radiance for directional 
+		 * lights.
+		 */
+		float getIntensity() const { return mIntensity; }
+
+		/**
+		 * Sets the power of the light source. This will be luminous flux for point & spot lights, and radiance for 
+		 * directional lights.
+		 */
+		void setIntensity(float intensity);
+
+		/**	Gets the total angle covered by a spot light. */
+		Degree getSpotAngle() const { return mSpotAngle; }
+
+		/**	Sets the total angle covered by a spot light. */
+		void setSpotAngle(const Degree& spotAngle) { mSpotAngle = spotAngle; _markCoreDirty(); updateBounds(); }
+
+		/**
+		 * Gets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
+		 * starts quadratically falling off as the angle approaches the total spot angle.
+		 */
+		Degree getSpotFalloffAngle() const { return mSpotFalloffAngle; }
+
+		/**
+		 * Sets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
+		 * starts quadratically falling off as the angle approaches the total spot angle.
+		 */
+		void setSpotFalloffAngle(const Degree& spotFallofAngle) 
+		{ mSpotFalloffAngle = spotFallofAngle; _markCoreDirty(); updateBounds(); }
+
+		/**	Returns world space bounds that completely encompass the light's area of influence. */
+		Sphere getBounds() const { return mBounds; }
+
+		/**
+		 * Returns the radiance of the light source. This is the value that should be used in lighting equations.
+		 *
+		 * @note	
+		 * Ignores the light direction, therefore caller must ensure to properly handle non-uniform emitters like spot 
+		 * lights.
+		 */
+		float getRadiance() const;
+
+		/**	Checks whether the light should be rendered or not. */
+		bool getIsActive() const { return mIsActive; }
+
+		/**	Sets whether the light should be rendered or not. */
+		void setIsActive(bool active) { mIsActive = active; _markCoreDirty(); }
+
+		/** @copydoc CoreObject::markCoreDirty */
+		virtual void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) { }
+
+	protected:
+		/** Updates the internal bounds for the light. Call this whenever a property affecting the bounds changes. */
+		void updateBounds();
+
+		/** Calculates maximum light range based on light intensity. */
+		void updatePhysicallyCorrectRange();
+
+		Vector3 mPosition; /**< World space position. */
+		Quaternion mRotation; /**< World space rotation. */
+
+		LightType mType; /**< Type of light that determines how are the rest of the parameters interpreted. */
+		bool mCastsShadows; /**< Determines whether the light casts shadows. */
+		Color mColor; /**< Color of the light. */
+		float mRange; /**< Cut off range for the light when rendering. */
+		float mIntensity; /**< Power of the light source. This will be luminous flux for point & spot lights, and radiance for directional lights. */
+		Degree mSpotAngle; /**< Total angle covered by a spot light. */
+		Degree mSpotFalloffAngle; /**< Spot light angle at which falloff starts. Must be smaller than total angle. */
+		bool mIsActive; /**< Whether the light should be rendered or not. */
+		Sphere mBounds; /**< Sphere that bounds the light area of influence. */
+		bool mPhysCorrectAtten; /**< Determines is physically based attentuation active. */
+	};
+
+	/** @} */
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Core thread usable version of a light.
+	 *
+	 * @see		LightBase
+	 */
+	class BS_EXPORT LightCore : public CoreObjectCore, public LightBase
+	{
+	public:
+		~LightCore();
+
+		/**	Sets an ID that can be used for uniquely identifying this object by the renderer. */
+		void setRendererId(UINT32 id) { mRendererId = id; }
+
+		/**	Retrieves an ID that can be used for uniquely identifying this object by the renderer. */
+		UINT32 getRendererId() const { return mRendererId; }
+
+		/**	Returns a mesh that represents the light's bounds. */
+		SPtr<MeshCore> getMesh() const;
+
+		static const UINT32 LIGHT_CONE_NUM_SIDES;
+		static const UINT32 LIGHT_CONE_NUM_SLICES;
+	protected:
+		friend class Light;
+
+		LightCore(LightType type, Color color, float intensity, 
+			float range, bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
+
+		/** @copydoc CoreObjectCore::initialize */
+		void initialize() override;
+
+		/** @copydoc CoreObject::syncToCore */
+		void syncToCore(const CoreSyncData& data) override;
+
+		UINT32 mRendererId;
+		SPtr<MeshCore> mMesh;
+	};
+
+	/**
+	 * Sim thread usable version of a light.
+	 *
+	 * @see		LightBase
+	 */
+	class BS_EXPORT Light : public IReflectable, public CoreObject, public LightBase
+	{
+	public:
+		/**	Retrieves an implementation of a light usable only from the core thread. */
+		SPtr<LightCore> getCore() const;
+
+		/** Returns the hash value that can be used to identify if the internal data needs an update. */
+		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
+
+		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
+		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
+
+		/**
+		 * Updates internal transform values from the specified scene object, in case that scene object's transform changed
+		 * since the last call.
+		 *
+		 * @note	Assumes the same scene object will be provided every time.
+		 */
+		void _updateTransform(const HSceneObject& parent);
+
+		/**
+		 * Creates a new light with provided settings.
+		 *
+		 * @param[in]	type				Type of light that determines how are the rest of the parameters interpreted.
+		 * @param[in]	color				Color of the light.
+		 * @param[in]	intensity			Power of the light source. This will be luminous flux for point & spot lights, 
+		 *									and radiance for directional lights.
+		 * @param[in]	range				Cut off range for the light when rendering.
+		 * @param[in]	castsShadows		Determines whether the light casts shadows.
+		 * @param[in]	spotAngle			Total angle covered by a spot light.
+		 * @param[in]	spotFalloffAngle	Spot light angle at which falloff starts. Must be smaller than total angle.
+		 */
+		static SPtr<Light> create(LightType type = LightType::Point, Color color = Color::White,
+			float intensity = 100.0f, float range = 10.0f, bool castsShadows = false,
+			Degree spotAngle = Degree(45), Degree spotFalloffAngle = Degree(40));
+
+	protected:
+		Light(LightType type, Color color, float intensity, float range, 
+			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
+
+		/** @copydoc CoreObject::createCore */
+		SPtr<CoreObjectCore> createCore() const override;
+
+		/** @copydoc CoreObject::markCoreDirty */
+		void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) override;
+
+		/** @copydoc CoreObject::syncToCore */
+		CoreSyncData syncToCore(FrameAlloc* allocator) override;
+
+		/**	Creates a light with without initializing it. Used for serialization. */
+		static SPtr<Light> createEmpty();
+
+		UINT32 mLastUpdateHash;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class LightRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+
+	protected:
+		Light(); // Serialization only
+	};
+
+	/** @} */
 }
 }

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

@@ -1,90 +1,90 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsLight.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT LightRTTI : public RTTIType <Light, IReflectable, LightRTTI>
-	{
-	private:
-		Vector3& getPosition(Light* obj) { return obj->mPosition; }
-		void setPosition(Light* obj, Vector3& position) { obj->mPosition = position; }
-
-		Quaternion& getRotation(Light* obj) { return obj->mRotation; }
-		void setRotation(Light* obj, Quaternion& rotation) { obj->mRotation = rotation; }
-
-		LightType& getType(Light* obj) { return obj->mType; }
-		void setType(Light* obj, LightType& type) { obj->mType = type; }
-
-		bool& getCastsShadow(Light* obj) { return obj->mCastsShadows; }
-		void setCastsShadow(Light* obj, bool& castsShadow) { obj->mCastsShadows = castsShadow; }
-
-		Color& getColor(Light* obj) { return obj->mColor; }
-		void setColor(Light* obj, Color& color) { obj->mColor = color; }
-
-		float& getRange(Light* obj) { return obj->mRange; }
-		void setRange(Light* obj, float& range) { obj->mRange = range; }
-
-		float& getIntensity(Light* obj) { return obj->mIntensity; }
-		void setIntensity(Light* obj, float& intensity) { obj->mIntensity = intensity; }
-
-		Degree& getSpotAngle(Light* obj) { return obj->mSpotAngle; }
-		void setSpotAngle(Light* obj, Degree& spotAngle) { obj->mSpotAngle = spotAngle; }
-
-		Degree& getSpotFalloffAngle(Light* obj) { return obj->mSpotFalloffAngle; }
-		void setSpotFalloffAngle(Light* obj, Degree& spotAngle) { obj->mSpotFalloffAngle = spotAngle; }
-
-		bool& getPhysCorrectAtten(Light* obj) { return obj->mPhysCorrectAtten; }
-		void setPhysCorrectAtten(Light* obj, bool& value) { obj->mPhysCorrectAtten = value; }
-	public:
-		LightRTTI()
-		{
-			addPlainField("mPosition", 0, &LightRTTI::getPosition, &LightRTTI::setPosition);
-			addPlainField("mRotation", 1, &LightRTTI::getRotation, &LightRTTI::setRotation);
-			addPlainField("mType", 2, &LightRTTI::getType, &LightRTTI::setType);
-			addPlainField("mCastsShadow", 3, &LightRTTI::getCastsShadow, &LightRTTI::setCastsShadow);
-			addPlainField("mColor", 4, &LightRTTI::getColor, &LightRTTI::setColor);
-			addPlainField("mRange", 5, &LightRTTI::getRange, &LightRTTI::setRange);
-			addPlainField("mIntensity", 6, &LightRTTI::getIntensity, &LightRTTI::setIntensity);
-			addPlainField("mSpotAngle", 7, &LightRTTI::getSpotAngle, &LightRTTI::setSpotAngle);
-			addPlainField("mSpotFalloffAngle", 8, &LightRTTI::getSpotFalloffAngle, &LightRTTI::setSpotFalloffAngle);
-			addPlainField("mPhysCorrectAtten", 9, &LightRTTI::getPhysCorrectAtten, &LightRTTI::setPhysCorrectAtten);
-		}
-
-		void onDeserializationEnded(IReflectable* obj) override
-		{
-			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
-			// but since this specific type is used in Components we delay initialization until Component
-			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
-			// purposes (you'll need to call initialize manually).
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "Light";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_Light;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return Light::createEmpty();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsLight.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT LightRTTI : public RTTIType <Light, IReflectable, LightRTTI>
+	{
+	private:
+		Vector3& getPosition(Light* obj) { return obj->mPosition; }
+		void setPosition(Light* obj, Vector3& position) { obj->mPosition = position; }
+
+		Quaternion& getRotation(Light* obj) { return obj->mRotation; }
+		void setRotation(Light* obj, Quaternion& rotation) { obj->mRotation = rotation; }
+
+		LightType& getType(Light* obj) { return obj->mType; }
+		void setType(Light* obj, LightType& type) { obj->mType = type; }
+
+		bool& getCastsShadow(Light* obj) { return obj->mCastsShadows; }
+		void setCastsShadow(Light* obj, bool& castsShadow) { obj->mCastsShadows = castsShadow; }
+
+		Color& getColor(Light* obj) { return obj->mColor; }
+		void setColor(Light* obj, Color& color) { obj->mColor = color; }
+
+		float& getRange(Light* obj) { return obj->mRange; }
+		void setRange(Light* obj, float& range) { obj->mRange = range; }
+
+		float& getIntensity(Light* obj) { return obj->mIntensity; }
+		void setIntensity(Light* obj, float& intensity) { obj->mIntensity = intensity; }
+
+		Degree& getSpotAngle(Light* obj) { return obj->mSpotAngle; }
+		void setSpotAngle(Light* obj, Degree& spotAngle) { obj->mSpotAngle = spotAngle; }
+
+		Degree& getSpotFalloffAngle(Light* obj) { return obj->mSpotFalloffAngle; }
+		void setSpotFalloffAngle(Light* obj, Degree& spotAngle) { obj->mSpotFalloffAngle = spotAngle; }
+
+		bool& getPhysCorrectAtten(Light* obj) { return obj->mPhysCorrectAtten; }
+		void setPhysCorrectAtten(Light* obj, bool& value) { obj->mPhysCorrectAtten = value; }
+	public:
+		LightRTTI()
+		{
+			addPlainField("mPosition", 0, &LightRTTI::getPosition, &LightRTTI::setPosition);
+			addPlainField("mRotation", 1, &LightRTTI::getRotation, &LightRTTI::setRotation);
+			addPlainField("mType", 2, &LightRTTI::getType, &LightRTTI::setType);
+			addPlainField("mCastsShadow", 3, &LightRTTI::getCastsShadow, &LightRTTI::setCastsShadow);
+			addPlainField("mColor", 4, &LightRTTI::getColor, &LightRTTI::setColor);
+			addPlainField("mRange", 5, &LightRTTI::getRange, &LightRTTI::setRange);
+			addPlainField("mIntensity", 6, &LightRTTI::getIntensity, &LightRTTI::setIntensity);
+			addPlainField("mSpotAngle", 7, &LightRTTI::getSpotAngle, &LightRTTI::setSpotAngle);
+			addPlainField("mSpotFalloffAngle", 8, &LightRTTI::getSpotFalloffAngle, &LightRTTI::setSpotFalloffAngle);
+			addPlainField("mPhysCorrectAtten", 9, &LightRTTI::getPhysCorrectAtten, &LightRTTI::setPhysCorrectAtten);
+		}
+
+		void onDeserializationEnded(IReflectable* obj) override
+		{
+			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
+			// but since this specific type is used in Components we delay initialization until Component
+			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
+			// purposes (you'll need to call initialize manually).
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "Light";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_Light;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return Light::createEmpty();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsPaths.h

@@ -4,8 +4,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup Utility-Engine
+	/** @addtogroup Utility-Engine-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -55,5 +54,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 33 - 35
Source/BansheeEngine/Include/BsPlainTextImporter.h

@@ -1,36 +1,34 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsSpecificImporter.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Resources-Engine
-	 *  @{
-	 */
-
-	/**	Imports plain text files (.txt, .xml, .json). */
-	class BS_EXPORT PlainTextImporter : public SpecificImporter
-	{
-	public:
-		PlainTextImporter();
-		virtual ~PlainTextImporter();
-
-		/** @copydoc SpecificImporter::isExtensionSupported */
-		virtual bool isExtensionSupported(const WString& ext) const override;
-
-		/** @copydoc SpecificImporter::isMagicNumberSupported */
-		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const override;
-
-		/** @copydoc SpecificImporter::import */
-		virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions) override;
-
-		static const WString DEFAULT_EXTENSION;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsSpecificImporter.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Resources-Engine-Internal
+	 *  @{
+	 */
+
+	/**	Imports plain text files (.txt, .xml, .json). */
+	class BS_EXPORT PlainTextImporter : public SpecificImporter
+	{
+	public:
+		PlainTextImporter();
+		virtual ~PlainTextImporter();
+
+		/** @copydoc SpecificImporter::isExtensionSupported */
+		virtual bool isExtensionSupported(const WString& ext) const override;
+
+		/** @copydoc SpecificImporter::isMagicNumberSupported */
+		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const override;
+
+		/** @copydoc SpecificImporter::import */
+		virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions) override;
+
+		static const WString DEFAULT_EXTENSION;
+	};
+
+	/** @} */
 }
 }

+ 45 - 45
Source/BansheeEngine/Include/BsPlainTextRTTI.h

@@ -1,46 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsPlainText.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT PlainTextRTTI : public RTTIType <PlainText, Resource, PlainTextRTTI>
-	{
-	private:
-		WString& getString(PlainText* obj) { return obj->mString; }
-		void setString(PlainText* obj, WString& val) { obj->mString = val; }
-	public:
-		PlainTextRTTI()
-		{
-			addPlainField("mString", 0, &PlainTextRTTI::getString, &PlainTextRTTI::setString);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "PlainText";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_PlainText;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return PlainText::_createPtr(L""); // Initial string doesn't matter, it'll get overwritten
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsPlainText.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT PlainTextRTTI : public RTTIType <PlainText, Resource, PlainTextRTTI>
+	{
+	private:
+		WString& getString(PlainText* obj) { return obj->mString; }
+		void setString(PlainText* obj, WString& val) { obj->mString = val; }
+	public:
+		PlainTextRTTI()
+		{
+			addPlainField("mString", 0, &PlainTextRTTI::getString, &PlainTextRTTI::setString);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "PlainText";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_PlainText;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return PlainText::_createPtr(L""); // Initial string doesn't matter, it'll get overwritten
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 41 - 11
Source/BansheeEngine/Include/BsPrerequisites.h

@@ -9,39 +9,38 @@
  */
  */
 
 
 /** @defgroup Engine Engine
 /** @defgroup Engine Engine
- *	Specific implementation of the BansheeCore layer. This layer provides a more focused goal than the more generic
- *  BansheeCore layer, and therefore provides specific implementations of various abstract interfaces from BansheeCore,
- *  either directly or through specific plugins.
+ *	Layer that builds upon Core, providing specific implementations of its interfaces as well as other high level systems.
  *  @{
  *  @{
  */
  */
 
 
 /** @defgroup Renderer-Engine Renderer
 /** @defgroup Renderer-Engine Renderer
-  *	Abstract interface and helper functionality for rendering scene objects and other geometry (for example GUI). Provides
-  * a more specialized functionality than Renderer abstraction in BansheeCore.
+  *	Abstract interface and helper functionality for rendering scene objects and other geometry.
   */
   */
 
 
 /** @defgroup 2D 2D
 /** @defgroup 2D 2D
-  *	Functionality relating to two dimensional geometry like sprites.
+  *	Two dimensional geometry (sprites).
   */
   */
 
 
 /** @defgroup Components Components
 /** @defgroup Components Components
-  *	Built-in components (elements that may be attached to scene objects).
+  *	Built-in components.
   */
   */
 
 
 /** @defgroup GUI GUI
 /** @defgroup GUI GUI
-  *	Everything relating to the graphical user interface, including elements, styles, events and GUI manager.
+  *	Graphical user interface, including elements, styles, events and GUI manager.
   */
   */
 
 
 /** @defgroup Input-Engine Input
 /** @defgroup Input-Engine Input
- *	Functionality for dealing with input (mouse, keyboard, gamepad, etc.).
+ *	User input (mouse, keyboard, gamepad, etc.).
  */
  */
 
 
+/** @cond RTTI */
 /** @defgroup RTTI-Impl-Engine RTTI types
 /** @defgroup RTTI-Impl-Engine RTTI types
  *  Types containing RTTI for specific classes.
  *  Types containing RTTI for specific classes.
  */
  */
+/** @endcond */
 
 
 /** @defgroup Resources-Engine Resources
 /** @defgroup Resources-Engine Resources
-  *	Contains engine resource types and manager for builtin resources.
+  *	Builtin engine resource types and a manager for such resources.
   */
   */
 
 
 /** @defgroup Utility-Engine Utility
 /** @defgroup Utility-Engine Utility
@@ -53,13 +52,44 @@
  */
  */
 
 
 /** @defgroup Script Script
 /** @defgroup Script Script
- *  Functionality for dealing with scripting languages and libraries.
+ *  Interaction with scripting languages and libraries.
  */
  */
 
 
 /** @defgroup Application-Engine Application
 /** @defgroup Application-Engine Application
  *  Entry point into the application.
  *  Entry point into the application.
  */
  */
 
 
+/** @defgroup Internal-Core [INTERNAL]
+ *	Low-level classes and methods not meant for normal use, useful for those that are modifying the engine.
+ *  @{
+ */
+
+/** @defgroup 2D-Internal 2D
+  *	Two dimensional geometry (sprites).
+  */
+
+/** @defgroup GUI-Internal GUI
+  *	Graphical user interface, including elements, styles, events and GUI manager.
+  */
+
+/** @defgroup Renderer-Engine-Internal Renderer
+  *	Abstract interface and helper functionality for rendering scene objects and other geometry.
+  */
+
+/** @defgroup Resources-Engine-Internal Resources
+  *	Builtin engine resource types and a manager for such resources.
+  */
+
+/** @defgroup Script-Internal Script
+ *  Interaction with scripting languages and libraries.
+ */
+
+/** @defgroup Utility-Engine-Internal Utility
+ *  Various utility methods and types used by the engine layer.
+ */
+
+/** @} */
+
 /** @} */
 /** @} */
 /** @} */
 /** @} */
 
 

+ 275 - 277
Source/BansheeEngine/Include/BsProfilerOverlay.h

@@ -1,278 +1,276 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsComponent.h"
-#include "BsProfilerGPU.h"
-#include "BsModule.h"
-#include "BsEvent.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	class ProfilerOverlayInternal;
-
-	/**	Determines type of data to display on the profiler overlay. */
-	enum class ProfilerOverlayType
-	{
-		CPUSamples,
-		GPUSamples
-	};
-
-	/**
-	 * Handles rendering of Profiler information as an overlay in a viewport.
-	 *			
-	 * @note	Component wrapper of ProfilerOverlayInternal.
-	 */
-	class BS_EXPORT ProfilerOverlay : public Component
-	{
-	public:
-		/**	Constructs a new overlay attached to the specified parent and displayed on the provided viewport. */
-		ProfilerOverlay(const HSceneObject& parent, const CameraPtr& target);
-		~ProfilerOverlay();
-
-		/**	Changes the camera to display the overlay on. */
-		void setTarget(const CameraPtr& target);
-
-		/**	Shows the overlay of the specified type. */
-		void show(ProfilerOverlayType type);
-
-		/**	Hides the overlay. */
-		void hide();
-
-		/** @copydoc Component::update */
-		void update() override;
-
-	private:
-		ProfilerOverlayInternal* mInternal;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class ProfilerOverlayRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-
-		ProfilerOverlay() { } // Serialization only
-	};
-
-	/**	Handles rendering of Profiler information as an overlay in a viewport. */
-	class BS_EXPORT ProfilerOverlayInternal
-	{
-	public:
-		/**	Holds data about GUI elements in a single row of a "CPU basic" sample. */
-		struct BasicRow
-		{
-			GUILayout* labelLayout;
-			GUILayout* contentLayout;
-			GUIFixedSpace* labelSpace;
-
-			GUILabel* guiName;
-			GUILabel* guiPctOfParent;
-			GUILabel* guiNumCalls;
-			GUILabel* guiNumAllocs;
-			GUILabel* guiNumFrees;
-			GUILabel* guiAvgTime;
-			GUILabel* guiTotalTime;
-			GUILabel* guiAvgTimeSelf;
-			GUILabel* guiTotalTimeSelf;
-
-			HString name;
-			HString pctOfParent;
-			HString numCalls;
-			HString numAllocs;
-			HString numFrees;
-			HString avgTime;
-			HString totalTime;
-			HString avgTimeSelf;
-			HString totalTimeSelf;
-
-			bool disabled;
-		};
-
-		/**	Holds data about GUI elements in a single row of a "CPU precise" sample. */
-		struct PreciseRow
-		{
-			GUILayout* labelLayout;
-			GUILayout* contentLayout;
-			GUIFixedSpace* labelSpace;
-
-			GUILabel* guiName;
-			GUILabel* guiPctOfParent;
-			GUILabel* guiNumCalls;
-			GUILabel* guiNumAllocs;
-			GUILabel* guiNumFrees;
-			GUILabel* guiAvgCycles;
-			GUILabel* guiTotalCycles;
-			GUILabel* guiAvgCyclesSelf;
-			GUILabel* guiTotalCyclesSelf;
-
-			HString name;
-			HString pctOfParent;
-			HString numCalls;
-			HString numAllocs;
-			HString numFrees;
-			HString avgCycles;
-			HString totalCycles;
-			HString avgCyclesSelf;
-			HString totalCyclesSelf;
-
-			bool disabled;
-		};
-		
-		/**	Holds data about GUI elements in a single row of a GPU sample. */
-		struct GPUSampleRow
-		{
-			GUILayout* layout;
-
-			GUILabel* guiName;
-			GUILabel* guiTime;
-
-			HString name;
-			HString time;
-
-			bool disabled;
-		};
-
-	public:
-		/**	Constructs a new overlay attached to the specified parent and displayed on the provided camera. */
-		ProfilerOverlayInternal(const CameraPtr& target);
-		~ProfilerOverlayInternal();
-
-		/**	Changes the camera to display the overlay on. */
-		void setTarget(const CameraPtr& target);
-
-		/**	Shows the overlay of the specified type. */
-		void show(ProfilerOverlayType type);
-
-		/**	Hides the overlay. */
-		void hide();
-
-		/**	Updates overlay contents. Should be called once per frame. */
-		void update();
-	private:
-		/**	Called whenever the viewport resizes in order to rearrange the GUI elements. */
-		void targetResized();
-
-		/** Updates sizes of GUI areas used for displaying CPU sample data. To be called after viewport change or resize. */
-		void updateCPUSampleAreaSizes();
-
-		/** Updates sizes of GUI areas used for displaying GPU sample data. To be called after viewport change or resize. */
-		void updateGPUSampleAreaSizes();
-
-		/**
-		 * Updates CPU GUI elements from the data in the provided profiler reports. To be called whenever a new report is 
-		 * received.
-		 */
-		void updateCPUSampleContents(const ProfilerReport& simReport, const ProfilerReport& coreReport);
-
-		/**
-		 * Updates GPU GUI elemnts from the data in the provided profiler report. To be called whenever a new report is
-		 * received.
-		 */
-		void updateGPUSampleContents(const GPUProfilerReport& gpuReport);
-
-		static const UINT32 MAX_DEPTH;
-
-		ProfilerOverlayType mType;
-		ViewportPtr mTarget;
-
-		HSceneObject mWidgetSO;
-		HGUIWidget mWidget;
-
-		GUILayout* mBasicLayoutLabels = nullptr;
-		GUILayout* mPreciseLayoutLabels = nullptr;
-		GUILayout* mBasicLayoutContents = nullptr;
-		GUILayout* mPreciseLayoutContents = nullptr;
-
-		GUIElement* mTitleBasicName = nullptr;
-		GUIElement* mTitleBasicPctOfParent = nullptr;
-		GUIElement* mTitleBasicNumCalls = nullptr;
-		GUIElement* mTitleBasicNumAllocs = nullptr;
-		GUIElement* mTitleBasicNumFrees = nullptr;
-		GUIElement* mTitleBasicAvgTime = nullptr;
-		GUIElement* mTitleBasicTotalTime = nullptr;
-		GUIElement* mTitleBasicAvgTitleSelf = nullptr;
-		GUIElement* mTitleBasicTotalTimeSelf = nullptr;
-
-		GUIElement* mTitlePreciseName = nullptr;
-		GUIElement* mTitlePrecisePctOfParent = nullptr;
-		GUIElement* mTitlePreciseNumCalls = nullptr;
-		GUIElement* mTitlePreciseNumAllocs = nullptr;
-		GUIElement* mTitlePreciseNumFrees = nullptr;
-		GUIElement* mTitlePreciseAvgCycles = nullptr;
-		GUIElement* mTitlePreciseTotalCycles = nullptr;
-		GUIElement* mTitlePreciseAvgCyclesSelf = nullptr;
-		GUIElement* mTitlePreciseTotalCyclesSelf = nullptr;
-
-		GUILayout* mGPULayoutFrameContents = nullptr;
-		GUILayout* mGPULayoutFrameContentsLeft = nullptr;
-		GUILayout* mGPULayoutFrameContentsRight = nullptr;
-		GUILayout* mGPULayoutSamples = nullptr;
-		GUILayout* mGPULayoutSampleContents = nullptr;
-
-		GUILabel* mGPUFrameNumLbl;
-		GUILabel* mGPUTimeLbl;
-		GUILabel* mGPUDrawCallsLbl;
-		GUILabel* mGPURenTargetChangesLbl;
-		GUILabel* mGPUPresentsLbl;
-		GUILabel* mGPUClearsLbl;
-		GUILabel* mGPUVerticesLbl;
-		GUILabel* mGPUPrimitivesLbl;
-		GUILabel* mGPUSamplesLbl;
-		GUILabel* mGPUBlendStateChangesLbl;
-		GUILabel* mGPURasterStateChangesLbl;
-		GUILabel* mGPUDepthStencilStateChangesLbl;
-
-		GUILabel* mGPUObjectsCreatedLbl;
-		GUILabel* mGPUObjectsDestroyedLbl;
-		GUILabel* mGPUResourceWritesLbl;
-		GUILabel* mGPUResourceReadsLbl;
-		GUILabel* mGPUTextureBindsLbl;
-		GUILabel* mGPUSamplerBindsLbl;
-		GUILabel* mGPUVertexBufferBindsLbl;
-		GUILabel* mGPUIndexBufferBindsLbl;
-		GUILabel* mGPUGPUProgramBufferBindsLbl;
-		GUILabel* mGPUGPUProgramBindsLbl;
-
-		HString mGPUFrameNumStr;
-		HString mGPUTimeStr;
-		HString mGPUDrawCallsStr;
-		HString mGPURenTargetChangesStr;
-		HString mGPUPresentsStr;
-		HString mGPUClearsStr;
-		HString mGPUVerticesStr;
-		HString mGPUPrimitivesStr;
-		HString mGPUSamplesStr;
-		HString mGPUBlendStateChangesStr;
-		HString mGPURasterStateChangesStr;
-		HString mGPUDepthStencilStateChangesStr;
-
-		HString mGPUObjectsCreatedStr;
-		HString mGPUObjectsDestroyedStr;
-		HString mGPUResourceWritesStr;
-		HString mGPUResourceReadsStr;
-		HString mGPUTextureBindsStr;
-		HString mGPUSamplerBindsStr;
-		HString mGPUVertexBufferBindsStr;
-		HString mGPUIndexBufferBindsStr;
-		HString mGPUGPUProgramBufferBindsStr;
-		HString mGPUGPUProgramBindsStr;
-
-		Vector<BasicRow> mBasicRows;
-		Vector<PreciseRow> mPreciseRows;
-		Vector<GPUSampleRow> mGPUSampleRows;
-
-		HEvent mTargetResizedConn;
-		bool mIsShown;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsComponent.h"
+#include "BsProfilerGPU.h"
+#include "BsModule.h"
+#include "BsEvent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	class ProfilerOverlayInternal;
+
+	/**	Determines type of data to display on the profiler overlay. */
+	enum class ProfilerOverlayType
+	{
+		CPUSamples,
+		GPUSamples
+	};
+
+	/**
+	 * Handles rendering of Profiler information as an overlay in a viewport.
+	 *			
+	 * @note	Component wrapper of ProfilerOverlayInternal.
+	 */
+	class BS_EXPORT ProfilerOverlay : public Component
+	{
+	public:
+		/**	Constructs a new overlay attached to the specified parent and displayed on the provided viewport. */
+		ProfilerOverlay(const HSceneObject& parent, const CameraPtr& target);
+		~ProfilerOverlay();
+
+		/**	Changes the camera to display the overlay on. */
+		void setTarget(const CameraPtr& target);
+
+		/**	Shows the overlay of the specified type. */
+		void show(ProfilerOverlayType type);
+
+		/**	Hides the overlay. */
+		void hide();
+
+		/** @copydoc Component::update */
+		void update() override;
+
+	private:
+		ProfilerOverlayInternal* mInternal;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class ProfilerOverlayRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+		ProfilerOverlay() { } // Serialization only
+	};
+
+	/**	Handles rendering of Profiler information as an overlay in a viewport. */
+	class BS_EXPORT ProfilerOverlayInternal
+	{
+	public:
+		/**	Holds data about GUI elements in a single row of a "CPU basic" sample. */
+		struct BasicRow
+		{
+			GUILayout* labelLayout;
+			GUILayout* contentLayout;
+			GUIFixedSpace* labelSpace;
+
+			GUILabel* guiName;
+			GUILabel* guiPctOfParent;
+			GUILabel* guiNumCalls;
+			GUILabel* guiNumAllocs;
+			GUILabel* guiNumFrees;
+			GUILabel* guiAvgTime;
+			GUILabel* guiTotalTime;
+			GUILabel* guiAvgTimeSelf;
+			GUILabel* guiTotalTimeSelf;
+
+			HString name;
+			HString pctOfParent;
+			HString numCalls;
+			HString numAllocs;
+			HString numFrees;
+			HString avgTime;
+			HString totalTime;
+			HString avgTimeSelf;
+			HString totalTimeSelf;
+
+			bool disabled;
+		};
+
+		/**	Holds data about GUI elements in a single row of a "CPU precise" sample. */
+		struct PreciseRow
+		{
+			GUILayout* labelLayout;
+			GUILayout* contentLayout;
+			GUIFixedSpace* labelSpace;
+
+			GUILabel* guiName;
+			GUILabel* guiPctOfParent;
+			GUILabel* guiNumCalls;
+			GUILabel* guiNumAllocs;
+			GUILabel* guiNumFrees;
+			GUILabel* guiAvgCycles;
+			GUILabel* guiTotalCycles;
+			GUILabel* guiAvgCyclesSelf;
+			GUILabel* guiTotalCyclesSelf;
+
+			HString name;
+			HString pctOfParent;
+			HString numCalls;
+			HString numAllocs;
+			HString numFrees;
+			HString avgCycles;
+			HString totalCycles;
+			HString avgCyclesSelf;
+			HString totalCyclesSelf;
+
+			bool disabled;
+		};
+		
+		/**	Holds data about GUI elements in a single row of a GPU sample. */
+		struct GPUSampleRow
+		{
+			GUILayout* layout;
+
+			GUILabel* guiName;
+			GUILabel* guiTime;
+
+			HString name;
+			HString time;
+
+			bool disabled;
+		};
+
+	public:
+		/**	Constructs a new overlay attached to the specified parent and displayed on the provided camera. */
+		ProfilerOverlayInternal(const CameraPtr& target);
+		~ProfilerOverlayInternal();
+
+		/**	Changes the camera to display the overlay on. */
+		void setTarget(const CameraPtr& target);
+
+		/**	Shows the overlay of the specified type. */
+		void show(ProfilerOverlayType type);
+
+		/**	Hides the overlay. */
+		void hide();
+
+		/**	Updates overlay contents. Should be called once per frame. */
+		void update();
+	private:
+		/**	Called whenever the viewport resizes in order to rearrange the GUI elements. */
+		void targetResized();
+
+		/** Updates sizes of GUI areas used for displaying CPU sample data. To be called after viewport change or resize. */
+		void updateCPUSampleAreaSizes();
+
+		/** Updates sizes of GUI areas used for displaying GPU sample data. To be called after viewport change or resize. */
+		void updateGPUSampleAreaSizes();
+
+		/**
+		 * Updates CPU GUI elements from the data in the provided profiler reports. To be called whenever a new report is 
+		 * received.
+		 */
+		void updateCPUSampleContents(const ProfilerReport& simReport, const ProfilerReport& coreReport);
+
+		/**
+		 * Updates GPU GUI elemnts from the data in the provided profiler report. To be called whenever a new report is
+		 * received.
+		 */
+		void updateGPUSampleContents(const GPUProfilerReport& gpuReport);
+
+		static const UINT32 MAX_DEPTH;
+
+		ProfilerOverlayType mType;
+		ViewportPtr mTarget;
+
+		HSceneObject mWidgetSO;
+		HGUIWidget mWidget;
+
+		GUILayout* mBasicLayoutLabels = nullptr;
+		GUILayout* mPreciseLayoutLabels = nullptr;
+		GUILayout* mBasicLayoutContents = nullptr;
+		GUILayout* mPreciseLayoutContents = nullptr;
+
+		GUIElement* mTitleBasicName = nullptr;
+		GUIElement* mTitleBasicPctOfParent = nullptr;
+		GUIElement* mTitleBasicNumCalls = nullptr;
+		GUIElement* mTitleBasicNumAllocs = nullptr;
+		GUIElement* mTitleBasicNumFrees = nullptr;
+		GUIElement* mTitleBasicAvgTime = nullptr;
+		GUIElement* mTitleBasicTotalTime = nullptr;
+		GUIElement* mTitleBasicAvgTitleSelf = nullptr;
+		GUIElement* mTitleBasicTotalTimeSelf = nullptr;
+
+		GUIElement* mTitlePreciseName = nullptr;
+		GUIElement* mTitlePrecisePctOfParent = nullptr;
+		GUIElement* mTitlePreciseNumCalls = nullptr;
+		GUIElement* mTitlePreciseNumAllocs = nullptr;
+		GUIElement* mTitlePreciseNumFrees = nullptr;
+		GUIElement* mTitlePreciseAvgCycles = nullptr;
+		GUIElement* mTitlePreciseTotalCycles = nullptr;
+		GUIElement* mTitlePreciseAvgCyclesSelf = nullptr;
+		GUIElement* mTitlePreciseTotalCyclesSelf = nullptr;
+
+		GUILayout* mGPULayoutFrameContents = nullptr;
+		GUILayout* mGPULayoutFrameContentsLeft = nullptr;
+		GUILayout* mGPULayoutFrameContentsRight = nullptr;
+		GUILayout* mGPULayoutSamples = nullptr;
+		GUILayout* mGPULayoutSampleContents = nullptr;
+
+		GUILabel* mGPUFrameNumLbl;
+		GUILabel* mGPUTimeLbl;
+		GUILabel* mGPUDrawCallsLbl;
+		GUILabel* mGPURenTargetChangesLbl;
+		GUILabel* mGPUPresentsLbl;
+		GUILabel* mGPUClearsLbl;
+		GUILabel* mGPUVerticesLbl;
+		GUILabel* mGPUPrimitivesLbl;
+		GUILabel* mGPUSamplesLbl;
+		GUILabel* mGPUBlendStateChangesLbl;
+		GUILabel* mGPURasterStateChangesLbl;
+		GUILabel* mGPUDepthStencilStateChangesLbl;
+
+		GUILabel* mGPUObjectsCreatedLbl;
+		GUILabel* mGPUObjectsDestroyedLbl;
+		GUILabel* mGPUResourceWritesLbl;
+		GUILabel* mGPUResourceReadsLbl;
+		GUILabel* mGPUTextureBindsLbl;
+		GUILabel* mGPUSamplerBindsLbl;
+		GUILabel* mGPUVertexBufferBindsLbl;
+		GUILabel* mGPUIndexBufferBindsLbl;
+		GUILabel* mGPUGPUProgramBufferBindsLbl;
+		GUILabel* mGPUGPUProgramBindsLbl;
+
+		HString mGPUFrameNumStr;
+		HString mGPUTimeStr;
+		HString mGPUDrawCallsStr;
+		HString mGPURenTargetChangesStr;
+		HString mGPUPresentsStr;
+		HString mGPUClearsStr;
+		HString mGPUVerticesStr;
+		HString mGPUPrimitivesStr;
+		HString mGPUSamplesStr;
+		HString mGPUBlendStateChangesStr;
+		HString mGPURasterStateChangesStr;
+		HString mGPUDepthStencilStateChangesStr;
+
+		HString mGPUObjectsCreatedStr;
+		HString mGPUObjectsDestroyedStr;
+		HString mGPUResourceWritesStr;
+		HString mGPUResourceReadsStr;
+		HString mGPUTextureBindsStr;
+		HString mGPUSamplerBindsStr;
+		HString mGPUVertexBufferBindsStr;
+		HString mGPUIndexBufferBindsStr;
+		HString mGPUGPUProgramBufferBindsStr;
+		HString mGPUGPUProgramBindsStr;
+
+		Vector<BasicRow> mBasicRows;
+		Vector<PreciseRow> mPreciseRows;
+		Vector<GPUSampleRow> mGPUSampleRows;
+
+		HEvent mTargetResizedConn;
+		bool mIsShown;
+	};
+
+	/** @} */
 }
 }

+ 43 - 43
Source/BansheeEngine/Include/BsProfilerOverlayRTTI.h

@@ -1,44 +1,44 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsProfilerOverlay.h"
-#include "BsGameObjectRTTI.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT ProfilerOverlayRTTI : public RTTIType <ProfilerOverlay, Component, ProfilerOverlayRTTI>
-	{
-	private:
-
-	public:
-		ProfilerOverlayRTTI()
-		{ }
-
-		const String& getRTTIName() override
-		{
-			static String name = "ProfilerOverlay";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_ProfilerOverlay;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<ProfilerOverlay>();
-		}
-	};
-
-	/** @} */
-	/** @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 "BsProfilerOverlay.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT ProfilerOverlayRTTI : public RTTIType <ProfilerOverlay, Component, ProfilerOverlayRTTI>
+	{
+	private:
+
+	public:
+		ProfilerOverlayRTTI()
+		{ }
+
+		const String& getRTTIName() override
+		{
+			static String name = "ProfilerOverlay";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ProfilerOverlay;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<ProfilerOverlay>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 99 - 101
Source/BansheeEngine/Include/BsRenderQueue.h

@@ -1,102 +1,100 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsVector3.h"
-#include "BsSubMesh.h"
-
-namespace BansheeEngine 
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/**
-	 * Controls if and how a render queue groups renderable objects by material in order to reduce number of state changes.
-	 */
-	enum class StateReduction
-	{
-		None, /**< No grouping based on material will be done. */
-		Material, /**< Elements will be grouped by material first, by distance second. */
-		Distance /**< Elements will be grouped by distance first, material second. */
-	};
-
-	/** Contains data needed for performing a single rendering pass. */
-	struct BS_EXPORT RenderQueueElement
-	{
-		RenderQueueElement()
-			:passIdx(0), renderElem(nullptr), applyPass(true)
-		{ }
-
-		RenderableElement* renderElem;
-		UINT32 passIdx;
-		bool applyPass;
-	};
-
-	/**
-	 * Render objects determines rendering order of objects contained within it. Rendering order is determined by object
-	 * material, and can influence rendering of transparent or opaque objects, or be used to improve performance by grouping
-	 * similar objects together.
-	 */
-	class BS_EXPORT RenderQueue
-	{
-		/**	Data used for renderable element sorting. Represents a single pass for a single mesh. */
-		struct SortableElement
-		{
-			UINT32 seqIdx;
-			INT32 priority;
-			float distFromCamera;
-			UINT32 shaderId;
-			UINT32 passIdx;
-		};
-
-	public:
-		RenderQueue(StateReduction grouping = StateReduction::Distance);
-		virtual ~RenderQueue() { }
-
-		/**
-		 * Adds a new entry to the render queue.
-		 *
-		 * @param[in]	element			Renderable element to add to the queue.
-		 * @param[in]	distFromCamera	Distance of this object from the camera. Used for distance sorting.
-		 */
-		void add(RenderableElement* element, float distFromCamera);
-
-		/**	Clears all render operations from the queue. */
-		void clear();
-		
-		/**	Sorts all the render operations using user-defined rules. */
-		virtual void sort();
-
-		/** Returns a list of sorted render elements. Caller must ensure sort() is called before this method. */
-		const Vector<RenderQueueElement>& getSortedElements() const;
-
-		/**
-		 * Controls if and how a render queue groups renderable objects by material in order to reduce number of state 
-		 * changes.
-		 */
-		void setStateReduction(StateReduction mode) { mStateReductionMode = mode; }
-
-	protected:
-		/**	Callback used for sorting elements with no material grouping. */
-		static bool elementSorterNoGroup(UINT32 aIdx, UINT32 bIdx, const Vector<SortableElement>& lookup);
-
-		/**	Callback used for sorting elements with preferred material grouping. */
-		static bool elementSorterPreferGroup(UINT32 aIdx, UINT32 bIdx, const Vector<SortableElement>& lookup);
-
-		/**	Callback used for sorting elements with material grouping after sorting. */
-		static bool elementSorterPreferSort(UINT32 aIdx, UINT32 bIdx, const Vector<SortableElement>& lookup);
-
-		Vector<SortableElement> mSortableElements;
-		Vector<UINT32> mSortableElementIdx;
-		Vector<RenderableElement*> mElements;
-
-		Vector<RenderQueueElement> mSortedRenderElements;
-		StateReduction mStateReductionMode;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsVector3.h"
+#include "BsSubMesh.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Controls if and how a render queue groups renderable objects by material in order to reduce number of state changes.
+	 */
+	enum class StateReduction
+	{
+		None, /**< No grouping based on material will be done. */
+		Material, /**< Elements will be grouped by material first, by distance second. */
+		Distance /**< Elements will be grouped by distance first, material second. */
+	};
+
+	/** Contains data needed for performing a single rendering pass. */
+	struct BS_EXPORT RenderQueueElement
+	{
+		RenderQueueElement()
+			:passIdx(0), renderElem(nullptr), applyPass(true)
+		{ }
+
+		RenderableElement* renderElem;
+		UINT32 passIdx;
+		bool applyPass;
+	};
+
+	/**
+	 * Render objects determines rendering order of objects contained within it. Rendering order is determined by object
+	 * material, and can influence rendering of transparent or opaque objects, or be used to improve performance by grouping
+	 * similar objects together.
+	 */
+	class BS_EXPORT RenderQueue
+	{
+		/**	Data used for renderable element sorting. Represents a single pass for a single mesh. */
+		struct SortableElement
+		{
+			UINT32 seqIdx;
+			INT32 priority;
+			float distFromCamera;
+			UINT32 shaderId;
+			UINT32 passIdx;
+		};
+
+	public:
+		RenderQueue(StateReduction grouping = StateReduction::Distance);
+		virtual ~RenderQueue() { }
+
+		/**
+		 * Adds a new entry to the render queue.
+		 *
+		 * @param[in]	element			Renderable element to add to the queue.
+		 * @param[in]	distFromCamera	Distance of this object from the camera. Used for distance sorting.
+		 */
+		void add(RenderableElement* element, float distFromCamera);
+
+		/**	Clears all render operations from the queue. */
+		void clear();
+		
+		/**	Sorts all the render operations using user-defined rules. */
+		virtual void sort();
+
+		/** Returns a list of sorted render elements. Caller must ensure sort() is called before this method. */
+		const Vector<RenderQueueElement>& getSortedElements() const;
+
+		/**
+		 * Controls if and how a render queue groups renderable objects by material in order to reduce number of state 
+		 * changes.
+		 */
+		void setStateReduction(StateReduction mode) { mStateReductionMode = mode; }
+
+	protected:
+		/**	Callback used for sorting elements with no material grouping. */
+		static bool elementSorterNoGroup(UINT32 aIdx, UINT32 bIdx, const Vector<SortableElement>& lookup);
+
+		/**	Callback used for sorting elements with preferred material grouping. */
+		static bool elementSorterPreferGroup(UINT32 aIdx, UINT32 bIdx, const Vector<SortableElement>& lookup);
+
+		/**	Callback used for sorting elements with material grouping after sorting. */
+		static bool elementSorterPreferSort(UINT32 aIdx, UINT32 bIdx, const Vector<SortableElement>& lookup);
+
+		Vector<SortableElement> mSortableElements;
+		Vector<UINT32> mSortableElementIdx;
+		Vector<RenderableElement*> mElements;
+
+		Vector<RenderQueueElement> mSortedRenderElements;
+		StateReduction mStateReductionMode;
+	};
+
+	/** @} */
 }
 }

+ 240 - 242
Source/BansheeEngine/Include/BsRenderable.h

@@ -1,243 +1,241 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsIReflectable.h"
-#include "BsCoreObject.h"
-#include "BsIResourceListener.h"
-#include "BsBounds.h"
-#include "BsAABox.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Implementation
-	 *  @{
-	 */
-
-	/**	Signals which portion of a Renderable is dirty. */
-	enum class RenderableDirtyFlag
-	{
-		Transform = 0x01,
-		Everything = 0x02
-	};
-
-	/**
-	 * Renderable represents any visible object in the scene. It has a mesh, bounds and a set of materials. Renderer will
-	 * render any Renderable objects visible by a camera.
-	 */
-	template<bool Core>
-	class BS_EXPORT TRenderable
-	{
-		template<bool Core> struct TMeshType {};
-		template<> struct TMeshType < false > { typedef HMesh Type; };
-		template<> struct TMeshType < true > { typedef SPtr<MeshCore> Type; };
-
-		template<bool Core> struct TMaterialType {};
-		template<> struct TMaterialType < false > { typedef HMaterial Type; };
-		template<> struct TMaterialType < true > { typedef SPtr<MaterialCore> Type; };
-
-		typedef typename TMeshType<Core>::Type MeshType;
-		typedef typename TMaterialType<Core>::Type MaterialType;
-
-	public:
-		TRenderable();
-		virtual ~TRenderable();
-
-		/**
-		 * Sets the mesh to render. All sub-meshes of the mesh will be rendered, and you may set individual materials for
-		 * each sub-mesh.
-		 */
-		void setMesh(const MeshType& mesh);
-
-		/**
-		 * Sets a material that will be used for rendering a sub-mesh with the specified index. If a sub-mesh doesn't have
-		 * a specific material set then the primary material will be used.
-		 */
-		void setMaterial(UINT32 idx, const MaterialType& material);
-
-		/**
-		 * Sets the primary material to use for rendering. Any sub-mesh that doesn't have an explicit material set will use
-		 * this material.
-		 *
-		 * @note	This is equivalent to calling setMaterial(0, material).
-		 */
-		void setMaterial(const MaterialType& material);
-
-		/**
-		 * Returns all materials used for rendering this renderable. Each of the materials is used for rendering a single
-		 * sub-mesh.
-		 */
-		const Vector<MaterialType>& getMaterials() { return mMaterials; }
-
-		/**
-		 * Sets all materials used for rendering this renderable. Each of the materials is used for rendering a single
-		 * sub-mesh. If number of materials is larger than number of sub-meshes, they will be ignored. If lower, the
-		 * remaining materials will be removed.
-		 */
-		void setMaterials(const Vector<MaterialType>& materials);
-
-		/**
-		 * Sets the layer bitfield that controls whether a renderable is considered visible in a specific camera. Renderable
-		 * layer must match camera layer in order for the camera to render the component.
-		 */
-		void setLayer(UINT64 layer);
-
-		/** Sets the transform matrix that is applied to the object when its being rendered. */
-		void setTransform(const Matrix4& transform, const Matrix4& transformNoScale);
-
-		/**	Sets whether the object should be rendered or not. */
-		void setIsActive(bool active);
-
-		/**
-		 * Gets the layer bitfield that controls whether a renderable is considered visible in a specific camera. 
-		 * Renderable layer must match camera layer in order for the camera to render the component.
-		 */
-		UINT64 getLayer() const { return mLayer; }
-
-		/**	Returns the mesh used for rendering. */
-		MeshType getMesh() const { return mMesh; }
-
-		/**	Returns the material used for rendering a sub-mesh with the specified index. */
-		MaterialType getMaterial(UINT32 idx) const { return mMaterials[idx]; }
-
-		/**	Returns the transform matrix that is applied to the object when its being rendered. */
-		Matrix4 getTransform() const { return mTransform; }
-
-		/**
-		 * Returns the transform matrix that is applied to the object when its being rendered. This transform matrix does 
-		 * not include scale values.
-		 */
-		Matrix4 getTransformNoScale() const { return mTransformNoScale; }
-
-		/**	Gets whether the object should be rendered or not. */
-		bool getIsActive() const { return mIsActive; }
-
-		/**	Retrieves the world position of the renderable. */
-		Vector3 getPosition() const { return mPosition; }
-
-	protected:
-		/** @copydoc CoreObject::markCoreDirty */
-		virtual void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) { }
-
-		/** @copydoc CoreObject::markDependenciesDirty */
-		virtual void _markDependenciesDirty() { }
-
-		/** @copydoc IResourceListener::markResourcesDirty */
-		virtual void _markResourcesDirty() { }
-
-		MeshType mMesh;
-		Vector<MaterialType> mMaterials;
-		UINT64 mLayer;
-		Vector<AABox> mWorldBounds;
-		Vector3 mPosition;
-		Matrix4 mTransform;
-		Matrix4 mTransformNoScale;
-		bool mIsActive;
-	};
-
-	/** @} */
-
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/** @copydoc TRenderable */
-	class BS_EXPORT RenderableCore : public CoreObjectCore, public TRenderable<true>
-	{
-	public:
-		~RenderableCore();
-
-		/**	Gets world bounds of the mesh rendered by this object. */
-		Bounds getBounds() const;
-
-		/**	Returns the type that controls how is this object rendered. */
-		RenderableType getRenderableType() const { return RenType_LitTextured; }
-
-		/**	Sets an ID that can be used for uniquely identifying this handler by the renderer. */
-		void setRendererId(UINT32 id) { mRendererId = id; }
-
-		/**	Retrieves an ID that can be used for uniquely identifying this handler by the renderer. */
-		UINT32 getRendererId() const { return mRendererId; }
-
-	protected:
-		friend class Renderable;
-
-		RenderableCore();
-
-		/** @copydoc CoreObject::initialize */
-		void initialize() override;
-
-		/** @copydoc CoreObject::syncToCore */
-		void syncToCore(const CoreSyncData& data) override;
-
-		UINT32 mRendererId;
-	};
-
-	/** @copydoc TRenderable */
-	class BS_EXPORT Renderable : public IReflectable, public CoreObject, public TRenderable<false>, public IResourceListener
-	{
-	public:
-		/**	Gets world bounds of the mesh rendered by this object. */
-		Bounds getBounds() const;
-
-		/**	Retrieves an implementation of a renderable handler usable only from the core thread. */
-		SPtr<RenderableCore> getCore() const;
-
-		/**	Returns the hash value that can be used to identify if the internal data needs an update. */
-		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
-
-		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
-		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
-
-		/**	Creates a new renderable handler instance. */
-		static RenderablePtr create();
-
-	protected:
-		Renderable();
-
-		/** @copydoc CoreObject::createCore */
-		SPtr<CoreObjectCore> createCore() const override;
-
-		/** @copydoc CoreObject::markCoreDirty */
-		void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) override;
-
-		/** @copydoc IResourceListener::markResourcesDirty */
-		void _markResourcesDirty() override;
-
-		/** @copydoc CoreObject::markDependenciesDirty */
-		void _markDependenciesDirty() override;
-
-		/** @copydoc CoreObject::syncToCore */
-		CoreSyncData syncToCore(FrameAlloc* allocator) override;
-
-		/** @copydoc CoreObject::getCoreDependencies */
-		void getCoreDependencies(Vector<CoreObject*>& dependencies) override;
-
-		/** @copydoc IResourceListener::getListenerResources */
-		void getListenerResources(Vector<HResource>& resources) override;
-
-		/** @copydoc IResourceListener::notifyResourceLoaded */
-		void notifyResourceLoaded(const HResource& resource) override;
-
-		/** @copydoc IResourceListener::notifyResourceChanged */
-		void notifyResourceChanged(const HResource& resource) override;
-
-		/**	Creates a new renderable handler instance without initializing it. */
-		static RenderablePtr createEmpty();
-
-		UINT32 mLastUpdateHash;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class RenderableRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		virtual RTTITypeBase* getRTTI() const override;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsIReflectable.h"
+#include "BsCoreObject.h"
+#include "BsIResourceListener.h"
+#include "BsBounds.h"
+#include "BsAABox.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Implementation
+	 *  @{
+	 */
+
+	/**	Signals which portion of a Renderable is dirty. */
+	enum class RenderableDirtyFlag
+	{
+		Transform = 0x01,
+		Everything = 0x02
+	};
+
+	/**
+	 * Renderable represents any visible object in the scene. It has a mesh, bounds and a set of materials. Renderer will
+	 * render any Renderable objects visible by a camera.
+	 */
+	template<bool Core>
+	class BS_EXPORT TRenderable
+	{
+		template<bool Core> struct TMeshType {};
+		template<> struct TMeshType < false > { typedef HMesh Type; };
+		template<> struct TMeshType < true > { typedef SPtr<MeshCore> Type; };
+
+		template<bool Core> struct TMaterialType {};
+		template<> struct TMaterialType < false > { typedef HMaterial Type; };
+		template<> struct TMaterialType < true > { typedef SPtr<MaterialCore> Type; };
+
+		typedef typename TMeshType<Core>::Type MeshType;
+		typedef typename TMaterialType<Core>::Type MaterialType;
+
+	public:
+		TRenderable();
+		virtual ~TRenderable();
+
+		/**
+		 * Sets the mesh to render. All sub-meshes of the mesh will be rendered, and you may set individual materials for
+		 * each sub-mesh.
+		 */
+		void setMesh(const MeshType& mesh);
+
+		/**
+		 * Sets a material that will be used for rendering a sub-mesh with the specified index. If a sub-mesh doesn't have
+		 * a specific material set then the primary material will be used.
+		 */
+		void setMaterial(UINT32 idx, const MaterialType& material);
+
+		/**
+		 * Sets the primary material to use for rendering. Any sub-mesh that doesn't have an explicit material set will use
+		 * this material.
+		 *
+		 * @note	This is equivalent to calling setMaterial(0, material).
+		 */
+		void setMaterial(const MaterialType& material);
+
+		/**
+		 * Returns all materials used for rendering this renderable. Each of the materials is used for rendering a single
+		 * sub-mesh.
+		 */
+		const Vector<MaterialType>& getMaterials() { return mMaterials; }
+
+		/**
+		 * Sets all materials used for rendering this renderable. Each of the materials is used for rendering a single
+		 * sub-mesh. If number of materials is larger than number of sub-meshes, they will be ignored. If lower, the
+		 * remaining materials will be removed.
+		 */
+		void setMaterials(const Vector<MaterialType>& materials);
+
+		/**
+		 * Sets the layer bitfield that controls whether a renderable is considered visible in a specific camera. Renderable
+		 * layer must match camera layer in order for the camera to render the component.
+		 */
+		void setLayer(UINT64 layer);
+
+		/** Sets the transform matrix that is applied to the object when its being rendered. */
+		void setTransform(const Matrix4& transform, const Matrix4& transformNoScale);
+
+		/**	Sets whether the object should be rendered or not. */
+		void setIsActive(bool active);
+
+		/**
+		 * Gets the layer bitfield that controls whether a renderable is considered visible in a specific camera. 
+		 * Renderable layer must match camera layer in order for the camera to render the component.
+		 */
+		UINT64 getLayer() const { return mLayer; }
+
+		/**	Returns the mesh used for rendering. */
+		MeshType getMesh() const { return mMesh; }
+
+		/**	Returns the material used for rendering a sub-mesh with the specified index. */
+		MaterialType getMaterial(UINT32 idx) const { return mMaterials[idx]; }
+
+		/**	Returns the transform matrix that is applied to the object when its being rendered. */
+		Matrix4 getTransform() const { return mTransform; }
+
+		/**
+		 * Returns the transform matrix that is applied to the object when its being rendered. This transform matrix does 
+		 * not include scale values.
+		 */
+		Matrix4 getTransformNoScale() const { return mTransformNoScale; }
+
+		/**	Gets whether the object should be rendered or not. */
+		bool getIsActive() const { return mIsActive; }
+
+		/**	Retrieves the world position of the renderable. */
+		Vector3 getPosition() const { return mPosition; }
+
+	protected:
+		/** @copydoc CoreObject::markCoreDirty */
+		virtual void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) { }
+
+		/** @copydoc CoreObject::markDependenciesDirty */
+		virtual void _markDependenciesDirty() { }
+
+		/** @copydoc IResourceListener::markResourcesDirty */
+		virtual void _markResourcesDirty() { }
+
+		MeshType mMesh;
+		Vector<MaterialType> mMaterials;
+		UINT64 mLayer;
+		Vector<AABox> mWorldBounds;
+		Vector3 mPosition;
+		Matrix4 mTransform;
+		Matrix4 mTransformNoScale;
+		bool mIsActive;
+	};
+
+	/** @} */
+
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/** @copydoc TRenderable */
+	class BS_EXPORT RenderableCore : public CoreObjectCore, public TRenderable<true>
+	{
+	public:
+		~RenderableCore();
+
+		/**	Gets world bounds of the mesh rendered by this object. */
+		Bounds getBounds() const;
+
+		/**	Returns the type that controls how is this object rendered. */
+		RenderableType getRenderableType() const { return RenType_LitTextured; }
+
+		/**	Sets an ID that can be used for uniquely identifying this handler by the renderer. */
+		void setRendererId(UINT32 id) { mRendererId = id; }
+
+		/**	Retrieves an ID that can be used for uniquely identifying this handler by the renderer. */
+		UINT32 getRendererId() const { return mRendererId; }
+
+	protected:
+		friend class Renderable;
+
+		RenderableCore();
+
+		/** @copydoc CoreObject::initialize */
+		void initialize() override;
+
+		/** @copydoc CoreObject::syncToCore */
+		void syncToCore(const CoreSyncData& data) override;
+
+		UINT32 mRendererId;
+	};
+
+	/** @copydoc TRenderable */
+	class BS_EXPORT Renderable : public IReflectable, public CoreObject, public TRenderable<false>, public IResourceListener
+	{
+	public:
+		/**	Gets world bounds of the mesh rendered by this object. */
+		Bounds getBounds() const;
+
+		/**	Retrieves an implementation of a renderable handler usable only from the core thread. */
+		SPtr<RenderableCore> getCore() const;
+
+		/**	Returns the hash value that can be used to identify if the internal data needs an update. */
+		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
+
+		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
+		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
+
+		/**	Creates a new renderable handler instance. */
+		static RenderablePtr create();
+
+	protected:
+		Renderable();
+
+		/** @copydoc CoreObject::createCore */
+		SPtr<CoreObjectCore> createCore() const override;
+
+		/** @copydoc CoreObject::markCoreDirty */
+		void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) override;
+
+		/** @copydoc IResourceListener::markResourcesDirty */
+		void _markResourcesDirty() override;
+
+		/** @copydoc CoreObject::markDependenciesDirty */
+		void _markDependenciesDirty() override;
+
+		/** @copydoc CoreObject::syncToCore */
+		CoreSyncData syncToCore(FrameAlloc* allocator) override;
+
+		/** @copydoc CoreObject::getCoreDependencies */
+		void getCoreDependencies(Vector<CoreObject*>& dependencies) override;
+
+		/** @copydoc IResourceListener::getListenerResources */
+		void getListenerResources(Vector<HResource>& resources) override;
+
+		/** @copydoc IResourceListener::notifyResourceLoaded */
+		void notifyResourceLoaded(const HResource& resource) override;
+
+		/** @copydoc IResourceListener::notifyResourceChanged */
+		void notifyResourceChanged(const HResource& resource) override;
+
+		/**	Creates a new renderable handler instance without initializing it. */
+		static RenderablePtr createEmpty();
+
+		UINT32 mLastUpdateHash;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class RenderableRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		virtual RTTITypeBase* getRTTI() const override;
+	};
+
+	/** @} */
 }
 }

+ 48 - 50
Source/BansheeEngine/Include/BsRenderableElement.h

@@ -1,51 +1,49 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsBounds.h"
-#include "BsMatrix4.h"
-#include "BsSubMesh.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/** Contains all information needed for rendering a single sub-mesh. Closely tied with Renderer. */
-	class BS_EXPORT RenderableElement
-	{
-	public:
-		/**	Contains a hardware GPU parameter buffer and index of the parameters and the slot it binds to in a material. */
-		struct BS_EXPORT BufferBindInfo
-		{
-			BufferBindInfo(UINT32 passIdx, UINT32 paramsIdx, UINT32 slotIdx, const SPtr<GpuParamBlockBufferCore>& buffer)
-				:passIdx(passIdx), paramsIdx(paramsIdx), slotIdx(slotIdx), buffer(buffer)
-			{ }
-
-			UINT32 passIdx;
-			UINT32 paramsIdx;
-			UINT32 slotIdx;
-			SPtr<GpuParamBlockBufferCore> buffer;
-		};
-
-		/**	Reference to the mesh to render. */
-		SPtr<MeshCore> mesh;
-
-		/**	Portion of the mesh to render. */
-		SubMesh subMesh;
-
-		/**	Material to render the mesh with. */
-		SPtr<MaterialCore> material;
-
-		/**	Custom data that may optionally be set by the RenderableHanbdler. */
-		Any rendererData;
-
-		Vector<BufferBindInfo> rendererBuffers;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsBounds.h"
+#include "BsMatrix4.h"
+#include "BsSubMesh.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/** Contains all information needed for rendering a single sub-mesh. Closely tied with Renderer. */
+	class BS_EXPORT RenderableElement
+	{
+	public:
+		/**	Contains a hardware GPU parameter buffer and index of the parameters and the slot it binds to in a material. */
+		struct BS_EXPORT BufferBindInfo
+		{
+			BufferBindInfo(UINT32 passIdx, UINT32 paramsIdx, UINT32 slotIdx, const SPtr<GpuParamBlockBufferCore>& buffer)
+				:passIdx(passIdx), paramsIdx(paramsIdx), slotIdx(slotIdx), buffer(buffer)
+			{ }
+
+			UINT32 passIdx;
+			UINT32 paramsIdx;
+			UINT32 slotIdx;
+			SPtr<GpuParamBlockBufferCore> buffer;
+		};
+
+		/**	Reference to the mesh to render. */
+		SPtr<MeshCore> mesh;
+
+		/**	Portion of the mesh to render. */
+		SubMesh subMesh;
+
+		/**	Material to render the mesh with. */
+		SPtr<MaterialCore> material;
+
+		/**	Custom data that may optionally be set by the RenderableHanbdler. */
+		Any rendererData;
+
+		Vector<BufferBindInfo> rendererBuffers;
+	};
+
+	/** @} */
 }
 }

+ 38 - 40
Source/BansheeEngine/Include/BsRenderableHandler.h

@@ -1,41 +1,39 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/**
-	 * Abstract class that provides an interface for initializing renderable elements of a certain type, along with their
-	 * GPU parameter buffers.
-	 *
-	 * Essentially this class holds all the information that is needed for rendering an element of a certain renderable 
-	 * type.
-	 */
-	class BS_EXPORT RenderableHandler
-	{
-	public:
-		virtual ~RenderableHandler() {}
-
-		/**
-		 * Initializes the specified renderable element, making it ready to be used. Caller must ensure the renderable
-		 * element actually supports this handler.
-		 */
-		virtual void initializeRenderElem(RenderableElement& element) = 0;
-
-		/**	Binds per object GPU parameter buffers to the provided element. */
-		virtual void bindPerObjectBuffers(const RenderableElement& element) = 0;
-
-		/** Binds global GPU parameter buffers used for this Renderable type to the provided element. */
-		virtual void bindGlobalBuffers(const RenderableElement& element);
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Abstract class that provides an interface for initializing renderable elements of a certain type, along with their
+	 * GPU parameter buffers.
+	 *
+	 * Essentially this class holds all the information that is needed for rendering an element of a certain renderable 
+	 * type.
+	 */
+	class BS_EXPORT RenderableHandler
+	{
+	public:
+		virtual ~RenderableHandler() {}
+
+		/**
+		 * Initializes the specified renderable element, making it ready to be used. Caller must ensure the renderable
+		 * element actually supports this handler.
+		 */
+		virtual void initializeRenderElem(RenderableElement& element) = 0;
+
+		/**	Binds per object GPU parameter buffers to the provided element. */
+		virtual void bindPerObjectBuffers(const RenderableElement& element) = 0;
+
+		/** Binds global GPU parameter buffers used for this Renderable type to the provided element. */
+		virtual void bindGlobalBuffers(const RenderableElement& element);
+	};
+
+	/** @} */
 }
 }

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

@@ -1,66 +1,66 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsRenderable.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT RenderableRTTI : public RTTIType<Renderable, IReflectable, RenderableRTTI>
-	{
-	private:
-		HMesh& getMesh(Renderable* obj) { return obj->mMesh; }
-		void setMesh(Renderable* obj, HMesh& val) { obj->mMesh = val; }
-
-		UINT64& getLayer(Renderable* obj) { return obj->mLayer; }
-		void setLayer(Renderable* obj, UINT64& val) { obj->mLayer = val; }
-
-		HMaterial& getMaterial(Renderable* obj, UINT32 idx) { return obj->mMaterials[idx]; }
-		void setMaterial(Renderable* obj, UINT32 idx, HMaterial& val) { obj->setMaterial(idx, val); }
-		UINT32 getNumMaterials(Renderable* obj) { return (UINT32)obj->mMaterials.size(); }
-		void setNumMaterials(Renderable* obj, UINT32 num) { obj->mMaterials.resize(num); }
-
-	public:
-		RenderableRTTI()
-		{
-			addReflectableField("mMesh", 0, &RenderableRTTI::getMesh, &RenderableRTTI::setMesh);
-			addPlainField("mLayer", 1, &RenderableRTTI::getLayer, &RenderableRTTI::setLayer);
-			addReflectableArrayField("mMaterials", 2, &RenderableRTTI::getMaterial, 
-				&RenderableRTTI::getNumMaterials, &RenderableRTTI::setMaterial, &RenderableRTTI::setNumMaterials);
-		}
-
-		void onDeserializationEnded(IReflectable* obj) override
-		{
-			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
-			// but since this specific type is used in Components we delay initialization until Component
-			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
-			// purposes (you'll need to call initialize manually).
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "Renderable";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_Renderable;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return Renderable::createEmpty();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsRenderable.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT RenderableRTTI : public RTTIType<Renderable, IReflectable, RenderableRTTI>
+	{
+	private:
+		HMesh& getMesh(Renderable* obj) { return obj->mMesh; }
+		void setMesh(Renderable* obj, HMesh& val) { obj->mMesh = val; }
+
+		UINT64& getLayer(Renderable* obj) { return obj->mLayer; }
+		void setLayer(Renderable* obj, UINT64& val) { obj->mLayer = val; }
+
+		HMaterial& getMaterial(Renderable* obj, UINT32 idx) { return obj->mMaterials[idx]; }
+		void setMaterial(Renderable* obj, UINT32 idx, HMaterial& val) { obj->setMaterial(idx, val); }
+		UINT32 getNumMaterials(Renderable* obj) { return (UINT32)obj->mMaterials.size(); }
+		void setNumMaterials(Renderable* obj, UINT32 num) { obj->mMaterials.resize(num); }
+
+	public:
+		RenderableRTTI()
+		{
+			addReflectableField("mMesh", 0, &RenderableRTTI::getMesh, &RenderableRTTI::setMesh);
+			addPlainField("mLayer", 1, &RenderableRTTI::getLayer, &RenderableRTTI::setLayer);
+			addReflectableArrayField("mMaterials", 2, &RenderableRTTI::getMaterial, 
+				&RenderableRTTI::getNumMaterials, &RenderableRTTI::setMaterial, &RenderableRTTI::setNumMaterials);
+		}
+
+		void onDeserializationEnded(IReflectable* obj) override
+		{
+			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
+			// but since this specific type is used in Components we delay initialization until Component
+			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
+			// purposes (you'll need to call initialize manually).
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "Renderable";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_Renderable;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return Renderable::createEmpty();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 66 - 68
Source/BansheeEngine/Include/BsRenderer.h

@@ -1,69 +1,67 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsCoreRenderer.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/** @copydoc CoreRenderer */
-	class BS_EXPORT Renderer : public CoreRenderer
-	{
-	public:
-		virtual ~Renderer() { }
-
-		/**
-		 * Called whenever a new renderable is created.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyRenderableAdded(RenderableCore* renderable) { }
-
-		/**
-		 * Called whenever a renderable is updated.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyRenderableUpdated(RenderableCore* renderable) { }
-
-		/**
-		 * Called whenever a renderable is destroyed.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyRenderableRemoved(RenderableCore* renderable) { }
-
-		/**
-		 * Called whenever a new light is created.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyLightAdded(LightCore* light) { }
-
-		/**
-		 * Called whenever a light is updated.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyLightUpdated(LightCore* light) { }
-
-		/**
-		 * Called whenever a light is destroyed.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void _notifyLightRemoved(LightCore* light) { }
-	};
-
-	/**	Provides easy access to Renderer. */
-	SPtr<Renderer> BS_EXPORT gRenderer();
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsCoreRenderer.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/** @copydoc CoreRenderer */
+	class BS_EXPORT Renderer : public CoreRenderer
+	{
+	public:
+		virtual ~Renderer() { }
+
+		/**
+		 * Called whenever a new renderable is created.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyRenderableAdded(RenderableCore* renderable) { }
+
+		/**
+		 * Called whenever a renderable is updated.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyRenderableUpdated(RenderableCore* renderable) { }
+
+		/**
+		 * Called whenever a renderable is destroyed.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyRenderableRemoved(RenderableCore* renderable) { }
+
+		/**
+		 * Called whenever a new light is created.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyLightAdded(LightCore* light) { }
+
+		/**
+		 * Called whenever a light is updated.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyLightUpdated(LightCore* light) { }
+
+		/**
+		 * Called whenever a light is destroyed.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void _notifyLightRemoved(LightCore* light) { }
+	};
+
+	/**	Provides easy access to Renderer. */
+	SPtr<Renderer> BS_EXPORT gRenderer();
+
+	/** @} */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsRendererMaterial.h

@@ -18,8 +18,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
+	/** @addtogroup Renderer-Engine-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -86,5 +85,4 @@ namespace BansheeEngine
 	RendererMaterialMetaData RendererMaterial<T>::mMetaData;
 	RendererMaterialMetaData RendererMaterial<T>::mMetaData;
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsRendererMaterialManager.h

@@ -8,8 +8,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
+	/** @addtogroup Renderer-Engine-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -54,5 +53,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 132 - 134
Source/BansheeEngine/Include/BsRendererUtility.h

@@ -1,135 +1,133 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsModule.h"
-#include "BsRect2.h"
-#include "BsVector2I.h"
-#include "BsRect2I.h"
-#include "BsRendererMaterial.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	class ResolveMat;
-	class BlitMat;
-
-	/**
-	 * Contains various utility methods that make various common operations in the renderer easier.
-	 * 			
-	 * @note	Core thread only.
-	 */
-	class BS_EXPORT RendererUtility : public Module<RendererUtility>
-	{
-	public:
-		RendererUtility();
-		~RendererUtility();
-
-		/**
-		 * Activates the specified material pass for rendering. Any further draw calls will be executed using this pass.
-		 *
-		 * @param[in]	material	Material containing the pass.
-		 * @param[in]	passIdx		Index of the pass in the material.
-		 *
-		 * @note	Core thread.
-		 */
-		void setPass(const SPtr<MaterialCore>& material, UINT32 passIdx);
-
-		/**
-		 * Sets parameters (textures, samplers, buffers) for the currently active pass.
-		 *
-		 * @param[in]	material	Material whose pass' parameters to bind.
-		 * @param[in]	passIdx		Index of the pass in the material.
-		 *					
-		 * @note	Core thread.
-		 */
-		static void setPassParams(const SPtr<MaterialCore>& material, UINT32 passIdx = 0);
-
-		/**
-		 * Draws the specified mesh.
-		 *
-		 * @note	Core thread.
-		 */
-		void draw(const SPtr<MeshCoreBase>& mesh, const SubMesh& subMesh);
-
-		/**
-		 * Blits contents of the provided texture into the currently bound render target. If the provided texture contains
-		 * multiple samples, they will be resolved.
-		 *
-		 * @param[in]	texture	Source texture to blit.
-		 * @param[in]	area	Area of the source texture to blit in pixels. If width or height is zero it is assumed
-		 *						the entire texture should be blitted.
-		 */
-		void blit(const SPtr<TextureCore>& texture, const Rect2I& area = Rect2I::EMPTY);
-
-		/**
-		 * Draws a quad over the entire viewport in normalized device coordinates.
-		 * 			
-		 * @param[in]	uv			UV coordinates to assign to the corners of the quad.
-		 * @param[in]	textureSize	Size of the texture the UV coordinates are specified for. If the UV coordinates are 
-		 *							already in normalized (0, 1) range then keep this value as is. If the UV coordinates 
-		 *							are in texels then set this value to the texture size so they can be normalized 
-		 *							internally.
-		 * 			
-		 * @note	Core thread.
-		 */
-		void drawScreenQuad(const Rect2& uv = Rect2(0.0f, 0.0f, 1.0f, 1.0f), const Vector2I& textureSize = Vector2I(1, 1));
-
-		/** Returns a stencil mesh used for a point light (a unit sphere). */
-		SPtr<MeshCore> getPointLightStencil() const { return mPointLightStencilMesh; }
-
-		/** Returns a stencil mesh used for spot light. Actual vertex positions need to be computed in shader. */
-		SPtr<MeshCore> getSpotLightStencil() const { return mSpotLightStencilMesh; }
-
-	private:
-		SPtr<MeshCore> mFullScreenQuadMesh;
-		SPtr<MeshCore> mPointLightStencilMesh;
-		SPtr<MeshCore> mSpotLightStencilMesh;
-		SPtr<ResolveMat> mResolveMat;
-		SPtr<BlitMat> mBlitMat;
-	};
-
-	/**
-	 * Provides easy access to RendererUtility.
-	 * 			
-	 * @note	Core thread only.
-	 */
-	BS_EXPORT RendererUtility& gRendererUtility();
-
-	/** Shader that resolves a MSAA surface into a non-MSAA render target. */
-	class ResolveMat : public RendererMaterial<ResolveMat>
-	{
-		RMAT_DEF("Resolve.bsl");
-
-	public:
-		ResolveMat();
-
-		/** Updates the parameter buffers used by the material. */
-		void setParameters(const SPtr<TextureCore>& source);
-	private:
-		MaterialParamIntCore mNumSamples;
-		MaterialParamTextureCore mSource;
-	};
-
-	/** Shader that copies a source texture into a render target. */
-	class BlitMat : public RendererMaterial<BlitMat>
-	{
-		RMAT_DEF("Blit.bsl");
-
-	public:
-		BlitMat();
-
-		/** Updates the parameter buffers used by the material. */
-		void setParameters(const SPtr<TextureCore>& source);
-	private:
-		MaterialParamTextureCore mSource;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsModule.h"
+#include "BsRect2.h"
+#include "BsVector2I.h"
+#include "BsRect2I.h"
+#include "BsRendererMaterial.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	class ResolveMat;
+	class BlitMat;
+
+	/**
+	 * Contains various utility methods that make various common operations in the renderer easier.
+	 * 			
+	 * @note	Core thread only.
+	 */
+	class BS_EXPORT RendererUtility : public Module<RendererUtility>
+	{
+	public:
+		RendererUtility();
+		~RendererUtility();
+
+		/**
+		 * Activates the specified material pass for rendering. Any further draw calls will be executed using this pass.
+		 *
+		 * @param[in]	material	Material containing the pass.
+		 * @param[in]	passIdx		Index of the pass in the material.
+		 *
+		 * @note	Core thread.
+		 */
+		void setPass(const SPtr<MaterialCore>& material, UINT32 passIdx);
+
+		/**
+		 * Sets parameters (textures, samplers, buffers) for the currently active pass.
+		 *
+		 * @param[in]	material	Material whose pass' parameters to bind.
+		 * @param[in]	passIdx		Index of the pass in the material.
+		 *					
+		 * @note	Core thread.
+		 */
+		static void setPassParams(const SPtr<MaterialCore>& material, UINT32 passIdx = 0);
+
+		/**
+		 * Draws the specified mesh.
+		 *
+		 * @note	Core thread.
+		 */
+		void draw(const SPtr<MeshCoreBase>& mesh, const SubMesh& subMesh);
+
+		/**
+		 * Blits contents of the provided texture into the currently bound render target. If the provided texture contains
+		 * multiple samples, they will be resolved.
+		 *
+		 * @param[in]	texture	Source texture to blit.
+		 * @param[in]	area	Area of the source texture to blit in pixels. If width or height is zero it is assumed
+		 *						the entire texture should be blitted.
+		 */
+		void blit(const SPtr<TextureCore>& texture, const Rect2I& area = Rect2I::EMPTY);
+
+		/**
+		 * Draws a quad over the entire viewport in normalized device coordinates.
+		 * 			
+		 * @param[in]	uv			UV coordinates to assign to the corners of the quad.
+		 * @param[in]	textureSize	Size of the texture the UV coordinates are specified for. If the UV coordinates are 
+		 *							already in normalized (0, 1) range then keep this value as is. If the UV coordinates 
+		 *							are in texels then set this value to the texture size so they can be normalized 
+		 *							internally.
+		 * 			
+		 * @note	Core thread.
+		 */
+		void drawScreenQuad(const Rect2& uv = Rect2(0.0f, 0.0f, 1.0f, 1.0f), const Vector2I& textureSize = Vector2I(1, 1));
+
+		/** Returns a stencil mesh used for a point light (a unit sphere). */
+		SPtr<MeshCore> getPointLightStencil() const { return mPointLightStencilMesh; }
+
+		/** Returns a stencil mesh used for spot light. Actual vertex positions need to be computed in shader. */
+		SPtr<MeshCore> getSpotLightStencil() const { return mSpotLightStencilMesh; }
+
+	private:
+		SPtr<MeshCore> mFullScreenQuadMesh;
+		SPtr<MeshCore> mPointLightStencilMesh;
+		SPtr<MeshCore> mSpotLightStencilMesh;
+		SPtr<ResolveMat> mResolveMat;
+		SPtr<BlitMat> mBlitMat;
+	};
+
+	/**
+	 * Provides easy access to RendererUtility.
+	 * 			
+	 * @note	Core thread only.
+	 */
+	BS_EXPORT RendererUtility& gRendererUtility();
+
+	/** Shader that resolves a MSAA surface into a non-MSAA render target. */
+	class ResolveMat : public RendererMaterial<ResolveMat>
+	{
+		RMAT_DEF("Resolve.bsl");
+
+	public:
+		ResolveMat();
+
+		/** Updates the parameter buffers used by the material. */
+		void setParameters(const SPtr<TextureCore>& source);
+	private:
+		MaterialParamIntCore mNumSamples;
+		MaterialParamTextureCore mSource;
+	};
+
+	/** Shader that copies a source texture into a render target. */
+	class BlitMat : public RendererMaterial<BlitMat>
+	{
+		RMAT_DEF("Blit.bsl");
+
+	public:
+		BlitMat();
+
+		/** Updates the parameter buffers used by the material. */
+		void setParameters(const SPtr<TextureCore>& source);
+	private:
+		MaterialParamTextureCore mSource;
+	};
+
+	/** @} */
 }
 }

+ 140 - 142
Source/BansheeEngine/Include/BsSceneManager.h

@@ -1,143 +1,141 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsCoreSceneManager.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Renderer-Engine
-	 *  @{
-	 */
-
-	/**	Contains information about a camera managed by the scene manager. */
-	struct SceneCameraData
-	{
-		SceneCameraData() { }
-
-		SceneCameraData(const CameraPtr& camera, const HSceneObject& sceneObject)
-			:camera(camera), sceneObject(sceneObject)
-		{ }
-
-		CameraPtr camera;
-		HSceneObject sceneObject;
-	};
-
-	/**	Contains information about a renderable managed by the scene manager. */
-	struct SceneRenderableData
-	{
-		SceneRenderableData() { }
-
-		SceneRenderableData(const RenderablePtr& renderable, const HSceneObject& sceneObject)
-			:renderable(renderable), sceneObject(sceneObject)
-		{ }
-
-		RenderablePtr renderable;
-		HSceneObject sceneObject;
-	};
-
-	/**	Contains information about a light managed by the scene manager. */
-	struct SceneLightData
-	{
-		SceneLightData() { }
-
-		SceneLightData(const SPtr<Light>& light, const HSceneObject& sceneObject)
-			:light(light), sceneObject(sceneObject)
-		{ }
-
-		SPtr<Light> light;
-		HSceneObject sceneObject;
-	};
-
-	/** Manages active SceneObjects and provides ways for querying and updating them or their components. */
-	class BS_EXPORT SceneManager : public CoreSceneManager
-	{
-	public:
-		struct InitOnStart
-		{
-		public:
-			InitOnStart()
-			{
-				SceneManagerFactory::setFactoryMethod(&startUp);
-			}
-
-			static void startUp()
-			{
-				CoreSceneManager::startUp<SceneManager>();
-			}
-		};
-
-		SceneManager() { }
-		virtual ~SceneManager() {}
-
-		/** Returns all cameras in the scene. */
-		const Map<Camera*, SceneCameraData>& getAllCameras() const { return mCameras; }
-
-		/**	Returns all renderables in the scene. */
-		const Map<Renderable*, SceneRenderableData>& getAllRenderables() const { return mRenderables; }
-
-		/**
-		 * Returns the camera in the scene marked as main. Main camera controls the final render surface that is displayed
-		 * to the user. If there are multiple main cameras, the first one found returned.
-		 */
-		SceneCameraData getMainCamera() const;
-
-		/**
-		 * Sets the render target that the main camera in the scene (if any) will render its view to. This generally means
-		 * the main game window when running standalone, or the Game viewport when running in editor.
-		 */
-		void setMainRenderTarget(const RenderTargetPtr& rt);
-
-		/** Notifies the scene manager that a new renderable was created. */
-		void _registerRenderable(const SPtr<Renderable>& renderable, const HSceneObject& so);
-
-		/**	Notifies the scene manager that a renderable was removed. */
-		void _unregisterRenderable(const SPtr<Renderable>& renderable);
-
-		/**	Notifies the scene manager that a new camera was created. */
-		void _registerCamera(const SPtr<Camera>& camera, const HSceneObject& so);
-
-		/**	Notifies the scene manager that a camera was removed. */
-		void _unregisterCamera(const SPtr<Camera>& camera);
-
-		/**	Notifies the scene manager that a camera either became the main camera, or has stopped being main camera. */
-		void _notifyMainCameraStateChanged(const SPtr<Camera>& camera);
-
-		/**	Notifies the scene manager that a new light was created. */
-		void _registerLight(const SPtr<Light>& light, const HSceneObject& so);
-
-		/**	Notifies the scene manager that a light was removed. */
-		void _unregisterLight(const SPtr<Light>& light);
-
-		/** @copydoc CoreSceneManager::_updateCoreObjectTransforms */
-		virtual void _updateCoreObjectTransforms() override;
-
-		/** @copydoc CoreSceneManager::instance */
-		static SceneManager& instance();
-
-		/** @copydoc CoreSceneManager::instancePtr */
-		static SceneManager* instancePtr();
-
-	private:
-		/**	Callback that is triggered when the main render target size is changed. */
-		void onMainRenderTargetResized();
-
-		Map<Camera*, SceneCameraData> mCameras;
-		Map<Renderable*, SceneRenderableData> mRenderables;
-		Map<Light*, SceneLightData> mLights;
-		Vector<SceneCameraData> mMainCameras;
-		RenderTargetPtr mMainRT;
-
-		HEvent mMainRTResizedConn;
-
-		volatile static InitOnStart DoInitOnStart;
-	};
-
-	/** Provides easier access to SceneManager. */
-	BS_EXPORT SceneManager& gSceneManager();
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsCoreSceneManager.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/**	Contains information about a camera managed by the scene manager. */
+	struct SceneCameraData
+	{
+		SceneCameraData() { }
+
+		SceneCameraData(const CameraPtr& camera, const HSceneObject& sceneObject)
+			:camera(camera), sceneObject(sceneObject)
+		{ }
+
+		CameraPtr camera;
+		HSceneObject sceneObject;
+	};
+
+	/**	Contains information about a renderable managed by the scene manager. */
+	struct SceneRenderableData
+	{
+		SceneRenderableData() { }
+
+		SceneRenderableData(const RenderablePtr& renderable, const HSceneObject& sceneObject)
+			:renderable(renderable), sceneObject(sceneObject)
+		{ }
+
+		RenderablePtr renderable;
+		HSceneObject sceneObject;
+	};
+
+	/**	Contains information about a light managed by the scene manager. */
+	struct SceneLightData
+	{
+		SceneLightData() { }
+
+		SceneLightData(const SPtr<Light>& light, const HSceneObject& sceneObject)
+			:light(light), sceneObject(sceneObject)
+		{ }
+
+		SPtr<Light> light;
+		HSceneObject sceneObject;
+	};
+
+	/** Manages active SceneObjects and provides ways for querying and updating them or their components. */
+	class BS_EXPORT SceneManager : public CoreSceneManager
+	{
+	public:
+		struct InitOnStart
+		{
+		public:
+			InitOnStart()
+			{
+				SceneManagerFactory::setFactoryMethod(&startUp);
+			}
+
+			static void startUp()
+			{
+				CoreSceneManager::startUp<SceneManager>();
+			}
+		};
+
+		SceneManager() { }
+		virtual ~SceneManager() {}
+
+		/** Returns all cameras in the scene. */
+		const Map<Camera*, SceneCameraData>& getAllCameras() const { return mCameras; }
+
+		/**	Returns all renderables in the scene. */
+		const Map<Renderable*, SceneRenderableData>& getAllRenderables() const { return mRenderables; }
+
+		/**
+		 * Returns the camera in the scene marked as main. Main camera controls the final render surface that is displayed
+		 * to the user. If there are multiple main cameras, the first one found returned.
+		 */
+		SceneCameraData getMainCamera() const;
+
+		/**
+		 * Sets the render target that the main camera in the scene (if any) will render its view to. This generally means
+		 * the main game window when running standalone, or the Game viewport when running in editor.
+		 */
+		void setMainRenderTarget(const RenderTargetPtr& rt);
+
+		/** Notifies the scene manager that a new renderable was created. */
+		void _registerRenderable(const SPtr<Renderable>& renderable, const HSceneObject& so);
+
+		/**	Notifies the scene manager that a renderable was removed. */
+		void _unregisterRenderable(const SPtr<Renderable>& renderable);
+
+		/**	Notifies the scene manager that a new camera was created. */
+		void _registerCamera(const SPtr<Camera>& camera, const HSceneObject& so);
+
+		/**	Notifies the scene manager that a camera was removed. */
+		void _unregisterCamera(const SPtr<Camera>& camera);
+
+		/**	Notifies the scene manager that a camera either became the main camera, or has stopped being main camera. */
+		void _notifyMainCameraStateChanged(const SPtr<Camera>& camera);
+
+		/**	Notifies the scene manager that a new light was created. */
+		void _registerLight(const SPtr<Light>& light, const HSceneObject& so);
+
+		/**	Notifies the scene manager that a light was removed. */
+		void _unregisterLight(const SPtr<Light>& light);
+
+		/** @copydoc CoreSceneManager::_updateCoreObjectTransforms */
+		virtual void _updateCoreObjectTransforms() override;
+
+		/** @copydoc CoreSceneManager::instance */
+		static SceneManager& instance();
+
+		/** @copydoc CoreSceneManager::instancePtr */
+		static SceneManager* instancePtr();
+
+	private:
+		/**	Callback that is triggered when the main render target size is changed. */
+		void onMainRenderTargetResized();
+
+		Map<Camera*, SceneCameraData> mCameras;
+		Map<Renderable*, SceneRenderableData> mRenderables;
+		Map<Light*, SceneLightData> mLights;
+		Vector<SceneCameraData> mMainCameras;
+		RenderTargetPtr mMainRT;
+
+		HEvent mMainRTResizedConn;
+
+		volatile static InitOnStart DoInitOnStart;
+	};
+
+	/** Provides easier access to SceneManager. */
+	BS_EXPORT SceneManager& gSceneManager();
+
+	/** @} */
 }
 }

+ 45 - 45
Source/BansheeEngine/Include/BsScriptCodeImportOptionsRTTI.h

@@ -1,46 +1,46 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsScriptCodeImportOptions.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT ScriptCodeImportOptionsRTTI : public RTTIType <ScriptCodeImportOptions, ImportOptions, ScriptCodeImportOptionsRTTI>
-	{
-	private:
-		bool& getEditorScript(ScriptCodeImportOptions* obj) { return obj->mEditorScript; }
-		void setEditorScript(ScriptCodeImportOptions* obj, bool& val) { obj->mEditorScript = val; }
-	public:
-		ScriptCodeImportOptionsRTTI()
-		{
-			addPlainField("mEditorScript", 0, &ScriptCodeImportOptionsRTTI::getEditorScript, &ScriptCodeImportOptionsRTTI::setEditorScript);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "ScriptCodeImportOptions";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_ScriptCodeImportOptions;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return bs_shared_ptr_new<ScriptCodeImportOptions>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsScriptCodeImportOptions.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT ScriptCodeImportOptionsRTTI : public RTTIType <ScriptCodeImportOptions, ImportOptions, ScriptCodeImportOptionsRTTI>
+	{
+	private:
+		bool& getEditorScript(ScriptCodeImportOptions* obj) { return obj->mEditorScript; }
+		void setEditorScript(ScriptCodeImportOptions* obj, bool& val) { obj->mEditorScript = val; }
+	public:
+		ScriptCodeImportOptionsRTTI()
+		{
+			addPlainField("mEditorScript", 0, &ScriptCodeImportOptionsRTTI::getEditorScript, &ScriptCodeImportOptionsRTTI::setEditorScript);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptCodeImportOptions";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptCodeImportOptions;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return bs_shared_ptr_new<ScriptCodeImportOptions>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 36 - 38
Source/BansheeEngine/Include/BsScriptCodeImporter.h

@@ -1,39 +1,37 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsSpecificImporter.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup Resources-Engine
-	 *  @{
-	 */
-
-	/**	Imports C# script source code files (.cs). */
-	class BS_EXPORT ScriptCodeImporter : public SpecificImporter
-	{
-	public:
-		ScriptCodeImporter();
-		virtual ~ScriptCodeImporter();
-
-		/** @copydoc SpecificImporter::isExtensionSupported */
-		virtual bool isExtensionSupported(const WString& ext) const override;
-
-		/** @copydoc SpecificImporter::isMagicNumberSupported */
-		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const override;
-
-		/** @copydoc SpecificImporter::import */
-		virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions) override;
-
-		/** @copydoc SpecificImporter::createImportOptions */
-		virtual ImportOptionsPtr createImportOptions() const override;
-
-		static const WString DEFAULT_EXTENSION;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsSpecificImporter.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Resources-Engine-Internal
+	 *  @{
+	 */
+
+	/**	Imports C# script source code files (.cs). */
+	class BS_EXPORT ScriptCodeImporter : public SpecificImporter
+	{
+	public:
+		ScriptCodeImporter();
+		virtual ~ScriptCodeImporter();
+
+		/** @copydoc SpecificImporter::isExtensionSupported */
+		virtual bool isExtensionSupported(const WString& ext) const override;
+
+		/** @copydoc SpecificImporter::isMagicNumberSupported */
+		virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const override;
+
+		/** @copydoc SpecificImporter::import */
+		virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions) override;
+
+		/** @copydoc SpecificImporter::createImportOptions */
+		virtual ImportOptionsPtr createImportOptions() const override;
+
+		static const WString DEFAULT_EXTENSION;
+	};
+
+	/** @} */
 }
 }

+ 49 - 49
Source/BansheeEngine/Include/BsScriptCodeRTTI.h

@@ -1,50 +1,50 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsScriptCode.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT ScriptCodeRTTI : public RTTIType <ScriptCode, Resource, ScriptCodeRTTI>
-	{
-	private:
-		WString& getString(ScriptCode* obj) { return obj->mString; }
-		void setString(ScriptCode* obj, WString& val) { obj->mString = val; }
-
-		bool& getEditorScript(ScriptCode* obj) { return obj->mEditorScript; }
-		void setEditorScript(ScriptCode* obj, bool& val) { obj->mEditorScript = val; }
-	public:
-		ScriptCodeRTTI()
-		{
-			addPlainField("mString", 0, &ScriptCodeRTTI::getString, &ScriptCodeRTTI::setString);
-			addPlainField("mEditorScript", 1, &ScriptCodeRTTI::getEditorScript, &ScriptCodeRTTI::setEditorScript);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "ScriptCode";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_ScriptCode;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return ScriptCode::_createPtr(L""); // Initial string doesn't matter, it'll get overwritten
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsScriptCode.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT ScriptCodeRTTI : public RTTIType <ScriptCode, Resource, ScriptCodeRTTI>
+	{
+	private:
+		WString& getString(ScriptCode* obj) { return obj->mString; }
+		void setString(ScriptCode* obj, WString& val) { obj->mString = val; }
+
+		bool& getEditorScript(ScriptCode* obj) { return obj->mEditorScript; }
+		void setEditorScript(ScriptCode* obj, bool& val) { obj->mEditorScript = val; }
+	public:
+		ScriptCodeRTTI()
+		{
+			addPlainField("mString", 0, &ScriptCodeRTTI::getString, &ScriptCodeRTTI::setString);
+			addPlainField("mEditorScript", 1, &ScriptCodeRTTI::getEditorScript, &ScriptCodeRTTI::setEditorScript);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "ScriptCode";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_ScriptCode;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return ScriptCode::_createPtr(L""); // Initial string doesn't matter, it'll get overwritten
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsScriptManager.h

@@ -7,8 +7,7 @@
 
 
 namespace BansheeEngine 
 namespace BansheeEngine 
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup Script
+	/** @addtogroup Script-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -55,5 +54,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 1 - 3
Source/BansheeEngine/Include/BsShortcutKey.h

@@ -7,8 +7,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
+	/** @addtogroup GUI-Internal
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
@@ -41,5 +40,4 @@ namespace BansheeEngine
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-	/** @endcond */
 }
 }

+ 39 - 41
Source/BansheeEngine/Include/BsShortcutManager.h

@@ -1,42 +1,40 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsModule.h"
-#include "BsShortcutKey.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup GUI
-	 *  @{
-	 */
-
-	/**
-	 * Allows you to register global keyboard shortcuts that trigger callbacks when a certain key, or a key combination is
-	 * pressed.
-	 */
-	class BS_EXPORT ShortcutManager : public Module<ShortcutManager>
-	{
-	public:
-		ShortcutManager();
-		~ShortcutManager();
-
-		/**	Registers a new shortcut key and a callback to be called when the shortcut key is triggered. */
-		void addShortcut(const ShortcutKey& key, std::function<void()> callback);
-
-		/** Removes an existing shortcut key (it's callback will no longer be triggered when this combination is pressed). */
-		void removeShortcut(const ShortcutKey& key);
-
-	private:
-		/**	Triggered whenever a user presses a button. */
-		void onButtonDown(const ButtonEvent& event);
-
-		UnorderedMap<ShortcutKey, std::function<void()>, ShortcutKey::Hash, ShortcutKey::Equals> mShortcuts;
-		HEvent mOnButtonDownConn;
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsModule.h"
+#include "BsShortcutKey.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup GUI-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Allows you to register global keyboard shortcuts that trigger callbacks when a certain key, or a key combination is
+	 * pressed.
+	 */
+	class BS_EXPORT ShortcutManager : public Module<ShortcutManager>
+	{
+	public:
+		ShortcutManager();
+		~ShortcutManager();
+
+		/**	Registers a new shortcut key and a callback to be called when the shortcut key is triggered. */
+		void addShortcut(const ShortcutKey& key, std::function<void()> callback);
+
+		/** Removes an existing shortcut key (it's callback will no longer be triggered when this combination is pressed). */
+		void removeShortcut(const ShortcutKey& key);
+
+	private:
+		/**	Triggered whenever a user presses a button. */
+		void onButtonDown(const ButtonEvent& event);
+
+		UnorderedMap<ShortcutKey, std::function<void()>, ShortcutKey::Hash, ShortcutKey::Equals> mShortcuts;
+		HEvent mOnButtonDownConn;
+	};
+
+	/** @} */
 }
 }

+ 193 - 195
Source/BansheeEngine/Include/BsSprite.h

@@ -1,196 +1,194 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsVector2I.h"
-#include "BsRect2I.h"
-#include "BsColor.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup 2D
-	 *  @{
-	 */
-
-	/** Determines position of the sprite in its bounds. */
-	enum SpriteAnchor
-	{
-		SA_TopLeft,
-		SA_TopCenter,
-		SA_TopRight,
-		SA_MiddleLeft,
-		SA_MiddleCenter,
-		SA_MiddleRight,
-		SA_BottomLeft,
-		SA_BottomCenter,
-		SA_BottomRight
-	};
-
-	/** Types of materials available for rendering sprites. */
-	enum class SpriteMaterial
-	{
-		Text, Image, ImageAlpha
-	};
-
-	/** Contains information for initializing a sprite material. */
-	struct SpriteMaterialInfo
-	{
-		/** Generates a hash value that describes the contents of this object. */
-		UINT64 generateHash() const;
-
-		SpriteMaterial type;
-		UINT64 groupId;
-		HTexture texture;
-		Color tint;
-	};
-
-	/** Equals operator for SpriteMaterialInfo. */
-	bool operator==(const SpriteMaterialInfo& lhs, const SpriteMaterialInfo& rhs);
-
-	/** Not equals operator for SpriteMaterialInfo. */
-	bool operator!=(const SpriteMaterialInfo& lhs, const SpriteMaterialInfo& rhs);
-
-	/** Contains information about a single sprite render element, including its geometry and material. */
-	struct SpriteRenderElement
-	{
-		SpriteRenderElement()
-			:vertices(nullptr), uvs(nullptr), indexes(nullptr), numQuads(0)
-		{ }
-
-		Vector2* vertices;
-		Vector2* uvs;
-		UINT32* indexes;
-		UINT32 numQuads;
-		SpriteMaterialInfo matInfo;
-	};
-
-	/**	Generates geometry and contains information needed for rendering a two dimensional element. */
-	class BS_EXPORT Sprite
-	{
-	public:
-		Sprite();
-		virtual ~Sprite();
-
-		/**
-		 * Returns clipped bounds of the sprite.
-		 *
-		 * @param[in]	offset		Offset that will be added to the returned bounds.
-		 * @param[in]	clipRect	Local clip rect that is used for clipping the sprite bounds. (Clipping is done before 
-		 *							the offset is applied). If clip rect width or height is zero, no clipping is done.
-		 *
-		 * @return				Clipped sprite bounds.
-		 */
-		Rect2I getBounds(const Vector2I& offset, const Rect2I& clipRect) const;
-
-		/**
-		 * Returns the number of separate render elements in the sprite. Normally this is 1, but some sprites may consist 
-		 * of multiple materials, in which case each will require its own mesh (render element)
-		 * 			
-		 * @return	The number render elements.
-		 */
-		UINT32 getNumRenderElements() const;
-
-		/**
-		 * Gets a material for the specified render element index.
-		 * 		
-		 * @return	Structure describing the material.
-		 *
-		 * @see		getNumRenderElements()
-		 */
-		const SpriteMaterialInfo& getMaterialInfo(UINT32 renderElementIdx) const;
-
-		/**
-		 * Returns the number of quads that the specified render element will use. You will need this value when creating
-		 * the buffers before calling fillBuffer().
-		 * 			
-		 * @return	Number of quads for the specified render element. 
-		 *	
-		 * @note	Number of vertices = Number of quads * 4
-		 *			Number of indices = Number of quads * 6
-		 *			
-		 * @see		getNumRenderElements()
-		 * @see		fillBuffer()
-		 */
-		UINT32 getNumQuads(UINT32 renderElementIdx) const;
-
-		/**
-		 * Fill the pre-allocated vertex, uv and index buffers with the mesh data for the specified render element.
-		 *
-		 * @param[out]	vertices			Previously allocated buffer where to store the vertices.
-		 * @param[out]	uv					Previously allocated buffer where to store the uv coordinates.
-		 * @param[out]	indices				Previously allocated buffer where to store the indices.
-		 * @param[in]	startingQuad		At which quad should the method start filling the buffer.
-		 * @param[in]	maxNumQuads			Total number of quads the buffers were allocated for. Used only for memory 
-		 *									safety.
-		 * @param[in]	vertexStride		Number of bytes between of vertices in the provided vertex and uv data.
-		 * @param[in]	indexStride			Number of bytes between two indexes in the provided index data.
-		 * @param[in]	renderElementIdx	Zero-based index of the render element.
-		 *
-		 * @see		getNumRenderElements()
-		 * @see		getNumQuads()
-		 */
-		UINT32 fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, 
-			UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx, const Vector2I& offset, 
-			const Rect2I& clipRect, bool clip = true) const;
-
-	protected:
-		/**
-		 * Clips the provided vertices to the provided clip rectangle.
-		 *
-		 * @param[in, out]	vertices	Pointer to the start of the buffer containing vertex positions.
-		 * @param[in, out]	uv			Pointer to the start of the buffer containing UV coordinates.
-		 * @param[in]		numQuads	Number of quads in the provided buffer pointers.
-		 * @param[in]		vertStride	Number of bytes to skip when going to the next vertex. This assumes both position
-		 *								and uv coordinates have the same stride (as they are likely pointing to the same 
-		 *								buffer).
-		 * @param[in]		clipRect	Rectangle to clip the geometry to.
-		 */
-		static void clipToRect(UINT8* vertices, UINT8* uv, UINT32 numQuads, UINT32 vertStride, const Rect2I& clipRect);
-
-		/**	Returns the offset needed to move the sprite in order for it to respect the provided anchor. */
-		static Vector2I getAnchorOffset(SpriteAnchor anchor, UINT32 width, UINT32 height);
-
-		/**	Calculates the bounds of all sprite vertices. */
-		void updateBounds() const;
-
-		mutable Rect2I mBounds;
-		mutable Vector<SpriteRenderElement> mCachedRenderElements;
-	};
-
-	/** @} */
-	/** @endcond */
-}
-
-/** @cond STDLIB */
-/** @addtogroup GUI
- *  @{
- */
-
-/**	Hash value generator for STL reference wrapper for SpriteMaterialInfo. */
-template<>
-struct std::hash<std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>>
-{
-	size_t operator()(const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& value) const
-	{
-		return (size_t)value.get().generateHash();
-	}
-};
-
-/** Provides equals operator for STL reference wrapper for SpriteMaterialInfo. */
-static bool operator==(const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& lhs, 
-	const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& rhs)
-{
-	return lhs.get() == rhs.get();
-}
-
-/** Provides not equals operator for STL reference wrapper for SpriteMaterialInfo. */
-static bool operator!=(const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& lhs,
-	const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& rhs)
-{
-	return !(lhs == rhs);
-}
-
-/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsVector2I.h"
+#include "BsRect2I.h"
+#include "BsColor.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup 2D-Internal
+	 *  @{
+	 */
+
+	/** Determines position of the sprite in its bounds. */
+	enum SpriteAnchor
+	{
+		SA_TopLeft,
+		SA_TopCenter,
+		SA_TopRight,
+		SA_MiddleLeft,
+		SA_MiddleCenter,
+		SA_MiddleRight,
+		SA_BottomLeft,
+		SA_BottomCenter,
+		SA_BottomRight
+	};
+
+	/** Types of materials available for rendering sprites. */
+	enum class SpriteMaterial
+	{
+		Text, Image, ImageAlpha
+	};
+
+	/** Contains information for initializing a sprite material. */
+	struct SpriteMaterialInfo
+	{
+		/** Generates a hash value that describes the contents of this object. */
+		UINT64 generateHash() const;
+
+		SpriteMaterial type;
+		UINT64 groupId;
+		HTexture texture;
+		Color tint;
+	};
+
+	/** Equals operator for SpriteMaterialInfo. */
+	bool operator==(const SpriteMaterialInfo& lhs, const SpriteMaterialInfo& rhs);
+
+	/** Not equals operator for SpriteMaterialInfo. */
+	bool operator!=(const SpriteMaterialInfo& lhs, const SpriteMaterialInfo& rhs);
+
+	/** Contains information about a single sprite render element, including its geometry and material. */
+	struct SpriteRenderElement
+	{
+		SpriteRenderElement()
+			:vertices(nullptr), uvs(nullptr), indexes(nullptr), numQuads(0)
+		{ }
+
+		Vector2* vertices;
+		Vector2* uvs;
+		UINT32* indexes;
+		UINT32 numQuads;
+		SpriteMaterialInfo matInfo;
+	};
+
+	/**	Generates geometry and contains information needed for rendering a two dimensional element. */
+	class BS_EXPORT Sprite
+	{
+	public:
+		Sprite();
+		virtual ~Sprite();
+
+		/**
+		 * Returns clipped bounds of the sprite.
+		 *
+		 * @param[in]	offset		Offset that will be added to the returned bounds.
+		 * @param[in]	clipRect	Local clip rect that is used for clipping the sprite bounds. (Clipping is done before 
+		 *							the offset is applied). If clip rect width or height is zero, no clipping is done.
+		 *
+		 * @return				Clipped sprite bounds.
+		 */
+		Rect2I getBounds(const Vector2I& offset, const Rect2I& clipRect) const;
+
+		/**
+		 * Returns the number of separate render elements in the sprite. Normally this is 1, but some sprites may consist 
+		 * of multiple materials, in which case each will require its own mesh (render element)
+		 * 			
+		 * @return	The number render elements.
+		 */
+		UINT32 getNumRenderElements() const;
+
+		/**
+		 * Gets a material for the specified render element index.
+		 * 		
+		 * @return	Structure describing the material.
+		 *
+		 * @see		getNumRenderElements()
+		 */
+		const SpriteMaterialInfo& getMaterialInfo(UINT32 renderElementIdx) const;
+
+		/**
+		 * Returns the number of quads that the specified render element will use. You will need this value when creating
+		 * the buffers before calling fillBuffer().
+		 * 			
+		 * @return	Number of quads for the specified render element. 
+		 *	
+		 * @note	Number of vertices = Number of quads * 4
+		 *			Number of indices = Number of quads * 6
+		 *			
+		 * @see		getNumRenderElements()
+		 * @see		fillBuffer()
+		 */
+		UINT32 getNumQuads(UINT32 renderElementIdx) const;
+
+		/**
+		 * Fill the pre-allocated vertex, uv and index buffers with the mesh data for the specified render element.
+		 *
+		 * @param[out]	vertices			Previously allocated buffer where to store the vertices.
+		 * @param[out]	uv					Previously allocated buffer where to store the uv coordinates.
+		 * @param[out]	indices				Previously allocated buffer where to store the indices.
+		 * @param[in]	startingQuad		At which quad should the method start filling the buffer.
+		 * @param[in]	maxNumQuads			Total number of quads the buffers were allocated for. Used only for memory 
+		 *									safety.
+		 * @param[in]	vertexStride		Number of bytes between of vertices in the provided vertex and uv data.
+		 * @param[in]	indexStride			Number of bytes between two indexes in the provided index data.
+		 * @param[in]	renderElementIdx	Zero-based index of the render element.
+		 *
+		 * @see		getNumRenderElements()
+		 * @see		getNumQuads()
+		 */
+		UINT32 fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, 
+			UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx, const Vector2I& offset, 
+			const Rect2I& clipRect, bool clip = true) const;
+
+	protected:
+		/**
+		 * Clips the provided vertices to the provided clip rectangle.
+		 *
+		 * @param[in, out]	vertices	Pointer to the start of the buffer containing vertex positions.
+		 * @param[in, out]	uv			Pointer to the start of the buffer containing UV coordinates.
+		 * @param[in]		numQuads	Number of quads in the provided buffer pointers.
+		 * @param[in]		vertStride	Number of bytes to skip when going to the next vertex. This assumes both position
+		 *								and uv coordinates have the same stride (as they are likely pointing to the same 
+		 *								buffer).
+		 * @param[in]		clipRect	Rectangle to clip the geometry to.
+		 */
+		static void clipToRect(UINT8* vertices, UINT8* uv, UINT32 numQuads, UINT32 vertStride, const Rect2I& clipRect);
+
+		/**	Returns the offset needed to move the sprite in order for it to respect the provided anchor. */
+		static Vector2I getAnchorOffset(SpriteAnchor anchor, UINT32 width, UINT32 height);
+
+		/**	Calculates the bounds of all sprite vertices. */
+		void updateBounds() const;
+
+		mutable Rect2I mBounds;
+		mutable Vector<SpriteRenderElement> mCachedRenderElements;
+	};
+
+	/** @} */
+}
+
+/** @cond STDLIB */
+/** @addtogroup GUI
+ *  @{
+ */
+
+/**	Hash value generator for STL reference wrapper for SpriteMaterialInfo. */
+template<>
+struct std::hash<std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>>
+{
+	size_t operator()(const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& value) const
+	{
+		return (size_t)value.get().generateHash();
+	}
+};
+
+/** Provides equals operator for STL reference wrapper for SpriteMaterialInfo. */
+static bool operator==(const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& lhs, 
+	const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& rhs)
+{
+	return lhs.get() == rhs.get();
+}
+
+/** Provides not equals operator for STL reference wrapper for SpriteMaterialInfo. */
+static bool operator!=(const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& lhs,
+	const std::reference_wrapper<const BansheeEngine::SpriteMaterialInfo>& rhs)
+{
+	return !(lhs == rhs);
+}
+
+/** @} */
 /** @endcond */
 /** @endcond */

+ 54 - 54
Source/BansheeEngine/Include/BsSpriteTextureRTTI.h

@@ -1,55 +1,55 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsSpriteTexture.h"
-
-namespace BansheeEngine
-{
-	/** @cond INTERNAL */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT SpriteTextureRTTI : public RTTIType<SpriteTexture, Resource, SpriteTextureRTTI>
-	{
-	private:
-		HTexture& getAtlasTexture(SpriteTexture* obj) { return obj->mAtlasTexture; }
-		void setAtlasTexture(SpriteTexture* obj, HTexture& val) { obj->mAtlasTexture = val; } 
-
-		Vector2& getUVOffset(SpriteTexture* obj) { return obj->mUVOffset; }
-		void setUVOffset(SpriteTexture* obj, Vector2& val) { obj->mUVOffset = val; } 
-
-		Vector2& getUVScale(SpriteTexture* obj) { return obj->mUVScale; }
-		void setUVScale(SpriteTexture* obj, Vector2& val) { obj->mUVScale = val; } 
-
-	public:
-		SpriteTextureRTTI()
-		{
-			addReflectableField("mAtlasTexture", 0, &SpriteTextureRTTI::getAtlasTexture, &SpriteTextureRTTI::setAtlasTexture);
-			addPlainField("mUVOffset", 1, &SpriteTextureRTTI::getUVOffset, &SpriteTextureRTTI::setUVOffset);
-			addPlainField("mUVScale", 2, &SpriteTextureRTTI::getUVScale, &SpriteTextureRTTI::setUVScale);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "SpriteTexture";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_SpriteTexture;
-		}
-
-		std::shared_ptr<IReflectable> newRTTIObject() override
-		{
-			return SpriteTexture::createEmpty();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsSpriteTexture.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_EXPORT SpriteTextureRTTI : public RTTIType<SpriteTexture, Resource, SpriteTextureRTTI>
+	{
+	private:
+		HTexture& getAtlasTexture(SpriteTexture* obj) { return obj->mAtlasTexture; }
+		void setAtlasTexture(SpriteTexture* obj, HTexture& val) { obj->mAtlasTexture = val; } 
+
+		Vector2& getUVOffset(SpriteTexture* obj) { return obj->mUVOffset; }
+		void setUVOffset(SpriteTexture* obj, Vector2& val) { obj->mUVOffset = val; } 
+
+		Vector2& getUVScale(SpriteTexture* obj) { return obj->mUVScale; }
+		void setUVScale(SpriteTexture* obj, Vector2& val) { obj->mUVScale = val; } 
+
+	public:
+		SpriteTextureRTTI()
+		{
+			addReflectableField("mAtlasTexture", 0, &SpriteTextureRTTI::getAtlasTexture, &SpriteTextureRTTI::setAtlasTexture);
+			addPlainField("mUVOffset", 1, &SpriteTextureRTTI::getUVOffset, &SpriteTextureRTTI::setUVOffset);
+			addPlainField("mUVScale", 2, &SpriteTextureRTTI::getUVScale, &SpriteTextureRTTI::setUVScale);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "SpriteTexture";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_SpriteTexture;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return SpriteTexture::createEmpty();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }
 }