Add BKE_pose_apply_action(object, action, evaluation_context) function to blenkernel, and expose in RNA as Pose.apply_action(action, evaluation_time).
This makes it possible to do the following:
- Have a rig in pose mode.
- Select a subset of the bones.
- Have some Action loaded that contains the pose you want to apply.
- Run C.object.pose.apply_pose_from_action(D.actions['PoseName'])
- The selected bones are now posed as determined by the Action.
Just like Blender's current pose library, having no bones selected acts the same as having all bones selected.
Note that this doesn't completely implement all the work for T86159: Pose Library: non-modal apply pose operator; I want to get this code approved before building up from it.
The thing I'm mostly in doubt about is the place of the code. Currently it's exposed as function of the Pose, but it could just as easily be a function of the Action (so D.actions['PoseName'].apply_to(C.object)). The latter is more generic, but the fact that bone selection is relevant for the function indicates to me it's better to make it Pose-specific. We can always make a similar Action.apply_to(ID) function if necessary, that then ignores bone selection.
Another doubt is that this patch makes armature_update.c depend on the animation system. This is the only use of Actions and RNA pointers in that file. Maybe it's preferred to create a new file, blenkernel/intern/pose_library.c? Having such a new file would also make it possible to actually implement the internals as C++, using Set<char *> instead of GSet.
Manifest Task: T86159