Skip to content

Commit

Permalink
Merge pull request #62980 from garychia/scene_tree_editor_improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Jul 14, 2022
2 parents 74ab3dc + 83d478f commit 2c11e6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions editor/scene_tree_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,10 @@ void SceneTreeDialog::_select() {
}
}

void SceneTreeDialog::_selected_changed() {
get_ok_button()->set_disabled(!tree->get_selected());
}

void SceneTreeDialog::_filter_changed(const String &p_filter) {
tree->set_filter(p_filter);
}
Expand Down Expand Up @@ -1386,6 +1390,10 @@ SceneTreeDialog::SceneTreeDialog() {
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tree->get_scene_tree()->connect("item_activated", callable_mp(this, &SceneTreeDialog::_select));
vbc->add_child(tree);

// Disable the OK button when no node is selected.
get_ok_button()->set_disabled(!tree->get_selected());
tree->connect("node_selected", callable_mp(this, &SceneTreeDialog::_selected_changed));
}

SceneTreeDialog::~SceneTreeDialog() {
Expand Down
1 change: 1 addition & 0 deletions editor/scene_tree_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class SceneTreeDialog : public ConfirmationDialog {

void _select();
void _cancel();
void _selected_changed();
void _filter_changed(const String &p_filter);
void _update_theme();

Expand Down

0 comments on commit 2c11e6d

Please sign in to comment.