summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-27 15:41:10 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-27 15:41:10 +0100
commit77af1a5589736e70f3a512edd1ecf35e0035ae89 (patch)
treeccc337f0f3794236c1ea9a31ddecec14e73bcbe6
parentf43fbb593ea1908a3cd3fe0c61d79d9a7f33714a (diff)
parent970f5533dd4a7b0f55f224b3224ea882565cf88a (diff)
Merge pull request #72171 from KoBeWi/editor_censorship
Fix filtering editor nodes in Create Dialog
-rw-r--r--editor/create_dialog.cpp7
-rw-r--r--editor/create_dialog.h3
2 files changed, 8 insertions, 2 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 0814d5b5ca..aee907854c 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -122,7 +122,7 @@ bool CreateDialog::_should_hide_type(const String &p_type) const {
return true;
}
- if (base_type == "Node" && p_type.begins_with("Editor")) {
+ if (is_base_type_node && p_type.begins_with("Editor")) {
return true; // Do not show editor nodes.
}
@@ -508,6 +508,11 @@ String CreateDialog::get_selected_type() {
return selected->get_text(0);
}
+void CreateDialog::set_base_type(const String &p_base) {
+ base_type = p_base;
+ is_base_type_node = ClassDB::is_parent_class(p_base, "Node");
+}
+
Variant CreateDialog::instantiate_selected() {
TreeItem *selected = search_options->get_selected();
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index ad63346a02..37579812cf 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -51,6 +51,7 @@ class CreateDialog : public ConfirmationDialog {
Tree *search_options = nullptr;
String base_type;
+ bool is_base_type_node = false;
String icon_fallback;
String preferred_search_result_type;
@@ -113,7 +114,7 @@ public:
Variant instantiate_selected();
String get_selected_type();
- void set_base_type(const String &p_base) { base_type = p_base; }
+ void set_base_type(const String &p_base);
String get_base_type() const { return base_type; }
void select_base();