summaryrefslogtreecommitdiff
path: root/editor/create_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r--editor/create_dialog.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 364c5126d7..26bd651c2b 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -238,6 +238,26 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
p_types[p_type] = item;
}
+bool CreateDialog::_is_class_disabled_by_feature_profile(const StringName &p_class) {
+
+ Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
+ if (profile.is_null()) {
+ return false;
+ }
+
+ StringName class_name = p_class;
+
+ while (class_name != StringName()) {
+
+ if (profile->is_class_disabled(class_name)) {
+ return true;
+ }
+ class_name = ClassDB::get_parent_class(class_name);
+ }
+
+ return false;
+}
+
void CreateDialog::_update_search() {
search_options->clear();
@@ -264,6 +284,10 @@ void CreateDialog::_update_search() {
for (List<StringName>::Element *I = type_list.front(); I; I = I->next()) {
String type = I->get();
+
+ if (_is_class_disabled_by_feature_profile(type)) {
+ continue;
+ }
bool cpp_type = ClassDB::class_exists(type);
if (base_type == "Node" && type.begins_with("Editor"))