Pose Shape Keys: Major Update #321

Merged
Demeter Dzadik merged 10 commits from pose-shape-keys-extension into main 2024-07-03 14:50:58 +02:00
Showing only changes of commit 39cb375309 - Show all commits

View File

@ -1,7 +1,7 @@
import bpy
from bpy.types import Object, Operator
from bpy.props import StringProperty, BoolProperty
from mathutils import Vector, Euler
from mathutils import Vector, Euler, Quaternion
from math import sqrt
from collections import OrderedDict
@ -907,10 +907,15 @@ class OBJECT_OT_pose_key_magic_driver(Operator):
bone_channels['rot'].append((axis.upper(), value))
channels[pb.name] = bone_channels
else:
# Quat/etc: Add variables for all 3 axes.
euler_rot = pb.matrix_channel.to_euler()
if pb.rotation_mode == 'QUATERNION':
euler_rot = pb.rotation_quaternion.to_euler()
elif pb.rotation_mode == 'AXIS_ANGLE':
quat = Quaternion(Vector(pb.rotation_axis_angle).yzw, pb.rotation_axis_angle[0])
euler_rot = quat.to_euler()
if euler_rot != Euler((0, 0, 0)):
value = getattr(euler_rot, axis)
if abs(value) > 0.00001:
bone_channels['rot'].append((axis.upper(), value))
channels[pb.name] = bone_channels