I am attempting to utilize facecap (iphone app) face fbx file (it has 51 shape keys with animation data on it etc) on a character with rigify rig (face as well).

Question. i want jaw rotation (jaw controller x rotation) to take animation data (driven) by head object shapekeys['jawOpen']. any ideas or python psudo code to setup driver expression will really help. thanks in advance


1 Answer 1


i managed to write one. if anyone else looking for same thing, below is simple function to test and could be starting point. select facecap head mesh and rigify jaw master (in pose mode)

def bindFacecapToRigify():
    obj = bpy.context.selected_objects[0]
    sk = obj.data.shape_keys
    # driver details (skname:'pbone','prop','axis','dir'),
    skname = 'jawOpen'
    pbone = bpy.context.active_pose_bone
    d = pbone.driver_add("rotation_euler",0)
    d.driver.type = "AVERAGE"
    var = d.driver.variables.new()
    var.targets[0].id= sk
    data_path = "key_blocks[\""+sk.key_blocks[2].name+"\"].value"
    data_path = "key_blocks[\""+"jawOpen"+"\"].value"
    var.targets[0].data_path = data_path
    d.driver.expression = "var"
  • 1
    $\begingroup$ Passing some arguments, for example def bindfacecap(ob, data_path, posebone): will make it more reusable as a method. Only if the driver type is 'SCRIPTED need to set expression. Consider using the new f string format data_path = f'key_blocks["{skname}"].value' $\endgroup$
    – batFINGER
    Dec 1, 2019 at 5:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .