mirror of
https://github.com/godotengine/godot.git
synced 2024-12-27 05:12:44 +00:00
Added Rename Context Menu Option for SceneTreeDock
This commit is contained in:
parent
36a74696d6
commit
1378ca1e04
@ -75,6 +75,8 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
|
||||
|
||||
if (ED_IS_SHORTCUT("scene_tree/batch_rename", p_event)) {
|
||||
_tool_selected(TOOL_BATCH_RENAME);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/rename", p_event)) {
|
||||
_tool_selected(TOOL_RENAME);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
|
||||
_tool_selected(TOOL_NEW);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) {
|
||||
@ -293,6 +295,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
rename_dialog->popup_centered();
|
||||
}
|
||||
} break;
|
||||
case TOOL_RENAME: {
|
||||
Tree *tree = scene_tree->get_scene_tree();
|
||||
if (tree->is_anything_selected()) {
|
||||
tree->grab_focus();
|
||||
tree->edit_selected();
|
||||
}
|
||||
} break;
|
||||
case TOOL_NEW: {
|
||||
|
||||
String preferred = "";
|
||||
@ -1870,7 +1879,6 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
|
||||
menu->clear();
|
||||
|
||||
menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
|
||||
if (selection.size() == 1) {
|
||||
|
||||
subresources.clear();
|
||||
@ -1886,6 +1894,9 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
menu->add_icon_shortcut(get_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
|
||||
menu->add_icon_shortcut(get_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT);
|
||||
menu->add_separator();
|
||||
menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/rename"), TOOL_RENAME);
|
||||
} else { // multi select
|
||||
menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
|
||||
}
|
||||
menu->add_icon_shortcut(get_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE);
|
||||
menu->add_separator();
|
||||
@ -2064,6 +2075,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||
filter_hbc->add_constant_override("separate", 0);
|
||||
ToolButton *tb;
|
||||
|
||||
ED_SHORTCUT("scene_tree/rename", TTR("Rename"));
|
||||
ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KEY_MASK_CMD | KEY_F2);
|
||||
ED_SHORTCUT("scene_tree/add_child_node", TTR("Add Child Node"), KEY_MASK_CMD | KEY_A);
|
||||
ED_SHORTCUT("scene_tree/instance_scene", TTR("Instance Child Scene"));
|
||||
|
@ -59,6 +59,7 @@ class SceneTreeDock : public VBoxContainer {
|
||||
|
||||
TOOL_NEW,
|
||||
TOOL_INSTANCE,
|
||||
TOOL_RENAME,
|
||||
TOOL_BATCH_RENAME,
|
||||
TOOL_REPLACE,
|
||||
TOOL_ATTACH_SCRIPT,
|
||||
|
Loading…
Reference in New Issue
Block a user