Forráskód Böngészése

Restored original controls in standard hotkeys mode. The MMB pan option (standard hotkeys mode only) now changes the behavior of shift in relation to pan & orbit only. Editor code cleanup & code convention edits.

Lasse Öörni 10 éve
szülő
commit
b74c2360f8
2 módosított fájl, 82 hozzáadás és 76 törlés
  1. 14 11
      Docs/GettingStarted.dox
  2. 68 65
      bin/Data/Scripts/Editor/EditorView.as

+ 14 - 11
Docs/GettingStarted.dox

@@ -720,9 +720,7 @@ Left mouse         - Select nodes or drag the node transform gizmo. Hold Shift t
                      select components instead. Hold Ctrl to multiselect.
                      select components instead. Hold Ctrl to multiselect.
 Right mouse        - Hold down and move mouse to rotate camera
 Right mouse        - Hold down and move mouse to rotate camera
 Middle mouse       - Hold down orbits the camera around selected objects
 Middle mouse       - Hold down orbits the camera around selected objects
-Shift+Right mouse   - Hold down pans the camera
 Shift+Middle mouse - Hold down pans the camera
 Shift+Middle mouse - Hold down pans the camera
-
 WSAD or arrows     - Move
 WSAD or arrows     - Move
 Shift+WSAD         - Move faster
 Shift+WSAD         - Move faster
 E                  - Ascend
 E                  - Ascend
@@ -773,11 +771,22 @@ F11                - Captures a screenshot
 F12                - Toggle UI
 F12                - Toggle UI
 \endverbatim
 \endverbatim
 
 
-\section EditorInstructions_Controls2 Controls (blender style hotkeys)
+The editor setting "Pan using middle mouse button" switches the controls to the following:
+
+\verbatim
+Middle mouse       - Hold down pans the camera
+Shift+Middle mouse - Hold down orbits the camera around selected objects
+\endverbatim
+
+\section EditorInstructions_Controls2 Controls (Blender style hotkeys)
 
 
 Hotkeys list show only differences with standard style
 Hotkeys list show only differences with standard style
 
 
 \verbatim
 \verbatim
+Left mouse         - Drag the node manipulator gizmo
+Middle mouse       - Hold down orbits the camera
+Shift+middle mouse - Hold down pans the camera
+Right mouse        - Select objects
 Shift+F            - Enter/Exit camera's flying mode
 Shift+F            - Enter/Exit camera's flying mode
 G,R,S              - Object manipulation mode: move/rotate/scale ( note: camera flying mode must be off to do this manipulation)
 G,R,S              - Object manipulation mode: move/rotate/scale ( note: camera flying mode must be off to do this manipulation)
 Cycle press G,R,S  - Toggle between world and local axes manipulation
 Cycle press G,R,S  - Toggle between world and local axes manipulation
@@ -785,7 +794,7 @@ Shift+D            - Duplicate node or component
 H                  - Enable/disable node hierarchy or component
 H                  - Enable/disable node hierarchy or component
 Alt+H              - Enable all nodes hierarchy or component in scene
 Alt+H              - Enable all nodes hierarchy or component in scene
 Alt+P              - Unparent scene node
 Alt+P              - Unparent scene node
-Ctrl+P             - Parent all selected scene nodes to last selected node 
+Ctrl+P             - Parent all selected scene nodes to last selected node
 Z                  - Cycle through solid, wireframe and point rendering
 Z                  - Cycle through solid, wireframe and point rendering
 M                  - Show/Hide LayerEditor
 M                  - Show/Hide LayerEditor
 F                  - Focus on selected object (LookAt)               
 F                  - Focus on selected object (LookAt)               
@@ -796,13 +805,7 @@ Key "." or Del     - View Closer selected node(s)
 
 
 Press right mouse button in the 3D view if you want to defocus the active window without changing the object selection.
 Press right mouse button in the 3D view if you want to defocus the active window without changing the object selection.
 
 
-An option in the settings (Pan using MMB) changes the default behavior of the MMB and RMB to pan the camera, and to require using Shift to use camera orbit and rotation.
-
-\verbatim
-Right mouse        - Hold down pans the camera
-Middle mouse       - Hold down pans the camera
-Shift+Right mouse  - Hold down and move mouse to rotate camera
-Shift+Middle mouse - Hold down orbits the camera around selected objects
+The "Pan using middle mouse button" option has no effect in Blender hotkeys mode.
 \endverbatim
 \endverbatim
 
 
 \section EditorInstructions_Workflow Workflow
 \section EditorInstructions_Workflow Workflow

+ 68 - 65
bin/Data/Scripts/Editor/EditorView.as

@@ -1213,12 +1213,14 @@ void UpdateView(float timeStep)
     }
     }
     
     
     // Check for camara fly mode
     // Check for camara fly mode
-    if (hotKeyMode == HOTKEYS_MODE_BLENDER )
+    if (hotKeyMode == HOTKEYS_MODE_BLENDER)
+    {
         if (input.keyDown[KEY_LSHIFT] && input.keyPress[KEY_F])
         if (input.keyDown[KEY_LSHIFT] && input.keyPress[KEY_F])
         {
         {
             cameraFlyMode = !cameraFlyMode;
             cameraFlyMode = !cameraFlyMode;
         }
         }
-    
+    }
+
     // Move camera
     // Move camera
     float speedMultiplier = 1.0;
     float speedMultiplier = 1.0;
     if (input.keyDown[KEY_LSHIFT])
     if (input.keyDown[KEY_LSHIFT])
@@ -1226,7 +1228,7 @@ void UpdateView(float timeStep)
     
     
     if (!input.keyDown[KEY_LCTRL])
     if (!input.keyDown[KEY_LCTRL])
     {        
     {        
-        if (hotKeyMode == HOTKEYS_MODE_STANDARD ||  (hotKeyMode == HOTKEYS_MODE_BLENDER && cameraFlyMode && !input.keyDown[KEY_LSHIFT]) ) 
+        if (hotKeyMode == HOTKEYS_MODE_STANDARD ||  (hotKeyMode == HOTKEYS_MODE_BLENDER && cameraFlyMode && !input.keyDown[KEY_LSHIFT])) 
         {
         {
             if (input.keyDown['W'] || input.keyDown[KEY_UP])
             if (input.keyDown['W'] || input.keyDown[KEY_UP])
             {
             {
@@ -1263,7 +1265,7 @@ void UpdateView(float timeStep)
     
     
     if (input.mouseMoveWheel != 0 && ui.GetElementAt(ui.cursor.position) is null)
     if (input.mouseMoveWheel != 0 && ui.GetElementAt(ui.cursor.position) is null)
     {
     {
-        if ( hotKeyMode == HOTKEYS_MODE_STANDARD) 
+        if (hotKeyMode == HOTKEYS_MODE_STANDARD) 
         {
         {
             if (mouseWheelCameraPosition)
             if (mouseWheelCameraPosition)
             {
             {
@@ -1278,7 +1280,7 @@ void UpdateView(float timeStep)
         }
         }
         else if (hotKeyMode == HOTKEYS_MODE_BLENDER) 
         else if (hotKeyMode == HOTKEYS_MODE_BLENDER) 
         {
         {
-            if (mouseWheelCameraPosition && !camera.orthographic )
+            if (mouseWheelCameraPosition && !camera.orthographic)
             {   
             {   
                 if (input.keyDown[KEY_LSHIFT])
                 if (input.keyDown[KEY_LSHIFT])
                     cameraNode.Translate(Vector3(0, -cameraBaseSpeed, 0) * -input.mouseMoveWheel*20* timeStep * speedMultiplier);
                     cameraNode.Translate(Vector3(0, -cameraBaseSpeed, 0) * -input.mouseMoveWheel*20* timeStep * speedMultiplier);
@@ -1327,16 +1329,16 @@ void UpdateView(float timeStep)
     // Rotate/orbit/pan camera
     // Rotate/orbit/pan camera
     bool changeCamViewButton = false;
     bool changeCamViewButton = false;
     
     
-    if ( hotKeyMode == HOTKEYS_MODE_STANDARD) 
+    if (hotKeyMode == HOTKEYS_MODE_STANDARD) 
         changeCamViewButton = input.mouseButtonDown[MOUSEB_RIGHT] || input.mouseButtonDown[MOUSEB_MIDDLE];
         changeCamViewButton = input.mouseButtonDown[MOUSEB_RIGHT] || input.mouseButtonDown[MOUSEB_MIDDLE];
-    else if (hotKeyMode == HOTKEYS_MODE_BLENDER) 
+    else if (hotKeyMode == HOTKEYS_MODE_BLENDER)
     {  
     {  
         changeCamViewButton = input.mouseButtonDown[MOUSEB_MIDDLE] || cameraFlyMode;
         changeCamViewButton = input.mouseButtonDown[MOUSEB_MIDDLE] || cameraFlyMode;
         
         
-        if (input.mouseButtonPress[MOUSEB_RIGHT] || input.keyDown[KEY_ESC]) 
+        if (input.mouseButtonPress[MOUSEB_RIGHT] || input.keyDown[KEY_ESC])
             cameraFlyMode = false;
             cameraFlyMode = false;
     }
     }
-    
+
     if (changeCamViewButton)
     if (changeCamViewButton)
     {
     {
         SetMouseLock();
         SetMouseLock();
@@ -1345,24 +1347,23 @@ void UpdateView(float timeStep)
         if (mouseMove.x != 0 || mouseMove.y != 0)
         if (mouseMove.x != 0 || mouseMove.y != 0)
         {
         {
             bool panTheCamera = false;
             bool panTheCamera = false;
-            
-            if(mmbPanMode || (hotKeyMode == HOTKEYS_MODE_BLENDER))
-                if ( hotKeyMode == HOTKEYS_MODE_STANDARD) 
-                    panTheCamera = !(changeCamViewButton && input.keyDown[KEY_LSHIFT]);
-                else if (hotKeyMode == HOTKEYS_MODE_BLENDER && cameraFlyMode) 
+
+            if (hotKeyMode == HOTKEYS_MODE_STANDARD)
+            {
+                if (input.mouseButtonDown[MOUSEB_MIDDLE])
                 {
                 {
-                    panTheCamera = false;
-                    //else if (camera.orthographic)
-                    //    panTheCamera = true;     
+                    if (mmbPanMode)
+                        panTheCamera = !input.keyDown[KEY_LSHIFT];
+                    else
+                        panTheCamera = input.keyDown[KEY_LSHIFT];
                 }
                 }
-            else 
+            }
+            else if (hotKeyMode == HOTKEYS_MODE_BLENDER)
             {
             {
-                if (!camera.orthographic)
-                    panTheCamera = changeCamViewButton && input.keyDown[KEY_LSHIFT];
-                else
-                    panTheCamera = changeCamViewButton && !input.keyDown[KEY_LSHIFT];
+                if (!cameraFlyMode)
+                    panTheCamera = input.keyDown[KEY_LSHIFT];
             }
             }
-                
+
             if (panTheCamera)
             if (panTheCamera)
                 cameraNode.Translate(Vector3(-mouseMove.x, mouseMove.y, 0) * timeStep * cameraBaseSpeed * 0.5);
                 cameraNode.Translate(Vector3(-mouseMove.x, mouseMove.y, 0) * timeStep * cameraBaseSpeed * 0.5);
             else
             else
@@ -1376,17 +1377,17 @@ void UpdateView(float timeStep)
                 Quaternion q = Quaternion(activeViewport.cameraPitch, activeViewport.cameraYaw, 0);
                 Quaternion q = Quaternion(activeViewport.cameraPitch, activeViewport.cameraYaw, 0);
                 cameraNode.rotation = q;
                 cameraNode.rotation = q;
 
 
-                if ( hotKeyMode == HOTKEYS_MODE_STANDARD)
-                { 
+                if (hotKeyMode == HOTKEYS_MODE_STANDARD)
+                {
                     if (input.mouseButtonDown[MOUSEB_MIDDLE] && (selectedNodes.length > 0 || selectedComponents.length > 0))
                     if (input.mouseButtonDown[MOUSEB_MIDDLE] && (selectedNodes.length > 0 || selectedComponents.length > 0))
-                    {                        
+                    {
                         Vector3 centerPoint = SelectedNodesCenterPoint();
                         Vector3 centerPoint = SelectedNodesCenterPoint();
                         Vector3 d = cameraNode.worldPosition - centerPoint;
                         Vector3 d = cameraNode.worldPosition - centerPoint;
                         cameraNode.worldPosition = centerPoint - q * Vector3(0.0, 0.0, d.length);
                         cameraNode.worldPosition = centerPoint - q * Vector3(0.0, 0.0, d.length);
                         orbiting = true;
                         orbiting = true;
                     }    
                     }    
                 }
                 }
-                else if ( hotKeyMode == HOTKEYS_MODE_BLENDER ) 
+                else if (hotKeyMode == HOTKEYS_MODE_BLENDER)
                 {
                 {
                     if (input.mouseButtonDown[MOUSEB_MIDDLE])
                     if (input.mouseButtonDown[MOUSEB_MIDDLE])
                     {
                     {
@@ -1411,49 +1412,51 @@ void UpdateView(float timeStep)
     if (orbiting && !input.mouseButtonDown[MOUSEB_MIDDLE])
     if (orbiting && !input.mouseButtonDown[MOUSEB_MIDDLE])
         orbiting = false;
         orbiting = false;
         
         
-    if ( hotKeyMode == HOTKEYS_MODE_BLENDER )
-    if ( viewCloser && lastSelectedDrawable.Get() !is null) 
+    if (hotKeyMode == HOTKEYS_MODE_BLENDER)
     {
     {
-        SetMouseLock();
-        BoundingBox bb;
-        Vector3 centerPoint;
-        
-        if ( selectedNodes.length <= 1 )
+        if (viewCloser && lastSelectedDrawable.Get() !is null)
         {
         {
-            Drawable@ drawable = lastSelectedDrawable.Get();
-            if (drawable !is null) 
-            {  
-                bb = drawable.boundingBox;
-                centerPoint = drawable.node.worldPosition;
+            SetMouseLock();
+            BoundingBox bb;
+            Vector3 centerPoint;
+            
+            if (selectedNodes.length <= 1)
+            {
+                Drawable@ drawable = lastSelectedDrawable.Get();
+                if (drawable !is null) 
+                {  
+                    bb = drawable.boundingBox;
+                    centerPoint = drawable.node.worldPosition;
+                }
             }
             }
-        }
-        else 
-        {
-            for (int i = 0; i < selectedNodes.length; i++) 
+            else
             {
             {
-                bb.Merge(selectedNodes[i].position);
+                for (int i = 0; i < selectedNodes.length; i++) 
+                {
+                    bb.Merge(selectedNodes[i].position);
+                }
+                      
+                centerPoint = SelectedNodesCenterPoint();
             }
             }
-                  
-            centerPoint = SelectedNodesCenterPoint();
+            
+            float distance = bb.size.length;
+            if (camera.orthographic) // if we use viewCloser for 2D get current distance to avoid near clip
+                distance = cameraNode.worldPosition.length;
+            
+            Quaternion q = Quaternion(activeViewport.cameraPitch, activeViewport.cameraYaw, 0);
+            cameraNode.rotation = q;
+            cameraNode.worldPosition = centerPoint -  cameraNode.worldDirection * distance;
+            // ReacquireCameraYawPitch();
+            viewCloser =  false;
         }
         }
-        
-        float distance = bb.size.length;
-        if (camera.orthographic) // if we use viewCloser for 2D get current distance to avoid near clip
-            distance = cameraNode.worldPosition.length;
-        
-        Quaternion q = Quaternion(activeViewport.cameraPitch, activeViewport.cameraYaw, 0);
-        cameraNode.rotation = q;
-        cameraNode.worldPosition = centerPoint -  cameraNode.worldDirection * distance;
-        // ReacquireCameraYawPitch();
-        viewCloser =  false;
+        else 
+            viewCloser =  false;
     }
     }
-    else 
-        viewCloser =  false;
     
     
     // Move/rotate/scale object
     // Move/rotate/scale object
-    if ( hotKeyMode == HOTKEYS_MODE_BLENDER) // force to select component node for manipulation if selected only component and not his node
+    if (hotKeyMode == HOTKEYS_MODE_BLENDER) // force to select component node for manipulation if selected only component and not his node
     {   
     {   
-        if ((editMode != EDIT_SELECT && editNodes.empty) && lastSelectedComponent.Get() !is null )
+        if ((editMode != EDIT_SELECT && editNodes.empty) && lastSelectedComponent.Get() !is null)
         {   
         {   
             if (lastSelectedComponent.Get() !is null) 
             if (lastSelectedComponent.Get() !is null) 
             {
             {
@@ -1762,7 +1765,8 @@ void ViewRaycast(bool mouseClick)
             Drawable@ drawable = result.drawable;
             Drawable@ drawable = result.drawable;
             
             
             // for actual last selected node or component in both modes
             // for actual last selected node or component in both modes
-            if ( hotKeyMode == HOTKEYS_MODE_STANDARD ) {
+            if (hotKeyMode == HOTKEYS_MODE_STANDARD) 
+            {
                 if (input.mouseButtonDown[MOUSEB_LEFT]) 
                 if (input.mouseButtonDown[MOUSEB_LEFT]) 
                 {
                 {
                     lastSelectedNode = drawable.node;
                     lastSelectedNode = drawable.node;
@@ -1770,7 +1774,8 @@ void ViewRaycast(bool mouseClick)
                     lastSelectedComponent = drawable;
                     lastSelectedComponent = drawable;
                 }
                 }
             }
             }
-            else if ( hotKeyMode == HOTKEYS_MODE_BLENDER ) {
+            else if (hotKeyMode == HOTKEYS_MODE_BLENDER) 
+            {
                 if (input.mouseButtonDown[MOUSEB_RIGHT]) 
                 if (input.mouseButtonDown[MOUSEB_RIGHT]) 
                 {
                 {
                     lastSelectedNode = drawable.node;
                     lastSelectedNode = drawable.node;
@@ -1825,7 +1830,7 @@ void ViewRaycast(bool mouseClick)
         componentSelectQualifier = input.qualifierDown[QUAL_SHIFT];
         componentSelectQualifier = input.qualifierDown[QUAL_SHIFT];
         multiselect = input.qualifierDown[QUAL_CTRL];
         multiselect = input.qualifierDown[QUAL_CTRL];
     }
     }
-    else if ( hotKeyMode == HOTKEYS_MODE_BLENDER ) 
+    else if (hotKeyMode == HOTKEYS_MODE_BLENDER)
     {
     {
         mouseButtonPressRL = input.mouseButtonPress[MOUSEB_RIGHT];
         mouseButtonPressRL = input.mouseButtonPress[MOUSEB_RIGHT];
         componentSelectQualifier = input.qualifierDown[QUAL_CTRL];
         componentSelectQualifier = input.qualifierDown[QUAL_CTRL];
@@ -1834,8 +1839,6 @@ void ViewRaycast(bool mouseClick)
     
     
     if (mouseClick && mouseButtonPressRL)
     if (mouseClick && mouseButtonPressRL)
     {
     {
-       
-        
         if (selectedComponent !is null)
         if (selectedComponent !is null)
         {
         {
             if (componentSelectQualifier)
             if (componentSelectQualifier)