diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2016-10-04 20:39:38 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2016-10-04 21:42:11 +0200 |
commit | 63abe3dcd0ba5323450b9b0603a34d61b2fe3033 (patch) | |
tree | 8c1693f852db004b57f7742b14e571779682e9c6 /tools | |
parent | 78d97b060a6873a454e710380cb9ef1bde5e4c65 (diff) |
Add shortcut to reset cursor position in 3D Editor ( #166 )
The shortcut will focus the origin after you moved around with shift + mouse3.
The default shortcut is the letter "O", like "F" for focus.
This can be customized in the editor shortcuts menu.
Closes #166
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 7 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 9701b8030d..6dcc71422a 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1978,6 +1978,11 @@ void SpatialEditorViewport::_menu_option(int p_option) { _update_name(); } break; + case VIEW_CENTER_TO_ORIGIN: { + + cursor.pos = Vector3(0,0,0); + + } break; case VIEW_CENTER_TO_SELECTION: { focus_selection(); @@ -2391,6 +2396,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_GIZMOS),true); view_menu->get_popup()->add_separator(); + view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/focus_origin"), VIEW_CENTER_TO_ORIGIN); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/focus_selection"), VIEW_CENTER_TO_SELECTION); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_selection_with_view"), VIEW_ALIGN_SELECTION_WITH_VIEW); view_menu->get_popup()->connect("item_pressed",this,"_menu_option"); @@ -3858,6 +3864,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal view"), KEY_KP_5); ED_SHORTCUT("spatial_editor/snap", TTR("Snap"), KEY_S); ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), KEY_K); + ED_SHORTCUT("spatial_editor/focus_origin", TTR("Focus Origin"), KEY_O); ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), KEY_F); ED_SHORTCUT("spatial_editor/align_selection_with_view", TTR("Align Selection With View"), KEY_MASK_ALT+KEY_MASK_CMD+KEY_F); diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 975092a01d..89587526ee 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -76,6 +76,7 @@ friend class SpatialEditor; VIEW_RIGHT, VIEW_FRONT, VIEW_REAR, + VIEW_CENTER_TO_ORIGIN, VIEW_CENTER_TO_SELECTION, VIEW_ALIGN_SELECTION_WITH_VIEW, VIEW_PERSPECTIVE, |