Skip to content

Commit

Permalink
Fix rotation import error for bones with no parents causing an error …
Browse files Browse the repository at this point in the history
…in blender.
  • Loading branch information
dtzxporter committed Dec 27, 2023
1 parent ecec12b commit 518d6fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
bl_info = {
"name": "Cast Support",
"author": "DTZxPorter",
"version": (1, 2, 9),
"version": (1, 3, 0),
"blender": (3, 0, 0),
"location": "File > Import",
"description": "Import & Export Cast",
Expand Down
4 changes: 3 additions & 1 deletion plugins/blender/import_cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,16 @@ def importRotCurveNode(node, nodeName, fcurves, poseBones, path, startFrame):
smallestFrame = min(frame, smallestFrame)
largestFrame = max(frame, largestFrame)

if mode == "absolute" or bone.parent is not None:
if mode == "absolute" and bone.parent is not None:
bone.matrix_basis.identity()
bone.matrix = (bone.parent.matrix.to_3x3() @ rotation).to_4x4()

for axis, track in enumerate(tracks):
track.keyframe_points.insert(
frame, value=bone.rotation_quaternion[axis], options={'FAST'})
elif mode == "relative" or bone.parent is None:
rotation = rotation.to_quaternion()

for axis, track in enumerate(tracks):
track.keyframe_points.insert(
frame, value=rotation[axis], options={'FAST'})
Expand Down
2 changes: 1 addition & 1 deletion plugins/maya/castplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

# Shared version number
version = "1.29"
version = "1.30"


def utilityAbout():
Expand Down

0 comments on commit 518d6fd

Please sign in to comment.