Skip to content

GDScript 2.0: @export_category interferes with the property inspector tooltip #64432

Closed
@permelin

Description

@permelin

Godot version

v4.0.alpha.custom_build [f2a6168]

System information

Linux

Issue description

Properties can be documented by giving them a description with ## comments. That description is then showed as a tooltip in the inspector, like this.
example1

However, any properties following an @export_category annotation will only have a "no description" tooltip.
example2

This bug actually predates @export_category and also occurs when using PROPERTY_USAGE_CATEGORY directly in _get_property_list().

The problem is that EditorInspector::update_tree() assumes that any property with PROPERTY_USAGE_CATEGORY either has a name that is a class name or a hint_string that is a path to a script. And it uses that class/path to look up the description of subsequent properties.

One possible fix is to simply add the required hint string to @export_category. I've verified that this works.

--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3826,6 +3826,7 @@ bool GDScriptParser::export_group_annotations(const AnnotationNode *p_annotation
        switch (t_usage) {
                case PROPERTY_USAGE_CATEGORY: {
                        annotation->export_info.usage = t_usage;
+                       annotation->export_info.hint_string = script_path;
                } break;

One downside to that is that the tooltip of the category itself will be the description of the script ("This is a description of the script" in the screenshots above).

I guess the alternative is to change EditorInspector::update_tree() which is a 670 line hairy monster.

Steps to reproduce

See screenshots above.

Minimal reproduction project

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions