-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Fix bindings of PhysicsServer3DRenderingServerHandler
#81298
Fix bindings of PhysicsServer3DRenderingServerHandler
#81298
Conversation
You need to run I expect there will also be a CI issue reported for breaking the compatibility in the extension API. Here it's arguably breaking something that apparently wouldn't work, but we're trying to preserve binary compatibility as far as possible. It should be possible to add compat methods for the old prototypes, so that it generates hashes that match the ones in 4.1. See #80168 for an example of adding compat methods, and listing the prototype change as an intentional change in |
Right, I forgot about that.
The methods being broken are |
I suppose I could leave the virtual methods ( |
163b1f4
to
4dd9ee4
Compare
There, no breaking changes, but the extension interface for class PhysicsServer3DRenderingServerHandler : public Object {
public:
void set_vertex(int32_t vertex_id, const Vector3 &vertex);
void set_normal(int32_t vertex_id, const Vector3 &normal);
void set_aabb(const AABB &aabb);
virtual void _set_vertex(int32_t vertex_id, const void *vertices);
virtual void _set_normal(int32_t vertex_id, const void *normals);
virtual void _set_aabb(const AABB &aabb);
}; So anyone wanting to implement their own |
Well before settling on keeping the |
With virtual methods, I think the best we could do currently for compatibility is adding new virtual methods under a new name (rather than changing the signature of the original virtual method). Then Godot could check if the newer method is implemented (via For the background on why: with virtual methods, Godot is asking the GDExtension for a function pointer for the virtual method by name, it's not passing any information about the expected method signature, like we do when GDExtension asks Godot for a function pointer. But even if it did, there isn't much the GDExtension can do with that information: it either has a method with the right signature or it doesn't. I could imagine a system where Godot asks the GDExtension for a function pointer AND some information about the methods signature, so that Godot could say "if the GDExtension gives me a pointer with the old signature, call it the old way; if it has the new signature, call it the new way." Creating such a system is possible, but it would be a big change from what we have right now. All that said, the current signature on these virtual methods is so weird and broken, an argument could be made that the compatibility breakage is perhaps OK? |
I would tend to agree. I have a hard time imagining that anyone is using this interface in its current form outside of the If we assume that nobody is actually using this currently, would there be any consequences other than technically breaking binary compatibility? @akien-mga mentioned something about hashes, but I'm not entirely sure what that means, or what the consequences would be from it changing. |
I agree, should be OK to break. But please add to the docs of each method that Godot < 4.2 accepted |
4dd9ee4
to
1a049d7
Compare
Seeing as how the general consensus seems to be that a breakage is acceptable I went ahead and did just that. I also added the breakages to Let me know if there's anything else I should do. |
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.
From the perspective of GDExtension, this looks good to me!
This comment was marked as resolved.
This comment was marked as resolved.
1a049d7
to
ee9f41a
Compare
Thanks! |
It's currently impossible to implement
SoftBody3D
from a GDExtension, due to theset_vertex
,set_normal
andset_aabb
methods ofPhysicsServer3DRenderingServerHandler
not being bound, which need to be called in order to update the rendered positions of each particle/vertex, as seen in the Godot Physics implementation here:godot/servers/physics_3d/godot_soft_body_3d.cpp
Lines 154 to 165 in 75de1ca
It's also impossible to bind
set_vertex
andset_normal
with the interface they have currently, as they (for some reason) take avoid*
to aVector3
rather than just aconst Vector3&
.This PR addresses both of these problems by changing these methods to take
const Vector3&
and then binding all the relevant methods.