-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
GDScript: Add array support to @export_enum
annotation
#72951
Conversation
Probably |
e63afcc
to
b42134f
Compare
b42134f
to
4efbb9f
Compare
about this closing #60516, there's still the wider issue of for instance, an user may want to export arrays of file paths, bit flags, or ranges just as well.
although if it makes more sense for #60516 to pertain to for reference, here's a snippet that can be used to quickly test the array support of all
|
See #72912. I'm not sure if we should support all valid combinations of export flags. I opened this PR because this feature is in 3.x but not in 4.0. This looks like an obvious oversight, because this feature is documented in 3.x, but in other cases it is not so obvious. Perhaps you are right, and other export annotations should also support arrays. |
ah, cool. so if I wanted to, say, have an array of but I understand that only the missing array support for |
Yes, You could use @export_custom(PROPERTY_HINT_TYPE_STRING, "%s/%s:" % [TYPE_COLOR, PROPERTY_HINT_COLOR_NO_ALPHA])
var array: Array[Color] But I think other export annotations should also support arrays, thanks for pointing that out. I'll try to expand this PR later or open a separate one (I think it won't require a lot of code). But keep in mind that this will not be included in 4.0.0 anyway. |
aaa03a2
to
4f23534
Compare
@@ -329,12 +329,17 @@ | |||
<return type="void" /> | |||
<param index="0" name="names" type="String" /> | |||
<description> | |||
Export an [int] or [String] property as an enumerated list of options. If the property is an [int], then the index of the value is stored, in the same order the values are provided. You can add explicit values using a colon. If the property is a [String], then the value is stored. | |||
See also [constant PROPERTY_HINT_ENUM]. | |||
Export an [int], [String], [StringName] or [Array] property as an enumerated list of options (or an array of options). If the property is an [int], then the value is stored. You can add explicit values using a colon. If the property is a [String] or [StringName], then the key is stored. If the property is an [Array] then the array of keys or values is stored (the array type must be [code]Array[/code], [code]Array[int][/code], [code]Array[String] or [code]Array[StringName][/code]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your comments are welcome. I feel it's confusing, but I don't know how to explain it in a simpler way.
4f23534
to
25b93d9
Compare
Closes #60516.