Browse Source

Fixed OpenGL texture binding
Alpha picking works
Fix for gizmo icon rendering on DX9 and DX11
Fixed ResourceHandle casing so it doesn't implicitly cast between invalid types
Properly hooked up SBansheeEditor shutdown

Marko Pintera 11 years ago
parent
commit
d231b89e53
28 changed files with 165 additions and 112 deletions
  1. 8 0
      BansheeCore/Include/BsCoreApplication.h
  2. 10 5
      BansheeCore/Include/BsResourceHandle.h
  3. 14 2
      BansheeCore/Source/BsCoreApplication.cpp
  4. 1 1
      BansheeCore/Source/BsFont.cpp
  5. 2 2
      BansheeCore/Source/BsRenderTexture.cpp
  6. 1 1
      BansheeD3D11RenderSystem/Source/BsD3D11RenderSystem.cpp
  7. 1 2
      BansheeD3D9RenderSystem/Source/BsD3D9RenderSystem.cpp
  8. 3 0
      BansheeEditor/Include/BsEditorApplication.h
  9. 0 1
      BansheeEditor/Include/BsHandleDrawManager.h
  10. 1 0
      BansheeEditor/Include/BsSceneEditorWidget.h
  11. 4 3
      BansheeEditor/Source/BsBuiltinEditorResources.cpp
  12. 16 7
      BansheeEditor/Source/BsEditorApplication.cpp
  13. 2 3
      BansheeEditor/Source/BsGizmoManager.cpp
  14. 6 10
      BansheeEditor/Source/BsHandleDrawManager.cpp
  15. 58 9
      BansheeEditor/Source/BsSceneEditorWidget.cpp
  16. 1 1
      BansheeEditor/Source/BsSelection.cpp
  17. 3 0
      BansheeEngine/Source/BsApplication.cpp
  18. 2 2
      BansheeEngine/Source/BsBuiltinResources.cpp
  19. 3 3
      BansheeEngine/Source/BsGUITexture.cpp
  20. 2 5
      BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp
  21. 0 2
      SBansheeEditor/Include/BsScriptHandleManager.h
  22. 3 0
      SBansheeEditor/Source/BsEditorScriptManager.cpp
  23. 6 1
      SBansheeEditor/Source/BsScriptEditorPlugin.cpp
  24. 5 2
      SBansheeEditor/Source/BsScriptHandleManager.cpp
  25. 8 5
      SBansheeEngine/Source/BsManagedSerializableField.cpp
  26. 1 1
      SBansheeEngine/Source/BsScriptGUIElementStyle.cpp
  27. 1 1
      SBansheeEngine/Source/BsScriptSpriteTexture.cpp
  28. 3 43
      SceneView.txt

+ 8 - 0
BansheeCore/Include/BsCoreApplication.h

@@ -72,6 +72,14 @@ namespace BansheeEngine
 			 */
 			 */
 			void unloadPlugin(DynLib* library);
 			void unloadPlugin(DynLib* library);
 
 
+			/**
+			 * @brief	Calls the shutdown method on the plugin.
+			 *
+			 * @note	This is separate from "unload" method and should be called
+			 *			before unload.
+			 */
+			void shutdownPlugin(DynLib* library);
+
 	protected:
 	protected:
 		/**
 		/**
 		 * @brief	Called for each iteration of the main loop.
 		 * @brief	Called for each iteration of the main loop.

+ 10 - 5
BansheeCore/Include/BsResourceHandle.h

@@ -126,8 +126,7 @@ namespace BansheeEngine
 		/**
 		/**
 		 * @brief	Copy constructor.
 		 * @brief	Copy constructor.
 		 */
 		 */
-		template <typename T1>
-		ResourceHandle(const ResourceHandle<T1>& ptr)
+		ResourceHandle(const ResourceHandle<T>& ptr)
 			:ResourceHandleBase()
 			:ResourceHandleBase()
 		{
 		{
 			mData = ptr.getHandleData();
 			mData = ptr.getHandleData();
@@ -136,9 +135,12 @@ namespace BansheeEngine
 		/**
 		/**
 		 * @brief	Converts a specific handle to generic Resource handle.
 		 * @brief	Converts a specific handle to generic Resource handle.
 		 */
 		 */
-		operator ResourceHandle<Resource>() 
+		operator ResourceHandle<Resource>() const
 		{
 		{
-			return ResourceHandle<Resource>(*this); 
+			ResourceHandle<Resource> handle;
+			handle._setHandleData(getHandleData());
+
+			return handle;
 		}
 		}
 
 
 		/**
 		/**
@@ -239,7 +241,10 @@ namespace BansheeEngine
 	template<class _Ty1, class _Ty2>
 	template<class _Ty1, class _Ty2>
 		ResourceHandle<_Ty1> static_resource_cast(const ResourceHandle<_Ty2>& other)
 		ResourceHandle<_Ty1> static_resource_cast(const ResourceHandle<_Ty2>& other)
 	{	
 	{	
-		return ResourceHandle<_Ty1>(other);
+		ResourceHandle<_Ty1> handle;
+		handle._setHandleData(other.getHandleData());
+
+		return handle;
 	}
 	}
 
 
 	/**
 	/**

+ 14 - 2
BansheeCore/Source/BsCoreApplication.cpp

@@ -122,9 +122,11 @@ namespace BansheeEngine
 		MeshManager::shutDown();
 		MeshManager::shutDown();
 		ProfilerGPU::shutDown();
 		ProfilerGPU::shutDown();
 
 
+		shutdownPlugin(mSceneManagerPlugin);
 		unloadPlugin(mSceneManagerPlugin);
 		unloadPlugin(mSceneManagerPlugin);
 		
 		
 		RendererManager::shutDown();
 		RendererManager::shutDown();
+		shutdownPlugin(mRendererPlugin);
 		unloadPlugin(mRendererPlugin);
 		unloadPlugin(mRendererPlugin);
 
 
 		Input::shutDown();
 		Input::shutDown();
@@ -311,11 +313,21 @@ namespace BansheeEngine
 		if(unloadPluginFunc != nullptr)
 		if(unloadPluginFunc != nullptr)
 			unloadPluginFunc();
 			unloadPluginFunc();
 
 
-		mPluginUpdateFunctions.erase(library);
-
 		gDynLibManager().unload(library);
 		gDynLibManager().unload(library);
 	}
 	}
 
 
+	void CoreApplication::shutdownPlugin(DynLib* library)
+	{
+		typedef void(*ShutdownPluginFunc)();
+
+		ShutdownPluginFunc shutdownPluginFunc = (ShutdownPluginFunc)library->getSymbol("shutdownPlugin");
+
+		if (shutdownPluginFunc != nullptr)
+			shutdownPluginFunc();
+
+		mPluginUpdateFunctions.erase(library);
+	}
+
 	CoreApplication& gCoreApplication()
 	CoreApplication& gCoreApplication()
 	{
 	{
 		return CoreApplication::instance();
 		return CoreApplication::instance();

+ 1 - 1
BansheeCore/Source/BsFont.cpp

@@ -87,7 +87,7 @@ namespace BansheeEngine
 	{
 	{
 		FontPtr newFont = _createPtr(fontData);
 		FontPtr newFont = _createPtr(fontData);
 
 
-		return gResources()._createResourceHandle(newFont);
+		return static_resource_cast<Font>(gResources()._createResourceHandle(newFont));
 	}
 	}
 
 
 	FontPtr Font::_createPtr(const Vector<FontData>& fontData)
 	FontPtr Font::_createPtr(const Vector<FontData>& fontData)

+ 2 - 2
BansheeCore/Source/BsRenderTexture.cpp

@@ -140,10 +140,10 @@ namespace BansheeEngine
 		// Create non-persistent resource handles for the used textures (we only need them because a lot of the code accepts only handles,
 		// Create non-persistent resource handles for the used textures (we only need them because a lot of the code accepts only handles,
 		// since they're non persistent they don't really have any benefit over shared pointers)
 		// since they're non persistent they don't really have any benefit over shared pointers)
 		if (desc.colorSurface.texture != nullptr)
 		if (desc.colorSurface.texture != nullptr)
-			mBindableColorTex = gResources()._createResourceHandle(desc.colorSurface.texture);
+			mBindableColorTex = static_resource_cast<Texture>(gResources()._createResourceHandle(desc.colorSurface.texture));
 
 
 		if (desc.depthStencilSurface.texture != nullptr)
 		if (desc.depthStencilSurface.texture != nullptr)
-			mBindableDepthStencilTex = gResources()._createResourceHandle(desc.depthStencilSurface.texture);
+			mBindableDepthStencilTex = static_resource_cast<Texture>(gResources()._createResourceHandle(desc.depthStencilSurface.texture));
 
 
 		RenderTarget::initialize();
 		RenderTarget::initialize();
 	}
 	}

+ 1 - 1
BansheeD3D11RenderSystem/Source/BsD3D11RenderSystem.cpp

@@ -1025,7 +1025,7 @@ namespace BansheeEngine
 
 
 	float D3D11RenderSystem::getMaximumDepthInputValue()
 	float D3D11RenderSystem::getMaximumDepthInputValue()
 	{
 	{
-		return -1.0f;
+		return 1.0f;
 	}
 	}
 
 
 	/************************************************************************/
 	/************************************************************************/

+ 1 - 2
BansheeD3D9RenderSystem/Source/BsD3D9RenderSystem.cpp

@@ -1503,8 +1503,7 @@ namespace BansheeEngine
 	float D3D9RenderSystem::getMaximumDepthInputValue()
 	float D3D9RenderSystem::getMaximumDepthInputValue()
 	{
 	{
 		// Range [0.0f, 1.0f]
 		// Range [0.0f, 1.0f]
-		// D3D inverts even identity view matrices, so maximum INPUT is -1.0
-		return -1.0f;
+		return 1.0f;
 	}
 	}
 
 
 	VertexElementType D3D9RenderSystem::getColorVertexElementType() const
 	VertexElementType D3D9RenderSystem::getColorVertexElementType() const

+ 3 - 0
BansheeEditor/Include/BsEditorApplication.h

@@ -22,6 +22,7 @@ namespace BansheeEngine
 
 
 	private:
 	private:
 		virtual void onStartUp();
 		virtual void onStartUp();
+		virtual void onShutDown();
 		virtual void update();
 		virtual void update();
 
 
 		EditorWidgetLayoutPtr loadWidgetLayout();
 		EditorWidgetLayoutPtr loadWidgetLayout();
@@ -33,6 +34,8 @@ namespace BansheeEngine
 		static const Path WIDGET_LAYOUT_PATH;
 		static const Path WIDGET_LAYOUT_PATH;
 		RenderSystemPlugin mActiveRSPlugin;
 		RenderSystemPlugin mActiveRSPlugin;
 
 
+		DynLib* mSBansheeEditorPlugin;
+
 		// DEBUG ONLY
 		// DEBUG ONLY
 
 
 		HGpuProgram mFragProgRef;
 		HGpuProgram mFragProgRef;

+ 0 - 1
BansheeEditor/Include/BsHandleDrawManager.h

@@ -53,7 +53,6 @@ namespace BansheeEngine
 		{
 		{
 			MaterialProxyPtr proxy;
 			MaterialProxyPtr proxy;
 			GpuParamMat4 mViewProj;
 			GpuParamMat4 mViewProj;
-			GpuParamMat4 mViewIT;
 		};
 		};
 
 
 		struct WireMaterialData
 		struct WireMaterialData

+ 1 - 0
BansheeEditor/Include/BsSceneEditorWidget.h

@@ -54,6 +54,7 @@ namespace BansheeEngine
 		HCamera mCamera;
 		HCamera mCamera;
 		GameObjectHandle<SceneCameraController> mCameraController;
 		GameObjectHandle<SceneCameraController> mCameraController;
 		SceneGrid* mSceneGrid;
 		SceneGrid* mSceneGrid;
+		bool mLeftButtonPressed;
 
 
 		HEvent mRenderCallback;
 		HEvent mRenderCallback;
 		HEvent mOnPointerMovedConn;
 		HEvent mOnPointerMovedConn;

+ 4 - 3
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -557,7 +557,7 @@ namespace BansheeEngine
 		mSkin.setStyle("ListBox", dropDownListStyle);
 		mSkin.setStyle("ListBox", dropDownListStyle);
 
 
 		// DropDown scroll up button arrow
 		// DropDown scroll up button arrow
-		HTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
+		HSpriteTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
 
 
 		GUIElementStyle dropDownScrollUpBtnArrowStyle;
 		GUIElementStyle dropDownScrollUpBtnArrowStyle;
 		dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
 		dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
@@ -1150,7 +1150,7 @@ namespace BansheeEngine
 					importOptions->setAntialiasing(false);
 					importOptions->setAntialiasing(false);
 				}
 				}
 
 
-				HFont font = Importer::instance().import(fontPath, fontImportOptions);
+				HFont font = Importer::instance().import<Font>(fontPath, fontImportOptions);
 
 
 				Path outputPath = FileSystem::getWorkingDirectoryPath();
 				Path outputPath = FileSystem::getWorkingDirectoryPath();
 				outputPath.append(DefaultSkinFolder);
 				outputPath.append(DefaultSkinFolder);
@@ -1204,7 +1204,7 @@ namespace BansheeEngine
 					importOptions->setType(importData.type);
 					importOptions->setType(importData.type);
 				}
 				}
 
 
-				HGpuProgram gpuProgram = Importer::instance().import(gpuProgInputLoc, gpuProgImportOptions);
+				HGpuProgram gpuProgram = Importer::instance().import<GpuProgram>(gpuProgInputLoc, gpuProgImportOptions);
 				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
 				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
 			}
 			}
 		}
 		}
@@ -1354,6 +1354,7 @@ namespace BansheeEngine
 
 
 		mShaderPickingAlpha[modeIdx]->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
 		mShaderPickingAlpha[modeIdx]->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
 
 
+		mShaderPickingAlpha[modeIdx]->addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
 		mShaderPickingAlpha[modeIdx]->addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
 		mShaderPickingAlpha[modeIdx]->addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
 		mShaderPickingAlpha[modeIdx]->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
 		mShaderPickingAlpha[modeIdx]->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
 
 

+ 16 - 7
BansheeEditor/Source/BsEditorApplication.cpp

@@ -58,7 +58,7 @@ namespace BansheeEngine
 
 
 	EditorApplication::EditorApplication(RenderSystemPlugin renderSystemPlugin)
 	EditorApplication::EditorApplication(RenderSystemPlugin renderSystemPlugin)
 		:Application(createRenderWindowDesc(), renderSystemPlugin, RendererPlugin::Default), 
 		:Application(createRenderWindowDesc(), renderSystemPlugin, RendererPlugin::Default), 
-		mActiveRSPlugin(renderSystemPlugin)
+		mActiveRSPlugin(renderSystemPlugin), mSBansheeEditorPlugin(nullptr)
 	{
 	{
 		BuiltinEditorResources::startUp(renderSystemPlugin);
 		BuiltinEditorResources::startUp(renderSystemPlugin);
 
 
@@ -100,6 +100,10 @@ namespace BansheeEngine
 		EditorWindowManager::shutDown();
 		EditorWindowManager::shutDown();
 		UndoRedo::shutDown();
 		UndoRedo::shutDown();
 
 
+		// We purposely don't unload this plugin, it needs to be unloaded after
+		// all mono assemblies have been unloaded (since their finalizers will call
+		// into the plugin). So we leave it to be unloaded automatically on app exit
+		shutdownPlugin(mSBansheeEditorPlugin);
 
 
 		/************************************************************************/
 		/************************************************************************/
 		/* 								DEBUG CODE                      		*/
 		/* 								DEBUG CODE                      		*/
@@ -141,7 +145,7 @@ namespace BansheeEngine
 		Application::onStartUp();
 		Application::onStartUp();
 
 
 		MainEditorWindow* mainWindow = MainEditorWindow::create(getPrimaryWindow());
 		MainEditorWindow* mainWindow = MainEditorWindow::create(getPrimaryWindow());
-		loadPlugin("SBansheeEditor"); // Managed part of the editor
+		loadPlugin("SBansheeEditor", &mSBansheeEditorPlugin); // Managed part of the editor
 
 
 		EditorWidgetLayoutPtr layout = loadWidgetLayout();
 		EditorWidgetLayoutPtr layout = loadWidgetLayout();
 		if (layout != nullptr)
 		if (layout != nullptr)
@@ -217,7 +221,7 @@ namespace BansheeEngine
 			importOptions->setType(GPT_FRAGMENT_PROGRAM);
 			importOptions->setType(GPT_FRAGMENT_PROGRAM);
 		}
 		}
 
 
-		mFragProgRef = Importer::instance().import(psLoc, gpuProgImportOptions);
+		mFragProgRef = Importer::instance().import<GpuProgram>(psLoc, gpuProgImportOptions);
 
 
 		gpuProgImportOptions = Importer::instance().createImportOptions(vsLoc);
 		gpuProgImportOptions = Importer::instance().createImportOptions(vsLoc);
 		if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
 		if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
@@ -230,15 +234,15 @@ namespace BansheeEngine
 			importOptions->setType(GPT_VERTEX_PROGRAM);
 			importOptions->setType(GPT_VERTEX_PROGRAM);
 		}
 		}
 
 
-		mVertProgRef = Importer::instance().import(vsLoc, gpuProgImportOptions);
+		mVertProgRef = Importer::instance().import<GpuProgram>(vsLoc, gpuProgImportOptions);
 
 
 		gResources().save(mVertProgRef, L"C:\\vertProgCg.vprog", true);
 		gResources().save(mVertProgRef, L"C:\\vertProgCg.vprog", true);
 		gResources().unload(mVertProgRef);
 		gResources().unload(mVertProgRef);
-		mVertProgRef = gResources().load(L"C:\\vertProgCg.vprog");
+		mVertProgRef = gResources().load<GpuProgram>(L"C:\\vertProgCg.vprog");
 
 
 		gResources().save(mFragProgRef, L"C:\\fragProgCg.vprog", true);
 		gResources().save(mFragProgRef, L"C:\\fragProgCg.vprog", true);
 		gResources().unload(mFragProgRef);
 		gResources().unload(mFragProgRef);
-		mFragProgRef = gResources().load(L"C:\\fragProgCg.vprog");
+		mFragProgRef = gResources().load<GpuProgram>(L"C:\\fragProgCg.vprog");
 
 
 		mTestShader = Shader::create("TestShader");
 		mTestShader = Shader::create("TestShader");
 		mTestShader->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4, RPS_WorldViewProjTfrm);
 		mTestShader->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4, RPS_WorldViewProjTfrm);
@@ -289,7 +293,7 @@ namespace BansheeEngine
 
 
 		gResources().unload(mTestMaterial);
 		gResources().unload(mTestMaterial);
 
 
-		mTestMaterial = gResources().load(L"C:\\ExportMaterial.mat");
+		mTestMaterial = gResources().load<Material>(L"C:\\ExportMaterial.mat");
 
 
 		testRenderable->setMesh(mDbgMeshRef);
 		testRenderable->setMesh(mDbgMeshRef);
 		testRenderable->setMaterial(0, mTestMaterial);
 		testRenderable->setMaterial(0, mTestMaterial);
@@ -358,6 +362,11 @@ namespace BansheeEngine
 		DbgEditorWidget2::open(); // DEBUG ONLY
 		DbgEditorWidget2::open(); // DEBUG ONLY
 	}
 	}
 
 
+	void EditorApplication::onShutDown()
+	{
+		Application::onShutDown();
+	}
+
 	void EditorApplication::startUp(RenderSystemPlugin renderSystemPlugin)
 	void EditorApplication::startUp(RenderSystemPlugin renderSystemPlugin)
 	{
 	{
 		CoreApplication::startUp<EditorApplication>(renderSystemPlugin);
 		CoreApplication::startUp<EditorApplication>(renderSystemPlugin);

+ 2 - 3
BansheeEditor/Source/BsGizmoManager.cpp

@@ -425,8 +425,8 @@ namespace BansheeEngine
 		{
 		{
 			if (a.distance == b.distance)
 			if (a.distance == b.distance)
 			{
 			{
-				HSpriteTexture texA = iconData[a.iconIdx].texture->getTexture();
-				HSpriteTexture texB = iconData[b.iconIdx].texture->getTexture();
+				HTexture texA = iconData[a.iconIdx].texture->getTexture();
+				HTexture texB = iconData[b.iconIdx].texture->getTexture();
 
 
 				if (texA == texB)
 				if (texA == texB)
 					return a.iconIdx < b.iconIdx;
 					return a.iconIdx < b.iconIdx;
@@ -708,7 +708,6 @@ namespace BansheeEngine
 		THROW_IF_NOT_CORE_THREAD;
 		THROW_IF_NOT_CORE_THREAD;
 
 
 		Matrix4 viewProjMat = projMatrix * viewMatrix;
 		Matrix4 viewProjMat = projMatrix * viewMatrix;
-		Matrix4 viewIT = viewMatrix.inverse().transpose();
 
 
 		mWireMaterial.mViewProj.set(viewProjMat);
 		mWireMaterial.mViewProj.set(viewProjMat);
 
 

+ 6 - 10
BansheeEditor/Source/BsHandleDrawManager.cpp

@@ -34,14 +34,14 @@ namespace BansheeEngine
 
 
 	HandleDrawManager::~HandleDrawManager()
 	HandleDrawManager::~HandleDrawManager()
 	{
 	{
-		bs_delete(mDrawHelper);
-
 		if (mSolidMesh != nullptr)
 		if (mSolidMesh != nullptr)
 			mDrawHelper->releaseSolidMesh(mSolidMesh);
 			mDrawHelper->releaseSolidMesh(mSolidMesh);
 
 
 		if (mWireMesh != nullptr)
 		if (mWireMesh != nullptr)
 			mDrawHelper->releaseWireMesh(mWireMesh);
 			mDrawHelper->releaseWireMesh(mWireMesh);
 
 
+		bs_delete(mDrawHelper);
+
 		gCoreAccessor().queueCommand(std::bind(&HandleDrawManager::destroyCore, this, mCore));
 		gCoreAccessor().queueCommand(std::bind(&HandleDrawManager::destroyCore, this, mCore));
 	}
 	}
 
 
@@ -150,18 +150,17 @@ namespace BansheeEngine
 	{
 	{
 		// TODO - Make a better interface when dealing with parameters through proxies?
 		// TODO - Make a better interface when dealing with parameters through proxies?
 		{
 		{
-			MaterialProxyPtr proxy = mWireMaterial.proxy;
-			GpuParamsPtr vertParams = proxy->params[proxy->passes[0].vertexProgParamsIdx];
+			mWireMaterial.proxy = wireMatProxy;
+			GpuParamsPtr vertParams = wireMatProxy->params[wireMatProxy->passes[0].vertexProgParamsIdx];
 
 
 			vertParams->getParam("matViewProj", mWireMaterial.mViewProj);
 			vertParams->getParam("matViewProj", mWireMaterial.mViewProj);
 		}
 		}
 
 
 		{
 		{
-			MaterialProxyPtr proxy = mSolidMaterial.proxy;
-			GpuParamsPtr vertParams = proxy->params[proxy->passes[0].vertexProgParamsIdx];
+			mSolidMaterial.proxy = solidMatProxy;
+			GpuParamsPtr vertParams = solidMatProxy->params[solidMatProxy->passes[0].vertexProgParamsIdx];
 
 
 			vertParams->getParam("matViewProj", mSolidMaterial.mViewProj);
 			vertParams->getParam("matViewProj", mSolidMaterial.mViewProj);
-			vertParams->getParam("matViewIT", mSolidMaterial.mViewIT);
 		}
 		}
 
 
 		RendererPtr activeRenderer = RendererManager::instance().getActive();
 		RendererPtr activeRenderer = RendererManager::instance().getActive();
@@ -200,10 +199,8 @@ namespace BansheeEngine
 		THROW_IF_NOT_CORE_THREAD;
 		THROW_IF_NOT_CORE_THREAD;
 
 
 		Matrix4 viewProjMat = projMatrix * viewMatrix;
 		Matrix4 viewProjMat = projMatrix * viewMatrix;
-		Matrix4 viewIT = viewMatrix.inverse().transpose();
 
 
 		mSolidMaterial.mViewProj.set(viewProjMat);
 		mSolidMaterial.mViewProj.set(viewProjMat);
-		mSolidMaterial.mViewIT.set(viewIT);
 
 
 		Renderer::setPass(*mSolidMaterial.proxy, 0);
 		Renderer::setPass(*mSolidMaterial.proxy, 0);
 		Renderer::draw(*meshProxy);
 		Renderer::draw(*meshProxy);
@@ -214,7 +211,6 @@ namespace BansheeEngine
 		THROW_IF_NOT_CORE_THREAD;
 		THROW_IF_NOT_CORE_THREAD;
 
 
 		Matrix4 viewProjMat = projMatrix * viewMatrix;
 		Matrix4 viewProjMat = projMatrix * viewMatrix;
-		Matrix4 viewIT = viewMatrix.inverse().transpose();
 
 
 		mWireMaterial.mViewProj.set(viewProjMat);
 		mWireMaterial.mViewProj.set(viewProjMat);
 
 

+ 58 - 9
BansheeEditor/Source/BsSceneEditorWidget.cpp

@@ -21,6 +21,8 @@
 #include "BsInput.h"
 #include "BsInput.h"
 #include "BsGUILayoutUtility.h"
 #include "BsGUILayoutUtility.h"
 #include "BsScenePicking.h"
 #include "BsScenePicking.h"
+#include "BsHandleManager.h"
+#include "BsSelection.h"
 
 
 // DEBUG ONLY
 // DEBUG ONLY
 #include "BsTime.h"
 #include "BsTime.h"
@@ -37,7 +39,7 @@ namespace BansheeEngine
 	SceneEditorWidget* SceneEditorWidget::Instance = nullptr;
 	SceneEditorWidget* SceneEditorWidget::Instance = nullptr;
 
 
 	SceneEditorWidget::SceneEditorWidget(const ConstructPrivately& dummy, EditorWidgetContainer& parentContainer)
 	SceneEditorWidget::SceneEditorWidget(const ConstructPrivately& dummy, EditorWidgetContainer& parentContainer)
-		:EditorWidget<SceneEditorWidget>(HString(L"SceneEditorWidget"), parentContainer), mGUIRenderTexture(nullptr)
+		:EditorWidget<SceneEditorWidget>(HString(L"SceneEditorWidget"), parentContainer), mGUIRenderTexture(nullptr), mLeftButtonPressed(false)
 	{
 	{
 		SceneViewLocator::_provide(this);
 		SceneViewLocator::_provide(this);
 
 
@@ -106,29 +108,76 @@ namespace BansheeEngine
 
 
 	void SceneEditorWidget::onPointerMoved(const PointerEvent& event)
 	void SceneEditorWidget::onPointerMoved(const PointerEvent& event)
 	{
 	{
+		Vector2I scenePos;
+		if (!toSceneViewPos(event.screenPos, scenePos))
+			return;
+
+		if (mLeftButtonPressed)
+		{
+			Ray inputRay = mCamera->screenPointToRay(scenePos);
 
 
-		
+			HandleManager::instance().update(scenePos, inputRay, mLeftButtonPressed);
+		}
 	}
 	}
 
 
 	void SceneEditorWidget::onPointerReleased(const PointerEvent& event)
 	void SceneEditorWidget::onPointerReleased(const PointerEvent& event)
 	{
 	{
+		if (event.button != PointerEventButton::Left)
+			return;
 
 
+		Vector2I scenePos;
+		if (!toSceneViewPos(event.screenPos, scenePos))
+			return;
+
+		mLeftButtonPressed = false;
+		Ray inputRay = mCamera->screenPointToRay(scenePos);
+
+		HandleManager::instance().update(scenePos, inputRay, mLeftButtonPressed);
 	}
 	}
 
 
 	void SceneEditorWidget::onPointerPressed(const PointerEvent& event)
 	void SceneEditorWidget::onPointerPressed(const PointerEvent& event)
 	{
 	{
+		if (event.button != PointerEventButton::Left)
+			return;
+
 		Vector2I scenePos;
 		Vector2I scenePos;
 		if (!toSceneViewPos(event.screenPos, scenePos))
 		if (!toSceneViewPos(event.screenPos, scenePos))
 			return;
 			return;
 
 
-		HSceneObject pickedObject = ScenePicking::instance().pickClosestSceneObject(mCamera, scenePos, Vector2I(1, 1));
-		if (pickedObject)
-		{
-			LOGDBG("PICKED OBJECT: " + pickedObject->getName());
-		}
-		else
+		mLeftButtonPressed = true;
+		Ray inputRay = mCamera->screenPointToRay(scenePos);
+
+		HandleManager::instance().update(scenePos, inputRay, mLeftButtonPressed);
+
+		// If we didn't hit a handle, perform normal selection
+		if (!HandleManager::instance().isHandleActive())
 		{
 		{
-			LOGDBG("PICKED NO OBJECT!");
+			// TODO - Handle multi-selection (i.e. selection rectangle when dragging)
+			// TODO - Handle selecting gizmos (will likely require slight refactor of ScenePicking)
+			HSceneObject pickedObject = ScenePicking::instance().pickClosestSceneObject(mCamera, scenePos, Vector2I(1, 1));
+
+			if (pickedObject)
+			{
+				if (event.control) // Append to existing selection
+				{
+					Vector<HSceneObject> selectedSOs = Selection::instance().getSceneObjects();
+
+					auto iterFind = std::find_if(selectedSOs.begin(), selectedSOs.end(), 
+						[&](const HSceneObject& obj) { return obj == pickedObject; }
+					);
+
+					if (iterFind != selectedSOs.end())
+						selectedSOs.push_back(pickedObject);
+
+					Selection::instance().setSceneObjects(selectedSOs);
+				}
+				else
+				{
+					Vector<HSceneObject> selectedSOs = { pickedObject };
+
+					Selection::instance().setSceneObjects(selectedSOs);
+				}
+			}
 		}
 		}
 	}
 	}
 
 

+ 1 - 1
BansheeEditor/Source/BsSelection.cpp

@@ -33,7 +33,7 @@ namespace BansheeEngine
 
 
 		GUISceneTreeView* sceneTreeView = SceneTreeViewLocator::instance();
 		GUISceneTreeView* sceneTreeView = SceneTreeViewLocator::instance();
 		if (sceneTreeView != nullptr)
 		if (sceneTreeView != nullptr)
-			sceneTreeView->setSelection(mSelectedSceneObjects);
+			sceneTreeView->setSelection(sceneObjects);
 	}
 	}
 
 
 	const Vector<Path>& Selection::getResourcePaths() const
 	const Vector<Path>& Selection::getResourcePaths() const

+ 3 - 0
BansheeEngine/Source/BsApplication.cpp

@@ -50,7 +50,10 @@ namespace BansheeEngine
 	Application::~Application()
 	Application::~Application()
 	{
 	{
 #if BS_VER == BS_VER_DEV
 #if BS_VER == BS_VER_DEV
+		shutdownPlugin(mSBansheeEnginePlugin);
 		unloadPlugin(mSBansheeEnginePlugin);
 		unloadPlugin(mSBansheeEnginePlugin);
+
+		shutdownPlugin(mMonoPlugin);
 		unloadPlugin(mMonoPlugin);
 		unloadPlugin(mMonoPlugin);
 #endif
 #endif
 
 

+ 2 - 2
BansheeEngine/Source/BsBuiltinResources.cpp

@@ -680,7 +680,7 @@ namespace BansheeEngine
 					importOptions->setAntialiasing(false);
 					importOptions->setAntialiasing(false);
 				}
 				}
 
 
-				HFont font = Importer::instance().import(fontPath, fontImportOptions);
+				HFont font = Importer::instance().import<Font>(fontPath, fontImportOptions);
 
 
 				Path outputPath = FileSystem::getWorkingDirectoryPath();
 				Path outputPath = FileSystem::getWorkingDirectoryPath();
 				outputPath.append(DefaultSkinFolder);
 				outputPath.append(DefaultSkinFolder);
@@ -734,7 +734,7 @@ namespace BansheeEngine
 					importOptions->setType(importData.type);
 					importOptions->setType(importData.type);
 				}
 				}
 
 
-				HGpuProgram gpuProgram = Importer::instance().import(gpuProgInputLoc, gpuProgImportOptions);
+				HGpuProgram gpuProgram = Importer::instance().import<GpuProgram>(gpuProgInputLoc, gpuProgImportOptions);
 				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
 				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
 			}
 			}
 		}
 		}

+ 3 - 3
BansheeEngine/Source/BsGUITexture.cpp

@@ -64,7 +64,7 @@ namespace BansheeEngine
 	GUITexture* GUITexture::create(GUIImageScaleMode scale, const GUIOptions& layoutOptions, const String& styleName)
 	GUITexture* GUITexture::create(GUIImageScaleMode scale, const GUIOptions& layoutOptions, const String& styleName)
 	{
 	{
 		return new (bs_alloc<GUITexture, PoolAlloc>()) GUITexture(getStyleName<GUITexture>(styleName), 
 		return new (bs_alloc<GUITexture, PoolAlloc>()) GUITexture(getStyleName<GUITexture>(styleName), 
-			HTexture(), scale, GUILayoutOptions::create(layoutOptions));
+			HSpriteTexture(), scale, GUILayoutOptions::create(layoutOptions));
 	}
 	}
 
 
 	GUITexture* GUITexture::create(GUIImageScaleMode scale, const String& styleName)
 	GUITexture* GUITexture::create(GUIImageScaleMode scale, const String& styleName)
@@ -76,13 +76,13 @@ namespace BansheeEngine
 	GUITexture* GUITexture::create(const GUIOptions& layoutOptions, const String& styleName)
 	GUITexture* GUITexture::create(const GUIOptions& layoutOptions, const String& styleName)
 	{
 	{
 		return new (bs_alloc<GUITexture, PoolAlloc>()) GUITexture(getStyleName<GUITexture>(styleName), 
 		return new (bs_alloc<GUITexture, PoolAlloc>()) GUITexture(getStyleName<GUITexture>(styleName), 
-			HTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(layoutOptions));
+			HSpriteTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create(layoutOptions));
 	}
 	}
 
 
 	GUITexture* GUITexture::create(const String& styleName)
 	GUITexture* GUITexture::create(const String& styleName)
 	{
 	{
 		return new (bs_alloc<GUITexture, PoolAlloc>()) GUITexture(getStyleName<GUITexture>(styleName), 
 		return new (bs_alloc<GUITexture, PoolAlloc>()) GUITexture(getStyleName<GUITexture>(styleName), 
-			HTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create());
+			HSpriteTexture(), GUIImageScaleMode::StretchToFit, GUILayoutOptions::create());
 	}
 	}
 
 
 	void GUITexture::setTexture(const HSpriteTexture& texture)
 	void GUITexture::setTexture(const HSpriteTexture& texture)

+ 2 - 5
BansheeGLRenderSystem/Source/BsGLRenderSystem.cpp

@@ -259,7 +259,6 @@ namespace BansheeEngine
 				setTexture(gptype, iter->second.slot, true, texture.getInternalPtr());
 				setTexture(gptype, iter->second.slot, true, texture.getInternalPtr());
 		}
 		}
 
 
-		UINT32 texUnit = 0;
 		for(auto iter = paramDesc.samplers.begin(); iter != paramDesc.samplers.end(); ++iter)
 		for(auto iter = paramDesc.samplers.begin(); iter != paramDesc.samplers.end(); ++iter)
 		{
 		{
 			HSamplerState& samplerState = bindableParams->getSamplerState(iter->second.slot);
 			HSamplerState& samplerState = bindableParams->getSamplerState(iter->second.slot);
@@ -269,9 +268,7 @@ namespace BansheeEngine
 			else
 			else
 				setSamplerState(gptype, iter->second.slot, samplerState.getInternalPtr());
 				setSamplerState(gptype, iter->second.slot, samplerState.getInternalPtr());
 
 
-			glProgramUniform1i(glProgram, iter->second.slot, getGLTextureUnit(gptype, texUnit));
-
-			texUnit++;
+			glProgramUniform1i(glProgram, iter->second.slot, getGLTextureUnit(gptype, iter->second.slot));
 		}
 		}
 
 
 		UINT8* uniformBufferData = nullptr;
 		UINT8* uniformBufferData = nullptr;
@@ -1718,7 +1715,7 @@ namespace BansheeEngine
 		mNumTextureTypes = numCombinedTexUnits;
 		mNumTextureTypes = numCombinedTexUnits;
 		mTextureTypes = bs_newN<GLenum>(mNumTextureTypes);
 		mTextureTypes = bs_newN<GLenum>(mNumTextureTypes);
 		for(UINT16 i = 0; i < numCombinedTexUnits; i++)
 		for(UINT16 i = 0; i < numCombinedTexUnits; i++)
-			mTextureTypes[i] = 0;
+			mTextureTypes[i] = GL_TEXTURE_2D;
 
 
 		mVertexUBOffset = 0;
 		mVertexUBOffset = 0;
 		UINT32 totalNumUniformBlocks = caps->getNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM);
 		UINT32 totalNumUniformBlocks = caps->getNumGpuParamBlockBuffers(GPT_VERTEX_PROGRAM);

+ 0 - 2
SBansheeEditor/Include/BsScriptHandleManager.h

@@ -32,8 +32,6 @@ namespace BansheeEngine
 		ScriptHandleManager(RuntimeScriptObjects& scriptObjectManager);
 		ScriptHandleManager(RuntimeScriptObjects& scriptObjectManager);
 		~ScriptHandleManager();
 		~ScriptHandleManager();
 
 
-		void update();
-
 	protected:
 	protected:
 		void refreshHandles();
 		void refreshHandles();
 		void triggerHandles();
 		void triggerHandles();

+ 3 - 0
SBansheeEditor/Source/BsEditorScriptManager.cpp

@@ -6,6 +6,7 @@
 #include "BsMonoMethod.h"
 #include "BsMonoMethod.h"
 #include "BsRuntimeScriptObjects.h"
 #include "BsRuntimeScriptObjects.h"
 #include "BsScriptGizmoManager.h"
 #include "BsScriptGizmoManager.h"
+#include "BsScriptHandleManager.h"
 #include "BsTime.h"
 #include "BsTime.h"
 #include "BsMath.h"
 #include "BsMath.h"
 
 
@@ -26,6 +27,7 @@ namespace BansheeEngine
 		RuntimeScriptObjects::instance().refreshScriptObjects(BansheeEditorAssemblyName);
 		RuntimeScriptObjects::instance().refreshScriptObjects(BansheeEditorAssemblyName);
 
 
 		ScriptGizmoManager::startUp(RuntimeScriptObjects::instance());
 		ScriptGizmoManager::startUp(RuntimeScriptObjects::instance());
+		HandleManager::startUp<ScriptHandleManager>(RuntimeScriptObjects::instance());
 
 
 		mProgramEdClass = mEditorAssembly->getClass("BansheeEditor", "ProgramEd");
 		mProgramEdClass = mEditorAssembly->getClass("BansheeEditor", "ProgramEd");
 		mUpdateMethod = mProgramEdClass->getMethod("EditorUpdate");
 		mUpdateMethod = mProgramEdClass->getMethod("EditorUpdate");
@@ -39,6 +41,7 @@ namespace BansheeEngine
 
 
 	EditorScriptManager::~EditorScriptManager()
 	EditorScriptManager::~EditorScriptManager()
 	{
 	{
+		HandleManager::shutDown();
 		ScriptGizmoManager::shutDown();
 		ScriptGizmoManager::shutDown();
 	}
 	}
 
 

+ 6 - 1
SBansheeEditor/Source/BsScriptEditorPlugin.cpp

@@ -21,8 +21,13 @@ namespace BansheeEngine
 		EditorScriptManager::instance().update();
 		EditorScriptManager::instance().update();
 	}
 	}
 
 
-	extern "C" BS_SCR_BED_EXPORT void unloadPlugin()
+	extern "C" BS_SCR_BED_EXPORT void shutdownPlugin()
 	{
 	{
 		EditorScriptManager::shutDown();
 		EditorScriptManager::shutDown();
 	}
 	}
+
+	extern "C" BS_SCR_BED_EXPORT void unloadPlugin()
+	{
+		
+	}
 }
 }

+ 5 - 2
SBansheeEditor/Source/BsScriptHandleManager.cpp

@@ -36,8 +36,11 @@ namespace BansheeEngine
 			mono_gchandle_free(handle.gcHandle);
 			mono_gchandle_free(handle.gcHandle);
 		}
 		}
 
 
-		callDestroy(mDefaultHandleManager);
-		mono_gchandle_free(mDefaultHandleManagerGCHandle);
+		if (mDefaultHandleManager != nullptr)
+		{
+			callDestroy(mDefaultHandleManager);
+			mono_gchandle_free(mDefaultHandleManagerGCHandle);
+		}
 
 
 		mAssemblyRefreshedConn.disconnect();
 		mAssemblyRefreshedConn.disconnect();
 	}
 	}

+ 8 - 5
SBansheeEngine/Source/BsManagedSerializableField.cpp

@@ -410,9 +410,10 @@ namespace BansheeEngine
 			{
 			{
 				if(value)
 				if(value)
 				{
 				{
-					ScriptTexture2D* scriptResource = ScriptResourceManager::instance().getScriptTexture(value);
+					HTexture texture = static_resource_cast<Texture>(value);
+					ScriptTexture2D* scriptResource = ScriptResourceManager::instance().getScriptTexture(texture);
 					if(scriptResource == nullptr)
 					if(scriptResource == nullptr)
-						scriptResource = ScriptResourceManager::instance().createScriptTexture(value);
+						scriptResource = ScriptResourceManager::instance().createScriptTexture(texture);
 
 
 					return scriptResource->getManagedInstance();
 					return scriptResource->getManagedInstance();
 				}
 				}
@@ -423,9 +424,10 @@ namespace BansheeEngine
 			{
 			{
 				if(value)
 				if(value)
 				{
 				{
-					ScriptSpriteTexture* scriptResource = ScriptResourceManager::instance().getScriptSpriteTexture(value);
+					HSpriteTexture spriteTexture = static_resource_cast<SpriteTexture>(value);
+					ScriptSpriteTexture* scriptResource = ScriptResourceManager::instance().getScriptSpriteTexture(spriteTexture);
 					if(scriptResource == nullptr)
 					if(scriptResource == nullptr)
-						scriptResource = ScriptResourceManager::instance().createScriptSpriteTexture(value);
+						scriptResource = ScriptResourceManager::instance().createScriptSpriteTexture(spriteTexture);
 
 
 					if(scriptResource != nullptr)
 					if(scriptResource != nullptr)
 						return scriptResource->getManagedInstance();
 						return scriptResource->getManagedInstance();
@@ -437,7 +439,8 @@ namespace BansheeEngine
 			{
 			{
 				if (value)
 				if (value)
 				{
 				{
-					ScriptManagedResource* scriptResource = ScriptResourceManager::instance().getScriptManagedResource(value);
+					HManagedResource managedResource = static_resource_cast<ManagedResource>(value);
+					ScriptManagedResource* scriptResource = ScriptResourceManager::instance().getScriptManagedResource(managedResource);
 					assert(scriptResource != nullptr); // Managed resource managed instance is created upon creation so it may never be null
 					assert(scriptResource != nullptr); // Managed resource managed instance is created upon creation so it may never be null
 
 
 					return scriptResource->getManagedInstance();
 					return scriptResource->getManagedInstance();

+ 1 - 1
SBansheeEngine/Source/BsScriptGUIElementStyle.cpp

@@ -111,7 +111,7 @@ namespace BansheeEngine
 	void ScriptGUIElementStyle::internal_SetFont(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	void ScriptGUIElementStyle::internal_SetFont(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
 	{
 		ScriptFont* nativeValue = ScriptFont::toNative(value);
 		ScriptFont* nativeValue = ScriptFont::toNative(value);
-		nativeInstance->mElementStyle->font = nativeValue->getNativeHandle();
+		nativeInstance->mElementStyle->font = static_resource_cast<Font>(nativeValue->getNativeHandle());
 		nativeInstance->mFont = nativeValue;
 		nativeInstance->mFont = nativeValue;
 	}
 	}
 }
 }

+ 1 - 1
SBansheeEngine/Source/BsScriptSpriteTexture.cpp

@@ -30,7 +30,7 @@ namespace BansheeEngine
 		}
 		}
 		else
 		else
 		{
 		{
-			HSpriteTexture spriteTexture = SpriteTexture::create(offset, scale, scriptTexture->getNativeHandle());
+			HSpriteTexture spriteTexture = SpriteTexture::create(offset, scale, static_resource_cast<Texture>(scriptTexture->getNativeHandle()));
 
 
 			ScriptResourceManager::instance().createScriptSpriteTexture(instance, spriteTexture);
 			ScriptResourceManager::instance().createScriptSpriteTexture(instance, spriteTexture);
 		}
 		}

+ 3 - 43
SceneView.txt

@@ -5,16 +5,11 @@
 	- Then make a Component wrapper around the non-component types, and also a C# wrapper around the same types
 	- Then make a Component wrapper around the non-component types, and also a C# wrapper around the same types
 
 
 RESOURCES CAN BE INCORRECTLY CAST between each other. e.g. HSpriteTexture to HTexture will be cast implicitly.
 RESOURCES CAN BE INCORRECTLY CAST between each other. e.g. HSpriteTexture to HTexture will be cast implicitly.
-Second pass for Gizmo ICon rendering doesn't work - actually it doesn't seem to render at all even if I send normal depth compare function
-
-TESTING:
- - Test picking on an object with alpha
- - Ensure that selecting an item in scene properly marks it in scene view
- - Ensure that selecting an item in scene or resource tree view properly updates Selection
+REFACTOR material getParams* and related classes. Those params should update all gpu program params that share that variable, not just the first found
+Icon appears faded even if it renders in front of a mesh (OpenGL). Likely wrong depth.
+Crash related to Handles when object is selected
 
 
 Test gizmos
 Test gizmos
- - Test rendering of icon gizmos
-   - Need a way to load a texture from C# (Extend ProjectLibrary?)
  - HOOK UP GIZMO SELECTION and test it
  - HOOK UP GIZMO SELECTION and test it
 
 
 Test handles
 Test handles
@@ -68,12 +63,6 @@ CONCRETE TODO:
 HandleSliderPlane/HandleSliderDisc
 HandleSliderPlane/HandleSliderDisc
  - update() implementation
  - update() implementation
 
 
-ScriptHandleManager
- - Needs to be started up somewhere
-
-SceneEditorWidget
- - Need to glue everything together
-
 ----------------------------------------------------
 ----------------------------------------------------
 STAGE 2
 STAGE 2
 Implement RotateHandle & ScaleHandle in C#
 Implement RotateHandle & ScaleHandle in C#
@@ -92,35 +81,6 @@ Find ones with Renderable components
 Retrieve Meshes, and world transforms from them
 Retrieve Meshes, and world transforms from them
 Draw that same mesh with either a wireframe or a grayed out shader with a slight depth bias
 Draw that same mesh with either a wireframe or a grayed out shader with a slight depth bias
 
 
-----------------------------------------------------------------------
-SceneView editor flow:
-  Hook up gizmo, handle and selection rendering methods to be executed after the scene is rendered
-  Calculate mouse coords manually relative to the window and to the render texture GUI element
-     - Don't use GUI events as we require more precise control (do we?)
-
-  Detect mouse clicks on the scene render target
-      Forward those mouse coordinates to HandleManager
-      It checks if screen ray intersects any handles and returns the handle if it does
-         If handle is found it is activated and method returns
-         Otherwise we mark the coordinates as selection start
-
-  Detect mouse drag on the scene render target
-    - If we have an active handle
-         Forward mouse coordinates to the active handle so it can do its thing
-         return
-    - Otherwise its assumed we are dragging a selection
-         Update selection endpoint and send it to ScenePicking
-         Use Selection to select picked objects if any
-         return
-
-  Detect mouse release on scene render target
-     If we have an active handle
-        Clear active handle
-        return
-     Otheriwse its assumed we are dragging a selection
-        Do nothing
-        return
-
 ---------------------------------------------------------------------
 ---------------------------------------------------------------------
 Multi-resources
 Multi-resources