diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-05-11 11:31:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 11:31:31 +0200 |
commit | 62bf8b4dd63d12db1dc53587795d8e64fba6bf35 (patch) | |
tree | f9c5ba13fe0c1cdd5ba376ca6fd3d926aa3dbe6f | |
parent | 845e2111ce7ede957670c2ae5f6a6aeeb9faaa32 (diff) | |
parent | 7fc0e38e92900be67b69b0c7e13abf93692e8cb4 (diff) |
Merge pull request #38594 from Calinou/rename-clear-script-action
Rename the Clear Script editor action to Detach Script
-rw-r--r-- | editor/scene_tree_dock.cpp | 44 | ||||
-rw-r--r-- | editor/scene_tree_dock.h | 4 |
2 files changed, 24 insertions, 24 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 5ee5fbcf9c..6e00e3c291 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -97,8 +97,8 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) { _tool_selected(TOOL_DUPLICATE); } else if (ED_IS_SHORTCUT("scene_tree/attach_script", p_event)) { _tool_selected(TOOL_ATTACH_SCRIPT); - } else if (ED_IS_SHORTCUT("scene_tree/clear_script", p_event)) { - _tool_selected(TOOL_CLEAR_SCRIPT); + } else if (ED_IS_SHORTCUT("scene_tree/detach_script", p_event)) { + _tool_selected(TOOL_DETACH_SCRIPT); } else if (ED_IS_SHORTCUT("scene_tree/move_up", p_event)) { _tool_selected(TOOL_MOVE_UP); } else if (ED_IS_SHORTCUT("scene_tree/move_down", p_event)) { @@ -426,7 +426,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { case TOOL_ATTACH_SCRIPT: { attach_script_to_selected(false); } break; - case TOOL_CLEAR_SCRIPT: { + case TOOL_DETACH_SCRIPT: { if (!profile_allow_script_editing) { break; @@ -437,7 +437,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (selection.empty()) return; - editor_data->get_undo_redo().create_action(TTR("Clear Script")); + editor_data->get_undo_redo().create_action(TTR("Detach Script")); editor_data->get_undo_redo().add_do_method(editor, "push_item", (Script *)nullptr); for (int i = 0; i < selection.size(); i++) { @@ -1071,7 +1071,7 @@ void SceneTreeDock::_notification(int p_what) { button_add->set_icon(get_theme_icon("Add", "EditorIcons")); button_instance->set_icon(get_theme_icon("Instance", "EditorIcons")); button_create_script->set_icon(get_theme_icon("ScriptCreate", "EditorIcons")); - button_clear_script->set_icon(get_theme_icon("ScriptRemove", "EditorIcons")); + button_detach_script->set_icon(get_theme_icon("ScriptRemove", "EditorIcons")); filter->set_right_icon(get_theme_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); @@ -1148,7 +1148,7 @@ void SceneTreeDock::_notification(int p_what) { button_add->set_icon(get_theme_icon("Add", "EditorIcons")); button_instance->set_icon(get_theme_icon("Instance", "EditorIcons")); button_create_script->set_icon(get_theme_icon("ScriptCreate", "EditorIcons")); - button_clear_script->set_icon(get_theme_icon("ScriptRemove", "EditorIcons")); + button_detach_script->set_icon(get_theme_icon("ScriptRemove", "EditorIcons")); filter->set_right_icon(get_theme_icon("Search", "EditorIcons")); filter->set_clear_button_enabled(true); @@ -1883,18 +1883,18 @@ void SceneTreeDock::_update_script_button() { if (!profile_allow_script_editing) { button_create_script->hide(); - button_clear_script->hide(); + button_detach_script->hide(); } else if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 0) { button_create_script->hide(); - button_clear_script->hide(); + button_detach_script->hide(); } else if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 1) { Node *n = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0]; if (n->get_script().is_null()) { button_create_script->show(); - button_clear_script->hide(); + button_detach_script->hide(); } else { button_create_script->hide(); - button_clear_script->show(); + button_detach_script->show(); } } else { button_create_script->hide(); @@ -1902,11 +1902,11 @@ void SceneTreeDock::_update_script_button() { for (int i = 0; i < selection.size(); i++) { Node *n = Object::cast_to<Node>(selection[i]); if (!n->get_script().is_null()) { - button_clear_script->show(); + button_detach_script->show(); return; } } - button_clear_script->hide(); + button_detach_script->hide(); } } @@ -2458,7 +2458,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { } if (existing_script.is_valid() && existing_script_removable) { add_separator = true; - menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT); + menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/detach_script"), TOOL_DETACH_SCRIPT); } else if (full_selection.size() > 1) { bool script_exists = false; for (List<Node *>::Element *E = full_selection.front(); E; E = E->next()) { @@ -2470,7 +2470,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (script_exists) { add_separator = true; - menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/clear_script"), TOOL_CLEAR_SCRIPT); + menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/detach_script"), TOOL_DETACH_SCRIPT); } } @@ -2816,7 +2816,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel ED_SHORTCUT("scene_tree/change_node_type", TTR("Change Type")); ED_SHORTCUT("scene_tree/attach_script", TTR("Attach Script")); ED_SHORTCUT("scene_tree/extend_script", TTR("Extend Script")); - ED_SHORTCUT("scene_tree/clear_script", TTR("Clear Script")); + ED_SHORTCUT("scene_tree/detach_script", TTR("Detach Script")); ED_SHORTCUT("scene_tree/move_up", TTR("Move Up"), KEY_MASK_CMD | KEY_UP); ED_SHORTCUT("scene_tree/move_down", TTR("Move Down"), KEY_MASK_CMD | KEY_DOWN); ED_SHORTCUT("scene_tree/duplicate", TTR("Duplicate"), KEY_MASK_CMD | KEY_D); @@ -2851,17 +2851,17 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel button_create_script = memnew(ToolButton); button_create_script->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(TOOL_ATTACH_SCRIPT, false)); - button_create_script->set_tooltip(TTR("Attach a new or existing script for the selected node.")); + button_create_script->set_tooltip(TTR("Attach a new or existing script to the selected node.")); button_create_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script")); filter_hbc->add_child(button_create_script); button_create_script->hide(); - button_clear_script = memnew(ToolButton); - button_clear_script->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(TOOL_CLEAR_SCRIPT, false)); - button_clear_script->set_tooltip(TTR("Clear a script for the selected node.")); - button_clear_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/clear_script")); - filter_hbc->add_child(button_clear_script); - button_clear_script->hide(); + button_detach_script = memnew(ToolButton); + button_detach_script->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected), make_binds(TOOL_DETACH_SCRIPT, false)); + button_detach_script->set_tooltip(TTR("Detach the script from the selected node.")); + button_detach_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/detach_script")); + filter_hbc->add_child(button_detach_script); + button_detach_script->hide(); button_hb = memnew(HBoxContainer); vbc->add_child(button_hb); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 31ef1ce7d0..00b95c9853 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -66,7 +66,7 @@ class SceneTreeDock : public VBoxContainer { TOOL_REPLACE, TOOL_EXTEND_SCRIPT, TOOL_ATTACH_SCRIPT, - TOOL_CLEAR_SCRIPT, + TOOL_DETACH_SCRIPT, TOOL_MOVE_UP, TOOL_MOVE_DOWN, TOOL_DUPLICATE, @@ -110,7 +110,7 @@ class SceneTreeDock : public VBoxContainer { ToolButton *button_add; ToolButton *button_instance; ToolButton *button_create_script; - ToolButton *button_clear_script; + ToolButton *button_detach_script; Button *button_3d; |