From 95955d2dfdc030476a3afe99b741b8b188f21465 Mon Sep 17 00:00:00 2001 From: Blazer Silving Date: Sat, 18 Jan 2025 21:43:49 -0600 Subject: [PATCH] Check for keyframes before applying pose --- common.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common.py b/common.py index 090f453..3987db2 100644 --- a/common.py +++ b/common.py @@ -62,6 +62,16 @@ def createFcurve(context, bone_name, transform, index_int): 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 createKeyframe(context, bone_name, transform, index_int, new_marker, loc): arm_object, pose_library = getArmatureData(context) pose_markers = pose_library.pose_markers @@ -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":