mirror of
https://github.com/godotengine/godot
synced 2024-09-05 06:58:29 +00:00
Fix filtering editor nodes in Create Dialog
This commit is contained in:
parent
9d555f5c68
commit
970f5533dd
|
@ -122,7 +122,7 @@ bool CreateDialog::_should_hide_type(const String &p_type) const {
|
||||||
return true;
|
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.
|
return true; // Do not show editor nodes.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,6 +508,11 @@ String CreateDialog::get_selected_type() {
|
||||||
return selected->get_text(0);
|
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() {
|
Variant CreateDialog::instantiate_selected() {
|
||||||
TreeItem *selected = search_options->get_selected();
|
TreeItem *selected = search_options->get_selected();
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ class CreateDialog : public ConfirmationDialog {
|
||||||
Tree *search_options = nullptr;
|
Tree *search_options = nullptr;
|
||||||
|
|
||||||
String base_type;
|
String base_type;
|
||||||
|
bool is_base_type_node = false;
|
||||||
String icon_fallback;
|
String icon_fallback;
|
||||||
String preferred_search_result_type;
|
String preferred_search_result_type;
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ public:
|
||||||
Variant instantiate_selected();
|
Variant instantiate_selected();
|
||||||
String get_selected_type();
|
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; }
|
String get_base_type() const { return base_type; }
|
||||||
void select_base();
|
void select_base();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue