-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Make Skeleton3D::add_bone
return the new bone index
#88791
Conversation
b0a1ecd
to
9d7a61f
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.
I do recall other things in the engine that do this, as well. It's also good to know when the bone cannot be added.
I thought that would be an advantage as well, but unfortunately, the function still throws an error, which doesn't really make this a useful check. It just allows graceful continuance if you've written bad code. You'd have to rewrite it anyway. |
Okay apparently I have no idea how compatibility works lol. Is there something explicit I have to do when I change API? I thought making a void function return something wouldn't break anything, but one of the tests failed? Sorry I'm kinda new at this. |
It breaks the function sig for a lot of extension and language API hence why those small innocent looking function changes are often not done. In this case it breaks GDExtension but I think C# also does not like this. Not sure about the comp details. |
I understand. I'm not concerned about when or how likely this is to be merged. What I'd like to know is when a change like this is made, what steps need to be taken to prevent those failed tests? What additional things would one have to edit? Obviously API changes do happen at some point. |
For GDExtension there are the validation files that need compatibility methods found in |
9d7a61f
to
b056471
Compare
f047789
to
df37682
Compare
I'm at a loss. :( |
Skeleton3D::add_bone
return the new bone index
You need to include the |
44fdba9
to
124034d
Compare
124034d
to
3e782d8
Compare
…ad of requiring an additional call to get_bone_count.
3e782d8
to
995bc8d
Compare
Thanks! |
This is a small quality-of-life change which makes
Skeleton3D::add_bone
return the newly assigned bone index as part of the same call, instead of requiring an additional function call.This PR should be backwards-compatible and not break any existing use of the function.
Additionally, the original documentation was also confusing and misleading because it said that
get_bone_count
would become the new index. However, it fails to mention that this value must be retrieved before adding the bone. It's pretty unintuitive to get the index of a bone before you add it. If you fetch the index afterwards, you'd actually have to useget_bone_count() - 1
. As part of this PR, the documentation was updated to avoid this confusion.New usage:
Old usage (correct):
Old usage (incorrect):