Browse Source

Refactored sliders to better accomodate snapping and fixed slider size

Marko Pintera 11 years ago
parent
commit
80fec94568
42 changed files with 438 additions and 211 deletions
  1. 1 0
      BansheeEditor/BansheeEditor.vcxproj
  2. 3 0
      BansheeEditor/BansheeEditor.vcxproj.filters
  3. 2 0
      BansheeEditor/Include/BsEditorApplication.h
  4. 2 0
      BansheeEditor/Include/BsEditorPrerequisites.h
  5. 12 11
      BansheeEditor/Include/BsHandleDrawManager.h
  6. 13 0
      BansheeEditor/Include/BsHandleManager.h
  7. 10 5
      BansheeEditor/Include/BsHandleSlider.h
  8. 2 7
      BansheeEditor/Include/BsHandleSliderDisc.h
  9. 2 7
      BansheeEditor/Include/BsHandleSliderLine.h
  10. 2 1
      BansheeEditor/Include/BsHandleSliderManager.h
  11. 2 5
      BansheeEditor/Include/BsHandleSliderPlane.h
  12. 45 0
      BansheeEditor/Include/BsProjectSettings.h
  13. 2 2
      BansheeEditor/Include/BsSceneGrid.h
  14. 5 0
      BansheeEditor/Source/BsEditorApplication.cpp
  15. 46 12
      BansheeEditor/Source/BsHandleDrawManager.cpp
  16. 14 1
      BansheeEditor/Source/BsHandleManager.cpp
  17. 26 3
      BansheeEditor/Source/BsHandleSlider.cpp
  18. 8 10
      BansheeEditor/Source/BsHandleSliderDisc.cpp
  19. 4 10
      BansheeEditor/Source/BsHandleSliderLine.cpp
  20. 8 2
      BansheeEditor/Source/BsHandleSliderManager.cpp
  21. 3 9
      BansheeEditor/Source/BsHandleSliderPlane.cpp
  22. 16 1
      BansheeEditor/Source/BsSceneEditorWidget.cpp
  23. 27 12
      BansheeEditor/Source/BsSceneGrid.cpp
  24. 6 0
      MBansheeEditor/EditorApplication.cs
  25. 1 0
      MBansheeEditor/MBansheeEditor.csproj
  26. 33 33
      MBansheeEditor/Scene/HandleDrawing.cs
  27. 8 9
      MBansheeEditor/Scene/HandleSliderDisc.cs
  28. 3 3
      MBansheeEditor/Scene/HandleSliderLine.cs
  29. 7 7
      MBansheeEditor/Scene/HandleSliderPlane.cs
  30. 30 0
      MBansheeEditor/Scene/Handles.cs
  31. 21 9
      MBansheeEditor/Scene/MoveHandle.cs
  32. 12 0
      MBansheeEngine/Camera.cs
  33. 1 0
      MBansheeEngine/MBansheeEngine.csproj
  34. 11 11
      SBansheeEditor/Include/BsScriptHandleDrawing.h
  35. 2 2
      SBansheeEditor/Include/BsScriptHandleSliderDisc.h
  36. 2 2
      SBansheeEditor/Include/BsScriptHandleSliderLine.h
  37. 2 2
      SBansheeEditor/Include/BsScriptHandleSliderPlane.h
  38. 22 22
      SBansheeEditor/Source/BsScriptHandleDrawing.cpp
  39. 4 4
      SBansheeEditor/Source/BsScriptHandleSliderDisc.cpp
  40. 4 4
      SBansheeEditor/Source/BsScriptHandleSliderLine.cpp
  41. 4 4
      SBansheeEditor/Source/BsScriptHandleSliderPlane.cpp
  42. 10 1
      SceneView.txt

+ 1 - 0
BansheeEditor/BansheeEditor.vcxproj

@@ -299,6 +299,7 @@
     <ClInclude Include="Include\BsHandleSliderDisc.h" />
     <ClInclude Include="Include\BsHandleSliderDisc.h" />
     <ClInclude Include="Include\BsHandleSliderLine.h" />
     <ClInclude Include="Include\BsHandleSliderLine.h" />
     <ClInclude Include="Include\BsHandleSliderPlane.h" />
     <ClInclude Include="Include\BsHandleSliderPlane.h" />
+    <ClInclude Include="Include\BsProjectSettings.h" />
     <ClInclude Include="Include\BsScenePicking.h" />
     <ClInclude Include="Include\BsScenePicking.h" />
     <ClInclude Include="Include\BsProjectLibraryEntriesRTTI.h" />
     <ClInclude Include="Include\BsProjectLibraryEntriesRTTI.h" />
     <ClInclude Include="Include\BsEditorPrerequisites.h" />
     <ClInclude Include="Include\BsEditorPrerequisites.h" />

+ 3 - 0
BansheeEditor/BansheeEditor.vcxproj.filters

@@ -243,6 +243,9 @@
     <ClInclude Include="Include\BsEditorUtility.h">
     <ClInclude Include="Include\BsEditorUtility.h">
       <Filter>Header Files\Editor</Filter>
       <Filter>Header Files\Editor</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\BsProjectSettings.h">
+      <Filter>Header Files\Editor</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsEditorWidgetContainer.cpp">
     <ClCompile Include="Source\BsEditorWidgetContainer.cpp">

+ 2 - 0
BansheeEditor/Include/BsEditorApplication.h

@@ -19,6 +19,7 @@ namespace BansheeEngine
 		bool isSceneViewFocused() const;
 		bool isSceneViewFocused() const;
 		const Path& getActiveProjectPath() const;
 		const Path& getActiveProjectPath() const;
 
 
+		ProjectSettingsPtr getProjectSettings() const { return mProjectSettings; }
 
 
 	private:
 	private:
 		virtual void onStartUp();
 		virtual void onStartUp();
@@ -33,6 +34,7 @@ namespace BansheeEngine
 	private:
 	private:
 		static const Path WIDGET_LAYOUT_PATH;
 		static const Path WIDGET_LAYOUT_PATH;
 		RenderSystemPlugin mActiveRSPlugin;
 		RenderSystemPlugin mActiveRSPlugin;
+		ProjectSettingsPtr mProjectSettings;
 
 
 		DynLib* mSBansheeEditorPlugin;
 		DynLib* mSBansheeEditorPlugin;
 
 

+ 2 - 0
BansheeEditor/Include/BsEditorPrerequisites.h

@@ -63,10 +63,12 @@ namespace BansheeEngine
 	class HandleSliderManager;
 	class HandleSliderManager;
 	class HandleDrawManager;
 	class HandleDrawManager;
 	class SceneCameraController;
 	class SceneCameraController;
+	class ProjectSettings;
 
 
 	typedef std::shared_ptr<ProjectResourceMeta> ProjectResourceMetaPtr;
 	typedef std::shared_ptr<ProjectResourceMeta> ProjectResourceMetaPtr;
 	typedef std::shared_ptr<DockManagerLayout> DockManagerLayoutPtr;
 	typedef std::shared_ptr<DockManagerLayout> DockManagerLayoutPtr;
 	typedef std::shared_ptr<EditorWidgetLayout> EditorWidgetLayoutPtr;
 	typedef std::shared_ptr<EditorWidgetLayout> EditorWidgetLayoutPtr;
+	typedef std::shared_ptr<ProjectSettings> ProjectSettingsPtr;
 
 
 	enum class DragAndDropType
 	enum class DragAndDropType
 	{
 	{

+ 12 - 11
BansheeEditor/Include/BsHandleDrawManager.h

@@ -16,17 +16,17 @@ namespace BansheeEngine
 		void setColor(const Color& color);
 		void setColor(const Color& color);
 		void setTransform(const Matrix4& transform);
 		void setTransform(const Matrix4& transform);
 
 
-		void drawCube(const Vector3& position, const Vector3& extents);
-		void drawSphere(const Vector3& position, float radius);
-		void drawWireCube(const Vector3& position, const Vector3& extents);
-		void drawWireSphere(const Vector3& position, float radius);
-		void drawCone(const Vector3& base, const Vector3& normal, float height, float radius);
-		void drawLine(const Vector3& start, const Vector3& end);
-		void drawDisc(const Vector3& position, const Vector3& normal, float radius);
-		void drawWireDisc(const Vector3& position, const Vector3& normal, float radius);
-		void drawArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle);
-		void drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle);
-		void drawRect(const Rect3& area);
+		void drawCube(const Vector3& position, const Vector3& extents, float size = 1.0f);
+		void drawSphere(const Vector3& position, float radius, float size = 1.0f);
+		void drawWireCube(const Vector3& position, const Vector3& extents, float size = 1.0f);
+		void drawWireSphere(const Vector3& position, float radius, float size = 1.0f);
+		void drawCone(const Vector3& base, const Vector3& normal, float height, float radius, float size = 1.0f);
+		void drawLine(const Vector3& start, const Vector3& end, float size = 1.0f);
+		void drawDisc(const Vector3& position, const Vector3& normal, float radius, float size = 1.0f);
+		void drawWireDisc(const Vector3& position, const Vector3& normal, float radius, float size = 1.0f);
+		void drawArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f);
+		void drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f);
+		void drawRect(const Rect3& area, float size = 1.0f);
 
 
 		void draw(const HCamera& camera);
 		void draw(const HCamera& camera);
 
 
@@ -40,6 +40,7 @@ namespace BansheeEngine
 		static const UINT32 WIRE_SPHERE_QUALITY;
 		static const UINT32 WIRE_SPHERE_QUALITY;
 		static const UINT32 ARC_QUALITY;
 		static const UINT32 ARC_QUALITY;
 
 
+		Matrix4 mTransform;
 		HandleDrawManagerCore* mCore;
 		HandleDrawManagerCore* mCore;
 		DrawHelper* mDrawHelper;
 		DrawHelper* mDrawHelper;
 	};
 	};

+ 13 - 0
BansheeEditor/Include/BsHandleManager.h

@@ -2,6 +2,7 @@
 
 
 #include "BsEditorPrerequisites.h"
 #include "BsEditorPrerequisites.h"
 #include "BsModule.h"
 #include "BsModule.h"
+#include "BsDegree.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -17,12 +18,24 @@ namespace BansheeEngine
 		HandleSliderManager& getSliderManager() const { return *mSliderManager; }
 		HandleSliderManager& getSliderManager() const { return *mSliderManager; }
 		HandleDrawManager& getDrawManager() const { return *mDrawManager; }
 		HandleDrawManager& getDrawManager() const { return *mDrawManager; }
 
 
+		float getHandleSize(const HCamera& camera, const Vector3& handlePos) const;
+
+		void setDefaultHandleSize(float value) { mDefaultHandleSize = value; }
+		void setMoveHandleSnapAmount(float value) { mMoveHandleSnapAmount = value; }
+		void setRotateHandleSnapAmount(Degree value) { mRotateHandleSnapAmount = value; }
+		void setScaleHandleSnapAmount(float value) { mScaleHandleSnapAmount = value; }
+
 		bool isHandleActive() const;
 		bool isHandleActive() const;
 
 
 	protected:
 	protected:
 		HandleSliderManager* mSliderManager;
 		HandleSliderManager* mSliderManager;
 		HandleDrawManager* mDrawManager;
 		HandleDrawManager* mDrawManager;
 
 
+		float mDefaultHandleSize = 20.0f;
+		float mMoveHandleSnapAmount = 0.1f;
+		Degree mRotateHandleSnapAmount = Degree(20.0f);
+		float mScaleHandleSnapAmount = 0.1f;
+
 		virtual void refreshHandles() = 0;
 		virtual void refreshHandles() = 0;
 		virtual void triggerHandles() = 0;
 		virtual void triggerHandles() = 0;
 		virtual void queueDrawCommands() = 0;
 		virtual void queueDrawCommands() = 0;

+ 10 - 5
BansheeEditor/Include/BsHandleSlider.h

@@ -17,15 +17,15 @@ namespace BansheeEngine
 			Hover
 			Hover
 		};
 		};
 
 
-		HandleSlider(bool fixedScale, float snapValue);
+		HandleSlider(bool fixedScale);
 		virtual ~HandleSlider() { }
 		virtual ~HandleSlider() { }
 
 
 		virtual bool intersects(const Ray& ray, float& t) const = 0;
 		virtual bool intersects(const Ray& ray, float& t) const = 0;
-		virtual void update(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray) = 0;
+		virtual void handleInput(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray) = 0;
+		void update(const HCamera& camera);
 
 
 		State getState() const { return mState; }
 		State getState() const { return mState; }
 		bool getFixedScale() const { return mFixedScale; }
 		bool getFixedScale() const { return mFixedScale; }
-		float getSnapValue() const { return mSnapValue; }
 
 
 		void setPosition(const Vector3& position);
 		void setPosition(const Vector3& position);
 		void setRotation(const Quaternion& rotation);
 		void setRotation(const Quaternion& rotation);
@@ -35,6 +35,9 @@ namespace BansheeEngine
 		const Quaternion& getRotation() const { return mRotation; }
 		const Quaternion& getRotation() const { return mRotation; }
 		const Vector3& getScale() const { return mScale; }
 		const Vector3& getScale() const { return mScale; }
 
 
+		float getDelta() const;
+		void reset();
+
 	protected:
 	protected:
 		friend class HandleSliderManager;
 		friend class HandleSliderManager;
 
 
@@ -46,22 +49,24 @@ namespace BansheeEngine
 		const Matrix4& getTransformInv() const;
 		const Matrix4& getTransformInv() const;
 
 
 		virtual void updateCachedTransform() const;
 		virtual void updateCachedTransform() const;
-		virtual void reset() = 0;
 
 
 		float calcDelta(const HCamera& camera, const Vector3& position, const Vector3& direction, 
 		float calcDelta(const HCamera& camera, const Vector3& position, const Vector3& direction, 
 			const Vector2I& pointerStart, const Vector2I& pointerEnd);
 			const Vector2I& pointerStart, const Vector2I& pointerEnd);
 
 
 		bool mFixedScale;
 		bool mFixedScale;
-		float mSnapValue;
 
 
 		Vector3 mPosition;
 		Vector3 mPosition;
 		Quaternion mRotation;
 		Quaternion mRotation;
 		Vector3 mScale;
 		Vector3 mScale;
+		float mDistanceScale;
 
 
 		Vector2I mLastPointerPos;
 		Vector2I mLastPointerPos;
 		Vector2I mCurPointerPos;
 		Vector2I mCurPointerPos;
 		State mState;
 		State mState;
 
 
+		float mDelta;
+		bool mHasLastPos;
+
 		mutable bool mTransformDirty;
 		mutable bool mTransformDirty;
 		mutable Matrix4 mTransform;
 		mutable Matrix4 mTransform;
 		mutable Matrix4 mTransformInv;
 		mutable Matrix4 mTransformInv;

+ 2 - 7
BansheeEditor/Include/BsHandleSliderDisc.h

@@ -9,19 +9,17 @@ namespace BansheeEngine
 	class BS_ED_EXPORT HandleSliderDisc : public HandleSlider
 	class BS_ED_EXPORT HandleSliderDisc : public HandleSlider
 	{
 	{
 	public:
 	public:
-		HandleSliderDisc(const Vector3& normal, float radius, float snapValue, bool fixedScale);
+		HandleSliderDisc(const Vector3& normal, float radius, bool fixedScale);
 		~HandleSliderDisc();
 		~HandleSliderDisc();
 
 
 		bool intersects(const Ray& ray, float& t) const;
 		bool intersects(const Ray& ray, float& t) const;
-		void update(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray);
+		void handleInput(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray);
 
 
-		float getDelta() const { return 0.0f; /* TODO */ }
 		Vector3 getDeltaDirection() const { return Vector3::ZERO; /* TODO */ }
 		Vector3 getDeltaDirection() const { return Vector3::ZERO; /* TODO */ }
 		Quaternion getNewRotation() const { return mRotation; /* TODO */ }
 		Quaternion getNewRotation() const { return mRotation; /* TODO */ }
 
 
 	protected:
 	protected:
 		virtual void updateCachedTransform() const;
 		virtual void updateCachedTransform() const;
-		virtual void reset();
 
 
 		static const float TORUS_RADIUS;
 		static const float TORUS_RADIUS;
 
 
@@ -30,8 +28,5 @@ namespace BansheeEngine
 		Matrix4 mTorusRotation;
 		Matrix4 mTorusRotation;
 
 
 		Torus mCollider;
 		Torus mCollider;
-
-		float mDelta;
-		bool mHasLastPos;
 	};
 	};
 }
 }

+ 2 - 7
BansheeEditor/Include/BsHandleSliderLine.h

@@ -10,17 +10,15 @@ namespace BansheeEngine
 	class BS_ED_EXPORT HandleSliderLine : public HandleSlider
 	class BS_ED_EXPORT HandleSliderLine : public HandleSlider
 	{
 	{
 	public:
 	public:
-		HandleSliderLine(const Vector3& direction, float length, float snapValue, bool fixedScale);
+		HandleSliderLine(const Vector3& direction, float length, bool fixedScale);
 		~HandleSliderLine();
 		~HandleSliderLine();
 
 
 		bool intersects(const Ray& ray, float& t) const;
 		bool intersects(const Ray& ray, float& t) const;
-		void update(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray);
+		void handleInput(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray);
 
 
-		float getDelta() const { return mDelta; }
 		Vector3 getNewPosition() const;
 		Vector3 getNewPosition() const;
 
 
 	protected:
 	protected:
-		void reset();
 
 
 		static const float CAPSULE_RADIUS;
 		static const float CAPSULE_RADIUS;
 		static const float SPHERE_RADIUS;
 		static const float SPHERE_RADIUS;
@@ -30,8 +28,5 @@ namespace BansheeEngine
 
 
 		Capsule mCapsuleCollider;
 		Capsule mCapsuleCollider;
 		Sphere mSphereCollider;
 		Sphere mSphereCollider;
-
-		float mDelta;
-		bool mHasLastPos;
 	};
 	};
 }
 }

+ 2 - 1
BansheeEditor/Include/BsHandleSliderManager.h

@@ -10,7 +10,8 @@ namespace BansheeEngine
 		HandleSliderManager();
 		HandleSliderManager();
 		~HandleSliderManager();
 		~HandleSliderManager();
 
 
-		void update(const HCamera& camera, const Vector2I& inputPos, const Ray& inputRay, bool pressed);
+		void update(const HCamera& camera);
+		void handleInput(const HCamera& camera, const Vector2I& inputPos, const Ray& inputRay, bool pressed);
 		bool isSliderActive() const;
 		bool isSliderActive() const;
 
 
 		void _registerSlider(HandleSlider* slider);
 		void _registerSlider(HandleSlider* slider);

+ 2 - 5
BansheeEditor/Include/BsHandleSliderPlane.h

@@ -9,19 +9,16 @@ namespace BansheeEngine
 	class BS_ED_EXPORT HandleSliderPlane : public HandleSlider
 	class BS_ED_EXPORT HandleSliderPlane : public HandleSlider
 	{
 	{
 	public:
 	public:
-		HandleSliderPlane(const Vector3& dir1, const Vector3& dir2, float length, float snapValue, bool fixedScale);
+		HandleSliderPlane(const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale);
 		~HandleSliderPlane();
 		~HandleSliderPlane();
 
 
 		bool intersects(const Ray& ray, float& t) const;
 		bool intersects(const Ray& ray, float& t) const;
-		void update(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray);
+		void handleInput(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray);
 
 
-		float getDelta() const { return 0.0f; /* TODO */ }
 		Vector3 getDeltaDirection() const { return Vector3::ZERO; /* TODO */ }
 		Vector3 getDeltaDirection() const { return Vector3::ZERO; /* TODO */ }
 		Vector3 getNewPosition() const { return mPosition; /* TODO */ }
 		Vector3 getNewPosition() const { return mPosition; /* TODO */ }
 
 
 	protected:
 	protected:
-		void reset();
-
 		Vector3 mDirection1;
 		Vector3 mDirection1;
 		Vector3 mDirection2;
 		Vector3 mDirection2;
 		float mLength;
 		float mLength;

+ 45 - 0
BansheeEditor/Include/BsProjectSettings.h

@@ -0,0 +1,45 @@
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsDegree.h"
+
+namespace BansheeEngine
+{
+	class BS_ED_EXPORT ProjectSettings
+	{
+	public:
+		float getMoveHandleSnap() const { return mMoveSnap; }
+		Degree getRotationHandleSnap() const { return mRotationSnap; }
+		float getScaleHandleSnap() const { return mScaleSnap; }
+
+		UINT32 getGridSize() const { return mGridSize; }
+		float getGridSpacing() const { return mGridAxisSpacing; }
+		UINT32 getGridMajorAxisSpacing() const { return mGridMajorAxisSpacing; }
+		UINT32 getGridAxisMarkerSpacing() const { return mGridAxisMarkerSpacing; }
+
+		float getHandleSize() const { return mHandleSize; }
+
+		void setMoveHandleSnap(float value) { mMoveSnap = value; }
+		void setRotationHandleSnap(Degree value) { mRotationSnap = value; }
+		void setScaleHandleSnap(float value) { mScaleSnap = value; }
+
+		void setGridSize(UINT32 value) { mGridSize = value; }
+		void setGridSpacing(float value) { mGridAxisSpacing = value; }
+		void setGridMajorAxisSpacing(UINT32 value) { mGridMajorAxisSpacing = value; }
+		void setGridAxisMarkerSpacing(UINT32 value) { mGridMajorAxisSpacing = value; }
+
+		void setHandleSize(float value) { mHandleSize = value; }
+
+	private:
+		float mMoveSnap = 0.1f;
+		Degree mRotationSnap = Degree(20.0f);
+		float mScaleSnap = 0.1f;
+
+		UINT32 mGridSize = 256;
+		float mGridAxisSpacing = 1.0f;
+		UINT32 mGridMajorAxisSpacing = 10;
+		UINT32 mGridAxisMarkerSpacing = 25;
+
+		float mHandleSize = 20.0f;
+	};
+}

+ 2 - 2
BansheeEditor/Include/BsSceneGrid.h

@@ -13,7 +13,7 @@ namespace BansheeEngine
 		SceneGrid();
 		SceneGrid();
 
 
 		void setOrigin(const Vector3& origin);
 		void setOrigin(const Vector3& origin);
-		void setSize(float size);
+		void setSize(UINT32 size);
 		void setSpacing(float spacing);
 		void setSpacing(float spacing);
 		void setMajorAxisSpacing(UINT32 spacing);
 		void setMajorAxisSpacing(UINT32 spacing);
 		void setAxisMarkerSpacing(UINT32 spacing);
 		void setAxisMarkerSpacing(UINT32 spacing);
@@ -29,7 +29,7 @@ namespace BansheeEngine
 
 
 		Vector3 mOrigin;
 		Vector3 mOrigin;
 		float mSpacing = 1.0f;
 		float mSpacing = 1.0f;
-		float mSize = 257.0f;
+		UINT32 mSize = 256;
 		UINT32 mMajorAxisSpacing = 10;
 		UINT32 mMajorAxisSpacing = 10;
 		UINT32 mAxisMarkerSpacing = 25;
 		UINT32 mAxisMarkerSpacing = 25;
 
 

+ 5 - 0
BansheeEditor/Source/BsEditorApplication.cpp

@@ -40,6 +40,7 @@
 #include "BsGUILayout.h"
 #include "BsGUILayout.h"
 #include "BsEvent.h"
 #include "BsEvent.h"
 #include "BsRenderer.h"
 #include "BsRenderer.h"
+#include "BsProjectSettings.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -60,6 +61,9 @@ namespace BansheeEngine
 		:Application(createRenderWindowDesc(), renderSystemPlugin, RendererPlugin::Default), 
 		:Application(createRenderWindowDesc(), renderSystemPlugin, RendererPlugin::Default), 
 		mActiveRSPlugin(renderSystemPlugin), mSBansheeEditorPlugin(nullptr)
 		mActiveRSPlugin(renderSystemPlugin), mSBansheeEditorPlugin(nullptr)
 	{
 	{
+		// TODO - Load project settings
+		mProjectSettings = bs_shared_ptr<ProjectSettings>();
+
 		BuiltinEditorResources::startUp(renderSystemPlugin);
 		BuiltinEditorResources::startUp(renderSystemPlugin);
 
 
 		{
 		{
@@ -95,6 +99,7 @@ namespace BansheeEngine
 		ScenePicking::shutDown();
 		ScenePicking::shutDown();
 
 
 		saveWidgetLayout(EditorWidgetManager::instance().getLayout());
 		saveWidgetLayout(EditorWidgetManager::instance().getLayout());
+		// TODO - Save project settings
 
 
 		EditorWidgetManager::shutDown();
 		EditorWidgetManager::shutDown();
 		EditorWindowManager::shutDown();
 		EditorWindowManager::shutDown();

+ 46 - 12
BansheeEditor/Source/BsHandleDrawManager.cpp

@@ -20,6 +20,7 @@ namespace BansheeEngine
 	HandleDrawManager::HandleDrawManager()
 	HandleDrawManager::HandleDrawManager()
 		:mCore(nullptr)
 		:mCore(nullptr)
 	{
 	{
+		mTransform = Matrix4::IDENTITY;
 		mDrawHelper = bs_new<DrawHelper>();
 		mDrawHelper = bs_new<DrawHelper>();
 
 
 		HMaterial solidMaterial = BuiltinEditorResources::instance().createSolidHandleMat();
 		HMaterial solidMaterial = BuiltinEditorResources::instance().createSolidHandleMat();
@@ -61,61 +62,94 @@ namespace BansheeEngine
 
 
 	void HandleDrawManager::setTransform(const Matrix4& transform)
 	void HandleDrawManager::setTransform(const Matrix4& transform)
 	{
 	{
-		mDrawHelper->setTransform(transform);
+		mTransform = transform;
 	}
 	}
 
 
-	void HandleDrawManager::drawCube(const Vector3& position, const Vector3& extents)
+	void HandleDrawManager::drawCube(const Vector3& position, const Vector3& extents, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->cube(position, extents);
 		mDrawHelper->cube(position, extents);
 	}
 	}
 
 
-	void HandleDrawManager::drawSphere(const Vector3& position, float radius)
+	void HandleDrawManager::drawSphere(const Vector3& position, float radius, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->sphere(position, radius);
 		mDrawHelper->sphere(position, radius);
 	}
 	}
 
 
-	void HandleDrawManager::drawWireCube(const Vector3& position, const Vector3& extents)
+	void HandleDrawManager::drawWireCube(const Vector3& position, const Vector3& extents, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->wireCube(position, extents);
 		mDrawHelper->wireCube(position, extents);
 	}
 	}
 
 
-	void HandleDrawManager::drawWireSphere(const Vector3& position, float radius)
+	void HandleDrawManager::drawWireSphere(const Vector3& position, float radius, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->wireSphere(position, radius);
 		mDrawHelper->wireSphere(position, radius);
 	}
 	}
 
 
-	void HandleDrawManager::drawCone(const Vector3& base, const Vector3& normal, float height, float radius)
+	void HandleDrawManager::drawCone(const Vector3& base, const Vector3& normal, float height, float radius, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->cone(base, normal, height, radius);
 		mDrawHelper->cone(base, normal, height, radius);
 	}
 	}
 
 
-	void HandleDrawManager::drawLine(const Vector3& start, const Vector3& end)
+	void HandleDrawManager::drawLine(const Vector3& start, const Vector3& end, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->line(start, end);
 		mDrawHelper->line(start, end);
 	}
 	}
 
 
-	void HandleDrawManager::drawDisc(const Vector3& position, const Vector3& normal, float radius)
+	void HandleDrawManager::drawDisc(const Vector3& position, const Vector3& normal, float radius, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->disc(position, normal, radius);
 		mDrawHelper->disc(position, normal, radius);
 	}
 	}
 
 
-	void HandleDrawManager::drawWireDisc(const Vector3& position, const Vector3& normal, float radius)
+	void HandleDrawManager::drawWireDisc(const Vector3& position, const Vector3& normal, float radius, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->wireDisc(position, normal, radius);
 		mDrawHelper->wireDisc(position, normal, radius);
 	}
 	}
 
 
-	void HandleDrawManager::drawArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle)
+	void HandleDrawManager::drawArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->arc(position, normal, radius, startAngle, amountAngle);
 		mDrawHelper->arc(position, normal, radius, startAngle, amountAngle);
 	}
 	}
 
 
-	void HandleDrawManager::drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle)
+	void HandleDrawManager::drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->wireArc(position, normal, radius, startAngle, amountAngle);
 		mDrawHelper->wireArc(position, normal, radius, startAngle, amountAngle);
 	}
 	}
 
 
-	void HandleDrawManager::drawRect(const Rect3& area)
+	void HandleDrawManager::drawRect(const Rect3& area, float size)
 	{
 	{
+		Matrix4 scale(Vector3::ZERO, Quaternion::IDENTITY, Vector3(size, size, size));
+		mDrawHelper->setTransform(scale * mTransform);
+
 		mDrawHelper->rectangle(area);
 		mDrawHelper->rectangle(area);
 	}
 	}
 
 

+ 14 - 1
BansheeEditor/Source/BsHandleManager.cpp

@@ -2,6 +2,8 @@
 #include "BsHandleDrawManager.h"
 #include "BsHandleDrawManager.h"
 #include "BsHandleSliderManager.h"
 #include "BsHandleSliderManager.h"
 #include "BsSceneEditorWidget.h"
 #include "BsSceneEditorWidget.h"
+#include "BsCamera.h"
+#include "BsSceneObject.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -43,8 +45,19 @@ namespace BansheeEngine
 			HCamera sceneCamera = sceneView->getSceneCamera();
 			HCamera sceneCamera = sceneView->getSceneCamera();
 
 
 			refreshHandles();
 			refreshHandles();
-			mSliderManager->update(sceneCamera, inputPos, inputRay, pressed);
+			mSliderManager->handleInput(sceneCamera, inputPos, inputRay, pressed);
 			triggerHandles();
 			triggerHandles();
 		}
 		}
 	}
 	}
+
+	float HandleManager::getHandleSize(const HCamera& camera, const Vector3& handlePos) const
+	{
+		HSceneObject cameraSO = camera->SO();
+		Vector3 cameraPos = camera->SO()->getWorldPosition();
+
+		Vector3 diff = handlePos - cameraPos;
+		float distAlongViewDir = diff.dot(cameraSO->getForward());
+
+		return mDefaultHandleSize / std::max(distAlongViewDir, 0.0001f);
+	}
 }
 }

+ 26 - 3
BansheeEditor/Source/BsHandleSlider.cpp

@@ -1,14 +1,22 @@
 #include "BsHandleSlider.h"
 #include "BsHandleSlider.h"
 #include "BsCamera.h"
 #include "BsCamera.h"
+#include "BsHandleManager.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	HandleSlider::HandleSlider(bool fixedScale, float snapValue)
-		:mFixedScale(fixedScale), mSnapValue(snapValue), mScale(Vector3::ONE), mTransformDirty(true)
+	HandleSlider::HandleSlider(bool fixedScale)
+		:mFixedScale(fixedScale), mScale(Vector3::ONE), mTransformDirty(true),
+		mDistanceScale(1.0f), mDelta(0.0f), mHasLastPos(false)
 	{
 	{
 
 
 	}
 	}
 
 
+	void HandleSlider::update(const HCamera& camera)
+	{
+		if (mFixedScale)
+			mDistanceScale = HandleManager::instance().getHandleSize(camera, mPosition);
+	}
+
 	void HandleSlider::setPosition(const Vector3& position)
 	void HandleSlider::setPosition(const Vector3& position)
 	{
 	{
 		mPosition = position;
 		mPosition = position;
@@ -45,11 +53,26 @@ namespace BansheeEngine
 
 
 	void HandleSlider::updateCachedTransform() const
 	void HandleSlider::updateCachedTransform() const
 	{
 	{
-		mTransform.setTRS(mPosition, mRotation, mScale);
+		if (mFixedScale)
+			mTransform.setTRS(mPosition, mRotation, mScale * mDistanceScale);
+		else
+			mTransform.setTRS(mPosition, mRotation, mScale);
+
 		mTransformInv = mTransform.inverseAffine();
 		mTransformInv = mTransform.inverseAffine();
 		mTransformDirty = false;
 		mTransformDirty = false;
 	}
 	}
 
 
+	void HandleSlider::reset()
+	{
+		mDelta = 0.0f;
+		mHasLastPos = false;
+	}
+
+	float HandleSlider::getDelta() const
+	{
+		return mDelta;
+	}
+
 	float HandleSlider::calcDelta(const HCamera& camera, const Vector3& position, const Vector3& direction,
 	float HandleSlider::calcDelta(const HCamera& camera, const Vector3& position, const Vector3& direction,
 		const Vector2I& pointerStart, const Vector2I& pointerEnd)
 		const Vector2I& pointerStart, const Vector2I& pointerEnd)
 	{
 	{

+ 8 - 10
BansheeEditor/Source/BsHandleSliderDisc.cpp

@@ -9,8 +9,8 @@ namespace BansheeEngine
 {
 {
 	const float HandleSliderDisc::TORUS_RADIUS = 0.5f;
 	const float HandleSliderDisc::TORUS_RADIUS = 0.5f;
 
 
-	HandleSliderDisc::HandleSliderDisc(const Vector3& normal, float radius, float snapValue, bool fixedScale)
-		:HandleSlider(fixedScale, snapValue), mRadius(radius), mDelta(0.0f), mHasLastPos(false)
+	HandleSliderDisc::HandleSliderDisc(const Vector3& normal, float radius, bool fixedScale)
+		:HandleSlider(fixedScale), mRadius(radius)
 	{
 	{
 		Vector3 x, z;
 		Vector3 x, z;
 		mNormal.orthogonalComplement(x, z);
 		mNormal.orthogonalComplement(x, z);
@@ -31,7 +31,11 @@ namespace BansheeEngine
 
 
 	void HandleSliderDisc::updateCachedTransform() const
 	void HandleSliderDisc::updateCachedTransform() const
 	{
 	{
-		mTransform.setTRS(mPosition, mRotation, mScale);
+		if (mFixedScale)
+			mTransform.setTRS(mPosition, mRotation, mScale * mDistanceScale);
+		else
+			mTransform.setTRS(mPosition, mRotation, mScale);
+
 		mTransform = mTransform * mTorusRotation;
 		mTransform = mTransform * mTorusRotation;
 		mTransformInv = mTransform.inverseAffine();
 		mTransformInv = mTransform.inverseAffine();
 		mTransformDirty = false;
 		mTransformDirty = false;
@@ -54,13 +58,7 @@ namespace BansheeEngine
 		return false;
 		return false;
 	}
 	}
 
 
-	void HandleSliderDisc::reset()
-	{
-		mDelta = 0.0f;
-		mHasLastPos = false;
-	}
-
-	void HandleSliderDisc::update(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray)
+	void HandleSliderDisc::handleInput(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray)
 	{
 	{
 		assert(getState() == State::Active);
 		assert(getState() == State::Active);
 
 

+ 4 - 10
BansheeEditor/Source/BsHandleSliderLine.cpp

@@ -11,8 +11,8 @@ namespace BansheeEngine
 	const float HandleSliderLine::CAPSULE_RADIUS = 0.05f;
 	const float HandleSliderLine::CAPSULE_RADIUS = 0.05f;
 	const float HandleSliderLine::SPHERE_RADIUS = 0.2f;
 	const float HandleSliderLine::SPHERE_RADIUS = 0.2f;
 
 
-	HandleSliderLine::HandleSliderLine(const Vector3& direction, float length, float snapValue, bool fixedScale)
-		:HandleSlider(fixedScale, snapValue), mLength(length), mDelta(0.0f), mHasLastPos(false)
+	HandleSliderLine::HandleSliderLine(const Vector3& direction, float length, bool fixedScale)
+		:HandleSlider(fixedScale), mLength(length)
 	{
 	{
 		mDirection = Vector3::normalize(direction);
 		mDirection = Vector3::normalize(direction);
 
 
@@ -63,7 +63,7 @@ namespace BansheeEngine
 		return gotIntersect;
 		return gotIntersect;
 	}
 	}
 
 
-	void HandleSliderLine::update(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray)
+	void HandleSliderLine::handleInput(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray)
 	{
 	{
 		assert(getState() == State::Active);
 		assert(getState() == State::Active);
 
 
@@ -76,14 +76,8 @@ namespace BansheeEngine
 		mHasLastPos = true;
 		mHasLastPos = true;
 	}
 	}
 
 
-	void HandleSliderLine::reset()
-	{
-		mDelta = 0.0f;
-		mHasLastPos = false;
-	}
-
 	Vector3 HandleSliderLine::getNewPosition() const
 	Vector3 HandleSliderLine::getNewPosition() const
 	{
 	{
-		return getPosition() + mDirection * mDelta;
+		return getPosition() + mDirection * getDelta();
 	}
 	}
 }
 }

+ 8 - 2
BansheeEditor/Source/BsHandleSliderManager.cpp

@@ -24,7 +24,13 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
-	void HandleSliderManager::update(const HCamera& camera, const Vector2I& inputPos, const Ray& inputRay, bool pressed)
+	void HandleSliderManager::update(const HCamera& camera)
+	{
+		for (auto& slider : mSliders)
+			slider->update(camera);
+	}
+
+	void HandleSliderManager::handleInput(const HCamera& camera, const Vector2I& inputPos, const Ray& inputRay, bool pressed)
 	{
 	{
 		if (!pressed)
 		if (!pressed)
 		{
 		{
@@ -88,7 +94,7 @@ namespace BansheeEngine
 
 
 			if (mActiveSlider != nullptr)
 			if (mActiveSlider != nullptr)
 			{
 			{
-				mActiveSlider->update(camera, inputPos, inputRay);
+				mActiveSlider->handleInput(camera, inputPos, inputRay);
 			}
 			}
 		}
 		}
 	}
 	}

+ 3 - 9
BansheeEditor/Source/BsHandleSliderPlane.cpp

@@ -6,8 +6,8 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	HandleSliderPlane::HandleSliderPlane(const Vector3& dir1, const Vector3& dir2, float length, float snapValue, bool fixedScale)
-		:HandleSlider(fixedScale, snapValue), mLength(length), mDelta(0.0f), mHasLastPos(false)
+	HandleSliderPlane::HandleSliderPlane(const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale)
+		:HandleSlider(fixedScale), mLength(length)
 	{
 	{
 		mDirection1 = Vector3::normalize(dir1);
 		mDirection1 = Vector3::normalize(dir1);
 		mDirection2 = Vector3::normalize(dir2);
 		mDirection2 = Vector3::normalize(dir2);
@@ -45,13 +45,7 @@ namespace BansheeEngine
 		return false;
 		return false;
 	}
 	}
 
 
-	void HandleSliderPlane::reset()
-	{
-		mDelta = 0.0f;
-		mHasLastPos = false;
-	}
-
-	void HandleSliderPlane::update(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray)
+	void HandleSliderPlane::handleInput(const HCamera& camera, const Vector2I& pointerPos, const Ray& ray)
 	{
 	{
 		assert(getState() == State::Active);
 		assert(getState() == State::Active);
 
 

+ 16 - 1
BansheeEditor/Source/BsSceneEditorWidget.cpp

@@ -23,6 +23,8 @@
 #include "BsScenePicking.h"
 #include "BsScenePicking.h"
 #include "BsHandleManager.h"
 #include "BsHandleManager.h"
 #include "BsSelection.h"
 #include "BsSelection.h"
+#include "BsEditorApplication.h"
+#include "BsProjectSettings.h"
 
 
 // DEBUG ONLY
 // DEBUG ONLY
 #include "BsTime.h"
 #include "BsTime.h"
@@ -69,12 +71,25 @@ namespace BansheeEngine
 
 
 	void SceneEditorWidget::_update()
 	void SceneEditorWidget::_update()
 	{
 	{
+		ProjectSettingsPtr projSettings = gEditorApplication().getProjectSettings();
+
 		if (mCameraController)
 		if (mCameraController)
 		{
 		{
 			mCameraController->update();
 			mCameraController->update();
 		}
 		}
 
 
-		HandleManager::instance().update();
+		HandleManager& handleManager = HandleManager::instance();
+
+		handleManager.setDefaultHandleSize(projSettings->getHandleSize());
+		handleManager.setMoveHandleSnapAmount(projSettings->getMoveHandleSnap());
+		handleManager.setRotateHandleSnapAmount(projSettings->getRotationHandleSnap());
+		handleManager.setScaleHandleSnapAmount(projSettings->getScaleHandleSnap());
+		handleManager.update();
+
+		mSceneGrid->setSize(projSettings->getGridSize());
+		mSceneGrid->setSpacing(projSettings->getGridSpacing());
+		mSceneGrid->setMajorAxisSpacing(projSettings->getGridMajorAxisSpacing());
+		mSceneGrid->setAxisMarkerSpacing(projSettings->getGridAxisMarkerSpacing());
 
 
 		//// DEBUG ONLY
 		//// DEBUG ONLY
 		//if (gTime().getCurrentFrameNumber() == 100)
 		//if (gTime().getCurrentFrameNumber() == 100)

+ 27 - 12
BansheeEditor/Source/BsSceneGrid.cpp

@@ -33,32 +33,47 @@ namespace BansheeEngine
 
 
 	void SceneGrid::setOrigin(const Vector3& origin)
 	void SceneGrid::setOrigin(const Vector3& origin)
 	{
 	{
-		mOrigin = origin;
-		updateGridMesh();
+		if (mOrigin != origin)
+		{
+			mOrigin = origin;
+			updateGridMesh();
+		}
 	}
 	}
 
 
-	void SceneGrid::setSize(float size)
+	void SceneGrid::setSize(UINT32 size)
 	{
 	{
-		mSize = size;
-		updateGridMesh();
+		if (mSize != size)
+		{
+			mSize = size;
+			updateGridMesh();
+		}
 	}
 	}
 
 
 	void SceneGrid::setSpacing(float spacing)
 	void SceneGrid::setSpacing(float spacing)
 	{
 	{
-		mSpacing = spacing;
-		updateGridMesh();
+		if (mSpacing != spacing)
+		{
+			mSpacing = spacing;
+			updateGridMesh();
+		}
 	}
 	}
 
 
 	void SceneGrid::setMajorAxisSpacing(UINT32 spacing)
 	void SceneGrid::setMajorAxisSpacing(UINT32 spacing)
 	{
 	{
-		mMajorAxisSpacing = spacing;
-		updateGridMesh();
+		if (mMajorAxisSpacing != spacing)
+		{
+			mMajorAxisSpacing = spacing;
+			updateGridMesh();
+		}
 	}
 	}
 
 
 	void SceneGrid::setAxisMarkerSpacing(UINT32 spacing)
 	void SceneGrid::setAxisMarkerSpacing(UINT32 spacing)
 	{
 	{
-		mAxisMarkerSpacing = spacing;
-		updateGridMesh();
+		if (mAxisMarkerSpacing != spacing)
+		{
+			mAxisMarkerSpacing = spacing;
+			updateGridMesh();
+		}
 	}
 	}
 
 
 	void SceneGrid::render(const CameraPtr& camera, DrawList& drawList)
 	void SceneGrid::render(const CameraPtr& camera, DrawList& drawList)
@@ -77,7 +92,7 @@ namespace BansheeEngine
 
 
 	void SceneGrid::updateGridMesh()
 	void SceneGrid::updateGridMesh()
 	{
 	{
-		UINT32 numLines = (UINT32)Math::roundToInt(mSize / mSpacing) - 1;
+		UINT32 numLines = (UINT32)Math::roundToInt(mSize / mSpacing);
 		if (numLines % 2 != 0)
 		if (numLines % 2 != 0)
 			numLines++;
 			numLines++;
 
 

+ 6 - 0
MBansheeEditor/EditorApplication.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using BansheeEngine;
 
 
 namespace BansheeEditor
 namespace BansheeEditor
 {
 {
@@ -46,5 +47,10 @@ namespace BansheeEditor
             get { return handleCoordinateMode; }
             get { return handleCoordinateMode; }
             set { handleCoordinateMode = value; } // TODO - Will likely need to update active GUI button when this changes
             set { handleCoordinateMode = value; } // TODO - Will likely need to update active GUI button when this changes
         }
         }
+
+        public static Camera sceneCamera
+        {
+            get { return null; } // TODO - Return actual scene camera
+        }
     }
     }
 }
 }

+ 1 - 0
MBansheeEditor/MBansheeEditor.csproj

@@ -84,6 +84,7 @@
     <Compile Include="Inspector\InspectorWindow.cs" />
     <Compile Include="Inspector\InspectorWindow.cs" />
     <Compile Include="Scene\DefaultHandle.cs" />
     <Compile Include="Scene\DefaultHandle.cs" />
     <Compile Include="Scene\DefaultHandleManager.cs" />
     <Compile Include="Scene\DefaultHandleManager.cs" />
+    <Compile Include="Scene\Handles.cs" />
     <Compile Include="Scene\MoveHandle.cs" />
     <Compile Include="Scene\MoveHandle.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="ProjectLibrary.cs" />
     <Compile Include="ProjectLibrary.cs" />

+ 33 - 33
MBansheeEditor/Scene/HandleDrawing.cs

@@ -15,59 +15,59 @@ namespace BansheeEditor
             Internal_SetTransform(transform);
             Internal_SetTransform(transform);
         }
         }
 
 
-        public static void DrawCube(Vector3 position, Vector3 extents)
+        public static void DrawCube(Vector3 position, Vector3 extents, float size = 1.0f)
         {
         {
-            Internal_DrawCube(position, extents);
+            Internal_DrawCube(position, extents, size);
         }
         }
 
 
-        public static void DrawSphere(Vector3 position, float radius)
+        public static void DrawSphere(Vector3 position, float radius, float size = 1.0f)
         {
         {
-            Internal_DrawSphere(position, radius);
+            Internal_DrawSphere(position, radius, size);
         }
         }
 
 
-        public static void DrawWireCube(Vector3 position, Vector3 extents)
+        public static void DrawWireCube(Vector3 position, Vector3 extents, float size = 1.0f)
         {
         {
-            Internal_DrawWireCube(position, extents);
+            Internal_DrawWireCube(position, extents, size);
         }
         }
 
 
-        public static void DrawWireSphere(Vector3 position, float radius)
+        public static void DrawWireSphere(Vector3 position, float radius, float size = 1.0f)
         {
         {
-            Internal_DrawWireSphere(position, radius);
+            Internal_DrawWireSphere(position, radius, size);
         }
         }
 
 
-        public static void DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius)
+        public static void DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size = 1.0f)
         {
         {
-            Internal_DrawCone(coneBase, normal, height, radius);
+            Internal_DrawCone(coneBase, normal, height, radius, size);
         }
         }
 
 
-        public static void DrawLine(Vector3 start, Vector3 end)
+        public static void DrawLine(Vector3 start, Vector3 end, float size = 1.0f)
         {
         {
-            Internal_DrawLine(start, end);
+            Internal_DrawLine(start, end, size);
         }
         }
 
 
-        public static void DrawDisc(Vector3 position, Vector3 normal, float radius)
+        public static void DrawDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
         {
         {
-            Internal_DrawDisc(position, normal, radius);
+            Internal_DrawDisc(position, normal, radius, size);
         }
         }
 
 
-        public static void DrawWireDisc(Vector3 position, Vector3 normal, float radius)
+        public static void DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
         {
         {
-            Internal_DrawWireDisc(position, normal, radius);
+            Internal_DrawWireDisc(position, normal, radius, size);
         }
         }
 
 
-        public static void DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle)
+        public static void DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
         {
         {
-            Internal_DrawArc(position, normal, radius, startAngle, amountAngle);
+            Internal_DrawArc(position, normal, radius, startAngle, amountAngle, size);
         }
         }
 
 
-        public static void DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle)
+        public static void DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
         {
         {
-            Internal_DrawWireArc(position, normal, radius, startAngle, amountAngle);
+            Internal_DrawWireArc(position, normal, radius, startAngle, amountAngle, size);
         }
         }
 
 
-        public static void DrawRect(Rect3 area)
+        public static void DrawRect(Rect3 area, float size = 1.0f)
         {
         {
-            Internal_DrawRect(area);
+            Internal_DrawRect(area, size);
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
@@ -77,36 +77,36 @@ namespace BansheeEditor
         private static extern void Internal_SetTransform(Matrix4 transform);
         private static extern void Internal_SetTransform(Matrix4 transform);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawCube(Vector3 position, Vector3 extents);
+        private static extern void Internal_DrawCube(Vector3 position, Vector3 extents, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawSphere(Vector3 position, float radius);
+        private static extern void Internal_DrawSphere(Vector3 position, float radius, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireCube(Vector3 position, Vector3 extents);
+        private static extern void Internal_DrawWireCube(Vector3 position, Vector3 extents, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireSphere(Vector3 position, float radius);
+        private static extern void Internal_DrawWireSphere(Vector3 position, float radius, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius);
+        private static extern void Internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawLine(Vector3 start, Vector3 end);
+        private static extern void Internal_DrawLine(Vector3 start, Vector3 end, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawDisc(Vector3 position, Vector3 normal, float radius);
+        private static extern void Internal_DrawDisc(Vector3 position, Vector3 normal, float radius, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius);
+        private static extern void Internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle);
+        private static extern void Internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle);
+        private static extern void Internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_DrawRect(Rect3 area);
+        private static extern void Internal_DrawRect(Rect3 area, float size);
     }
     }
 }
 }

+ 8 - 9
MBansheeEditor/Scene/HandleSliderDisc.cs

@@ -9,7 +9,7 @@ namespace BansheeEditor
         public HandleSliderDisc(Handle parentHandle, Vector3 normal, float radius, bool fixedScale = true, float snapValue = 0.0f)
         public HandleSliderDisc(Handle parentHandle, Vector3 normal, float radius, bool fixedScale = true, float snapValue = 0.0f)
             :base(parentHandle)
             :base(parentHandle)
         {
         {
-            Internal_CreateInstance(this, normal, radius, fixedScale, snapValue);
+            Internal_CreateInstance(this, normal, radius, fixedScale);
         }
         }
 
 
         public float Delta
         public float Delta
@@ -21,29 +21,28 @@ namespace BansheeEditor
                 return value;
                 return value;
             }
             }
         }
         }
-
-        public Vector3 DeltaDirection
+        public Quaternion NewRotation
         {
         {
             get
             get
             {
             {
-                Vector3 value;
-                Internal_GetDeltaDirection(mCachedPtr, out value);
+                Quaternion value;
+                Internal_GetNewRotation(mCachedPtr, out value);
                 return value;
                 return value;
             }
             }
         }
         }
 
 
-        public Quaternion NewRotation
+        public Vector3 DeltaDirection
         {
         {
             get
             get
             {
             {
-                Quaternion value;
-                Internal_GetNewRotation(mCachedPtr, out value);
+                Vector3 value;
+                Internal_GetDeltaDirection(mCachedPtr, out value);
                 return value;
                 return value;
             }
             }
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(HandleSliderDisc instance, Vector3 normal, float radius, bool fixedScale, float snapValue);
+        private static extern void Internal_CreateInstance(HandleSliderDisc instance, Vector3 normal, float radius, bool fixedScale);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);
         private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);

+ 3 - 3
MBansheeEditor/Scene/HandleSliderLine.cs

@@ -6,10 +6,10 @@ namespace BansheeEditor
 {
 {
     public sealed class HandleSliderLine : HandleSlider
     public sealed class HandleSliderLine : HandleSlider
     {
     {
-        public HandleSliderLine(Handle parentHandle, Vector3 direction, float length,  bool fixedScale = true, float snapValue = 0.0f)
+        public HandleSliderLine(Handle parentHandle, Vector3 direction, float length,  bool fixedScale = true)
             :base(parentHandle)
             :base(parentHandle)
         {
         {
-            Internal_CreateInstance(this, direction, length, fixedScale, snapValue);
+            Internal_CreateInstance(this, direction, length, fixedScale);
         }
         }
 
 
         public float Delta
         public float Delta
@@ -33,7 +33,7 @@ namespace BansheeEditor
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(HandleSliderLine instance, Vector3 direction, float length, bool fixedScale, float snapValue);
+        private static extern void Internal_CreateInstance(HandleSliderLine instance, Vector3 direction, float length, bool fixedScale);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);
         private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);

+ 7 - 7
MBansheeEditor/Scene/HandleSliderPlane.cs

@@ -6,10 +6,10 @@ namespace BansheeEditor
 {
 {
     public sealed class HandleSliderPlane : HandleSlider
     public sealed class HandleSliderPlane : HandleSlider
     {
     {
-        public HandleSliderPlane(Handle parentHandle, Vector3 dir1, Vector3 dir2, float length, bool fixedScale = true, float snapValue = 0.0f)
+        public HandleSliderPlane(Handle parentHandle, Vector3 dir1, Vector3 dir2, float length, bool fixedScale = true)
             :base(parentHandle)
             :base(parentHandle)
         {
         {
-            Internal_CreateInstance(this, dir1, dir2, length, fixedScale, snapValue);
+            Internal_CreateInstance(this, dir1, dir2, length, fixedScale);
         }
         }
 
 
         public float Delta
         public float Delta
@@ -22,28 +22,28 @@ namespace BansheeEditor
             }
             }
         }
         }
 
 
-        public Vector3 DeltaDirection
+        public Vector3 NewPosition
         {
         {
             get
             get
             {
             {
                 Vector3 value;
                 Vector3 value;
-                Internal_GetDeltaDirection(mCachedPtr, out value);
+                Internal_GetNewPosition(mCachedPtr, out value);
                 return value;
                 return value;
             }
             }
         }
         }
 
 
-        public Vector3 NewPosition
+        public Vector3 DeltaDirection
         {
         {
             get
             get
             {
             {
                 Vector3 value;
                 Vector3 value;
-                Internal_GetNewPosition(mCachedPtr, out value);
+                Internal_GetDeltaDirection(mCachedPtr, out value);
                 return value;
                 return value;
             }
             }
         }
         }
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(HandleSliderPlane instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale, float snapValue);
+        private static extern void Internal_CreateInstance(HandleSliderPlane instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);
         private static extern void Internal_GetDelta(IntPtr nativeInstance, out float value);

+ 30 - 0
MBansheeEditor/Scene/Handles.cs

@@ -0,0 +1,30 @@
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    public sealed class Handles
+    {
+        // TODO - Implement these properly by retrieving them from some user-toggled properly
+        public static bool MoveHandleSnapActive { get { return true; } }
+        public static bool RotateHandleSnapActive { get { return true; } }
+        public static bool ScaleHandleSnapActive { get { return true; } }
+
+        public static float MoveSnapAmount { get { return 1.0f; /* TODO */ } }
+        public static float RotateSnapAmount { get { return 1.0f; /* TODO */ } }
+        public static float ScaleSnapAmount { get { return 1.0f; /* TODO */ } }
+
+        public static float SnapValue(float value, float snapAmount)
+        {
+            int intValue = MathEx.FloorToInt(value/snapAmount);
+
+            return value - intValue*snapAmount;
+        }
+
+        public static float GetHandleSize(Camera camera, Vector3 position)
+        {
+            // TODO 
+
+            return 1;
+        }
+    }
+}

+ 21 - 9
MBansheeEditor/Scene/MoveHandle.cs

@@ -39,9 +39,19 @@ namespace BansheeEditor
         protected override void PostInput()
         protected override void PostInput()
         {
         {
             delta = Vector3.zero;
             delta = Vector3.zero;
-            delta += xAxis.Delta * GetXDir();
-            delta += yAxis.Delta * GetYDir();
-            delta += zAxis.Delta * GetZDir();
+
+            if (Handles.MoveHandleSnapActive)
+            {
+                delta += Handles.SnapValue(xAxis.Delta, Handles.MoveSnapAmount) * GetXDir();
+                delta += Handles.SnapValue(yAxis.Delta, Handles.MoveSnapAmount) * GetYDir();
+                delta += Handles.SnapValue(zAxis.Delta, Handles.MoveSnapAmount) * GetZDir();
+            }
+            else
+            {
+                delta += xAxis.Delta * GetXDir();
+                delta += yAxis.Delta * GetYDir();
+                delta += zAxis.Delta * GetZDir();
+            }
         }
         }
 
 
         protected override void Draw()
         protected override void Draw()
@@ -58,8 +68,10 @@ namespace BansheeEditor
             else
             else
                 HandleDrawing.SetColor(Color.red);
                 HandleDrawing.SetColor(Color.red);
 
 
-            HandleDrawing.DrawLine(center, xEnd - GetXDir() * CONE_HEIGHT);
-            HandleDrawing.DrawCone(xEnd - GetXDir()*CONE_HEIGHT, GetXDir(), CONE_HEIGHT, CONE_RADIUS);
+            float handleSize = Handles.GetHandleSize(EditorApplication.sceneCamera, position);
+
+            HandleDrawing.DrawLine(center, xEnd - GetXDir() * CONE_HEIGHT, handleSize);
+            HandleDrawing.DrawCone(xEnd - GetXDir() * CONE_HEIGHT, GetXDir(), CONE_HEIGHT, CONE_RADIUS, handleSize);
 
 
             if (yAxis.State == HandleSlider.StateType.Active)
             if (yAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.SetColor(Color.white);
                 HandleDrawing.SetColor(Color.white);
@@ -68,8 +80,8 @@ namespace BansheeEditor
             else
             else
                 HandleDrawing.SetColor(Color.green);
                 HandleDrawing.SetColor(Color.green);
 
 
-            HandleDrawing.DrawLine(center, yEnd - GetYDir() * CONE_HEIGHT);
-            HandleDrawing.DrawCone(yEnd - GetYDir() * CONE_HEIGHT, GetYDir(), CONE_HEIGHT, CONE_RADIUS);
+            HandleDrawing.DrawLine(center, yEnd - GetYDir() * CONE_HEIGHT, handleSize);
+            HandleDrawing.DrawCone(yEnd - GetYDir() * CONE_HEIGHT, GetYDir(), CONE_HEIGHT, CONE_RADIUS, handleSize);
 
 
             if (zAxis.State == HandleSlider.StateType.Active)
             if (zAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.SetColor(Color.white);
                 HandleDrawing.SetColor(Color.white);
@@ -78,8 +90,8 @@ namespace BansheeEditor
             else
             else
                 HandleDrawing.SetColor(Color.blue);
                 HandleDrawing.SetColor(Color.blue);
 
 
-            HandleDrawing.DrawLine(center, zEnd - GetZDir() * CONE_HEIGHT);
-            HandleDrawing.DrawCone(zEnd - GetZDir() * CONE_HEIGHT, GetZDir(), CONE_HEIGHT, CONE_RADIUS);
+            HandleDrawing.DrawLine(center, zEnd - GetZDir() * CONE_HEIGHT, handleSize);
+            HandleDrawing.DrawCone(zEnd - GetZDir() * CONE_HEIGHT, GetZDir(), CONE_HEIGHT, CONE_RADIUS, handleSize);
         }
         }
 
 
         private Vector3 GetXDir()
         private Vector3 GetXDir()

+ 12 - 0
MBansheeEngine/Camera.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BansheeEngine
+{
+    public class Camera
+    {
+        // TODO
+    }
+}

+ 1 - 0
MBansheeEngine/MBansheeEngine.csproj

@@ -43,6 +43,7 @@
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Compile Include="BuiltinResources.cs" />
     <Compile Include="BuiltinResources.cs" />
+    <Compile Include="Camera.cs" />
     <Compile Include="Debug.cs" />
     <Compile Include="Debug.cs" />
     <Compile Include="Color.cs" />
     <Compile Include="Color.cs" />
     <Compile Include="Component.cs" />
     <Compile Include="Component.cs" />

+ 11 - 11
SBansheeEditor/Include/BsScriptHandleDrawing.h

@@ -18,16 +18,16 @@ namespace BansheeEngine
 		static void internal_SetColor(Color color);
 		static void internal_SetColor(Color color);
 		static void internal_SetTransform(Matrix4 transform);
 		static void internal_SetTransform(Matrix4 transform);
 
 
-		static void internal_DrawCube(Vector3 position, Vector3 extents);
-		static void internal_DrawSphere(Vector3 position, float radius);
-		static void internal_DrawWireCube(Vector3 position, Vector3 extents);
-		static void internal_DrawWireSphere(Vector3 position, float radius);
-		static void internal_DrawLine(Vector3 start, Vector3 end);
-		static void internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius);
-		static void internal_DrawDisc(Vector3 position, Vector3 normal, float radius);
-		static void internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius);
-		static void internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle);
-		static void internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle);
-		static void internal_DrawRect(Rect3 area);
+		static void internal_DrawCube(Vector3 position, Vector3 extents, float size);
+		static void internal_DrawSphere(Vector3 position, float radius, float size);
+		static void internal_DrawWireCube(Vector3 position, Vector3 extents, float size);
+		static void internal_DrawWireSphere(Vector3 position, float radius, float size);
+		static void internal_DrawLine(Vector3 start, Vector3 end, float size);
+		static void internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size);
+		static void internal_DrawDisc(Vector3 position, Vector3 normal, float radius, float size);
+		static void internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size);
+		static void internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
+		static void internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size);
+		static void internal_DrawRect(Rect3 area, float size);
 	};
 	};
 }
 }

+ 2 - 2
SBansheeEditor/Include/BsScriptHandleSliderDisc.h

@@ -18,12 +18,12 @@ namespace BansheeEngine
 		virtual void destroyInternal();
 		virtual void destroyInternal();
 
 
 	private:
 	private:
-		static void internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale, float snapValue);
+		static void internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale);
 		static void internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value);
 		static void internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value);
 		static void internal_GetDeltaDirection(ScriptHandleSliderDisc* nativeInstance, Vector3* value);
 		static void internal_GetDeltaDirection(ScriptHandleSliderDisc* nativeInstance, Vector3* value);
 		static void internal_GetNewRotation(ScriptHandleSliderDisc* nativeInstance, Quaternion* value);
 		static void internal_GetNewRotation(ScriptHandleSliderDisc* nativeInstance, Quaternion* value);
 
 
-		ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale, float snapValue);
+		ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale);
 		~ScriptHandleSliderDisc();
 		~ScriptHandleSliderDisc();
 
 
 		HandleSliderDisc* mSlider;
 		HandleSliderDisc* mSlider;

+ 2 - 2
SBansheeEditor/Include/BsScriptHandleSliderLine.h

@@ -18,11 +18,11 @@ namespace BansheeEngine
 		virtual void destroyInternal();
 		virtual void destroyInternal();
 
 
 	private:
 	private:
-		static void internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale, float snapValue);
+		static void internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale);
 		static void internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value);
 		static void internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value);
 		static void internal_GetNewPosition(ScriptHandleSliderLine* nativeInstance, Vector3* value);
 		static void internal_GetNewPosition(ScriptHandleSliderLine* nativeInstance, Vector3* value);
 
 
-		ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale, float snapValue);
+		ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale);
 		~ScriptHandleSliderLine();
 		~ScriptHandleSliderLine();
 
 
 		HandleSliderLine* mSlider;
 		HandleSliderLine* mSlider;

+ 2 - 2
SBansheeEditor/Include/BsScriptHandleSliderPlane.h

@@ -18,12 +18,12 @@ namespace BansheeEngine
 		virtual void destroyInternal();
 		virtual void destroyInternal();
 
 
 	private:
 	private:
-		static void internal_CreateInstance(MonoObject* instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale, float snapValue);
+		static void internal_CreateInstance(MonoObject* instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale);
 		static void internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, float* value);
 		static void internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, float* value);
 		static void internal_GetDeltaDirection(ScriptHandleSliderPlane* nativeInstance, Vector3* value);
 		static void internal_GetDeltaDirection(ScriptHandleSliderPlane* nativeInstance, Vector3* value);
 		static void internal_GetNewPosition(ScriptHandleSliderPlane* nativeInstance, Vector3* value);
 		static void internal_GetNewPosition(ScriptHandleSliderPlane* nativeInstance, Vector3* value);
 
 
-		ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale, float snapValue);
+		ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale);
 		~ScriptHandleSliderPlane();
 		~ScriptHandleSliderPlane();
 
 
 		HandleSliderPlane* mSlider;
 		HandleSliderPlane* mSlider;

+ 22 - 22
SBansheeEditor/Source/BsScriptHandleDrawing.cpp

@@ -35,58 +35,58 @@ namespace BansheeEngine
 		HandleManager::instance().getDrawManager().setTransform(transform);
 		HandleManager::instance().getDrawManager().setTransform(transform);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawCube(Vector3 position, Vector3 extents)
+	void ScriptHandleDrawing::internal_DrawCube(Vector3 position, Vector3 extents, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawCube(position, extents);
+		HandleManager::instance().getDrawManager().drawCube(position, extents, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawSphere(Vector3 position, float radius)
+	void ScriptHandleDrawing::internal_DrawSphere(Vector3 position, float radius, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawSphere(position, radius);
+		HandleManager::instance().getDrawManager().drawSphere(position, radius, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawWireCube(Vector3 position, Vector3 extents)
+	void ScriptHandleDrawing::internal_DrawWireCube(Vector3 position, Vector3 extents, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawWireCube(position, extents);
+		HandleManager::instance().getDrawManager().drawWireCube(position, extents, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawWireSphere(Vector3 position, float radius)
+	void ScriptHandleDrawing::internal_DrawWireSphere(Vector3 position, float radius, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawWireSphere(position, radius);
+		HandleManager::instance().getDrawManager().drawWireSphere(position, radius, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawLine(Vector3 start, Vector3 end)
+	void ScriptHandleDrawing::internal_DrawLine(Vector3 start, Vector3 end, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawLine(start, end);
+		HandleManager::instance().getDrawManager().drawLine(start, end, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius)
+	void ScriptHandleDrawing::internal_DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawCone(coneBase, normal, height, radius);
+		HandleManager::instance().getDrawManager().drawCone(coneBase, normal, height, radius, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawDisc(Vector3 position, Vector3 normal, float radius)
+	void ScriptHandleDrawing::internal_DrawDisc(Vector3 position, Vector3 normal, float radius, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawDisc(position, normal, radius);
+		HandleManager::instance().getDrawManager().drawDisc(position, normal, radius, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius)
+	void ScriptHandleDrawing::internal_DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawWireDisc(position, normal, radius);
+		HandleManager::instance().getDrawManager().drawWireDisc(position, normal, radius, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle)
+	void ScriptHandleDrawing::internal_DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawArc(position, normal, radius, startAngle, amountAngle);
+		HandleManager::instance().getDrawManager().drawArc(position, normal, radius, startAngle, amountAngle, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle)
+	void ScriptHandleDrawing::internal_DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawWireArc(position, normal, radius, startAngle, amountAngle);
+		HandleManager::instance().getDrawManager().drawWireArc(position, normal, radius, startAngle, amountAngle, size);
 	}
 	}
 
 
-	void ScriptHandleDrawing::internal_DrawRect(Rect3 area)
+	void ScriptHandleDrawing::internal_DrawRect(Rect3 area, float size)
 	{
 	{
-		HandleManager::instance().getDrawManager().drawRect(area);
+		HandleManager::instance().getDrawManager().drawRect(area, size);
 	}
 	}
 }
 }

+ 4 - 4
SBansheeEditor/Source/BsScriptHandleSliderDisc.cpp

@@ -6,10 +6,10 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	ScriptHandleSliderDisc::ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale, float snapValue)
+	ScriptHandleSliderDisc::ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale)
 		:ScriptObject(instance), mSlider(nullptr)
 		:ScriptObject(instance), mSlider(nullptr)
 	{
 	{
-		mSlider = bs_new<HandleSliderDisc>(normal, radius, snapValue, fixedScale);
+		mSlider = bs_new<HandleSliderDisc>(normal, radius, fixedScale);
 	}
 	}
 
 
 	ScriptHandleSliderDisc::~ScriptHandleSliderDisc()
 	ScriptHandleSliderDisc::~ScriptHandleSliderDisc()
@@ -34,10 +34,10 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_GetNewRotation", &ScriptHandleSliderDisc::internal_GetNewRotation);
 		metaData.scriptClass->addInternalCall("Internal_GetNewRotation", &ScriptHandleSliderDisc::internal_GetNewRotation);
 	}
 	}
 
 
-	void ScriptHandleSliderDisc::internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale, float snapValue)
+	void ScriptHandleSliderDisc::internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale)
 	{
 	{
 		ScriptHandleSliderDisc* nativeInstance = new (bs_alloc<ScriptHandleSliderDisc>())
 		ScriptHandleSliderDisc* nativeInstance = new (bs_alloc<ScriptHandleSliderDisc>())
-			ScriptHandleSliderDisc(instance, normal, radius, fixedScale, snapValue);
+			ScriptHandleSliderDisc(instance, normal, radius, fixedScale);
 	}
 	}
 
 
 	void ScriptHandleSliderDisc::internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value)
 	void ScriptHandleSliderDisc::internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value)

+ 4 - 4
SBansheeEditor/Source/BsScriptHandleSliderLine.cpp

@@ -6,10 +6,10 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	ScriptHandleSliderLine::ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale, float snapValue)
+	ScriptHandleSliderLine::ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale)
 		:ScriptObject(instance), mSlider(nullptr)
 		:ScriptObject(instance), mSlider(nullptr)
 	{
 	{
-		mSlider = bs_new<HandleSliderLine>(direction, length, snapValue, fixedScale);
+		mSlider = bs_new<HandleSliderLine>(direction, length, fixedScale);
 	}
 	}
 
 
 	ScriptHandleSliderLine::~ScriptHandleSliderLine()
 	ScriptHandleSliderLine::~ScriptHandleSliderLine()
@@ -33,10 +33,10 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_GetNewPosition", &ScriptHandleSliderLine::internal_GetNewPosition);
 		metaData.scriptClass->addInternalCall("Internal_GetNewPosition", &ScriptHandleSliderLine::internal_GetNewPosition);
 	}
 	}
 
 
-	void ScriptHandleSliderLine::internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale, float snapValue)
+	void ScriptHandleSliderLine::internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale)
 	{
 	{
 		ScriptHandleSliderLine* nativeInstance = new (bs_alloc<ScriptHandleSliderLine>()) 
 		ScriptHandleSliderLine* nativeInstance = new (bs_alloc<ScriptHandleSliderLine>()) 
-			ScriptHandleSliderLine(instance, direction, length, fixedScale, snapValue);
+			ScriptHandleSliderLine(instance, direction, length, fixedScale);
 	}
 	}
 
 
 	void ScriptHandleSliderLine::internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value)
 	void ScriptHandleSliderLine::internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value)

+ 4 - 4
SBansheeEditor/Source/BsScriptHandleSliderPlane.cpp

@@ -6,10 +6,10 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	ScriptHandleSliderPlane::ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale, float snapValue)
+	ScriptHandleSliderPlane::ScriptHandleSliderPlane(MonoObject* instance, const Vector3& dir1, const Vector3& dir2, float length, bool fixedScale)
 		:ScriptObject(instance), mSlider(nullptr)
 		:ScriptObject(instance), mSlider(nullptr)
 	{
 	{
-		mSlider = bs_new<HandleSliderPlane>(dir1, dir2, length, snapValue, fixedScale);
+		mSlider = bs_new<HandleSliderPlane>(dir1, dir2, length, fixedScale);
 	}
 	}
 
 
 	ScriptHandleSliderPlane::~ScriptHandleSliderPlane()
 	ScriptHandleSliderPlane::~ScriptHandleSliderPlane()
@@ -34,10 +34,10 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_GetNewPosition", &ScriptHandleSliderPlane::internal_GetNewPosition);
 		metaData.scriptClass->addInternalCall("Internal_GetNewPosition", &ScriptHandleSliderPlane::internal_GetNewPosition);
 	}
 	}
 
 
-	void ScriptHandleSliderPlane::internal_CreateInstance(MonoObject* instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale, float snapValue)
+	void ScriptHandleSliderPlane::internal_CreateInstance(MonoObject* instance, Vector3 dir1, Vector3 dir2, float length, bool fixedScale)
 	{
 	{
 		ScriptHandleSliderPlane* nativeInstance = new (bs_alloc<ScriptHandleSliderPlane>())
 		ScriptHandleSliderPlane* nativeInstance = new (bs_alloc<ScriptHandleSliderPlane>())
-			ScriptHandleSliderPlane(instance, dir1, dir2, length, fixedScale, snapValue);
+			ScriptHandleSliderPlane(instance, dir1, dir2, length, fixedScale);
 	}
 	}
 
 
 	void ScriptHandleSliderPlane::internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, float* value)
 	void ScriptHandleSliderPlane::internal_GetDelta(ScriptHandleSliderPlane* nativeInstance, float* value)

+ 10 - 1
SceneView.txt

@@ -3,10 +3,19 @@
   - Make a C# wrapper for Camera and Renderable
   - Make a C# wrapper for Camera and Renderable
 
 
 REFACTOR material getParams* and related classes. Those params should update all gpu program params that share that variable, not just the first found
 REFACTOR material getParams* and related classes. Those params should update all gpu program params that share that variable, not just the first found
-Selecting/Deselecting/selecting an object makes the handles not draw on second select
 Need a way to drag and drop items from Scene tree view to Scene view
 Need a way to drag and drop items from Scene tree view to Scene view
 When dragging a handle make sure it works when cursor leaves the scene view
 When dragging a handle make sure it works when cursor leaves the scene view
 Also make sure that handle manager receives mouse up event if its done outside of scene view
 Also make sure that handle manager receives mouse up event if its done outside of scene view
+When selecting/deselecting stuff handle display is delayed
+
+Add C# methods for retrieving handle size and snap amounts
+Actually make use of snapping in MoveHandle
+Test if fixed size handles & snapping work
+
+-----------
+
+Start work on C# Camera, and C# EditorApplication.sceneCamera
+  - I'll need to replace all current uses of scene camera with CameraHandler?? Since this camera will have to be a ManagedComponent...
 
 
 Test handles
 Test handles
  - Test a custom handle from C#
  - Test a custom handle from C#