Using Hook Modifiers instead of Shape Keys: offset and recenter from Python

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[:], and I have been able to set the hook center with o.modifiers[0].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.

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?

I found another issue using hook modifiers in this way. I have the arm bent 90 degrees at the shoulder and elbow and figure out how the vertices need to move. If the arm was bent 45 degrees, the vertices would have to move half as much but not in the same direction. If a vertex would move 1 unit in the +z direction when the arm is bent 90 degrees, it would need to move by (0,sqrt(1/8),sqrt(1/8)) when it is 45 degrees.

I’ve tried things like making the bone target of the hook modifier a parent of the bone that moves the arm, and also putting a copy rotation constraint on the bone target. The problem is that rotating the bone (whether it be due to inheriting rotation from a parent or from a copy rotation constraint) also rotates the vertices of the hook modifier.

The only idea I have to fix this is to use a Python script to add a function to the drivers namespace, where the unit vector in the direction of the arm would be calculated then for each axis, the function would multiply the amount of distance the bone target should move by the unit vector’s value for that axis and return the value to the driver. Is there an easier way?