Check for keyframes before applying pose

This commit is contained in:
2025-01-18 21:41:24 -06:00
parent cb3999de33
commit 6fbfc22956
5 changed files with 936 additions and 923 deletions

View File

@ -74,6 +74,16 @@ def createKeyframe(context, bone_name, transform, index_int, new_marker, loc):
pass
def findKeyframe(context, bone, active_frame):
arm_object, pose_library = getArmatureData(context)
for fcu in pose_library.fcurves:
if fcu.data_path.startswith('pose.bones["'+bone.name+'"]'):
for kp in fcu.keyframe_points:
if kp.co.x == active_frame:
return fcu.data_path
def setKeyframesFromBones(context, arm_object, new_marker):
none_selected = True
for bone in arm_object.pose.bones:
@ -149,6 +159,9 @@ def setBonesfromKeyframes(context, arm_object, active_marker):
if bone.bone.select or none_selected == True:
bone_name = bone.name
if findKeyframe(context, bone, active_marker.frame) is None:
continue
if bone.rotation_mode == "XYZ":
rot_mode = "rotation_euler"
elif bone.rotation_mode == "YZX":