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

Display enum value descriptions in the editor inspector help tooltips #76238

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Apr 19, 2023

This makes it possible to see what each value does without having to open a documentation tab:

Screenshot_20230419_015912

Some enum value names may be mismatched as the API doesn't always match the property hint used in the editor:

Screenshot_20230419_015955

I've tried to implement this in tooltips (only displaying the description for the current value), but the way the editor inspector cache is generated makes this difficult. (We should avoid full cache rebuilds when an enum value is changed in the inspector.)

for (DocData::ConstantDoc val : enum_class->value.constants) {
// Don't display `_MAX` enum value descriptions, as these are never exposed in the inspector.
if (val.enumeration == enum_name && !val.name.ends_with("_MAX")) {
// Prettify the enum value display, so that "<ENUM NAME>_<VALUE>" becomes "Value".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if all our enum values are named like this consistently, but I guess time will tell if this works well for everything or not. It's a clever approach to start with :)

@akien-mga
Copy link
Member

That's a really cool idea! Didn't think the implementation would be so straightforward, but it's neat :)

@Calinou Calinou force-pushed the editor-inspector-tooltip-display-enum-descriptions branch from 30f36ac to 422484c Compare April 19, 2023 20:56
This makes it possible to see what each value does without having
to open a documentation tab.

Some enum value names may be mismatched as the API doesn't always
match the property hint used in the editor.
@Calinou Calinou force-pushed the editor-inspector-tooltip-display-enum-descriptions branch from 422484c to 76c0a3f Compare April 19, 2023 20:56
@akien-mga akien-mga merged commit 1f5811e into godotengine:master Apr 20, 2023
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga modified the milestones: 4.x, 4.1 Apr 20, 2023
@Calinou Calinou deleted the editor-inspector-tooltip-display-enum-descriptions branch April 20, 2023 14:22
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.

Display a description for the currently selected value in enum property inspector tooltips
2 participants