summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-14 17:45:48 +0200
committerGitHub <noreply@github.com>2022-07-14 17:45:48 +0200
commit2c11e6d9efc42370a8d7537eaff8b1ea78a283e5 (patch)
tree045dbaee2c11ed462d5df1be3b988c71aa6df52e /editor
parent74ab3dce4f8666a92bc986bfa0fa509458c8b773 (diff)
parent83d478ffcd12a77803b0646749c06eca14802d99 (diff)
Merge pull request #62980 from garychia/scene_tree_editor_improvement
Diffstat (limited to 'editor')
-rw-r--r--editor/scene_tree_editor.cpp8
-rw-r--r--editor/scene_tree_editor.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 86fa9222c0..5e1f5ab750 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -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);
}
@@ -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() {
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 5d4230059c..31a14e4667 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -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();