-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Allow ClassDB to create a Object without postinitialization for GDExtension. #91018
base: master
Are you sure you want to change the base?
Conversation
@AThousandShips I think this pr should be add a
Due to this reason, the edior will crash when we copying a gdextenion Node if it have a internal node (be add in constructor but not be marked as internal). |
How could the node be created in the constructor and not be marked as internal? It won't be created if duplicated in this case, that would be the bug instead, this shouldn't be needed Or rather they aren't internal if they're created that way But in either way this would be an improvement, as the user should consider this limitation instead id say, the same goes for scripts |
I mean that the GDExtension node(A) have a node(B) which be added in A's constructor, the B should be an internal node. But currently, the B is not mark as an internal node, because when A adding B, the flag So if we copy A in editor, the B would not be skiped correctly and lead crash. |
That should be handled by the extension IMO, just like it would have to be if you do it in GDScript, in my opinion that's a limitation, a missing feature, not a bug, especially as changing this breaks code that does handle that, so would need to be adjusted for Edit: Also this would be unnecessary for that part if this gets merged: Edit: I'll mark it as a bug but will keep it for 4.x for the time being to discuss the practical sides of the changes and how they affect existing code |
This comment was marked as outdated.
This comment was marked as outdated.
e9a88b2
to
5bf0e2d
Compare
I rename I think this can keep the consistency between multiple programming languages, and at least can help to solves the problem of editor crash caused by the duplication of custom nodes which running in the editor (a GDExtension node or GDScrip node with @tool flag) when they have internal nodes (GDExtension(c++ binding) node can be solved, GDScript node need more efforts). |
I think the other option, being less invasive, might be safer, and the extension team would be best suited to decide what milestone to direct this to, depending on the impact of the changes to initialization While crashes should be avoided the exact solution and cause and safe use should be discussed, to provide the best solution |
42a0011
to
204f87a
Compare
204f87a
to
43185f9
Compare
7a99a0e
to
48aa6c8
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 for your continued work on this!
If we can merge this pr in 4.3, I think we should merge GDExtensionClassCreationInfo4 into GDExtensionClassCreationInfo3.
I think we should save this for 4.4 - Godot 4.3 is basically in feature freeze at this point (with a couple of specific possible exceptions, but this PR isn't among them).
I would try to implement similar feature for #91019 later.
At this point, I think I personally favor the approach in this PR over the other one. It would be nice to get some feedback from other GDExtension team members, though.
f03388f
to
fca783c
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 great to me now :-)
However, we should wait until the Godot 4.4 development cycle starts to merge this.
fca783c
to
c780be2
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.
The changes to GodotSharp look good to me.
Does this need a follow-up in godot-cpp
? As I understand it, this is an alternative to godotengine/godot-cpp#1447 so should that be reverted after merging this one? Or, to put it another way, what should GDExtension language bindings do regarding the POSTINITIALIZED notification after this PR is merged?
Yep! Once a GDExtension binding switches to using |
c780be2
to
0c42997
Compare
0c42997
to
3cbd25f
Compare
3cbd25f
to
4c220d6
Compare
ac0f302
to
3e28cf2
Compare
3e28cf2
to
874a1b1
Compare
874a1b1
to
bda2f97
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 to me :-)
(Reminder: Please don't merge this until the Godot 4.4 development cycle opens)
Currently, the flow of creating GDExtension object like this:
ObjectGDExtension::create_instance
in ClassDB.Wrapped
, will create its_owner
godot object byClassInfo::creation_func
.ClassInfo::creation_func
, the owner godot object will notifyNOTIFICATION_POSTINITIALIZE
byNode::_postinitialize
in thememnew
in godot.NOTIFICATION_POSTINITIALIZE
byWrapped::_postinitialize
in thememnew
in GDExtension .This will bring two issues:
data.in_constructor
already be cleared.NOTIFICATION_POSTINITIALIZE
in GDExtension is through its owner.This pr do these things:
Fixes #91023