-
-
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
Expose the get_rid
method of Joint2D and Joint3D
#80736
Conversation
I'd say to call it by the original method name, the documentation makes it clear, and having it named thus makes it clearer what you are getting Using a different name from the c++ method for the bind feels error prone, and breaks with how |
e9050f1
to
d492d4a
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.
It makes sense to expose this, e.g. to allow physics server extensions to add features to joints and to make those features usable from joint nodes.
With stuff like the physics bodies ( So you can do stuff like: extends RigidBody3D
func _physics_process(_delta: float):
print("My collision layer: ", PhysicsServer3D.body_get_collision_layer(self)) Does anyone know through what mechanism that happens? That might be worth adding to this PR as well, if it's something that needs to be explicitly bound somehow. |
It looks like the implicit cast is done through godot/core/variant/variant.cpp Line 2128 in 0511f9d
I guess that should work just fine then. Nevermind. :) |
Not sure what the original name is or what to change. Can you explain or leave code feedback where the change should be? |
@AThousandShips I agree with the principle but disagree with naming it Since the current C++ code uses a private API named |
Sorry I don't always write clearly. Keep
It will change many more lines of code, but it would be the right thing to do, IMHO. The reason why @AThousandShips' comment matters, is because GDExtension C++ code will use an API generated from the method bindings. GDExtension is designed to be mostly compatible with Godot modules. However, when there is a mismatch in method naming, it would mean that GDExtension code would use a different function name ( |
They aren't named |
get_rid
method of Joint2D and Joint3D
Irrespective of what other decisions were made in the past for other Node types, it makes sense for Joint to be consistent with CollisionObject, since both are part of physics. I still think it should be |
Changed it. It wasn't used at all it seems, so it was simple. Now the method is also called get_rid instead of get_joint |
As long as the c++ and API names line up I'm for either option, though I think it needs some more reviewers to confirm |
a598a90
to
b53fead
Compare
There is an argument to be made that this makes things more inconsistent in the engine overall. If we only have a handful of exception it's not that bad, but if we start using exceptions as a second rule, then we end up with a mess. Resources and RefCounted objects seem to use Well, as long as there is consensus on this PR, we can go with either option. @Ughuuu Could you please amend the commit message? The title of this PR is a good option for it. |
Please squash your commits into one, see here |
update occurance of get_joint Update documentation as per feedback. update update Co-Authored-By: A Thousand Ships <[email protected]>
2ed8ac1
to
f9435b6
Compare
Oh, sorry, I am trying, hope I got it right this time. |
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.
Seems good.
Thanks! And congrats for your first merged Godot contribution 🎉 |
Thank you! Can't wait to have my name permanently immortalised in the list of godot contributors(jk) |
Adds the
get_rid
property toJoint2D
andJoint3D
nodes.