Skip to content

Commit

Permalink
Hotfix: Skeleton Misalignment on Import
Browse files Browse the repository at this point in the history
Fix for issue #206
  • Loading branch information
danielbui78 committed Jun 10, 2024
1 parent 2d5b3b4 commit 14a64b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,20 @@ def set_bone_head_tail(self):

bone.use_connect = False

# set head
bone.head[0] = float(head_and_tail[0])
bone.head[1] = -float(head_and_tail[2])
bone.head[2] = float(head_and_tail[1])
# DB 2024-06-09: BUGFIX misalignment of bones from Daz-space to Blender-space
correction_vector = mathutils.Vector((0, 0, 0))
correction_vector[0] = float(head_and_tail[0]) - bone.head[0]
correction_vector[1] = -float(head_and_tail[2]) - bone.head[1]
correction_vector[2] = float(head_and_tail[1]) - bone.head[2]
# # set head
# bone.head[0] = float(head_and_tail[0])
# bone.head[1] = -float(head_and_tail[2])
# bone.head[2] = float(head_and_tail[1])

# set tail
bone.tail[0] = float(head_and_tail[3])
bone.tail[1] = -float(head_and_tail[5])
bone.tail[2] = float(head_and_tail[4])
bone.tail[0] = float(head_and_tail[3]) - correction_vector[0]
bone.tail[1] = -float(head_and_tail[5]) - correction_vector[1]
bone.tail[2] = float(head_and_tail[4]) - correction_vector[2]

# calculate roll aligning bone towards a vector
align_axis_vec = mathutils.Vector(
Expand Down
Binary file modified DazStudioPlugin/Resources/blenderplugin.zip
Binary file not shown.

0 comments on commit 14a64b1

Please sign in to comment.