summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/icons/icon_script_extend.svg8
-rw-r--r--editor/scene_tree_dock.cpp9
2 files changed, 16 insertions, 1 deletions
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 @@
+<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
+<g transform="translate(0 -1036.4)">
+<path transform="translate(0 1036.4)" d="m6 1v1c-0.55228 0-1 0.44772-1 1v10h-1v-2h-2v2c2.826e-4 0.35698 0.19084 0.68674 0.5 0.86523 0.15194 0.088045 0.32439 0.13452 0.5 0.13477v1h7c0.73866 0 1.3763-0.40437 1.7227-1h-3.7227v-4h4v-5h3v-2c0-1.1046-0.89543-2-2-2z" fill="#e0e0e0"/>
+<path transform="translate(0 1036.4)" d="m6 1c-1.1046 0-2 0.89543-2 2v7h-2-1v1 2c0 1.1046 0.89543 2 2 2s2-0.89543 2-2v-10c0-0.55228 0.44772-1 1-1s1 0.44772 1 1v1 1 1h1 4v-1h-4v-1-1c0-1.1046-0.89543-2-2-2zm-4 10h2v2c0 0.55228-0.44772 1-1 1s-1-0.44772-1-1v-2z" fill="#b4b4b4"/>
+<circle cx="3" cy="1048.4" rx="1" ry="1" fill="#e0e0e0"/>
+<path d="m16 1048.4-3-3v2h-4v2h4v2z" fill="#68b6ff" fill-rule="evenodd"/>
+</g>
+</svg>
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();