-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
An export variable hint which shows a warning icon if the value has not been set in the inspector #550
An export variable hint which shows a warning icon if the value has not been set in the inspector #550
Comments
I think this would be hard to make. Exported variable's default value are the default value of their type (a string would just be an empty string, an integer would be 0, etc). What happens when you have Instead you can use _get_configuration_warning : func _get_configuration_warning() -> String:
if some_exported_value == 0:
return "some_exported_value needs a value different than 0."
return "" The warning icon will be shown in the SceneTree, next to the node icon which is more visible in my honest opinion. Also, keep in mind that the script needs to have |
I see your point. _get_configuration_warning is cool, I didn't know it existed. Still, the code is more verbose if you have a lot of these (every export needs a setter with update_configuration_warning), but it is a workaround which works. |
In addition to |
To resolve this, we could likely amend This would make building node configuration warnings more complex, but it'll allow for significantly more freedom, including the ability to implement auto-fix actions with Callables. A system similar to UndoRedo can be used here. |
I've implemented part of this proposal at godotengine/godot#68420 It allows for linking a configuration warning to a property, which easily allows for this specific use case. As it's a dictionary, it should be easy to extend this to support configuration errors, assigning IDs, auto-fix actions, etc. |
Please allow the ability to ignore configuration warnings or visually localize them to the |
Reopening, as the feature is getting reverted due to compatibility breakage in GDExtension (godotengine/godot#88455). It's still wanted, but the implementation should be different. Since we can't modify the existing The new method could be called together with the old one, although having a separate |
Would there be a particular reason for this to be limited to nodes? |
I could see a benefit in mechanism to indicate property field errors/warnings/info (via different icons), as it can be very useful to draw attention to a unique property (whether showing an error, warning, or info). For example, perhaps a |
Describe the project you are working on:
A 2D game with a lot of node work in the editor.
Describe the problem or limitation you are having in your project:
I often forget to set exported script variables which do not have a default and which require a value from the inspector. If I could see a warning icon when I have forgotten to set something it would really help my workflow and cut down on hunting through nodes to find something I missed in a debug session.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Add a warning icon (yellow triangle with exclamation) to inspector exported variable fields which need a setting from the inspector, similar to the collision shape reminders in the Scene tab.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
One way to approach this would be to add an optional
required
flag to export hints, perhaps before the type:export(required, int) var healthPoints
If the
required
hint is specified and the exported var does not have a default and if the user has not supplied a value in the inspector, then the inspector would display a warning icon (yellow triangle with exclamation) inside of the script variable label right aligned.Also, source code such as this would be marked as a warning or error:
export(required, int) var healthPoints = 10
Warning: required export variable has a default value. To remove this warning either remove the required keyword or the default value.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
I don't believe it can be worked around, but maybe I'm missing something.
Is there a reason why this should be core and not an add-on in the asset library?:
This relates to how the core editor works.
The text was updated successfully, but these errors were encountered: