Hey @iker.mozos
Sorry for the delayed response on my part. I looked over the code and there does not seem to be any way to add driven attrs after a RBF node has been made. So I made you this little work around. I tested it a little bit and worked well. Let me know if it gives you what you need.
Remember when adding attrs like scale to an existing setup to pass in a default value of 1.0 to avoid issues.
Swap out the node names and desired attrs of course!
from mgear import rigbits
driven_node = "capeFront_L3_driven"
wd_node = "capeFront_L3_driven_WD"
def addDrivenAttributes(rbf_node, driven_node, attrs, default_value=0):
existing_attrs = rigbits.weightNode_io.getDrivenNodeAttributes(rbf_node)
non_existing_attrs = [x for x in attrs if x not in existing_attrs]
number_of_driven = len(existing_attrs)
attrs_added = []
for index, dAttr in enumerate(non_existing_attrs):
starting_index = number_of_driven + index
nodePlug = "{}.output[{}]".format(rbf_node, starting_index)
drivenPlug = "{}.{}".format(driven_node, dAttr)
attrs_added.append(dAttr)
attrs_added.append(mc.getAttr(drivenPlug))
mc.connectAttr(nodePlug, drivenPlug, f=True)
num_of_poses = cmds.getAttr("{}.poses".format(rbf_node), mi=True)
for pose_index in range(len(num_of_poses)):
for index, dAttr in enumerate(non_existing_attrs):
starting_index = number_of_driven + index
cmds.setAttr("{}.poses[{}].poseValue[{}]".format(rbf_node, pose_index, starting_index), default_value)
rigbits.weightNode_io.forceEvaluation(rbf_node)
return attrs_added
addDrivenAttributes(wd_node, driven_node, ["scaleX", "scaleY", "scaleZ"], default_value=1)