-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 scaling last bone length with negative scales #81048
Conversation
1e834e6
to
9c6b2ec
Compare
@TokageItLab does this look ok? |
9c6b2ec
to
d3ae624
Compare
@@ -325,7 +325,7 @@ bool Bone2D::_editor_get_bone_shape(Vector<Vector2> *p_shape, Vector<Vector2> *p | |||
rel = rel.rotated(-get_global_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation | |||
} else { | |||
real_t angle_to_use = get_rotation() + bone_angle; | |||
rel = Vector2(cos(angle_to_use), sin(angle_to_use)) * (length * MIN(get_global_scale().x, get_global_scale().y)); | |||
rel = Vector2(cos(angle_to_use), sin(angle_to_use)) * length * get_global_scale().abs(); |
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.
This PR is attempting to give scale to length
and could probably be solved by changing how length
is calculated: #83397 (comment)
(just an observation, no change should be made in this PR)
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 also found a more fundamental problem with the bone direction calculation. When the parent has Skew, the bone direction does not take it into account, so everything gets messed up, but this has nothing to do with this PR. Although I think it should be fixed somewhere else.
Superseded by #91731. Thanks for the contribution! |
Fixes: #80643
Change to use absolute value.
EDIT:
I was trying to maintain the logic "use the lower value to define the length of the last bone", but I don't think this the right way.
The user always want to see how much the bone is scaled in any direction, so why use the lower value?
No change to scale:
Current behaviour when scaling X to 3:
Propose change:
This also helps with #76087, in this issue we can see that saving calls this functions to redraw bones. Current behavior:
Note: Changing this would only help with the last bone.