summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrunoSXS <trustmeiamadeveloper@gmail.com>2022-11-20 19:35:48 -0300
committerBrunoSXS <trustmeiamadeveloper@gmail.com>2022-11-23 22:12:12 -0300
commita5e9878ef89b04d55f997d22d6a426491bdc0db5 (patch)
treec4473694e188e4bcd5554943a6df9f55b2c88af8
parentc9c09ad608754a9025ca227358fca5a02553f2cb (diff)
Fix for documentation not appearing in preview in editor inspector
-rw-r--r--editor/editor_inspector.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 6e18bde303..4822aab7d4 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -3114,11 +3114,24 @@ void EditorInspector::update_tree() {
// Build the doc hint, to use as tooltip.
// Get the class name.
- StringName classname = doc_name == "" ? object->get_class_name() : doc_name;
+ StringName classname = doc_name;
if (!object_class.is_empty()) {
classname = object_class;
} else if (Object::cast_to<MultiNodeEdit>(object)) {
classname = Object::cast_to<MultiNodeEdit>(object)->get_edited_class_name();
+ } else if (classname == "") {
+ classname = object->get_class_name();
+ Resource *res = Object::cast_to<Resource>(object);
+ if (res && !res->get_script().is_null()) {
+ // Grab the script of this resource to get the evaluated script class.
+ Ref<Script> scr = res->get_script();
+ if (scr.is_valid()) {
+ Vector<DocData::ClassDoc> docs = scr->get_documentation();
+ if (!docs.is_empty()) {
+ classname = docs[0].name;
+ }
+ }
+ }
}
StringName propname = property_prefix + p.name;