diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-04-08 19:18:03 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-04-08 19:18:51 -0300 |
commit | a20235aeb02c0c9e5ce58c0236f88a19865d571c (patch) | |
tree | 9232009f86a08dedf4f6f709a8f1fd18a5df8322 /editor/create_dialog.cpp | |
parent | 9ab17b664dbecad4bf773048c422c66320bd45eb (diff) |
Add ability to edit editor feature profiles
Allows enabling/disabling parts of the editor and storing/loading profiles for that.
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r-- | editor/create_dialog.cpp | 24 |
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")) |