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)
def getNodeGroupByFilter(self): initNodes = {} motionOutputPlacementNodes = {} motionOutputSocketNodes = {} motionOutputNodes = {} motionOutputSpaceNodes = {} controlPlacementNodes = {} controlSpaceNodes = {} controlPlugNodes = {} fkConNodes = {} spaceRefNodes = {} for key in self.outputs.iterkeys(): if self.outputs[key]['parent'] == self.modulePathDic['top']: if key.rfind(self.modulePathDic['init'][1:]) != -1: util.getChildrenNodes(key, 'init', initNodes, 1) elif key.rfind(self.modulePathDic['output'][1:]) != -1: util.getChildrenNodes(key, 'placement', motionOutputPlacementNodes, 1) util.getChildrenNodes(key, 'parent_socket', motionOutputSocketNodes, 1) util.getChildrenNodes(key, 'node', motionOutputNodes, 1) util.getChildrenNodes(key, 'space', motionOutputSpaceNodes, 1) elif key.rfind(self.modulePathDic['control'][1:]) != -1: util.getChildrenNodes(key, 'placement', controlPlacementNodes, 1) util.getChildrenNodes(key, 'child_plug', controlPlugNodes, 1) util.getChildrenNodes(key, 'fk_Con', fkConNodes, 1) util.getChildrenNodes(key, 'ref', spaceRefNodes, 1) util.getChildrenNodes(key, 'space', controlSpaceNodes, 1) else: continue self.filterGroupNodeDic['init'] = initNodes self.filterGroupNodeDic['outputPlacement'] = motionOutputPlacementNodes self.filterGroupNodeDic['outputParentSocket'] = motionOutputSocketNodes self.filterGroupNodeDic['outputNode'] = motionOutputNodes self.filterGroupNodeDic['outputSpace'] = motionOutputSpaceNodes self.filterGroupNodeDic['controlPlacement'] = controlPlacementNodes self.filterGroupNodeDic['controlChildPlug'] = controlPlugNodes self.filterGroupNodeDic['controlFkCon'] = fkConNodes self.filterGroupNodeDic['controlRef'] = spaceRefNodes self.filterGroupNodeDic['controlSpace'] = controlSpaceNodes return self.filterGroupNodeDic
def getNodeList(self): util.getChildrenNodes(self.modulePathDic['top'], '', self.outputs, 1) return self.outputs
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)
def getNodeGroupByFilter(self): initNodes = {} motionInputPlacementNodes = {} motionInputPlugNodes = {} motionFkPlacementNodes = {} motionFkSpaceNodes = {} motionFkJnts = {} motionIkPlacementNodes = {} motionIkSpaceNodes = {} motionIkJnts = {} motionIkHandles = {} motionIkSoftNodes = {} motionOutputPlacementNodes = {} motionOutputSpaceNodes = {} motionOutputBlendJnts = {} motionOutputSocketNodes = {} motionOutputNodes = {} controlPlacementNodes = {} controlFkPlacementNodes = {} controlIkPlacementNodes = {} controlFkSpaceNodes = {} controlIkSpaceNodes = {} fkConNodes = {} ikConNodes = {} refNodes = {} poleAutoNodes = {} fk2ikConNodes = {} fk2ikSpaceNodes = {} for key in self.outputs.iterkeys(): if self.outputs[key]['parent'] == self.modulePathDic['top']: if key.rfind(self.modulePathDic['init'][1:]) != -1: util.getChildrenNodes(key, 'init', initNodes, 1) elif key.rfind(self.modulePathDic['input'][1:]) != -1: util.getChildrenNodes(key, 'placement', motionInputPlacementNodes, 1) util.getChildrenNodes(key, 'child_plug', motionInputPlugNodes, 1) elif key.rfind(self.modulePathDic['fk'][1:]) != -1: util.getChildrenNodes(key, 'placement', motionFkPlacementNodes, 1) util.getChildrenNodes(key, 'space', motionFkSpaceNodes, 1) util.getChildrenNodes(key, 'Jnt', motionFkJnts, 1, objectType='joint') elif key.rfind(self.modulePathDic['ik'][1:]) != -1: util.getChildrenNodes(key, 'placement', motionIkPlacementNodes, 1) util.getChildrenNodes(key, 'space', motionIkSpaceNodes, 1) util.getChildrenNodes(key, 'Jnt', motionIkJnts, 1, objectType='joint') util.getChildrenNodes(key, 'handle', motionIkHandles, 1) util.getChildrenNodes(key, 'soft', motionIkSoftNodes, 1) elif key.rfind(self.modulePathDic['output'][1:]) != -1: util.getChildrenNodes(key, 'placement', motionOutputPlacementNodes, 1) util.getChildrenNodes(key, 'space', motionOutputSpaceNodes, 1) util.getChildrenNodes(key, 'blend', motionOutputBlendJnts, 1, objectType='joint') util.getChildrenNodes(key, 'parent_socket', motionOutputSocketNodes, 1) util.getChildrenNodes(key, '', motionOutputNodes, 1) elif key.rfind(self.modulePathDic['control'][1:]) != -1: util.getChildrenNodes(key, 'placement', controlPlacementNodes, 1) util.getChildrenNodes(key, 'fk_placement', controlFkPlacementNodes, 1) util.getChildrenNodes(key, 'ik_placement', controlIkPlacementNodes, 1) util.getChildrenNodes(key, 'fk_space', controlFkSpaceNodes, 1) util.getChildrenNodes(key, 'ik_space', controlIkSpaceNodes, 1) util.getChildrenNodes(key, 'fk_Con', fkConNodes, 1) util.getChildrenNodes(key, 'ik_Con', ikConNodes, 1) util.getChildrenNodes(key, 'ref', refNodes, 1) util.getChildrenNodes(key, 'Auto', poleAutoNodes, 1) util.getChildrenNodes(key, 'fk2ik_Con', fk2ikConNodes, 1) util.getChildrenNodes(key, 'fk2ik_space', fk2ikSpaceNodes, 1) else: continue self.filterGroupNodeDic['init'] = initNodes self.filterGroupNodeDic['inputPlacement'] = motionInputPlacementNodes self.filterGroupNodeDic['inputChildPlug'] = motionInputPlugNodes self.filterGroupNodeDic['fkPlacement'] = motionFkPlacementNodes self.filterGroupNodeDic['fkSpace'] = motionFkSpaceNodes self.filterGroupNodeDic['fkJnt'] = motionFkJnts self.filterGroupNodeDic['ikPlacement'] = motionIkPlacementNodes self.filterGroupNodeDic['ikSpace'] = motionIkSpaceNodes self.filterGroupNodeDic['ikJnt'] = motionIkJnts self.filterGroupNodeDic['ikHandle'] = motionIkHandles self.filterGroupNodeDic['ikSoft'] = motionIkSoftNodes self.filterGroupNodeDic['outputPlacement'] = motionOutputPlacementNodes self.filterGroupNodeDic['outputSpace'] = motionOutputSpaceNodes self.filterGroupNodeDic['outputBlend'] = motionOutputBlendJnts self.filterGroupNodeDic['outputParentSocket'] = motionOutputSocketNodes self.filterGroupNodeDic['outputNode'] = motionOutputNodes self.filterGroupNodeDic['controlPlacement'] = controlPlacementNodes self.filterGroupNodeDic['controlFkPlacement'] = controlFkPlacementNodes self.filterGroupNodeDic['controlIkPlacement'] = controlIkPlacementNodes self.filterGroupNodeDic['controlFkSpace'] = controlFkSpaceNodes self.filterGroupNodeDic['controlIkSpace'] = controlIkSpaceNodes self.filterGroupNodeDic['controlFkCon'] = fkConNodes self.filterGroupNodeDic['controlIkCon'] = ikConNodes self.filterGroupNodeDic['controlRef'] = refNodes self.filterGroupNodeDic['controlPoleAuto'] = poleAutoNodes self.filterGroupNodeDic['fk2ikCon'] = fk2ikConNodes self.filterGroupNodeDic['fk2ikSpace'] = fk2ikSpaceNodes return self.filterGroupNodeDic