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

onready attribute when deriving GodotClass [feature request] #447

Closed
speelbarrow opened this issue Oct 9, 2023 · 1 comment
Closed

onready attribute when deriving GodotClass [feature request] #447

speelbarrow opened this issue Oct 9, 2023 · 1 comment
Labels
status: duplicate This issue or pull request already exists

Comments

@speelbarrow
Copy link

Hey folks!

GDScript has an onready annotation you can apply when declaring a variable that allows you to define how the value should be initialized when _ready is called (as opposed to init). In this library, when using the derive macro for GodotClass, the attribute #[init(default = ... )] can be used to set a default value for the struct field it tags. Would it be possible to add something like #[init(onready = ...)] for object initialization at ready time? Based on how this library currently works, this would require the tagged field to be Option<T> (so that at init time the field can be initialized in some way). Maybe the attribute could apply that Option wrapper itself?

I'm not super familiar with the internals of this library (yet), so I'm not entirely sure if this is even possible/how exactly one would go about implementing it. However, it is a feature I'd love to see implemented!

Thanks for taking the time to read this :)

@Bromeon
Copy link
Member

Bromeon commented Oct 9, 2023

Please check for existing issues: #130
But you remind me of some experiments I started a while ago, will answer there.

@Bromeon Bromeon closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
@Bromeon Bromeon added the status: duplicate This issue or pull request already exists label Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants