Exemplo n.º 1
0
def createRBFFromInfo(weightNodeInfo_dict):
    """create an rbf node from the dictionary provided information

    Args:
        weightNodeInfo_dict (dict): of weightDriver information

    Returns:
        list: of all created weightDriver nodes
    """
    createdNodes = []
    weightNodeInfo_dict = copy.deepcopy(weightNodeInfo_dict)
    for weightNodeName, weightInfo in weightNodeInfo_dict.iteritems():
        rbfType = weightInfo.pop("rbfType", RBF_TYPE)
        connectionsInfo = weightInfo.pop("connections", {})
        posesInfo = weightInfo.pop("poses", {})
        transformNodeInfo = weightInfo.pop("transformNode", {})
        driverListInfo = weightInfo.pop("driverList", {})
        attributesToRecreate = weightInfo.pop("attributesToRecreate", [])
        # hook for future support of vector
        driverInfo = weightInfo.pop("vectorDriver", {})
        driverNodeName = weightInfo.pop("driverNode", {})
        driverNodeAttributes = weightInfo.pop("driverAttrs", {})
        drivenNodeName = weightInfo.pop("drivenNode", {})
        drivenNodeAttributes = weightInfo.pop("drivenAttrs", {})
        transformName = transformNodeInfo.pop("name", None)
        setupName = weightInfo.pop("setupName", "")
        drivenControlName = weightInfo.pop("drivenControlName", "")
        driverControl = weightInfo.pop("driverControl", "")
        driverControlPoseInfo = weightInfo.pop(rbf_node.DRIVER_POSES_INFO_ATTR,
                                               {})
        transformNode, node = createRBF(weightNodeName,
                                        transformName=transformName)
        rbf_node.setSetupName(node.name(), setupName)
        # create the driven group for the control
        if (drivenNodeName and
            drivenNodeName[0].endswith(DRIVEN_SUFFIX) and
                drivenControlName):
            rbf_node.addDrivenGroup(drivenControlName)
        elif (drivenNodeName and
              drivenNodeName[0].endswith(DRIVEN_SUFFIX) and
              mc.objExists(drivenNodeName[0].replace(DRIVEN_SUFFIX, ""))):
            drivenControlName = drivenNodeName[0].replace(DRIVEN_SUFFIX, "")
            rbf_node.addDrivenGroup(drivenControlName)

        rbf_node.createRBFToggleAttr(drivenControlName)
        rbf_node.setDriverControlAttr(node.name(), driverControl)
        setTransformNode(transformNode, transformNodeInfo)
        setWeightNodeAttributes(node, weightInfo)
        recreateAttributes(node, attributesToRecreate)
        setPosesFromInfo(node, posesInfo)
        setDriverListFromInfo(node, driverListInfo)
        createVectorDriver(driverInfo)
        rbf_node.setDriverControlPoseAttr(node.name(), driverControlPoseInfo)
        recreateConnections(connectionsInfo)
        createdNodes.append(node.name())
    return createdNodes
Exemplo n.º 2
0
 def setDrivenNode(self, drivenNode, drivenAttrs, parent=True):
     setDrivenNode(self.name, drivenNode, drivenAttrs)
     if parent:
         mc.parent(self.transformNode, drivenNode)
     if drivenNode.endswith(DRIVEN_SUFFIX):
         drivenControlName = drivenNode.replace(DRIVEN_SUFFIX, CTL_SUFFIX)
         if not mc.objExists(drivenControlName):
             return
         rbf_node.createRBFToggleAttr(drivenControlName)
         rbf_node.connectRBFToggleAttr(drivenControlName,
                                       self.name,
                                       self.getRBFToggleAttr())