-
-
Notifications
You must be signed in to change notification settings - Fork 461
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
Set instance and instance binding in Wrapped
constructor.
#1446
base: master
Are you sure you want to change the base?
Conversation
76100c1
to
0230024
Compare
0230024
to
a57118d
Compare
Wrapped
constructor.
As pointed out in a comment on a similar issue, moving this setup to the I haven't had a chance to really review the code here, but I think we need automated tests that ensure both paths work correctly. This should either be part of this PR or in a PR that's merged before it, since this is one of the things that has gotten broken and fixed in godot-cpp a couple of times. |
I don't know if there are other ways to create extension class objects that I have neglected.
About test, I think the content in "test" folder already done this thing. Both creating extensions node( If there have other situations need to be tested, please point them out. |
Yeah, we're already creating objects in both ways, but we aren't really testing it, ie. the tests won't necessarily fail if we get this wrong. Looking over old issues/PRs where we broke this previously, we commonly got particular error messages, for example:
In the current code, I think that message would actually be different, but perhaps making the CI fail if we got those sort of error messages would help here? Anyway, given that this is tricky, and we have a history of breaking and fixing this multiple times in the past, I'd really like to have some support from the automated tests to help us get this right. :-) |
a57118d
to
acd8e4c
Compare
I found the reson of this error
In my example, We can draw a conclusion, the key point of the new test is to check whether the binding is set many times unexpectedly, instead of creating extension class in godot-cpp and godot. But I can't find a elegant way to do this check currently, maybe we need some new things which provided by godot.
So I added a new test to check whether the binding was set before the constructor of extension class. |
Thanks for your work on this PR! I haven't had a chance to test this yet, but skimming the code I think this could work. I worry a bit about the extra complexity, and if this is going to lead to more function calls during object construction. A few of the new functions are marked as Anyway, I still need to spend some more time to try this out. |
acd8e4c
to
fbaf79a
Compare
Yes, |
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.
Thanks again for working on this!
I've finally gotten around to doing some testing and deeper review - I have a couple of notes.
However, overall, I think I'm personally in favor of going forward with this. While C++ doesn't make this easy for us, I feel like the added complexity isn't too bad, and this does fix a big compatibility issue between what developers can do in modules vs GDExtensions.
2c6ef7a
to
3b4ff60
Compare
de0b3d0
to
c233430
Compare
c233430
to
c3e8639
Compare
c3e8639
to
1ee4e76
Compare
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.
Thanks, this is looking really great!
All the important bits are good - I only have some small nitpicks :-)
1ee4e76
to
76cbc66
Compare
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.
Thanks!
Fixes #1039
Refer to this comment. This is my solution to advance the timing of setting instance and instance binding.
There may be some potential problems that I haven't found, please review it carefully.
This is my test class:
Before this pr, it will push an error: