From 42300b2769c9164d22b8a6d1a626eb9a539c7e93 Mon Sep 17 00:00:00 2001 From: Will Nations Date: Fri, 19 Oct 2018 09:04:07 -0500 Subject: Add icon_script_extend & update the icon @runtime --- editor/icons/icon_script_extend.svg | 8 ++++++++ editor/scene_tree_dock.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 editor/icons/icon_script_extend.svg diff --git a/editor/icons/icon_script_extend.svg b/editor/icons/icon_script_extend.svg new file mode 100644 index 0000000000..ef3d48af9f --- /dev/null +++ b/editor/icons/icon_script_extend.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 8925804710..45c20121da 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1613,6 +1613,14 @@ void SceneTreeDock::_delete_confirm() { void SceneTreeDock::_update_script_button() { if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 1) { button_create_script->show(); + Node *n = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0]; + if (n->get_script().is_null()) { + button_create_script->set_icon(get_icon("ScriptCreate", "EditorIcons")); + button_create_script->set_tooltip(TTR("Attach a new or existing script for the selected node.")); + } else { + button_create_script->set_icon(get_icon("ScriptExtend", "EditorIcons")); + button_create_script->set_tooltip(TTR("Extend the selected node's script with a new or existing script.")); + } } else { button_create_script->hide(); } @@ -2359,7 +2367,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel tb = memnew(ToolButton); tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_ATTACH_SCRIPT, false)); - tb->set_tooltip(TTR("Attach a new or existing script for the selected node.")); tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script")); filter_hbc->add_child(tb); tb->hide(); -- cgit v1.2.3