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

Added GDScript annotations for export variable tooltips and groupings. #41033

Closed
wants to merge 1 commit into from

Conversation

EricEzaM
Copy link
Contributor

@EricEzaM EricEzaM commented Aug 5, 2020

Added some extra annotations for some features I have wanted for a long time!

@group("my_group")
@group("my_group/my_sub_group")

@tooltip("An explanation of the variable.")

Basically works the same as HeaderAttribute and TooltipAttribute in Unity, so as a result should be reasonably easy to implement in C# - haven't looked though.

sKYrOsFZuE

godot windows tools 64_uypvilWPiS

This basically does the same thing as #40669 except it is with annotations (and as a result requires much less code). However since this relies on annotations, this is for 4.0 only and not 3.2.

Closes godotengine/godot-proposals#1255 (comment) and maybe others.

@bojidar-bg
Copy link
Contributor

Quick note: @tooltip was proposed to be @doc in godotengine/godot-proposals#993

@EricEzaM
Copy link
Contributor Author

EricEzaM commented Aug 5, 2020

From my understanding of that proposal,@doc was to be used for a slightly different purpose?

Personally I prefer @tooltip, as I think what it does is more clear. It also shares the name given to this particular function in the engine code: EditorProperty::set_tooltip. I think it would be preferable to limit different names given to the same or similar things.

@vnen
Copy link
Member

vnen commented Aug 5, 2020

If you want to change PropertyInfo to include groups then you'd need to change the whole engine API to use to use those (of course only after a discussion with coredevs if this is really wanted). Currently this is done by adding dummy "properties" with PROPERTY_USAGE_CATEGORY or PROPERTY_USAGE_GROUP depending on the intended result. So GDScript should follow this. Given that, I would add this as @category since that's what you are doing essentially, and then add another for @group to follow the same convention of the native engine API.

For the tooltip, I'd rather use the documentation comments instead of an annotation. The @doc suggestion was made when documentation was supposed to be added as annotations, but now we settled for comments so we should use that. There's not much reason to have two different descriptions: one for the documentation and one for the tooltip. The engine already gets tooltips from documentation, so it would be much more consistent to do the same in GDScript.

@EricEzaM
Copy link
Contributor Author

EricEzaM commented Aug 5, 2020

Yep, sounds like there is a plan for this stuff. Was fun to try and implement anyway, thanks for the feedback!

@EricEzaM EricEzaM closed this Aug 5, 2020
@KoBeWi KoBeWi added the archived label Aug 5, 2020
@EricEzaM EricEzaM deleted the custom-annotations branch August 8, 2020 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make grouping exported variables easier
5 participants