Skip to content

Commit

Permalink
Do not cache the doc information written by user in the script in Ins…
Browse files Browse the repository at this point in the history
…pector

The doc information of the edited object is cached to reuse it in the next `EditorInspector::update_tree()` call.

This is not suitable for doc information written by users in the script because it is easily changed.
  • Loading branch information
Rindbee committed May 1, 2023
1 parent ee86505 commit fd75bb5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2808,18 +2808,22 @@ void EditorInspector::update_tree() {
category->label = label;

if (use_doc_hints) {
String descr = "";
// Sets the category tooltip to show documentation.
if (!class_descr_cache.has(doc_name)) {
String descr;
DocTools *dd = EditorHelp::get_doc_data();
HashMap<String, DocData::ClassDoc>::Iterator E = dd->class_list.find(doc_name);
if (E) {
descr = DTR(E->value.brief_description);
}
class_descr_cache[doc_name] = descr;
if (ClassDB::class_exists(doc_name)) {
class_descr_cache[doc_name] = descr; // Do not cache the class description of scripts.
}
} else {
descr = class_descr_cache[doc_name];
}

category->set_tooltip_text(p.name + "::" + (class_descr_cache[doc_name].is_empty() ? "" : class_descr_cache[doc_name]));
category->set_tooltip_text(p.name + "::" + descr);
}

// Add editors at the start of a category.
Expand Down Expand Up @@ -3212,7 +3216,9 @@ void EditorInspector::update_tree() {
}
}

doc_info_cache[classname][propname] = doc_info;
if (ClassDB::class_exists(classname)) {
doc_info_cache[classname][propname] = doc_info; // Do not cache the doc information of scripts.
}
}
}

Expand Down

0 comments on commit fd75bb5

Please sign in to comment.