Home Website Youtube GitHub

Scripting RBF weightDriver

Hello,
Is there a way to script RBF corrective blendshapes using either weightDriver or rigbits rbf_node?
I have some issues trying weightDriver and can not find any clear docs.

Help much appreciated!
Cheers,
Krzysztof

Hello @Krzym

So the weightDriver is a Maya node that is wrapped by the rbf_node. A python api that works with the RBF manager. So yes, you should be able to use the rbf_node api to script the generation of correctives.

But also, you can use the UI to create the correctives and just import/export premade ones.

Do you mean import/export with RBF Manager? I can not figure out how to connect blendshapes via that UI.
Sure, I could create that with SHAPES plugin, which I’m usually doing, just in that case it’s a long term project and we’re changing the meshes, adding new clothes, rebuilding the rig all the time :wink:

So that’s why I’m automatically creating all the RBFs from the base and it would be great to create the nodes via code. Sometimes it’s not working for me to import SHAPES data and it’s needed to create the nodes manually then (maybe I’m doing something wrong).

Is there a chance for any example code? For now I’ve separated the RBFS from rig structure and each time I’m re-connecting inputs

    for i, rbf in enumerate(RBFS_Node):
        pm.parentConstraint(RBFS_Parents[i], RBFS_Node[i])
        pm.scaleConstraint(RBFS_Parents[i], RBFS_Node[i])

        pm.connectAttr(pm.PyNode(RBFS_Parents[i])+".worldMatrix[0]", pm.PyNode(RBFS_Node[i])+".driverList[0].driverInput")
        pm.connectAttr(pm.PyNode(RBFS_Controls[i])+".message", pm.PyNode(RBFS_Node[i])+".driverList[0].controlNode")

    pm.setDrivenKeyframe(bNode+".L_arm_Y_90minus", value=0.0, currentDriver = pm.PyNode(RBFS_Controls[3]).ry, driverValue = 0.0)

In case anyone was wondering:

from mgear.rigbits import rbf_io
rbf_io.importRBFs(path)
1 Like