diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-09 08:55:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-09 08:55:37 +0100 |
commit | 28655e16d65ba8e5e281dd1be65d21b6630559c3 (patch) | |
tree | 274c0e6778eae4cab456b6bdf96488d603f03e86 /editor | |
parent | 1d304d87ebe2d5c578086a16498a253e054022dc (diff) | |
parent | b0e42050696452479afb74691164e3725bc0271e (diff) |
Merge pull request #33426 from PucklaMotzer09/ignore_disabled_recent
Ignore the classes in the recent and favorite panels of the create dialog if they are disabled
Diffstat (limited to 'editor')
-rw-r--r-- | editor/create_dialog.cpp | 16 | ||||
-rw-r--r-- | editor/editor_feature_profile.cpp | 10 |
2 files changed, 10 insertions, 16 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index df423bfa0e..4adb3844bc 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -58,9 +58,7 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const St while (!f->eof_reached()) { String l = f->get_line().strip_edges(); String name = l.split(" ")[0]; - if ((ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) && !_is_class_disabled_by_feature_profile(name)) { - TreeItem *ti = recent->create_item(root); ti->set_text(0, l); ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type)); @@ -275,17 +273,7 @@ bool CreateDialog::_is_class_disabled_by_feature_profile(const StringName &p_cla 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_nocheck(class_name); - } - - return false; + return profile->is_class_disabled(p_class); } void CreateDialog::select_type(const String &p_type) { @@ -616,7 +604,7 @@ void CreateDialog::_update_favorite_list() { for (int i = 0; i < favorite_list.size(); i++) { String l = favorite_list[i]; String name = l.split(" ")[0]; - if (!(ClassDB::class_exists(name) || ScriptServer::is_global_class(name))) + if (!((ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) && !_is_class_disabled_by_feature_profile(name))) continue; TreeItem *ti = favorites->create_item(root); ti->set_text(0, l); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 1fa2bfcd60..a4a7a0cd45 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -64,7 +64,10 @@ void EditorFeatureProfile::set_disable_class(const StringName &p_class, bool p_d } bool EditorFeatureProfile::is_class_disabled(const StringName &p_class) const { - return disabled_classes.has(p_class); + if (p_class == StringName()) { + return false; + } + return disabled_classes.has(p_class) || is_class_disabled(ClassDB::get_parent_class_nocheck(p_class)); } void EditorFeatureProfile::set_disable_class_editor(const StringName &p_class, bool p_disabled) { @@ -76,7 +79,10 @@ void EditorFeatureProfile::set_disable_class_editor(const StringName &p_class, b } bool EditorFeatureProfile::is_class_editor_disabled(const StringName &p_class) const { - return disabled_editors.has(p_class); + if (p_class == StringName()) { + return false; + } + return disabled_editors.has(p_class) || is_class_editor_disabled(ClassDB::get_parent_class_nocheck(p_class)); } void EditorFeatureProfile::set_disable_class_property(const StringName &p_class, const StringName &p_property, bool p_disabled) { |