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

Add support for tooltip descriptions in dynamically exported properties #8531

Open
Lcbx opened this issue Nov 27, 2023 · 3 comments
Open

Add support for tooltip descriptions in dynamically exported properties #8531

Lcbx opened this issue Nov 27, 2023 · 3 comments

Comments

@Lcbx
Copy link

Lcbx commented Nov 27, 2023

Describe the project you are working on

I'm working on tooling, notably a custom skeleton IK system that I might release as an addon or replacement for the current deprecated one (depending on maintainer opinion).

Describe the problem or limitation you are having in your project

My implementation uses multiple dynamically exported properties (using _get_property_list() ).
Notably to expose bone names in the tool and allow optional magnet position. As I intend to make this available to other users, documenting these properties so they have a tooltip description would be valuable for the user experience.
There is no way to do this currently in Godot afaik.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The feature would allow users to add tooltips to dynamic exports.
There are multiple places outside of my particular case where documenting dynamic properties could help :
some nodes expose conditional properties based on a boolean or enum, for example PhysicalBone3D has multiple different properties exposed based on the joint type chosen.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Looking at the code for property descriptions/tooltips, there doesn't seem to be an easy way to document dynamic properties :

  • they are exposed through a runtime function that creates a PropertyInfo
  • PropertyInfo does not contain a "description" property (and it probably should not, and then only with tools enabled)
  • documentation is parsed and added to doctool at script parse time for GDscript
  • the script is not executable at this step of the process
  • this would mean adding additional documentation code paths, at least for c++

The way I see it, there are multiple ways to implement this :

  • adding a description field to PropertyInfo that would be editor-build only.
    it would make the process of dynamic exports simpler for users but might require a lot of refactoring
  • adding a syntax to the parser, something like :
    ## (CustomPropertyPath): description for GDscript
    But I don't know what equivalent there could be for C# and c++ though.

If this enhancement will not be used often, can it be worked around with a few lines of script?

doctools and class documentation are part of core ; there might be ways to add entries into the cache, but it would be hackish and very verbose.

Is there a reason why this should be core and not an add-on in the asset library?

as said above, not possible as part of core functionality.

@Lcbx Lcbx changed the title allow descriptions for dynamic properties allow descriptions for dynamically exported properties Nov 27, 2023
@Calinou Calinou changed the title allow descriptions for dynamically exported properties Add support for tooltip descriptions in dynamically exported properties Nov 28, 2023
@monitz87
Copy link

monitz87 commented Jan 3, 2024

Same here. We're developing multiple addons that we intend to eventually release. Some of them rely heavily on custom properties, and something like this would greatly improve UX.

I think enhancing PropertyInfo to include the description makes a lot of sense (at least from a usability perspective). We find ourselves often needing to wrap resources and "spread" their properties in the inspector using dynamically exported properties. As it is, those new properties lose the original descriptions. Being able to access and re-export the originals would be great in these cases.

This would also allow us to do cool things like templating descriptions of properties in base scripts which can then be enriched by the context of whatever scripts extend them.

@Splizard
Copy link

Wanted to note here that this issue affects GDExtension too, there is no way to document properties.

@AThousandShips
Copy link
Member

Wanted to note here that this issue affects GDExtension too, there is no way to document properties.

There is, not dynamically but there absolutely is:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants