Merge pull request #26678 from YeldhamDev/hide_addscript_multiselected
Hide "Add Script" button in Scene dock when multiple nodes are selected
This commit is contained in:
commit
adb41c8bee
|
@ -1741,7 +1741,7 @@ void SceneTreeDock::_update_script_button() {
|
||||||
button_clear_script->show();
|
button_clear_script->show();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
button_create_script->show();
|
button_create_script->hide();
|
||||||
Array selection = editor_selection->get_selected_nodes();
|
Array selection = editor_selection->get_selected_nodes();
|
||||||
for (int i = 0; i < selection.size(); i++) {
|
for (int i = 0; i < selection.size(); i++) {
|
||||||
Node *n = Object::cast_to<Node>(selection[i]);
|
Node *n = Object::cast_to<Node>(selection[i]);
|
||||||
|
@ -2277,7 +2277,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||||
menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
|
menu->add_icon_shortcut(get_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
|
||||||
}
|
}
|
||||||
menu->add_separator();
|
menu->add_separator();
|
||||||
menu->add_icon_item(get_icon("Help", "EditorIcons"), TTR("Open documentation"), TOOL_OPEN_DOCUMENTATION);
|
menu->add_icon_item(get_icon("Help", "EditorIcons"), TTR("Open Documentation"), TOOL_OPEN_DOCUMENTATION);
|
||||||
|
|
||||||
if (profile_allow_editing) {
|
if (profile_allow_editing) {
|
||||||
menu->add_separator();
|
menu->add_separator();
|
||||||
|
@ -2508,7 +2508,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||||
|
|
||||||
HBoxContainer *filter_hbc = memnew(HBoxContainer);
|
HBoxContainer *filter_hbc = memnew(HBoxContainer);
|
||||||
filter_hbc->add_constant_override("separate", 0);
|
filter_hbc->add_constant_override("separate", 0);
|
||||||
ToolButton *tb;
|
|
||||||
|
|
||||||
ED_SHORTCUT("scene_tree/rename", TTR("Rename"));
|
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/batch_rename", TTR("Batch Rename"), KEY_MASK_CMD | KEY_F2);
|
||||||
|
@ -2529,19 +2528,17 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||||
ED_SHORTCUT("scene_tree/delete_no_confirm", TTR("Delete (No Confirm)"), KEY_MASK_SHIFT | KEY_DELETE);
|
ED_SHORTCUT("scene_tree/delete_no_confirm", TTR("Delete (No Confirm)"), KEY_MASK_SHIFT | KEY_DELETE);
|
||||||
ED_SHORTCUT("scene_tree/delete", TTR("Delete"), KEY_DELETE);
|
ED_SHORTCUT("scene_tree/delete", TTR("Delete"), KEY_DELETE);
|
||||||
|
|
||||||
tb = memnew(ToolButton);
|
button_add = memnew(ToolButton);
|
||||||
tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_NEW, false));
|
button_add->connect("pressed", this, "_tool_selected", make_binds(TOOL_NEW, false));
|
||||||
tb->set_tooltip(TTR("Add/Create a New Node"));
|
button_add->set_tooltip(TTR("Add/Create a New Node"));
|
||||||
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_child_node"));
|
button_add->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_child_node"));
|
||||||
filter_hbc->add_child(tb);
|
filter_hbc->add_child(button_add);
|
||||||
button_add = tb;
|
|
||||||
|
|
||||||
tb = memnew(ToolButton);
|
button_instance = memnew(ToolButton);
|
||||||
tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_INSTANCE, false));
|
button_instance->connect("pressed", this, "_tool_selected", make_binds(TOOL_INSTANCE, false));
|
||||||
tb->set_tooltip(TTR("Instance a scene file as a Node. Creates an inherited scene if no root node exists."));
|
button_instance->set_tooltip(TTR("Instance a scene file as a Node. Creates an inherited scene if no root node exists."));
|
||||||
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/instance_scene"));
|
button_instance->set_shortcut(ED_GET_SHORTCUT("scene_tree/instance_scene"));
|
||||||
filter_hbc->add_child(tb);
|
filter_hbc->add_child(button_instance);
|
||||||
button_instance = tb;
|
|
||||||
|
|
||||||
vbc->add_child(filter_hbc);
|
vbc->add_child(filter_hbc);
|
||||||
filter = memnew(LineEdit);
|
filter = memnew(LineEdit);
|
||||||
|
@ -2551,21 +2548,19 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||||
filter->add_constant_override("minimum_spaces", 0);
|
filter->add_constant_override("minimum_spaces", 0);
|
||||||
filter->connect("text_changed", this, "_filter_changed");
|
filter->connect("text_changed", this, "_filter_changed");
|
||||||
|
|
||||||
tb = memnew(ToolButton);
|
button_create_script = memnew(ToolButton);
|
||||||
tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_ATTACH_SCRIPT, false));
|
button_create_script->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."));
|
button_create_script->set_tooltip(TTR("Attach a new or existing script for the selected node."));
|
||||||
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script"));
|
button_create_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script"));
|
||||||
filter_hbc->add_child(tb);
|
filter_hbc->add_child(button_create_script);
|
||||||
tb->hide();
|
button_create_script->hide();
|
||||||
button_create_script = tb;
|
|
||||||
|
|
||||||
tb = memnew(ToolButton);
|
button_clear_script = memnew(ToolButton);
|
||||||
tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_CLEAR_SCRIPT, false));
|
button_clear_script->connect("pressed", this, "_tool_selected", make_binds(TOOL_CLEAR_SCRIPT, false));
|
||||||
tb->set_tooltip(TTR("Clear a script for the selected node."));
|
button_clear_script->set_tooltip(TTR("Clear a script for the selected node."));
|
||||||
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/clear_script"));
|
button_clear_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/clear_script"));
|
||||||
filter_hbc->add_child(tb);
|
filter_hbc->add_child(button_clear_script);
|
||||||
button_clear_script = tb;
|
button_clear_script->hide();
|
||||||
tb->hide();
|
|
||||||
|
|
||||||
button_hb = memnew(HBoxContainer);
|
button_hb = memnew(HBoxContainer);
|
||||||
vbc->add_child(button_hb);
|
vbc->add_child(button_hb);
|
||||||
|
|
Loading…
Reference in New Issue