Skip to content

Commit

Permalink
Merge pull request #23142 from willnationsdev/editor-extend-script
Browse files Browse the repository at this point in the history
Add icon_script_extend & update the icon @runtime
  • Loading branch information
akien-mga committed Oct 19, 2018
2 parents bde3e88 + 42300b2 commit cf7a661
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions editor/icons/icon_script_extend.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit cf7a661

Please sign in to comment.