Re-add script button from b77200728e
This commit is contained in:
parent
e3d6d863af
commit
225b1d2d76
@ -675,6 +675,7 @@ void SceneTreeDock::_notification(int p_what) {
|
||||
}
|
||||
button_add->set_icon(get_icon("Add", "EditorIcons"));
|
||||
button_instance->set_icon(get_icon("Instance", "EditorIcons"));
|
||||
button_create_script->set_icon(get_icon("Script", "EditorIcons"));
|
||||
|
||||
filter_icon->set_texture(get_icon("Zoom", "EditorIcons"));
|
||||
|
||||
@ -1239,11 +1240,18 @@ void SceneTreeDock::_delete_confirm() {
|
||||
|
||||
void SceneTreeDock::_selection_changed() {
|
||||
|
||||
if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() > 1) {
|
||||
int selection_size = EditorNode::get_singleton()->get_editor_selection()->get_selection().size();
|
||||
if (selection_size > 1) {
|
||||
//automatically turn on multi-edit
|
||||
_tool_selected(TOOL_MULTI_EDIT);
|
||||
}
|
||||
|
||||
if (selection_size==1 && EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) {
|
||||
button_create_script->show();
|
||||
} else {
|
||||
button_create_script->hide();
|
||||
}
|
||||
|
||||
//tool_buttons[TOOL_MULTI_EDIT]->set_disabled(EditorNode::get_singleton()->get_editor_selection()->get_selection().size()<2);
|
||||
}
|
||||
|
||||
@ -1779,6 +1787,13 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||
filter_icon->set_stretch_mode(TextureFrame::STRETCH_KEEP_CENTERED);
|
||||
filter->connect("text_changed", this, "_filter_changed");
|
||||
|
||||
tb = memnew(ToolButton);
|
||||
tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_SCRIPT, false));
|
||||
tb->set_tooltip(TTR("Create a new script for the selected node."));
|
||||
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_script"));
|
||||
filter_hbc->add_child(tb);
|
||||
button_create_script=tb;
|
||||
|
||||
scene_tree = memnew(SceneTreeEditor(false, true, true));
|
||||
vbc->add_child(scene_tree);
|
||||
scene_tree->set_v_size_flags(SIZE_EXPAND | SIZE_FILL);
|
||||
|
@ -76,6 +76,7 @@ class SceneTreeDock : public VBoxContainer {
|
||||
|
||||
ToolButton *button_add;
|
||||
ToolButton *button_instance;
|
||||
ToolButton *button_create_script;
|
||||
|
||||
SceneTreeEditor *scene_tree;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user