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

Refix document not showing for gdscript properties in inspector since commit 77d3ac7 #64246

Merged
merged 1 commit into from
Aug 10, 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
18 changes: 11 additions & 7 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2662,7 +2662,7 @@ void EditorInspector::update_tree() {
_parse_added_editors(main_vbox, nullptr, ped);
}

StringName type_name;
StringName doc_name;

// Get the lists of editors for properties.
for (List<PropertyInfo>::Element *E_property = plist.front(); E_property; E_property = E_property->next()) {
Expand Down Expand Up @@ -2735,7 +2735,7 @@ void EditorInspector::update_tree() {

String type = p.name;
String label = p.name;
type_name = p.name;
doc_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 All @@ -2746,6 +2746,10 @@ void EditorInspector::update_tree() {
if (script.is_valid()) {
base_type = script->get_instance_base_type();
name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
Vector<DocData::ClassDoc> docs = script->get_documentation();
if (!docs.is_empty()) {
doc_name = docs[0].name;
}
if (name != StringName() && label != name) {
label = name;
}
Expand Down Expand Up @@ -2774,17 +2778,17 @@ void EditorInspector::update_tree() {

if (use_doc_hints) {
// Sets the category tooltip to show documentation.
if (!class_descr_cache.has(type_name)) {
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(type_name);
HashMap<String, DocData::ClassDoc>::Iterator E = dd->class_list.find(doc_name);
if (E) {
descr = DTR(E->value.brief_description);
}
class_descr_cache[type_name] = descr;
class_descr_cache[doc_name] = descr;
}

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

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

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