mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 06:23:59 -06:00
Add menu item to reset the camera
This commit is contained in:
parent
2502038f76
commit
3f903d2c76
3 changed files with 21 additions and 0 deletions
|
@ -36,6 +36,15 @@ class CuraActions(QObject):
|
|||
event = CallFunctionEvent(self._openUrl, [QUrl("http://github.com/Ultimaker/Cura/issues")], {})
|
||||
Application.getInstance().functionEvent(event)
|
||||
|
||||
## Reset camera position and direction to default
|
||||
@pyqtSlot()
|
||||
def homeCamera(self) -> None:
|
||||
scene = Application.getInstance().getController().getScene()
|
||||
camera = scene.getActiveCamera()
|
||||
camera.setPosition(Vector(-80, 250, 700))
|
||||
camera.setPerspective(True)
|
||||
camera.lookAt(Vector(0, 0, 0))
|
||||
|
||||
## Center all objects in the selection
|
||||
@pyqtSlot()
|
||||
def centerSelection(self) -> None:
|
||||
|
|
|
@ -17,6 +17,8 @@ Item
|
|||
property alias undo: undoAction;
|
||||
property alias redo: redoAction;
|
||||
|
||||
property alias homeCamera: homeCameraAction;
|
||||
|
||||
property alias deleteSelection: deleteSelectionAction;
|
||||
property alias centerSelection: centerSelectionAction;
|
||||
property alias multiplySelection: multiplySelectionAction;
|
||||
|
@ -96,6 +98,13 @@ Item
|
|||
shortcut: StandardKey.Quit;
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: homeCameraAction;
|
||||
text: catalog.i18nc("@action:inmenu menubar:view","&Reset camera position");
|
||||
onTriggered: CuraActions.homeCamera();
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: preferencesAction;
|
||||
|
|
|
@ -27,4 +27,7 @@ Menu
|
|||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
ExclusiveGroup { id: group; }
|
||||
|
||||
MenuSeparator {}
|
||||
MenuItem { action: Cura.Actions.homeCamera; }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue