I need to find the previous f-curve keyframe a particular pose bone, to test if any of the transform values have changed. In fact my goal is iterating through all pose bones so I can keyframe_insert() new values where needed/changed, and possibly keyframe on a previous marker.
It's possible that some bone channel group names have been changed (e.g., instead of 7 location and rotation channels groups by bone name, there may be re-groupings like 'footIK.L.rotations' and 'footIK.L.locations', or some arbitrary re-grouping by a user like 'MyGroup'. So I can't reliably get to the groups (previous keys) with the bone name, nor pose bone via the group name.
bpy.data.objects['metarig.001'].pose.bones["footIK.R"]
may be in group o.animation_data.action.groups['footIK.R.rot']
in which case a reference like o.animation_data.action.groups[ o.pose.bones['footIK.R'] ].channels[0]
would throw an exception.
Is there a way to the o.animation_data.action.group via the o.pose.bone or visa versa?