I am trying to find a way to correct deformations from the armature and make facial expressions other than shape keys. Right now I am trying to use hook modifiers.
One issue I am not sure about is the reset and recenter buttons (which are visible in the properties window, modifiers button pushed, when the object is in edit mode). The reset button sets the transformation offset and the recenter button sets the hook center. It seems that the vertices transform based on the difference between the target object’s location/rotation/scale and the transformation offset. It also seems that the reset button changes the offset to the location of the target object at the time the reset button is pushed. I can’t figure out what the hook center does. The manual just says the reset button is used to “Recalculate and clear the offset transform of hook,” and recenter button is used to “Set hook center to the 3D cursor position,” but doesn’t say the difference between offset and hook center.
I also would probably need to work with hook modifiers in Python, but it will probably be mostly copying modifiers from one mesh to another. I see that the center can be accessed with bpy.types.HookModifier.center[:], and I have been able to set the hook center with o.modifiers.center = (x,y,z) (where o is an object with mesh data and modifier #0 is a hook modifier). However, the Python reference for the hook modifier has no way to set or access the offset. https://www.blender.org/api/blender_python_api_2_77_1/bpy.types.HookModifier.html
The object operators page of the Python reference lists bpy.ops.object.hook_reset(modifier=’’) as a way to reset the offset from Python, but set it to an explicit value. I have the hook modifiers target bones of an armature. I don’t simply use the armature modifier for this because that averages instead of adds the transformations. I think in any case I would want the offset for each modifier to be (0,0,0) in the local space of its target bone. Based on my testing, it seems like it would work to clear all transforms on a bone then reset the offset, but I have the armature posed in a certain position so I can see how and where vertices have to be moved to correct armature deformations.
It would probably work to go to pose mode for the armature, copy the transform, clear the transform, select the mesh object, go to edit mode, push the recent button on the hook modifier, go back to object mode, select the armature, then paste transform, but it seems like a hassle. Is there an easier way to set the offset of a hook modifier while leaving bones posed the way they are? Is there a way to set the offset to a specific value in Python?