Ver código fonte

Added shortcuts for view/move/rotate/scale scene tools

Marko Pintera 10 anos atrás
pai
commit
8eddad13d2

+ 4 - 0
MBansheeEditor/EditorApplication.cs

@@ -96,6 +96,10 @@ namespace BansheeEditor
             inputConfig.RegisterAxis(SceneCamera.VerticalAxisBinding, InputAxis.MouseY);
 
             inputConfig.RegisterButton(SceneWindow.ToggleProfilerOverlayBinding, ButtonCode.P, ButtonModifier.CtrlAlt);
+            inputConfig.RegisterButton(SceneWindow.ViewToolBinding, ButtonCode.Q);
+            inputConfig.RegisterButton(SceneWindow.MoveToolBinding, ButtonCode.W);
+            inputConfig.RegisterButton(SceneWindow.RotateToolBinding, ButtonCode.E);
+            inputConfig.RegisterButton(SceneWindow.ScaleToolBinding, ButtonCode.R);
 
             ProjectLibrary.Refresh();
             monitor = new FolderMonitor(ProjectLibrary.ResourceFolder);

+ 26 - 0
MBansheeEditor/Scene/SceneWindow.cs

@@ -11,6 +11,10 @@ namespace BansheeEditor
     internal sealed class SceneWindow : EditorWindow
     {
         internal const string ToggleProfilerOverlayBinding = "ToggleProfilerOverlay";
+        internal const string ViewToolBinding = "ViewTool";
+        internal const string MoveToolBinding = "MoveTool";
+        internal const string RotateToolBinding = "RotateTool";
+        internal const string ScaleToolBinding = "ScaleTool";
 
         private const int HeaderHeight = 20;
         private const float DefaultPlacementDepth = 5.0f;
@@ -44,6 +48,12 @@ namespace BansheeEditor
 
         private int editorSettingsHash = int.MaxValue;
 
+        // Tool shortcuts
+        private VirtualButton viewToolKey;
+        private VirtualButton moveToolKey;
+        private VirtualButton rotateToolKey;
+        private VirtualButton scaleToolKey;
+
         // Profiler overlay
         private ProfilerOverlay activeProfilerOverlay;
         private Camera profilerCamera;
@@ -132,6 +142,10 @@ namespace BansheeEditor
             handlesLayout.AddElement(rotateSnapInput);
 
             toggleProfilerOverlayKey = new VirtualButton(ToggleProfilerOverlayBinding);
+            viewToolKey = new VirtualButton(ViewToolBinding);
+            moveToolKey = new VirtualButton(MoveToolBinding);
+            rotateToolKey = new VirtualButton(RotateToolBinding);
+            scaleToolKey = new VirtualButton(ScaleToolBinding);
 
             UpdateRenderTexture(Width, Height - HeaderHeight);
             UpdateProfilerOverlay();
@@ -170,6 +184,18 @@ namespace BansheeEditor
             {
                 if (VirtualInput.IsButtonUp(toggleProfilerOverlayKey))
                     EditorSettings.SetBool(ProfilerOverlayActiveKey, !EditorSettings.GetBool(ProfilerOverlayActiveKey));
+
+                if(VirtualInput.IsButtonUp(viewToolKey))
+                    EditorApplication.ActiveSceneTool = SceneViewTool.View;
+
+                if (VirtualInput.IsButtonUp(moveToolKey))
+                    EditorApplication.ActiveSceneTool = SceneViewTool.Move;
+
+                if(VirtualInput.IsButtonUp(rotateToolKey))
+                    EditorApplication.ActiveSceneTool = SceneViewTool.Rotate;
+
+                if (VirtualInput.IsButtonUp(scaleToolKey))
+                    EditorApplication.ActiveSceneTool = SceneViewTool.Scale;
             }
 
             // Refresh GUI buttons if needed (in case someones changes the values from script)

+ 1 - 2
TODO.txt

@@ -93,7 +93,7 @@ Ribek use:
 First screenshot:
  - Additional menu bar items: 
   - File: Exit, Save Project, New Project, Open Project, Save Scene As
-  - Edit: Undo/Redo, Cut/Copy/Paste/Duplicate/Delete(need to make sure it works in Hierarchy, with shortcuts), Frame Selected, Preferences, Play/Pause/Step
+  - Edit: Undo/Redo, Cut/Copy/Paste/Duplicate/Delete(need to make sure it works in Hierarchy, with shortcuts), Frame Selected, Preferences, Play/Pause/Step, View/Move/rotate/scale
   - Assets (also add to context): Create(Folder, Material, Shader, Script, Prefab, GUI Skin), Show in explorer
   - Game Object (also add to context): Create(Empty, Empty Child, Camera, Renderable, Point/Spot/Directional Light), Apply prefab, Break prefab, Revert prefab
    - Possibly create helper objects: Cube, Sphere, Plane, Quad, Capsule, Cylinder
@@ -150,7 +150,6 @@ Finalizing:
    - And all prefab instances should have updateFromPrefab called on them.
  - Undo/Redo when breaking or reverting a scene object (and in general test & finalize undo/redo system)
  - Move all the code files into subfolders so their hierarchy is similar to VS filters
- - Get rid of PoolAlloc and other unused allocators (plus fix bs_new and others which have weird overloads)
  - Splash screen
  - Settings/Preferences window
  - Documentation