This past week I have been working with Haley Zutty (producer and lead rigger on the SCAD collaborative film "Analogue"), on a scripting project inspired by Dario Triglia's pose tool (since his tool is not publicly available). To begin with we broke down the tool into several functions:
store a pose
load a pose onto a rig (and if possible load it for only part of the rig)
mirror or flip a pose
Storing a pose is fairly easy. First we got a list of all the controls in the rig by using this command (I apologize for the size, but I wanted to preserve coloration and formatting so that the script could be read easily).
Then we went through the list of controls and recorded there long names, attribute names, and attribute values. There are a few additional steps including removing the namespace from rigs that are referenced and screening for locked or connected attributes. We decide to write it like this (object:attribute_name:attribute_value) so that it could be read back with relatives ease. We ruled out "|" because of it's use in long names "_" and "-" for there use in numbers and names, but several other characters like "," '#" or "~", would have worked just fine as well. Below is the code for writing a pose to file (at this point we are only working with full-body poses).
Loading poses is almost as easy as storing them, the main difference is that it requires more checks (in the form of if statements). We need to check if the rig has a namespace, we need to check if the rig has a control with the given name, we need to check to see if that control has an attribute with the given name, and we need to check that the attribute has no non-animation connections and is not locked. Below is the code for loading a pose onto a rig.
At this point we haven't tried to work with applying only part of a pose. The challenge of doing that is assigning each control a flag of some sort so that we could tell what part of the body it was on. If the naming conventions were good then there would be no issue, but we'd like to do something more open ended that could be applied to existing rigs with any naming convention. It was nice to spend some time working on a project that had some real practical application, especially while working alongside another talented rigger like Haley. The skills developed in this little proof of concept will no doubt be helpful in a larger scale production setting.