Exemple #1
0
    def applyInitNodeConnections(self):
        for key in self.filterGroupNodeDic['inputPlacement'].keys():
            sourceNode = key.replace("motion_input",
                                     "init").replace("input_placement", "init")
            util.transformChannelBinding(sourceNode, key)

        for key in self.filterGroupNodeDic['outputPlacement'].keys():
            sourceNode = key.replace("motion_output",
                                     "init").replace("output_placement",
                                                     "init")
            sourceLocal = util.fullPathName2Local(sourceNode)
            matchNodes = {}
            util.getChildrenNodes(self.modulePathDic['init'], sourceLocal[1],
                                  matchNodes, 1)
            sourceNode = matchNodes.keys()[0]
            util.transformChannelBinding(sourceNode, key)

        for key in self.filterGroupNodeDic['controlPlacement'].keys():
            sourceNode = key.replace("motion_control",
                                     "init").replace("control_placement",
                                                     "init")
            sourceLocal = util.fullPathName2Local(sourceNode)
            matchNodes = {}
            util.getChildrenNodes(self.modulePathDic['init'], sourceLocal[1],
                                  matchNodes, 1)
            sourceNode = matchNodes.keys()[0]
            util.transformChannelBinding(sourceNode, key)
Exemple #2
0
    def applyInitNodeConnections(self):

        for key in self.filterGroupNodeDic['inputPlacement'].keys():
            sourceNode = key.replace("motion_input",
                                     "init").replace("input_placement", "init")
            util.transformChannelBinding(sourceNode, key)

        for key in self.filterGroupNodeDic['outputPlacement'].keys():
            sourceNode = key.replace("motion_output",
                                     "init").replace("output_placement",
                                                     "init")
            util.transformChannelBinding(sourceNode, key)

        for key in self.filterGroupNodeDic['controlPlacement'].keys():
            sourceNode = key.replace("motion_control",
                                     "init").replace("control_placement",
                                                     "init")
            util.transformChannelBinding(sourceNode, key)
Exemple #3
0
    def applyMotionNodeConnections(self):

        bodyNode = None
        bodyFkCons = {}
        for fkConNode in self.filterGroupNodeDic['controlFkCon']:
            fkConLocalNode = util.fullPathName2Local(fkConNode)
            if fkConLocalNode[1].rfind('space') == -1:
                if fkConLocalNode[1].rfind('body') != -1 and fkConLocalNode[
                        1].rfind('upbody') == -1:
                    if fkConLocalNode[1].rfind('piv') != -1:
                        bodyFkCons['piv'] = fkConNode
                    else:
                        bodyFkCons['con'] = fkConNode
                fkLocalNodeStr = fkConLocalNode[1].replace('fk_Con', 'node')
                for motionOutputNode in self.filterGroupNodeDic['outputNode']:
                    motionOutputLocalNode = util.fullPathName2Local(
                        motionOutputNode)
                    if motionOutputLocalNode[1].rfind(
                            'body') != -1 and motionOutputLocalNode[1].rfind(
                                'upbody') == -1:
                        bodyNode = motionOutputNode
                    if motionOutputLocalNode[1] == fkLocalNodeStr:
                        util.transformChannelBinding(fkConNode,
                                                     motionOutputNode)

        cmds.connectAttr(bodyFkCons['piv'] + '.translate',
                         bodyFkCons['con'] + '.rotatePivot',
                         f=True)
        cmds.connectAttr(bodyFkCons['piv'] + '.translate',
                         bodyNode + '.rotatePivot',
                         f=True)

        upbody_hip_blend_socket_node = None
        for socketNode in self.filterGroupNodeDic['outputParentSocket']:
            if socketNode.rfind('upbody') != -1 and socketNode.rfind(
                    'hip') != -1:
                upbody_hip_blend_socket_node = socketNode

        targetNodes = []
        for motionOutputNode in self.filterGroupNodeDic['outputNode']:
            motionOutputLocalNode = util.fullPathName2Local(motionOutputNode)
            if motionOutputLocalNode[1].rfind(
                    'upbody') != -1 or motionOutputLocalNode[1].rfind(
                        'hip') != -1 and motionOutputLocalNode[1].rfind(
                            'placement') == -1:
                targetNodes.append(motionOutputNode)

        upbody_hip_blend_ori = cmds.orientConstraint(
            targetNodes[0], targetNodes[1], upbody_hip_blend_socket_node)
        upbody_hip_blend_pos = cmds.pointConstraint(
            targetNodes[0], targetNodes[1], upbody_hip_blend_socket_node)

        hipFkCon = None
        headFkCon = None
        for fkConNode in self.filterGroupNodeDic['controlFkCon']:
            fkConLocalNode = util.fullPathName2Local(fkConNode)
            if fkConLocalNode[1].rfind(
                    'hip') != -1 and fkConLocalNode[1].rfind('space') == -1:
                hipFkCon = fkConNode
            elif fkConLocalNode[1].rfind('head') != -1 and fkConLocalNode[
                    1].rfind('space') == -1 and fkConLocalNode[1].rfind(
                        'comp') == -1:
                headFkCon = fkConNode
            else:
                continue

        check = cmds.attributeQuery('hip_nodeW0',
                                    node=upbody_hip_blend_pos[0],
                                    ex=True)
        attr = ''
        if check:
            attr = 'hip_nodeW0'
        else:
            attr = 'hip_nodeW1'

        cmds.connectAttr(hipFkCon + '.hipPosWeight',
                         upbody_hip_blend_pos[0] + '.' + attr,
                         f=True)
        check = cmds.attributeQuery('hip_nodeW0',
                                    node=upbody_hip_blend_ori[0],
                                    ex=True)
        attr = ''
        if check:
            attr = 'hip_nodeW0'
        else:
            attr = 'hip_nodeW1'
        cmds.connectAttr(hipFkCon + '.hipOriWeight',
                         upbody_hip_blend_ori[0] + '.' + attr,
                         f=True)

        headCompSpaceOp = util.createOpNode(
            self.moduleNameSpace, 'choice',
            self.filterStrList[3] + '_compSpace_selector')

        spaceRefNodeList = self.filterGroupNodeDic['controlRef'].keys()
        for i in range(len(spaceRefNodeList)):
            cmds.connectAttr(spaceRefNodeList[i] + '.worldMatrix',
                             headCompSpaceOp + '.input[' + str(i) + ']',
                             f=True)

        cmds.connectAttr(headFkCon + '.headCompSpace',
                         headCompSpaceOp + '.selector',
                         f=True)

        headConPlacementNode = None
        for controlPNode in self.filterGroupNodeDic[
                'controlPlacement'].iterkeys():
            controlPNodeLocal = util.fullPathName2Local(controlPNode)
            if controlPNodeLocal[1].rfind(self.filterStrList[3]) != -1:
                headConPlacementNode = controlPNode

        matrixOps = util.localMatrixOp(
            self.moduleNameSpace, self.filterStrList[3] + '_compSpace_cal')
        cmds.connectAttr(headCompSpaceOp + '.output',
                         matrixOps[0] + '.matrixIn[0]',
                         f=True)
        cmds.connectAttr(headConPlacementNode + '.worldInverseMatrix',
                         matrixOps[0] + '.matrixIn[1]',
                         f=True)
        headCompWeightApplyOp = util.createOpNode(
            self.moduleNameSpace, 'multiplyDivide',
            self.filterStrList[3] + '_compWeight_apply')
        cmds.connectAttr(matrixOps[1] + '.outputRotate',
                         headCompWeightApplyOp + '.input1',
                         f=True)
        cmds.connectAttr(headFkCon + '.headCompWeight',
                         headCompWeightApplyOp + '.input2X',
                         f=True)
        cmds.connectAttr(headFkCon + '.headCompWeight',
                         headCompWeightApplyOp + '.input2Y',
                         f=True)
        cmds.connectAttr(headFkCon + '.headCompWeight',
                         headCompWeightApplyOp + '.input2Z',
                         f=True)
        cmds.setAttr(headCompWeightApplyOp + '.operation', 1)

        headConCompSpaceNode = None
        for controlSpaceNode in self.filterGroupNodeDic[
                'controlSpace'].iterkeys():
            controlSpaceLocalNode = util.fullPathName2Local(controlSpaceNode)
            if controlSpaceLocalNode[1].rfind(
                    'head_fk') != -1 and controlSpaceLocalNode[1].rfind(
                        'comp') != -1:
                headConCompSpaceNode = controlSpaceNode
        cmds.connectAttr(headCompWeightApplyOp + '.output',
                         headConCompSpaceNode + '.rotate',
                         f=True)

        headOutputSpaceNode = None
        for motionOutputSpaceNode in self.filterGroupNodeDic[
                'outputSpace'].iterkeys():
            motionOutputSpaceLocalNode = util.fullPathName2Local(
                motionOutputSpaceNode)
            if motionOutputSpaceLocalNode[1].rfind('head') != -1:
                headOutputSpaceNode = motionOutputSpaceNode
        cmds.connectAttr(headConCompSpaceNode + '.rotate',
                         headOutputSpaceNode + '.rotate',
                         f=True)
Exemple #4
0
    def applyInitNodeConnections(self):

        rootNode = None
        controlNode = None
        outputPlacementNode = None
        initNodeLocal = None
        filterStr = 'root'

        for initNode in self.filterGroupNodeDic['init'].iterkeys():
            initNodeLocal = util.fullPathName2Local(initNode)
            if initNodeLocal[1].rfind(filterStr) != -1:
                rootNode = initNode
        for outPNode in self.filterGroupNodeDic['outputPlacement'].iterkeys():
            outPNodeLocal = util.fullPathName2Local(outPNode)
            if outPNodeLocal[1].rfind(
                    filterStr
            ) != -1:  #and initNodeLocal[1].rfind('upbody') == -1:
                outputPlacementNode = outPNode
        for controlPNode in self.filterGroupNodeDic[
                'controlPlacement'].iterkeys():
            controlPNodeLocal = util.fullPathName2Local(controlPNode)
            if controlPNodeLocal[1].rfind(filterStr) != -1:
                controlNode = controlPNode

        util.transformChannelBinding(rootNode, controlNode)
        util.transformChannelBinding(rootNode, outputPlacementNode)

        filterStr = 'body'
        matrixOp = []
        bodyInitNode = None
        bodySocketNode = None

        for outPNode in self.filterGroupNodeDic['outputPlacement'].iterkeys():
            outPNodeLocal = util.fullPathName2Local(outPNode)
            if outPNodeLocal[1].rfind(filterStr) != -1 and outPNodeLocal[
                    1].rfind('upbody') == -1:
                outputPlacementNode = outPNode
        for controlPNode in self.filterGroupNodeDic[
                'controlPlacement'].iterkeys():
            controlPNodeLocal = util.fullPathName2Local(controlPNode)
            if controlPNodeLocal[1].rfind(filterStr) != -1:
                controlNode = controlPNode

        for initNode in self.filterGroupNodeDic['init'].iterkeys():
            initNodeLocal = util.fullPathName2Local(initNode)
            if initNodeLocal[1].rfind(filterStr) != -1 and initNodeLocal[
                    1].rfind('upbody') == -1:
                bodyInitNode = initNode
                matrixOps = util.localMatrixOp(self.moduleNameSpace,
                                               filterStr + '_init')

        cmds.connectAttr(rootNode + '.worldInverseMatrix',
                         matrixOps[0] + '.matrixIn[1]',
                         f=True)
        cmds.connectAttr(bodyInitNode + '.worldMatrix',
                         matrixOps[0] + '.matrixIn[0]',
                         f=True)

        util.decompChannelBinding(matrixOps[1], controlNode)
        util.decompChannelBinding(matrixOps[1], outputPlacementNode)

        for socketNode in self.filterGroupNodeDic['outputParentSocket']:
            socketLocalNode = util.fullPathName2Local(socketNode)
            if socketLocalNode[1].rfind(filterStr) != -1 and socketLocalNode[
                    1].rfind('upbody') == -1:
                bodySocketNode = socketNode

        bodyNegYOp = util.createOpNode(self.moduleNameSpace, 'multiplyDivide',
                                       filterStr + '_space_neg_y')
        cmds.setAttr(bodyNegYOp + '.input2Y', -1)
        cmds.connectAttr(outputPlacementNode + '.translate',
                         bodyNegYOp + '.input1',
                         f=True)
        cmds.connectAttr(bodyNegYOp + '.outputY',
                         bodySocketNode + '.translateY',
                         f=True)

        upbodyInitNode = None
        chestInitNode = None
        hipInitNode = None
        headInitNode = None

        for initNode in self.filterGroupNodeDic['init'].iterkeys():
            initNodeLocal = util.fullPathName2Local(initNode)
            if initNodeLocal[1].rfind(self.filterStrList[0]) != -1:
                upbodyInitNode = initNode
            elif initNodeLocal[1].rfind(self.filterStrList[1]) != -1:
                chestInitNode = initNode
            elif initNodeLocal[1].rfind(self.filterStrList[2]) != -1:
                hipInitNode = initNode
            elif initNodeLocal[1].rfind(self.filterStrList[3]) != -1:
                headInitNode = initNode
            else:
                continue

        upbodyOutputNodes = []
        chestOutputNodes = []
        hipOutputNodes = []
        headOutputNodes = []

        for outPNode in self.filterGroupNodeDic['outputPlacement'].iterkeys():
            outPNodeLocal = util.fullPathName2Local(outPNode)
            if outPNodeLocal[1].rfind(self.filterStrList[0]) != -1:
                upbodyOutputNodes.append(outPNode)
            elif outPNodeLocal[1].rfind(self.filterStrList[1]) != -1:
                chestOutputNodes.append(outPNode)
            elif outPNodeLocal[1].rfind(self.filterStrList[2]) != -1:
                hipOutputNodes.append(outPNode)
            elif outPNodeLocal[1].rfind(self.filterStrList[3]) != -1:
                headOutputNodes.append(outPNode)
            else:
                continue

        upbodyControlNodes = []
        chestControlNodes = []
        hipControlNodes = []
        headControlNodes = []

        for controlPNode in self.filterGroupNodeDic[
                'controlPlacement'].iterkeys():
            controlPNodeLocal = util.fullPathName2Local(controlPNode)
            if controlPNodeLocal[1].rfind(self.filterStrList[0]) != -1:
                upbodyControlNodes.append(controlPNode)
            elif controlPNodeLocal[1].rfind(self.filterStrList[1]) != -1:
                chestControlNodes.append(controlPNode)
            elif controlPNodeLocal[1].rfind(self.filterStrList[2]) != -1:
                hipControlNodes.append(controlPNode)
            elif controlPNodeLocal[1].rfind(self.filterStrList[3]) != -1:
                headControlNodes.append(controlPNode)
            else:
                continue

        upbodyConnections = upbodyOutputNodes + upbodyControlNodes
        for upbodyConnection in upbodyConnections:
            util.transformChannelBinding(upbodyInitNode, upbodyConnection)

        matrixOps = util.localMatrixOp(self.moduleNameSpace,
                                       self.filterStrList[1] + '_init')
        cmds.connectAttr(upbodyInitNode + '.worldInverseMatrix',
                         matrixOps[0] + '.matrixIn[1]',
                         f=True)
        cmds.connectAttr(chestInitNode + '.worldMatrix',
                         matrixOps[0] + '.matrixIn[0]',
                         f=True)

        util.decompChannelBinding(matrixOps[1], chestControlNodes[0])
        util.decompChannelBinding(matrixOps[1], chestOutputNodes[0])

        util.transformChannelBinding(hipInitNode, hipOutputNodes[0])
        util.transformChannelBinding(hipInitNode, hipControlNodes[0])

        matrixOps = util.localMatrixOp(self.moduleNameSpace,
                                       self.filterStrList[3] + '_init')
        cmds.connectAttr(chestInitNode + '.worldInverseMatrix',
                         matrixOps[0] + '.matrixIn[1]',
                         f=True)
        cmds.connectAttr(headInitNode + '.worldMatrix',
                         matrixOps[0] + '.matrixIn[0]',
                         f=True)

        util.decompChannelBinding(matrixOps[1], headControlNodes[0])
        util.decompChannelBinding(matrixOps[1], headOutputNodes[0])
Exemple #5
0
    def applyMotionNodeConnections(self):

        for key in self.filterGroupNodeDic['outputChildPlug'].keys():
            sourceNode = key.replace("motion_output", "motion_input").replace(
                "output", "input")
            util.transformChannelBinding(sourceNode, key)

        for key in self.filterGroupNodeDic['controlChildPlug'].keys():
            sourceNode = key.replace("motion_control", "motion_input").replace(
                "control", "input")
            util.transformChannelBinding(sourceNode, key)

        addFkConNode = cmds.listRelatives(
            self.filterGroupNodeDic['controlAddFkConSpace'].keys()[0],
            c=1,
            s=0,
            f=1,
            typ='transform')[0]

        for key in self.filterGroupNodeDic['controlFkConSpace'].keys():
            localKey = util.fullPathName2Local(key)
            baseName = localKey[1]
            part = baseName.split('_')[0]
            for initNode in self.filterGroupNodeDic['init']:
                localName = util.fullPathName2Local(initNode)
                if localName[1].rfind(part) != -1:
                    addOpNode = util.createOpNode(self.moduleNameSpace,
                                                  'plusMinusAverage',
                                                  'add_fk_op_' + part)
                    if part != 'meta':
                        cmds.connectAttr(initNode + '.rotate',
                                         addOpNode + '.input3D[0]',
                                         f=True)
                    cmds.connectAttr(addFkConNode + '.curl',
                                     addOpNode + '.input3D[1]',
                                     f=True)

                    if part == "meta":
                        multOpNode = util.createOpNode(
                            self.moduleNameSpace, 'multiplyDivide',
                            'add_fk_mult_op_' + part)
                        cmds.setAttr(multOpNode + '.operation', 1)
                        cmds.setAttr(multOpNode + '.input2X',
                                     self._params[2]['value'])
                        cmds.setAttr(multOpNode + '.input2Y',
                                     self._params[2]['value'])
                        cmds.setAttr(multOpNode + '.input2Z',
                                     self._params[2]['value'])
                        cmds.connectAttr(addOpNode + '.output3D',
                                         multOpNode + '.input1',
                                         f=True)
                        cmds.connectAttr(multOpNode + '.output',
                                         key + '.rotate',
                                         f=True)
                    else:
                        util.transformChannelBinding(initNode, key, 2)
                        util.transformChannelBinding(initNode, key, 4)
                        cmds.connectAttr(addOpNode + '.output3D',
                                         key + '.rotate',
                                         f=True)

        fkConNodes = []
        for key in self.filterGroupNodeDic['controlFkConSpace'].keys():
            child = cmds.listRelatives(key, c=1, s=0, f=1, typ='transform')[0]
            fkConNodes.append(child)

        for fkConNode in fkConNodes:
            localKey = util.fullPathName2Local(fkConNode)
            baseName = localKey[1]
            if baseName == 'fk_Con':
                for node in self.filterGroupNodeDic['outputNode']:
                    localNode = util.fullPathName2Local(node)
                    baseName2 = localNode[1]
                    part = baseName2.split('_')[0]
                    part2 = baseName2.split('_')[-1]
                    if part == 'meta' and part2 != 'space':
                        util.transformChannelBinding(fkConNode, node)
            else:
                for node in self.filterGroupNodeDic['outputNode']:
                    localNode = util.fullPathName2Local(node)
                    baseName2 = localNode[1]
                    part = baseName2.split('_')[0]
                    localFkCon = util.fullPathName2Local(fkConNode)
                    if part in localFkCon[1]:
                        if baseName2.rfind('space') != -1:
                            continue
                        matrixOp = util.localMatrixOp(self.moduleNameSpace,
                                                      part)
                        spaceNode = self.filterGroupNodeDic['outputNode'][
                            node]['parent']
                        cmds.connectAttr(fkConNode + '.worldMatrix',
                                         matrixOp[0] + '.matrixIn[0]',
                                         f=True)
                        cmds.connectAttr(spaceNode + '.worldInverseMatrix',
                                         matrixOp[0] + '.matrixIn[1]',
                                         f=True)
                        cmds.connectAttr(matrixOp[1] + '.outputTranslate',
                                         node + '.translate',
                                         f=True)
                        cmds.connectAttr(matrixOp[1] + '.outputRotate',
                                         node + '.rotate',
                                         f=True)
                        cmds.connectAttr(matrixOp[1] + '.outputScale',
                                         node + '.scale',
                                         f=True)
                        cmds.connectAttr(matrixOp[1] + '.outputShear',
                                         node + '.shear',
                                         f=True)
Exemple #6
0
    def applyMotionNodeConnections(self):
        for key in self.filterGroupNodeDic['outputChildPlug'].keys():
            sourceNode = key.replace("motion_output", "motion_input").replace(
                "output", "input")
            util.transformChannelBinding(sourceNode, key)

        for key in self.filterGroupNodeDic['controlChildPlug'].keys():
            sourceNode = key.replace("motion_control", "motion_input").replace(
                "control", "input")
            util.transformChannelBinding(sourceNode, key)

        for key in self.filterGroupNodeDic['controlFkCon'].keys():
            keyLocal = util.fullPathName2Local(key)
            if keyLocal[1].rfind('space') == -1:
                outputNodes = {}
                nodeStrLocal = keyLocal[1].replace("fk_Con", "node")
                util.getChildrenNodes(self.modulePathDic['output'],
                                      nodeStrLocal, outputNodes, 1)
                for node in outputNodes:
                    if node.split('|')[-1].rfind('space') != -1 or node.split(
                            '|')[-1].rfind('socket') != -1:
                        continue
                    else:
                        if keyLocal[1].rfind('hand_roll') != -1:
                            util.transformChannelBinding(key, node, 3)
                        else:
                            util.transformChannelBinding(key, node)

        hand_piv_con_op = util.createOpNode(self.moduleNameSpace,
                                            'plusMinusAverage',
                                            'hand_piv_con_add_op')

        for key in self.filterGroupNodeDic['controlPlacement']:
            keyLocal = util.fullPathName2Local(key)
            if keyLocal[1].rfind('piv') != -1:
                cmds.connectAttr(key + '.translate',
                                 hand_piv_con_op + '.input3D[0]',
                                 f=True)
        for key in self.filterGroupNodeDic['controlFkCon']:
            keyLocal = util.fullPathName2Local(key)
            if keyLocal[1].rfind('piv') != -1 and keyLocal[1].rfind(
                    'space') == -1:
                cmds.connectAttr(key + '.translate',
                                 hand_piv_con_op + '.input3D[1]',
                                 f=True)
        rollFkConNode = ''
        for key in self.filterGroupNodeDic['controlFkCon']:
            keyLocal = util.fullPathName2Local(key)
            if keyLocal[1].rfind('roll') != -1 and keyLocal[1].rfind(
                    'space') == -1:
                rollFkConNode = key
                cmds.connectAttr(hand_piv_con_op + '.output3D',
                                 key + '.rotatePivot',
                                 f=True)

        hand_piv_node_op = util.createOpNode(self.moduleNameSpace,
                                             'plusMinusAverage',
                                             'hand_piv_node_add_op')

        for key in self.filterGroupNodeDic['outputPlacement']:
            keyLocal = util.fullPathName2Local(key)
            if keyLocal[1].rfind('piv') != -1:
                cmds.connectAttr(key + '.translate',
                                 hand_piv_node_op + '.input3D[0]',
                                 f=True)
        for key in self.filterGroupNodeDic['outputNode']:
            keyLocal = util.fullPathName2Local(key)
            if keyLocal[1].rfind('piv') != -1:
                cmds.connectAttr(key + '.translate',
                                 hand_piv_node_op + '.input3D[1]',
                                 f=True)
        for key in self.filterGroupNodeDic['outputNode']:
            keyLocal = util.fullPathName2Local(key)
            if keyLocal[1].rfind('roll') != -1 and keyLocal[1].rfind(
                    'space') == -1 and keyLocal[1].rfind('socket') == -1:
                cmds.connectAttr(hand_piv_node_op + '.output3D',
                                 key + '.rotatePivot',
                                 f=True)
            elif keyLocal[1].rfind('roll') != -1 and keyLocal[1].rfind(
                    'space') != -1:
                cmds.connectAttr(rollFkConNode + '.translate',
                                 key + '.translate',
                                 f=True)
Exemple #7
0
    def applyMotionNodeConnections(self):
        spaceListGroup = [self.filterGroupNodeDic['fkSpace'], self.filterGroupNodeDic['ikSpace'], self.filterGroupNodeDic['outputSpace'], self.filterGroupNodeDic['controlFkSpace'], self.filterGroupNodeDic['controlIkSpace']]
        for node in self.filterGroupNodeDic['inputChildPlug'].iterkeys():
            nodeLocal = util.fullPathName2Local(node)
            if nodeLocal[1].rfind('upleg') != -1:
                for spaceList in spaceListGroup:
                    for spaceNode in spaceList:
                        spaceNodeLocal = util.fullPathName2Local(spaceNode)
                        if spaceNodeLocal[1].rfind('upleg') != -1:
                            util.transformChannelBinding(node, spaceNode)

            elif nodeLocal[1].rfind('ball_twist') != -1:
                for controlIkSpace in self.filterGroupNodeDic['controlIkSpace']:
                    controlIkSpaceLocal = util.fullPathName2Local(controlIkSpace)
                    if controlIkSpaceLocal[1].rfind('Pole_Rot') != -1:
                        cmds.orientConstraint(node, controlIkSpace)

            elif nodeLocal[1].rfind('foot_offset') != -1:

                footOffsetPlug = node
                ballJntOffsetPlug = ''
                tipJntOffsetPlug = ''
                
                uplegIkSpace = ''
                footIkSpace = ''
                ballIkSpaceLocal = ''
                tipIkSpaceLocal = ''

                controlIKSpaceLocalNodes = []
                for controlIkSpace in self.filterGroupNodeDic['controlIkSpace']:
                    controlIkSpaceLocal = util.fullPathName2Local(controlIkSpace)
                    if controlIkSpaceLocal[1].rfind('space_local') != -1:
                        controlIKSpaceLocalNodes.append(controlIkSpace)

                for spaceLocalNode in controlIKSpaceLocalNodes:
                    spaceLocalNodeBaseStr = util.fullPathName2Local(spaceLocalNode)
                    if spaceLocalNodeBaseStr[1].rfind('ball') != -1:
                        ballIkSpaceLocal = spaceLocalNode
                    elif spaceLocalNodeBaseStr[1].rfind('tip') != -1:
                        tipIkSpaceLocal = spaceLocalNode

                for plugNode in self.filterGroupNodeDic['inputChildPlug'].iterkeys():
                    plugNodeLocal = util.fullPathName2Local(plugNode)
                    if plugNodeLocal[1].rfind('ball_jnt') != -1:
                        ballJntOffsetPlug = plugNode
                    elif plugNodeLocal[1].rfind('tip_jnt') != -1:
                        tipJntOffsetPlug = plugNode

                for controlIkSpace in self.filterGroupNodeDic['controlIkSpace']:
                    controlIkSpaceLocalStr = util.fullPathName2Local(controlIkSpace)
                    if controlIkSpaceLocalStr[1].rfind('upleg_con_ik') != -1:
                        uplegIkSpace = controlIkSpace
                    elif controlIkSpaceLocalStr[1].rfind('foot_con_ik') != -1 and controlIkSpaceLocalStr[1].rfind('local') == -1:
                        footIkSpace = controlIkSpace

                matrixOps = util.localMatrixOp(self.moduleNameSpace, 'foot_Ik_Con_space')
                cmds.connectAttr(uplegIkSpace+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                cmds.connectAttr(footOffsetPlug+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                util.decompChannelBinding(matrixOps[1], footIkSpace)

                matrixOps = util.localMatrixOp(self.moduleNameSpace, 'ball_ik_Con_space')
                cmds.connectAttr(footOffsetPlug+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                cmds.connectAttr(ballJntOffsetPlug+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                util.decompChannelBinding(matrixOps[1], ballIkSpaceLocal)

                matrixOps = util.localMatrixOp(self.moduleNameSpace, 'tip_Ik_Con_space')
                cmds.connectAttr(footOffsetPlug+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                cmds.connectAttr(tipJntOffsetPlug+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                util.decompChannelBinding(matrixOps[1], tipIkSpaceLocal)

        for controlFkCon in self.filterGroupNodeDic['controlFkCon']:
            controlFkConLocal = util.fullPathName2Local(controlFkCon)
            matchStr = controlFkConLocal[1].replace('_fk_Con', 'Jnt_fk')
            for fkJntNode in self.filterGroupNodeDic['fkJnt']:
                fkJntNodeLocal = util.fullPathName2Local(fkJntNode)
                if fkJntNodeLocal[1] == matchStr:
                    cmds.connectAttr(controlFkCon+'.rotate', fkJntNode+'.rotate', f=True)

        filterDic = {'foot':'ball', 'ball':'tip'}
        sourceNode = ''
        targetNode = ''
        targetUpNode = ''

        for key, value in filterDic.iteritems():
            for ikJnt in self.filterGroupNodeDic['ikJnt']:
                ikJntLocal = util.fullPathName2Local(ikJnt)
                if ikJntLocal[1].rfind(key) != -1:
                    sourceNode = ikJnt
            for controlRef in self.filterGroupNodeDic['controlRef']:
                controlRefLocal = util.fullPathName2Local(controlRef)
                if controlRefLocal[1].rfind(value) != -1:
                    if controlRefLocal[1].rfind('Handle') != -1:
                        targetNode = controlRef
                    elif controlRefLocal[1].rfind('Pole') != -1:
                        targetUpNode = controlRef
            cmds.aimConstraint(targetNode, sourceNode, aim = [1,0,0], u= [0,1,0], wut='object', wuo=targetUpNode)

        for spaceIkNode in self.filterGroupNodeDic['ikSpace']:
            spaceIkNodeLocal = util.fullPathName2Local(spaceIkNode)
            if spaceIkNodeLocal[1].rfind('soft') != -1:
                sourceNode = spaceIkNode
        for controlIkNode in self.filterGroupNodeDic['controlIkCon']:
            controlIkNodeLocal = util.fullPathName2Local(controlIkNode)
            if controlIkNodeLocal[1].rfind('foot') != -1 and controlIkNodeLocal[1].rfind('local') != -1:
                targetNode = controlIkNode
            elif controlIkNodeLocal[1].rfind('leg') != -1 and controlIkNodeLocal[1].rfind('Pole') != -1:
                targetUpNode = controlIkNode
        cmds.aimConstraint(targetNode, sourceNode, aim = [1,0,0], u= [0,1,0], wut='object', wuo=targetUpNode)

        for blendNode in self.filterGroupNodeDic['outputBlend']:
            blendNodeLocal = util.fullPathName2Local(blendNode)
            blendNodeLocalPrefix = blendNodeLocal[1].split('_')[0]
            blendNodeOp = util.createOpNode(self.moduleNameSpace, 'blendColors', blendNodeLocalPrefix+'_blend_op')
            cmds.connectAttr(self.filterGroupNodeDic['fk2ikCon'].keys()[0]+'.fk2ik', blendNodeOp+'.blender', f=True)
            for ikJntNode in self.filterGroupNodeDic['ikJnt']:
                ikJntNodeLocal = util.fullPathName2Local(ikJntNode)
                if  blendNodeLocalPrefix+'_ik' == ikJntNodeLocal[1]:
                    cmds.connectAttr(ikJntNode+'.rotate', blendNodeOp+'.color1', f=True)
            for fkJntNode in self.filterGroupNodeDic['fkJnt']:
                fkJntNodeLocal = util.fullPathName2Local(fkJntNode)
                if  blendNodeLocalPrefix+'_fk' == fkJntNodeLocal[1]:
                    cmds.connectAttr(fkJntNode+'.rotate', blendNodeOp+'.color2', f=True)
            cmds.connectAttr(blendNodeOp+'.output', blendNode+'.rotate', f=True)

            ikConDisplayOp = util.createOpNode(self.moduleNameSpace, 'condition', 'ik_con_display_op')
            cmds.setAttr(ikConDisplayOp+'.operation', 0)
            cmds.setAttr(ikConDisplayOp+'.secondTerm', 1)
            cmds.setAttr(ikConDisplayOp+'.colorIfTrueR', 1)
            cmds.setAttr(ikConDisplayOp+'.colorIfFalseR', 0)
            fkConDisplayOp = util.createOpNode(self.moduleNameSpace, 'condition', 'fk_con_display_op')
            cmds.setAttr(fkConDisplayOp+'.operation', 0)
            cmds.setAttr(fkConDisplayOp+'.secondTerm', 0)
            cmds.setAttr(fkConDisplayOp+'.colorIfTrueR', 1)
            cmds.setAttr(fkConDisplayOp+'.colorIfFalseR', 0)
            cmds.connectAttr(self.filterGroupNodeDic['fk2ikCon'].keys()[0]+'.controlDisplay', ikConDisplayOp+'.firstTerm', f=True)
            cmds.connectAttr(self.filterGroupNodeDic['fk2ikCon'].keys()[0]+'.controlDisplay', fkConDisplayOp+'.firstTerm', f=True)

        for blendNode in self.filterGroupNodeDic['outputBlend']:
            blendNodeLocal = util.fullPathName2Local(blendNode)
            if blendNodeLocal[1].rfind('upleg') != -1:
                cmds.connectAttr(blendNode+'.rotate', self.filterGroupNodeDic['fk2ikSpace'].keys()[0]+'.rotate', f=True)

        placementList = ['Fk', 'Ik']
        for typeStr in placementList:
            for placementNode in self.filterGroupNodeDic['control'+typeStr+'Placement'].iterkeys():
                placementNodeLocal = util.fullPathName2Local(placementNode)
                if placementNodeLocal[1].rfind('upleg') != -1 and placementNodeLocal[1].rfind('fk2ik') == -1:
                    if typeStr == placementList[0]:
                        cmds.connectAttr(fkConDisplayOp+'.outColorR', placementNode+'.visibility', f=True)
                    else:
                        cmds.connectAttr(ikConDisplayOp+'.outColorR', placementNode+'.visibility', f=True)
        
        legPoleAutoAssetPath = self.pathInfo.assetDirPath + 'poleVectorPosAutoOpAsset' + '.' + self.file_extenstion_str
        legPoleAutoOpNode = ''
        legPoleAutoOpNodeNew = ''
        fileCheck = cmds.file( legPoleAutoAssetPath, query=True, exists=True )
        if fileCheck:
            cmds.file( legPoleAutoAssetPath, i=True, mergeNamespacesOnClash=True )
            containerNodes = cmds.ls(type='container', l=True)
            if containerNodes != None:
                for containerNode in containerNodes:
                    localStr = containerNode.split(':')[-1]
                    if localStr == 'poleVectorPosAutoOp':
                        legPoleAutoOpNode = containerNode
        if cmds.objExists(legPoleAutoOpNode):
            legPoleAutoOpNodeNew = cmds.rename(legPoleAutoOpNode, legPoleAutoOpNode + '_' + self.component_val)
        
        uplegIkMotion = ''
        legPoleAuto = ''
        legPoleSideAuto = ''
        legPoleFntAuto = ''
        footIkConLocal = ''
        
        uplegIkMotionStr = ''
        legPoleAutoStr = ''
        legPoleSideAutoStr = ''
        legPoleFntAutoStr = ''
        footIkConLocalStr = ''
        
        for conPoleAutoNode in self.filterGroupNodeDic['controlPoleAuto']:
            conPoleAutoNodeLocal = util.fullPathName2Local(conPoleAutoNode)
            if conPoleAutoNodeLocal[1].rfind('Pole_Auto') != -1:
                legPoleAuto = conPoleAutoNode
                legPoleAutoStr = conPoleAutoNodeLocal[1]
                
            elif conPoleAutoNodeLocal[1].rfind('Side') != -1:
                legPoleSideAuto = conPoleAutoNode
                legPoleSideAutoStr = conPoleAutoNodeLocal[1]
                
            elif conPoleAutoNodeLocal[1].rfind('Fnt') != -1:
                legPoleFntAuto = conPoleAutoNode
                legPoleFntAutoStr = conPoleAutoNodeLocal[1]
                
        for motinoIkSpaceNode in self.filterGroupNodeDic['ikSpace']:
            motinoIkSpaceNodeLocal = util.fullPathName2Local(motinoIkSpaceNode)
            if motinoIkSpaceNodeLocal[1].rfind('upleg') != -1:
                uplegIkMotion = motinoIkSpaceNode
                uplegIkMotionStr = motinoIkSpaceNodeLocal[1]
        
        for conIkNode in self.filterGroupNodeDic['controlIkCon']:
            conIkNodeLocal = util.fullPathName2Local(conIkNode)
            if conIkNodeLocal[1] == 'foot_ik_Con_local':
                footIkConLocal = conIkNode
                footIkConLocalStr = conIkNodeLocal[1]
        
        uplegIkMotionDecompOp = util.createOpNode(self.moduleNameSpace, 'decomposeMatrix', uplegIkMotionStr+'_decomp')
        footIkConLocalDecompOp = util.createOpNode(self.moduleNameSpace, 'decomposeMatrix', footIkConLocalStr+'_decomp')
        legPoleSideAutoDecompOp = util.createOpNode(self.moduleNameSpace, 'decomposeMatrix', legPoleSideAutoStr+'_decomp')
        cmds.connectAttr(uplegIkMotion+'.worldMatrix', uplegIkMotionDecompOp +'.inputMatrix', f=True)
        cmds.connectAttr(footIkConLocal+'.worldMatrix', footIkConLocalDecompOp +'.inputMatrix', f=True)
        cmds.connectAttr(legPoleSideAuto+'.worldMatrix', legPoleSideAutoDecompOp +'.inputMatrix', f=True)
        
        cmds.connectAttr(uplegIkMotionDecompOp+'.outputTranslate', legPoleAutoOpNodeNew +'.Input_ikSpaceWorldPos', f=True)
        cmds.connectAttr(footIkConLocalDecompOp+'.outputTranslate', legPoleAutoOpNodeNew +'.Input_conSpaceWorldPos', f=True)
        cmds.connectAttr(legPoleSideAutoDecompOp+'.outputTranslate', legPoleAutoOpNodeNew +'.Input_ikSideWorldPos', f=True)
        
        legPoleSideAutoCompOp = util.createOpNode(self.moduleNameSpace, 'composeMatrix', legPoleSideAutoStr+'_comp')
        cmds.connectAttr(legPoleAutoOpNodeNew+'.Output_poleVectorWorldPos', legPoleSideAutoCompOp +'.inputTranslate', f=True)
        
        matrixOps = util.localMatrixOp(self.moduleNameSpace, legPoleSideAutoStr+'_comp')
        cmds.connectAttr(legPoleAuto+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
        cmds.connectAttr(legPoleSideAutoCompOp +'.outputMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
        util.decompChannelBinding(matrixOps[1], legPoleFntAuto, option=2)
        
        for conIkSpaceNode in self.filterGroupNodeDic['controlIkSpace']:
            conIkSpaceNodeLocal = util.fullPathName2Local(conIkSpaceNode)
            if conIkSpaceNodeLocal[1].rfind('Pole_Pos') != -1:
                cmds.pointConstraint(legPoleFntAuto, conIkSpaceNode)
        
        legFk2IkConNode = self.filterGroupNodeDic['fk2ikCon'].keys()[0]
        if self._side == 'L':
            legFk2IkConShapeNode = cmds.listRelatives(legFk2IkConNode, shapes=True, f=True)[0]
            spanNums = cmds.getAttr(legFk2IkConShapeNode+'.spans')
            spanNums = spanNums + 1
            for i in range(0, spanNums):
                originalPos = cmds.getAttr(legFk2IkConShapeNode+".controlPoints["+ str(i)+"].zValue")
                cmds.setAttr(legFk2IkConShapeNode+".controlPoints["+ str(i)+"].zValue", originalPos * -1)
Exemple #8
0
    def applyInitNodeConnections(self):

        initNodeFullName = cmds.ls(self.modulePathDic['init'], l=True)[0]
        initNodeParents = []
        placementNodesList = [self.filterGroupNodeDic['inputPlacement'], self.filterGroupNodeDic['fkPlacement'], self.filterGroupNodeDic['ikPlacement'], self.filterGroupNodeDic['outputPlacement'], self.filterGroupNodeDic['controlPlacement']]
        uplegInitFull = ''
        for initNode, parentNode in self.filterGroupNodeDic['init'].iteritems():
            initLocalNode = util.fullPathName2Local(initNode)
            matchStr = initLocalNode[1].replace('init', '')
            for placementNodes in placementNodesList:
                for placementNode in placementNodes:
                    placementLocalNode = util.fullPathName2Local(placementNode)
                    if placementLocalNode[1].rfind(matchStr) != -1:
                        util.transformChannelBinding(initNode, placementNode)

        uplegInitFull = ''
        lolegInitFull = ''
        footInitFull = ''
        ballInitFull = ''
        tipInitFull = ''
        spaceInitFull = ''
        controlInitFull = ''

        for initNode, parentNode in self.filterGroupNodeDic['init'].iteritems():
            initLocalNode = util.fullPathName2Local(initNode)
            partStr = initLocalNode[1].replace('_init', '')
            if initLocalNode[1].rfind('upleg') != -1:
                uplegInitFull = initNode
            elif initLocalNode[1].rfind('loleg') != -1:
                lolegInitFull = initNode
            elif initLocalNode[1].rfind('foot') != -1:
                footInitFull = initNode
            elif initLocalNode[1].rfind('ball') != -1:
                ballInitFull = initNode
            elif initLocalNode[1].rfind('tip') != -1:
                tipInitFull = initNode
            elif initLocalNode[1].rfind('space') != -1:
                spaceInitFull = initNode
            elif initLocalNode[1].rfind('control') != -1:
                controlInitFull = initNode

        jointListGroup = [self.filterGroupNodeDic['fkJnt'], self.filterGroupNodeDic['ikJnt'], self.filterGroupNodeDic['outputBlend']]
        for initNode, parentNode in self.filterGroupNodeDic['init'].iteritems():
            initLocalNode = util.fullPathName2Local(initNode)
            partStr = initLocalNode[1].replace('_init', '')
            if initLocalNode[1].rfind('loleg') != -1:
                for controlFkSpace in self.filterGroupNodeDic['controlFkSpace']:
                    controlLocalFkSpace = util.fullPathName2Local(controlFkSpace)
                    if controlLocalFkSpace[1].rfind('loleg') != -1:
                        matrixOps = util.localMatrixOp(self.moduleNameSpace, 'loleg_init')
                        cmds.connectAttr(uplegInitFull+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                        cmds.connectAttr(initNode+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                        util.decompChannelBinding(matrixOps[1], controlFkSpace)
                        for jointList in jointListGroup:
                            for jnt in jointList:
                                jntLocal = util.fullPathName2Local(jnt)
                                if jntLocal[1].rfind('loleg') != -1:
                                    cmds.connectAttr(matrixOps[1]+'.outputTranslate', jnt+'.translate')
                                    cmds.connectAttr(matrixOps[1]+'.outputRotate', jnt+'.jointOrient')

            elif initLocalNode[1].rfind('foot') != -1:
                for controlFkSpace in self.filterGroupNodeDic['controlFkSpace']:
                    controlLocalFkSpace = util.fullPathName2Local(controlFkSpace)
                    if controlLocalFkSpace[1].rfind('foot') != -1:
                        matrixOps = util.localMatrixOp(self.moduleNameSpace, 'foot_init')
                        cmds.connectAttr(lolegInitFull+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                        cmds.connectAttr(initNode+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                        util.decompChannelBinding(matrixOps[1], controlFkSpace)
                        for jointList in jointListGroup:
                            for jnt in jointList:
                                jntLocal = util.fullPathName2Local(jnt)
                                if jntLocal[1].rfind('foot') != -1:
                                    cmds.connectAttr(matrixOps[1]+'.outputTranslate', jnt+'.translate')
                                    cmds.connectAttr(matrixOps[1]+'.outputRotate', jnt+'.jointOrient')

            elif initLocalNode[1].rfind('ball') != -1:
                for controlFkSpace in self.filterGroupNodeDic['controlFkSpace']:
                    controlLocalFkSpace = util.fullPathName2Local(controlFkSpace)
                    if controlLocalFkSpace[1].rfind('ball') != -1:
                        matrixOps = util.localMatrixOp(self.moduleNameSpace, 'ball_init')
                        cmds.connectAttr(footInitFull+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                        cmds.connectAttr(initNode+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                        util.decompChannelBinding(matrixOps[1], controlFkSpace)
                        for jointList in jointListGroup:
                            for jnt in jointList:
                                jntLocal = util.fullPathName2Local(jnt)
                                if jntLocal[1].rfind('ball') != -1:
                                    cmds.connectAttr(matrixOps[1]+'.outputTranslate', jnt+'.translate')
                                    cmds.connectAttr(matrixOps[1]+'.outputRotate', jnt+'.jointOrient')

            elif initLocalNode[1].rfind('tip') != -1:
                for controlFkSpace in self.filterGroupNodeDic['controlFkSpace']:
                    controlLocalFkSpace = util.fullPathName2Local(controlFkSpace)
                    if controlLocalFkSpace[1].rfind('tip') != -1:
                        matrixOps = util.localMatrixOp(self.moduleNameSpace, 'ball_init')
                        cmds.connectAttr(ballInitFull+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                        cmds.connectAttr(initNode+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                        util.decompChannelBinding(matrixOps[1], controlFkSpace)
                        for jointList in jointListGroup:
                            for jnt in jointList:
                                jntLocal = util.fullPathName2Local(jnt)
                                if jntLocal[1].rfind('tip') != -1:
                                    cmds.connectAttr(matrixOps[1]+'.outputTranslate', jnt+'.translate')
                                    cmds.connectAttr(matrixOps[1]+'.outputRotate', jnt+'.jointOrient')

        for fkSpaceNode in self.filterGroupNodeDic['fkSpace']:
                fkSpaceLocalNode = util.fullPathName2Local(fkSpaceNode)
                if fkSpaceLocalNode[1].rfind('foot') != -1:
                    matrixOps = util.localMatrixOp(self.moduleNameSpace, 'foot_init')
                    cmds.connectAttr(lolegInitFull+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                    cmds.connectAttr(footInitFull+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                    util.decompChannelBinding(matrixOps[1], fkSpaceNode)

        # soft IK OP
        upleg2lolegDistanceOp = util.createOpNode(self.moduleNameSpace, 'distanceBetween', 'upleg2loleg_distasnce')
        loleg2footDistanceOp = util.createOpNode(self.moduleNameSpace, 'distanceBetween', 'loleg2foot_distasnce')
        legDistanceOp = util.createOpNode(self.moduleNameSpace, 'plusMinusAverage', 'leg_distance_sum')
        cmds.connectAttr(uplegInitFull+'.worldMatrix', upleg2lolegDistanceOp+'.inMatrix1', f=True)
        cmds.connectAttr(lolegInitFull+'.worldMatrix', upleg2lolegDistanceOp+'.inMatrix2', f=True)
        cmds.connectAttr(lolegInitFull+'.worldMatrix', loleg2footDistanceOp+'.inMatrix1', f=True)
        cmds.connectAttr(footInitFull+'.worldMatrix', loleg2footDistanceOp+'.inMatrix2', f=True)
        cmds.connectAttr(upleg2lolegDistanceOp+'.distance', legDistanceOp+'.input1D[0]', f=True)
        cmds.connectAttr(loleg2footDistanceOp+'.distance', legDistanceOp+'.input1D[1]', f=True)

        softIkAssetPath = self.pathInfo.assetDirPath + 'softIkOpAsset' + '.' + self.file_extenstion_str
        softIkOpNode = ''
        softIkOpNodeNew = ''
        fileCheck = cmds.file( softIkAssetPath, query=True, exists=True )
        if fileCheck:
            cmds.file( softIkAssetPath, i=True, mergeNamespacesOnClash=True )
            containerNodes = cmds.ls(type='container', l=True)
            if containerNodes != None:
                for containerNode in containerNodes:
                    localStr = containerNode.split(':')[-1]
                    if localStr == 'softIKOp':
                        softIkOpNode = containerNode
        if cmds.objExists(softIkOpNode):
            softIkOpNodeNew = cmds.rename(softIkOpNode, softIkOpNode + '_' + self.component_val)

        cmds.connectAttr(legDistanceOp+'.output1D', softIkOpNodeNew+'.In_initLength', f=True)
        
        softIkNode = ''
        for ikSoftNode in self.filterGroupNodeDic['ikSoft']:
            ikSoftNodeLocal = util.fullPathName2Local(ikSoftNode)
            if ikSoftNodeLocal[1].rfind('space') == -1:
                softIkNode = ikSoftNode
        
        cmds.connectAttr(softIkOpNodeNew+'.Out_softDistance', softIkNode +'.translateX', f=True)

        legIkSpaceNode = ''
        for ikSpaceNode in self.filterGroupNodeDic['ikSpace']:
            ikSpaceLocalNode = util.fullPathName2Local(ikSpaceNode)
            if ikSpaceLocalNode[1].rfind('leg') != -1 and ikSpaceLocalNode[1].rfind('soft') == -1:
                legIkSpaceNode = ikSpaceNode

        footikConLocalNode = ''
        footikConNode = ''
        for ikConNode in self.filterGroupNodeDic['controlIkCon']:
            ikConLocalNode = util.fullPathName2Local(ikConNode)
            if ikConLocalNode[1].rfind('foot') != -1:
                if ikConLocalNode[1].rfind('local') != -1:
                    footikConLocalNode = ikConNode
                else:
                    footikConNode = ikConNode

        ikControlDistanceOp = util.createOpNode(self.moduleNameSpace, 'distanceBetween', 'ik_control_distasnce')
        cmds.connectAttr(legIkSpaceNode+'.worldMatrix', ikControlDistanceOp+'.inMatrix1', f=True)
        cmds.connectAttr(footikConLocalNode+'.worldMatrix', ikControlDistanceOp+'.inMatrix2', f=True)
        cmds.connectAttr(ikControlDistanceOp+'.distance', softIkOpNodeNew+'.In_motionLength', f=True)
        cmds.connectAttr(footikConNode+'.softIK', softIkOpNodeNew+'.In_softWeight', f=True)

        for initNode, parentNode in self.filterGroupNodeDic['init'].iteritems():
            initNodeLocal = util.fullPathName2Local(initNode)
            partStr = initNodeLocal[1].replace('_init', '')
            if partStr in ['foot', 'ball', 'tip']:
                for ikSpace in self.filterGroupNodeDic['ikSpace']:
                    ikLocalSpace = util.fullPathName2Local(ikSpace)
                    if ikLocalSpace[1].rfind(partStr) != -1:
                        matrixOps = util.localMatrixOp(self.moduleNameSpace, partStr+'_init')
                        cmds.connectAttr(uplegInitFull+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
                        cmds.connectAttr(initNode+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
                        util.decompChannelBinding(matrixOps[1], ikSpace)

        uplegInitDecompOp = util.createOpNode(self.moduleNameSpace, 'decomposeMatrix', 'upleg_init_decomp')
        cmds.connectAttr(uplegInitFull+'.worldMatrix', uplegInitDecompOp+'.inputMatrix')

        lolegInitDecompOp = util.createOpNode(self.moduleNameSpace, 'decomposeMatrix', 'loleg_init_decomp')
        cmds.connectAttr(lolegInitFull+'.worldMatrix', lolegInitDecompOp+'.inputMatrix')

        footInitDecompOp = util.createOpNode(self.moduleNameSpace, 'decomposeMatrix', 'foot_init_decomp')
        cmds.connectAttr(footInitFull+'.worldMatrix', footInitDecompOp+'.inputMatrix')

        footVecOp = util.createOpNode(self.moduleNameSpace, 'plusMinusAverage', 'footVec')
        cmds.setAttr(footVecOp+'.operation',2)
        cmds.connectAttr(uplegInitDecompOp+'.outputTranslate', footVecOp+'.input3D[0]')
        cmds.connectAttr(footInitDecompOp+'.outputTranslate', footVecOp+'.input3D[1]')
        #cmds.connectAttr(footInitDecompOp+'.outputTranslate',  +'.translate')

        footVecMagOp = util.createOpNode(self.moduleNameSpace, 'distanceBetween', 'footVecMag')
        cmds.connectAttr(uplegInitDecompOp+'.outputTranslate', footVecMagOp+'.point1')
        cmds.connectAttr(footInitDecompOp+'.outputTranslate', footVecMagOp+'.point2')

        footVecUnitOp = util.createOpNode(self.moduleNameSpace, 'multiplyDivide', 'footVecUnit')
        cmds.setAttr(footVecUnitOp+'.operation',2)
        cmds.connectAttr(footVecOp+'.output3D', footVecUnitOp+'.input1')
        cmds.connectAttr(footVecMagOp+'.distance', footVecUnitOp+'.input2X')
        cmds.connectAttr(footVecMagOp+'.distance', footVecUnitOp+'.input2Y')
        cmds.connectAttr(footVecMagOp+'.distance', footVecUnitOp+'.input2Z')

        lolegVecOp = util.createOpNode(self.moduleNameSpace, 'plusMinusAverage', 'lolegVec')
        cmds.setAttr(lolegVecOp+'.operation',2)
        cmds.connectAttr(lolegInitDecompOp+'.outputTranslate', lolegVecOp+'.input3D[0]')
        cmds.connectAttr(footInitDecompOp+'.outputTranslate', lolegVecOp+'.input3D[1]')

        lolegVecMagOp = util.createOpNode(self.moduleNameSpace, 'distanceBetween', 'lolegVecMag')
        cmds.connectAttr(lolegInitDecompOp+'.outputTranslate', lolegVecMagOp+'.point1')
        cmds.connectAttr(footInitDecompOp+'.outputTranslate', lolegVecMagOp+'.point2')

        lolegVecUnitOp = util.createOpNode(self.moduleNameSpace, 'multiplyDivide', 'lolegVecUnit')
        cmds.setAttr(lolegVecUnitOp+'.operation',2)
        cmds.connectAttr(lolegVecOp+'.output3D', lolegVecUnitOp+'.input1')
        cmds.connectAttr(lolegVecMagOp+'.distance', lolegVecUnitOp+'.input2X')
        cmds.connectAttr(lolegVecMagOp+'.distance', lolegVecUnitOp+'.input2Y')
        cmds.connectAttr(lolegVecMagOp+'.distance', lolegVecUnitOp+'.input2Z')

        poleSideVecOp = util.createOpNode(self.moduleNameSpace, 'vectorProduct', 'poleSideVec')
        cmds.setAttr(poleSideVecOp+'.normalizeOutput', 1)
        cmds.setAttr(poleSideVecOp+'.operation',2)
        cmds.connectAttr(footVecUnitOp+'.output', poleSideVecOp+'.input1')
        cmds.connectAttr(lolegVecUnitOp+'.output', poleSideVecOp+'.input2')

        poleFntVecOp = util.createOpNode(self.moduleNameSpace, 'vectorProduct', 'poleFntVec')
        cmds.setAttr(poleFntVecOp+'.normalizeOutput', 1)
        cmds.setAttr(poleFntVecOp+'.operation',2)
        cmds.connectAttr(poleSideVecOp+'.output', poleFntVecOp+'.input1')
        cmds.connectAttr(footVecUnitOp+'.output', poleFntVecOp+'.input2')

        poleMatOp = util.createOpNode(self.moduleNameSpace, 'fourByFourMatrix', 'poleMat')
        # X axis
        cmds.connectAttr(poleSideVecOp+'.outputX', poleMatOp+'.in00')
        cmds.connectAttr(poleSideVecOp+'.outputY', poleMatOp+'.in01')
        cmds.connectAttr(poleSideVecOp+'.outputZ', poleMatOp+'.in02')
        # Y axis
        cmds.connectAttr(footVecUnitOp+'.outputX', poleMatOp+'.in10')
        cmds.connectAttr(footVecUnitOp+'.outputY', poleMatOp+'.in11')
        cmds.connectAttr(footVecUnitOp+'.outputZ', poleMatOp+'.in12')
        # Z axis
        cmds.connectAttr(poleFntVecOp+'.outputX', poleMatOp+'.in20')
        cmds.connectAttr(poleFntVecOp+'.outputY', poleMatOp+'.in21')
        cmds.connectAttr(poleFntVecOp+'.outputZ', poleMatOp+'.in22')
        # translate
        cmds.connectAttr(footInitDecompOp+'.outputTranslateX', poleMatOp+'.in30')
        cmds.connectAttr(footInitDecompOp+'.outputTranslateY', poleMatOp+'.in31')
        cmds.connectAttr(footInitDecompOp+'.outputTranslateZ', poleMatOp+'.in32')
        # decomp
        poleMatDecompOp = util.createOpNode(self.moduleNameSpace, 'decomposeMatrix', 'poleMat_decomp')
        cmds.connectAttr(poleMatOp+'.output', poleMatDecompOp+'.inputMatrix')

        cmds.connectAttr(poleMatDecompOp+'.outputTranslate', spaceInitFull+'.translate')
        cmds.connectAttr(poleMatDecompOp+'.outputRotate', spaceInitFull+'.rotate')

        matrixOps = util.localMatrixOp(self.moduleNameSpace, 'space_init')
        cmds.connectAttr(controlInitFull+'.worldInverseMatrix', matrixOps[0]+'.matrixIn[1]', f=True)
        cmds.connectAttr(spaceInitFull+'.worldMatrix', matrixOps[0]+'.matrixIn[0]', f=True)
        for controlPoleNode in self.filterGroupNodeDic['controlPoleAuto']:
            controlPoleNodeLocal = util.fullPathName2Local(controlPoleNode)
            if controlPoleNodeLocal[1].rfind('Pole_Auto') != -1:
                util.decompChannelBinding(matrixOps[1], controlPoleNode)

        return