Browse Source

Properly display handle after re-selection

Marko Pintera 11 years ago
parent
commit
8e9fa1ac6f
2 changed files with 23 additions and 21 deletions
  1. 22 20
      MBansheeEditor/Scene/DefaultHandleManager.cs
  2. 1 1
      SceneView.txt

+ 22 - 20
MBansheeEditor/Scene/DefaultHandleManager.cs

@@ -12,7 +12,7 @@ namespace BansheeEditor
         {
             SceneObject[] selectedSceneObjects = Selection.sceneObjects;
 
-            if (activeHandleType != EditorApplication.ActiveSceneTool || selectedSceneObjects.Length == 0)
+            if (selectedSceneObjects.Length == 0)
             {
                 if (activeHandle != null)
                 {
@@ -20,29 +20,31 @@ namespace BansheeEditor
                     activeHandle = null;
                 }
             }
-
-            if (activeHandleType != EditorApplication.ActiveSceneTool && selectedSceneObjects.Length > 0)
+            else
             {
-                if (activeHandle != null)
+                if (activeHandleType != EditorApplication.ActiveSceneTool || activeHandle == null)
                 {
-                    activeHandle.Destroy();
-                    activeHandle = null;
-                }
+                    if (activeHandle != null)
+                    {
+                        activeHandle.Destroy();
+                        activeHandle = null;
+                    }
 
-                switch (EditorApplication.ActiveSceneTool)
-                {
-                    case SceneViewTool.Move:
-                        activeHandle = new MoveHandle();
-                        break;
-                    case SceneViewTool.Rotate:
-                        activeHandle = new RotateHandle();
-                        break;
-                    case SceneViewTool.Scale:
-                        activeHandle = new ScaleHandle();
-                        break;
-                }
+                    switch (EditorApplication.ActiveSceneTool)
+                    {
+                        case SceneViewTool.Move:
+                            activeHandle = new MoveHandle();
+                            break;
+                        case SceneViewTool.Rotate:
+                            activeHandle = new RotateHandle();
+                            break;
+                        case SceneViewTool.Scale:
+                            activeHandle = new ScaleHandle();
+                            break;
+                    }
 
-                activeHandleType = EditorApplication.ActiveSceneTool;
+                    activeHandleType = EditorApplication.ActiveSceneTool;
+                }
             }
 
             if (activeHandle != null)

+ 1 - 1
SceneView.txt

@@ -3,7 +3,7 @@
   - 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
-Clicking on empty space needs to deselect everything
+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
 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