Make docs search hide nodes disabled by the editor feature profile

This commit is contained in:
Michael Alexsander Silva Dias 2019-06-06 22:04:25 -03:00
parent 197b65f32a
commit def0485ca9
2 changed files with 56 additions and 33 deletions

View file

@ -250,6 +250,25 @@ EditorHelpSearch::EditorHelpSearch() {
vbox->add_child(results_tree, true);
}
bool EditorHelpSearch::Runner::_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 (!ClassDB::class_exists(class_name) || profile->is_class_disabled(class_name)) {
return true;
}
class_name = ClassDB::get_parent_class(class_name);
}
return false;
}
bool EditorHelpSearch::Runner::_slice() {
bool phase_done = false;
@ -299,6 +318,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() {
bool EditorHelpSearch::Runner::_phase_match_classes() {
DocData::ClassDoc &class_doc = iterator_doc->value();
if (!_is_class_disabled_by_feature_profile(class_doc.name)) {
matches[class_doc.name] = ClassMatch();
ClassMatch &match = matches[class_doc.name];
@ -337,6 +357,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
if (_match_string(term, class_doc.theme_properties[i].name))
match.theme_properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.theme_properties[i]));
}
}
iterator_doc = iterator_doc->next();
return !iterator_doc;

View file

@ -125,6 +125,8 @@ class EditorHelpSearch::Runner : public Reference {
Map<String, TreeItem *> class_items;
TreeItem *matched_item;
bool _is_class_disabled_by_feature_profile(const StringName &p_class);
bool _slice();
bool _phase_match_classes_init();
bool _phase_match_classes();