Skip to content

Allow using unions and structs in the native structure definition. #1812

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jul 7, 2025

Part of godotengine/godot#108369, should not affect any of existing native structures.

@bruvzg bruvzg added this to the 4.x milestone Jul 7, 2025
@bruvzg bruvzg requested a review from a team as a code owner July 7, 2025 09:49
@bruvzg bruvzg added the enhancement This is an enhancement on the current functionality label Jul 7, 2025
@bruvzg bruvzg force-pushed the nat_struct_union branch from 0f94325 to 2f66014 Compare July 7, 2025 09:50
@dsnopek
Copy link
Collaborator

dsnopek commented Jul 10, 2025

This seems OK, for what it's attempting to accomplish

It doesn't look like it would work with structs or unions that are nested another level deeper. I don't know if it's worth attempting to support that, but if we have one level, it seems natural that more levels could follow? Using a regex to "unwrap" each level of the struct or union could work

However, I think the more important discussion (which we should have with the wider GDExtension team, not just related to godot-cpp) is if we want to support having native structs with nested structs or unions in the first place, and if so, is this is how we want them represented. This will also cause problems for all the other bindings too, and so those maintainers should have the opportunity to be involved as well

@dsnopek
Copy link
Collaborator

dsnopek commented Jul 10, 2025

Actually, looking back at godotengine/godot#108369 I don't see it using nested structs or unions? Is that to work around them not being supported in godot-cpp, or is that something that you decided just not to do anymore?

@bruvzg
Copy link
Member Author

bruvzg commented Jul 10, 2025

Is that to work around them not being supported in godot-cpp, or is that something that you decided just not to do anymore?

I have changed API, so it is no longer need (using RIDs instead of raw pointer).

@dsnopek
Copy link
Collaborator

dsnopek commented Jul 10, 2025

Ok, so then should this PR just be closed? Or do you foresee this being needed for something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an enhancement on the current functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants