-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Ability to declare exported properties that are not shown (aka hidden) in inspector #7794
Comments
Given that hidden properties are not visible in the editor, there is no point in combining
|
This can be useful for animation player to get property, or marking duplicatable properties in resource files without cluttering editor. |
It would also useful for custom classes that want to overwrite some exported var by class after it inherits from. For example I develop AdvancedTextLabel that inherits from RichTextLabel: |
Another idea could be |
Interesting idea, but we already have many specialized export annotations instead of just one annotation with parameters (like |
|
I think Also @export_hidden var new_var Which make unuseable, in example I gave above I was thinking it would be this way:
@hidden("property/path")
# or
@on_editor("property/path") |
"Export" does not mean "display in inspector", it means "get property value from scene/resource file". That is, serialization is primary. The fact that the property is editable in the inspector is secondary, although from the user’s point of view it seems the opposite. See also #3906. Therefore, I would prefer that the annotation name start with
|
As I see it, there are two quite distinct use cases:
I'm not sure how much demand is for the second use-case. If you exported a property with the same name as a core class property, you should effectively shadow it for any script (but not the core C++ code). However, the property of the core class will likely show up in the inspector anyway, since it is exported in the C++ code. As for the first use case, I also proposed using |
What are your opinions 👍 👎 on renaming PROPERTY_USAGE_NO_EDITOR -> PROPERTY_USAGE_HIDDEN? Could be also utilized in other places like documentation parsing. |
No, that's not the problem. The parser does not use @serialize
@export # <-- Error: Annotation "@export" cannot be used with another "@export" annotation.
var a = 1 This error is confusing because there are no other annotations applied to the variable that begin with I also believe that the word "export" in our terminology already means serialization. The exported (serialized) property may or may not show up in the inspector, it doesn't matter. But introducing a new term, "serialization", which means the same thing as "export", will only confuse users more. Users may think that there is some difference between the two, that exported properties are not serialized, etc.
Please see the discussion in #3906 first. Even if the term "export" is not the best (there was a proposal to rename it to "expose", "storage", "serialize", etc.), this is established terminology and in any case cannot be renamed in 4.x due to compatibility.
We can't really rename a constant, only deprecate it and add a new constant with the same value. But I don't think it makes sense now. Note that 3.x: PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK,
PROPERTY_USAGE_NOEDITOR = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, 4.x: PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR,
PROPERTY_USAGE_NO_EDITOR = PROPERTY_USAGE_STORAGE, Now Footnotes
|
I thought about it from a different perspective. What if the user instead wants to display the field in the editor, but not store the value in a file? In this case, a modifier annotation makes more sense than duplicating all the export annotations. That is, export annotations by default use storage + editor, and we could add two modifier annotations |
|
Describe the project you are working on
I used
_get_property_list
to hide properties in inspector on multiple occasions. It is especially useful for data serialization in the resource files when making editor plugins. However, the dictionary syntax is not easy to use, and it is quite easy to make a mistake.Describe the problem or limitation you are having in your project
It's cumbersome and error-prone to implement
_get_property_list
to hide a property in inspector. There has to be a better way!Describe the feature / enhancement and how it helps to overcome the problem or limitation
Similar to @onready, there could be a @hidden annotation to hide a property in the inspector.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be worked around using
_get_property_list
:Is there a reason why this should be core and not an add-on in the asset library?
N/A
The text was updated successfully, but these errors were encountered: