Add keyboard shortcuts for grouping and locking nodes, change grid toggle
- Locking nodes can now be done by pressing Ctrl + L, and unlocking with Ctrl + Shift + L. - Grouping nodes is now done by pressing Ctrl + G, and ungrouping with Ctrl + Shift + G (similar to Inkscape). - Toggling the grid is now done by pressing the `#` key (also similar to Inkscape). This change was needed as Ctrl + G now groups selected nodes. Different shortcuts are used for the lock/unlock and group/ungroup actions, so that the shortcuts are idempotent.
This commit is contained in:
parent
aff96e2986
commit
4d35049dc7
2 changed files with 10 additions and 2 deletions
|
@ -5960,21 +5960,25 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||
|
||||
lock_button->connect("pressed", this, "_popup_callback", varray(LOCK_SELECTED));
|
||||
lock_button->set_tooltip(TTR("Lock the selected object in place (can't be moved)."));
|
||||
lock_button->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
|
||||
|
||||
unlock_button = memnew(ToolButton);
|
||||
hb->add_child(unlock_button);
|
||||
unlock_button->connect("pressed", this, "_popup_callback", varray(UNLOCK_SELECTED));
|
||||
unlock_button->set_tooltip(TTR("Unlock the selected object (can be moved)."));
|
||||
unlock_button->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
|
||||
|
||||
group_button = memnew(ToolButton);
|
||||
hb->add_child(group_button);
|
||||
group_button->connect("pressed", this, "_popup_callback", varray(GROUP_SELECTED));
|
||||
group_button->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
||||
group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
||||
|
||||
ungroup_button = memnew(ToolButton);
|
||||
hb->add_child(ungroup_button);
|
||||
ungroup_button->connect("pressed", this, "_popup_callback", varray(UNGROUP_SELECTED));
|
||||
ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
||||
ungroup_button->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
||||
|
||||
hb->add_child(memnew(VSeparator));
|
||||
|
||||
|
@ -6013,7 +6017,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||
|
||||
p = view_menu->get_popup();
|
||||
p->set_hide_on_checkable_item_selection(false);
|
||||
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Always Show Grid"), KEY_MASK_CMD | KEY_G), SHOW_GRID);
|
||||
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Always Show Grid"), KEY_NUMBERSIGN), SHOW_GRID);
|
||||
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show Helpers"), KEY_H), SHOW_HELPERS);
|
||||
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show Rulers")), SHOW_RULERS);
|
||||
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), KEY_Y), SHOW_GUIDES);
|
||||
|
|
|
@ -6416,24 +6416,28 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
|||
button_binds.write[0] = MENU_LOCK_SELECTED;
|
||||
tool_button[TOOL_LOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||
tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock the selected object in place (can't be moved)."));
|
||||
tool_button[TOOL_LOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
|
||||
|
||||
tool_button[TOOL_UNLOCK_SELECTED] = memnew(ToolButton);
|
||||
hbc_menu->add_child(tool_button[TOOL_UNLOCK_SELECTED]);
|
||||
button_binds.write[0] = MENU_UNLOCK_SELECTED;
|
||||
tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||
tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved)."));
|
||||
tool_button[TOOL_UNLOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
|
||||
|
||||
tool_button[TOOL_GROUP_SELECTED] = memnew(ToolButton);
|
||||
hbc_menu->add_child(tool_button[TOOL_GROUP_SELECTED]);
|
||||
button_binds.write[0] = MENU_GROUP_SELECTED;
|
||||
tool_button[TOOL_GROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable."));
|
||||
tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
|
||||
|
||||
tool_button[TOOL_UNGROUP_SELECTED] = memnew(ToolButton);
|
||||
hbc_menu->add_child(tool_button[TOOL_UNGROUP_SELECTED]);
|
||||
button_binds.write[0] = MENU_UNGROUP_SELECTED;
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Restores the object's children's ability to be selected."));
|
||||
tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
|
||||
|
||||
hbc_menu->add_child(memnew(VSeparator));
|
||||
|
||||
|
@ -6549,7 +6553,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
|
|||
|
||||
p->add_separator();
|
||||
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_origin", TTR("View Origin")), MENU_VIEW_ORIGIN);
|
||||
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid", TTR("View Grid"), KEY_MASK_CMD + KEY_G), MENU_VIEW_GRID);
|
||||
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid", TTR("View Grid"), KEY_NUMBERSIGN), MENU_VIEW_GRID);
|
||||
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_portal_culling", TTR("View Portal Culling"), KEY_MASK_ALT | KEY_P), MENU_VIEW_PORTAL_CULLING);
|
||||
p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_occlusion_culling", TTR("View Occlusion Culling")), MENU_VIEW_OCCLUSION_CULLING);
|
||||
|
||||
|
|
Loading…
Reference in a new issue