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