-
-
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
Added support for generic type exported properties in gdscript #33080
Conversation
2fda1c6
to
5bd18bb
Compare
5bd18bb
to
a04a751
Compare
Why not handle this using |
I guess I could! Thanks for the feedback. I'm going to test and see if it causes any problem, since this flag is used for slightly different cases than the ones my changes handle. And if everything works fine, I'll add it to the documentation too. |
a04a751
to
faf00e5
Compare
Done. I've also updated the PR description. |
@pouleyKetchoupp Is this still desired? If so, it needs to be rebased on the latest master branch. |
This change allows scripts to use untyped properties. Their type can be changed in the inspector the same way as for elements in Array or Dictionary. This implementation uses properties of type TYPE_NIL with the existing usage flag PROPERTY_USAGE_NIL_IS_VARIANT. Syntax for property list: { "name": "generic_var", "type": TYPE_NIL, "usage": PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NIL_IS_VARIANT, "hint": PROPERTY_HINT_NONE, "hint_string" : "", } Syntax for exported variable: export(Variant) var generic_export_var
faf00e5
to
9b3b618
Compare
Rebased on master and fixed. I think this feature is still needed as afaik there's no other way for scripts to use Variant properties. If needed, I can write a proper proposal for this feature, but given that it's not very complex and doesn't change a lot of code it seems like a faster process can be applied. Here are some details about the use case: |
@vnen What do you think about this? |
Worth mentioning that I've implement I can make a proposal about this upon pre-approval from the core developers. Of course this could be just an alternative to allowing exporting |
I also have a dedicated PR to expose |
Is this pr still valid? |
AFAIK it's still valid, at least to re-use the inspector part of it and possibly for 3.x. I can port it to master if it makes sense to @vnen and doesn't interfere with the plans for gdscript 2.0. |
Is anybody still working on this? I'm currently working around the lack of this feature by using It's surprising to me that the Inspector provides support for untyped |
Closing because this PR has conflicts and the original author is no longer interested in working on it. However, if anyone wants this feature, you are welcome to salvage it and work on it further. |
@aaronfranke, I'm interested in salvaging this. What's the right way to do that? Open a new PR? |
@Pennycook Yes, you will need to grab the changes, rebase them, compile, fix the bugs, test, push them to a branch on your fork, and open a PR. |
This change allows scripts to use untyped properties. Their type can be changed in the inspector the same way as for elements in
Array
orDictionary
.This implementation uses properties of type
TYPE_NIL
with the existing usage flagPROPERTY_USAGE_NIL_IS_VARIANT
.Syntax for property list:
Syntax for exported variable:
export(Variant) var generic_export_var
Property in the inspector: