Did a bit of digging to see if this had been implimented yet, but it seems that there is currently nothing available so it will have to be a homebrew solution. Action bake features were removed in 2.46 due to functionality and legacy issues and I can’t find any sign of a recent official or community solution.
Bake features have been removed (including the ‘BAKE’ button on the header). This is because they were not really functional anyway, and should really belong exclusively in the NLA (and/or 3D view). If and when they are reimplemented, they should not be added back to the Action Editor.
Please forgive the verbosity of the rest of my post! It’s a pretty much complete summary of my thinking on this issue and effectively amounts to a script development proposal.
My proposed workflow would be something like this:
- Create the ik action as usual
- Run the script to create a new action that is the same, but now has no ik, only fk.
Here are my rough thoughts on how the script would run:
- Analyse the armature to find bones that are ik targets and add them to a dictionary as keys with empty lists as values.
- Find the bones that are controlled by each ik target (possibly by using chain length and bone parenting to identify them) and add them to the list in the dictionary with the ik target as the key.
- Create a new action with the same name as an existing action but with the prefix of suffix FK (forward kinematics) so the name is unique.
- For each ik target in the dictionary, scan the action channel for that ik target looking for keyframes.
- When an ik keyframe is found, set the animation to that frame (to deform the armature using ik).
- Insert keyframes to the new FK action for all bones in the ik chain (retrieved from the dictionary).
- Repeat No 5-6 for the whole action.
This should create a new action that is identical, but now has no ik. The armature could be duplicated and the duplicate could have ik targets removed if this is necessary (needs testing).
This is just my thoughts on the subject and there might be some issues with the actual implimentation. I am not much of a rigger or animator which is the main reason that I never got around to writing this script.
It might not be possible to add keyframes to action2 when the armature is already posed by action1. This would require some kind of workaround such as:.
Store bone matrices when posed by action1
I’m not sure whether it might be possible to ‘lock’ an armature in position so the bone matrices would not need to be stored.
Switch to action2.
Set bone matrices then keyframe the new position in action2.
Switch back to action1 and find the next ik keyframe.
If ‘locking’ an armature is possible then it would be ‘unlocked’ after switching back to action1
Rinse and repeat.
It could be difficult to find out what bones are in an ik chain. This would require some kind of processing that depends on the structure of the armature:
Assuming that the ik target head is positioned at the tail of the first bone in the ik chain when the armature is in rest position, this could be used to identify where the ik chain starts.
This would depend on the structure of the rig.
Appending/prepending “FK” to the name of the action stands a chance of hitting Blender’s 21 character datablock name limit. This would have to be caught and dealt with in a sensible way.
Hope this is of interest.
A script/addon such as this is requested and searched for from time to time by people on the forum and would definately be of use to everyone who makes games with bge. However, my free time is pretty much packed out with stuff that I really should be doing and with stuff that I get distracted by so I’m probably not going to get round to coding this any time soon (unless it distracts me ;)). It’s been on my todo list for quite a while, but I keep getting distracted by researching stuff for my projects and by life™.
My ragdoll project has improved my knowledge of accessing data from armatures though so this script/addon is a lot more doable for me than it was previously. However, I have absolutely no knowledge of the animation part of bpy.