Skip to content
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 2D bone weight editor not accounting for offset #84070

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions editor/plugins/polygon_2d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ void Polygon2DEditor::_uv_draw() {

found_child = true;

Transform2D bone_xform = node->get_global_transform().affine_inverse() * (skeleton->get_global_transform() * bone->get_skeleton_rest());
Transform2D bone_xform = node->get_global_transform().affine_inverse().translated(-node->get_offset()) * (skeleton->get_global_transform() * bone->get_skeleton_rest());
Transform2D endpoint_xform = bone_xform * n->get_transform();

Color color = current ? Color(1, 1, 1) : Color(0.5, 0.5, 0.5);
Expand All @@ -1180,7 +1180,7 @@ void Polygon2DEditor::_uv_draw() {

if (!found_child) {
//draw normally
Transform2D bone_xform = node->get_global_transform().affine_inverse() * (skeleton->get_global_transform() * bone->get_skeleton_rest());
Transform2D bone_xform = node->get_global_transform().affine_inverse().translated(-node->get_offset()) * (skeleton->get_global_transform() * bone->get_skeleton_rest());
Transform2D endpoint_xform = bone_xform * Transform2D(0, Vector2(bone->get_length(), 0));

Color color = current ? Color(1, 1, 1) : Color(0.5, 0.5, 0.5);
Expand Down
Loading