Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix document not showing for gdscript properties in inspector #62936

Merged
merged 1 commit into from
Jul 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2465,6 +2465,8 @@ void EditorInspector::update_tree() {
_parse_added_editors(main_vbox, ped);
}

StringName type_name;

// Get the lists of editors for properties.
for (List<PropertyInfo>::Element *E_property = plist.front(); E_property; E_property = E_property->next()) {
PropertyInfo &p = E_property->get();
Expand Down Expand Up @@ -2535,6 +2537,7 @@ void EditorInspector::update_tree() {
category_vbox = nullptr; //reset

String type = p.name;
type_name = p.name;

// Set the category icon.
if (!ClassDB::class_exists(type) && !ScriptServer::is_global_class(type) && p.hint_string.length() && FileAccess::exists(p.hint_string)) {
Expand Down Expand Up @@ -2568,18 +2571,17 @@ void EditorInspector::update_tree() {

if (use_doc_hints) {
// Sets the category tooltip to show documentation.
StringName type2 = p.name;
if (!class_descr_cache.has(type2)) {
if (!class_descr_cache.has(type_name)) {
String descr;
DocTools *dd = EditorHelp::get_doc_data();
HashMap<String, DocData::ClassDoc>::Iterator E = dd->class_list.find(type2);
HashMap<String, DocData::ClassDoc>::Iterator E = dd->class_list.find(type_name);
if (E) {
descr = DTR(E->value.brief_description);
}
class_descr_cache[type2] = descr;
class_descr_cache[type_name] = descr;
}

category->set_tooltip(p.name + "::" + (class_descr_cache[type2].is_empty() ? "" : class_descr_cache[type2]));
category->set_tooltip(p.name + "::" + (class_descr_cache[type_name].is_empty() ? "" : class_descr_cache[type_name]));
}

// Add editors at the start of a category.
Expand Down Expand Up @@ -2850,7 +2852,7 @@ void EditorInspector::update_tree() {
// Build the doc hint, to use as tooltip.

// Get the class name.
StringName classname = object->get_class_name();
StringName classname = type_name == "" ? object->get_class_name() : type_name;
if (!object_class.is_empty()) {
classname = object_class;
}
Expand Down