Пример #1
0
 def setupRig(self):
     if common.isValid(self.name()):
         return True
     
     self.setupConstraints = []
     #makes component a puppet node
     self.puppetNode = puppet.create(self.name())
     
     #Create master guide control and 
     control.createSetup('{0}_master'.format(self.name()), type = 'square')
     common.setColor(self.masterGuide, 'darkred')
     
     #create hierarchy
     cmds.createNode('transform', n = self.setupRigGrp)
     cmds.createNode('transform', n = self.skeletonGrp)
     cmds.createNode('transform', n = self.guidesGrp)
     
     cmds.parent(self.skeletonGrp, self.setupRigGrp)
     cmds.parent(self.guidesGrp, self.setupRigGrp)
     cmds.parent(common.getParent(self.masterGuide),self.guidesGrp)
     
     #add attributes to groups
     attribute.addAttr(self.setupRigGrp, 'tag_guides', attrType = 'message')
     masterGuideAttr = attribute.addAttr(self.setupRigGrp, 'master_guide', attrType = 'message')
     attribute.connect(masterGuideAttr, '%s.tag_controls' % self.masterGuide)
Пример #2
0
    def postRig(self):
        '''
        clean up for the rig build.
        '''
        if common.isValid('%s.jointVis' % self.rigGrp):
            return True
        
        if cmds.ls(type = 'rig') and common.isValid(self.controlsGrp) and not common.isValid(self.rigGrp):
            return True
        
        jointVisAttr     = attribute.addAttr(self.rigGrp, 'jointVis', attrType = 'enum', defValue = 'off:on')
        scaleAttr        = attribute.addAttr(self.rigGrp, 'uniformScale', attrType = 'double', defValue = 1, min = 0)
        jointDisplayAttr = attribute.addAttr(self.rigGrp, 'displayJnts', attrType = 'enum', defValue = 'Normal:Template:Reference')
        
        cmds.setAttr(jointDisplayAttr, 2)
        
        #setup attribute for uniform scale
        attribute.connect(scaleAttr, '%s.sx' % self.rigGrp)
        attribute.connect(scaleAttr, '%s.sy' % self.rigGrp)
        attribute.connect(scaleAttr, '%s.sz' % self.rigGrp)
            
        if self.skinClusterJnts:
            for jnt in self.skinClusterJnts:
                if cmds.objExists(jnt):
                    attribute.connect(jointVisAttr , '%s.v' % jnt)
                    cmds.setAttr('%s.overrideEnabled' % jnt, 1)
                    attribute.connect(jointDisplayAttr , '%s.overrideDisplayType' % jnt)

        #set joint visibility attribute
        cmds.setAttr(jointVisAttr, 1)
        
        for grp in [self.rigGrp, self.jointsGrp, self.controlsGrp]:
            attribute.lockAndHide(['t', 'r', 's', 'v'], grp)
Пример #3
0
    def postBuild(self):
        """
        clean up rig asset
        
        .. todo: Finish complete cleanup of the rig
        """
        # create nodes on the rigGrp node
        tagControlsAttr = control.tag_as_control(self.rigGrp)
        cmds.addAttr(self.rigGrp, ln="deform_joints", at="message")
        tagJointsAttr = "%s.deform_joints" % self.rigGrp

        if self.controls:
            for ctrl in self.controls:
                attribute.connect(tagControlsAttr, "%s.%s" % (ctrl, tagControlsAttr.split(".")[1]))
            # end loop
        # end if

        if self.skinClusterJoints:
            for jnt in self.skinClusterJoints:
                if common.isValid(jnt):
                    cmds.addAttr(jnt, ln="deform_joints", at="message")
                    attribute.connect(tagJointsAttr, "%s.deform_joints" % jnt)
                # end if
            # end loop
        # end if

        # lock and hide attributes
        attribute.lockAndHide(["s", "v"], [self._shotCtrl, self._trsCtrl])
        attribute.lockAndHide(["t", "r", "s", "v"], self.rigGrp)

        # clear selection
        cmds.select(cl=True)
Пример #4
0
    def postSetupRig(self):
        '''
        clean up section for the setup rig
        '''
        if common.isValid('%s.displayAxis' % self.masterGuide) or common.isValid(self.masterGuide) != True:
            return True
        #create attributes and lock/hide attrs on top nodes as well as masterGuide control
        displayAttr = attribute.addAttr(self.masterGuide, 'displayAxis', attrType = 'enum', defValue = 'off:on')
        attribute.lockAndHide(['r','t','s','v'], [self.setupRigGrp, self.skeletonGrp,self.guidesGrp, common.getParent(self.masterGuide)])
        attribute.lockAndHide('v', self.masterGuide)
        
        #resize guide controls
        for guide in self.getGuides():
            cmds.setAttr('%s.radius' % common.getShapes(guide, 0), self.controlScale * .5)
        
        #resize masterGuide control
        control.scaleShape(self.masterGuide, scale = [self.controlScale * 2, self.controlScale * 2, self.controlScale * 2])
        
        #declaring skeleton joints
        skeletonJnts = self.getSkeletonJnts()
        
        #connect joints to the attributes on the masterGuide control
        for jnt in skeletonJnts:
            if cmds.objExists(jnt):
                attribute.connect(displayAttr , '%s.displayLocalAxis' % jnt)
                common.setDisplayType(jnt, 'reference')

        #parent all constraints to guides group
        if self.setupConstraints:
            cmds.parent(self.setupConstraints, self.guidesGrp)

        #Put the build attributes onto setup rigs
        '''
        cmds.addAttr(self.setupRigGrp, ln = 'kwargs', dt = "string")
        cmds.setAttr('%s.kwargs' % self.setupRigGrp, str(self._buildAttrs), type = "string")
        '''
        attribute.copy('displayAxis', self.masterGuide, self.name(), reverseConnect = True)
        
        #parent setup under puppet node
        self._puppetNode.addChild(self.setupRigGrp)
        
        if self.parentHook:
            if cmds.objExists(self.parentHook):
                displayLine = control.displayLine(self.masterGuide, self.parentHook, name = self.masterGuide.replace('_%s' % common.GUIDES, '_%s' % common.CURVE))
                cmds.parent(displayLine, self.guidesGrp)

        #set build args on puppet node
        attrs = dict()
        for attr in self.attributes():
            attrs[attr.name()] = attr.value()
        self.puppetNode.storeArgs(**attrs)
Пример #5
0
 def _ikControlSetup(self, drivers):
     '''
     Takes driver joints that drive the IK spine and create controls for them
     
     @param drivers: list of drivers you want to put controls on
     @type drivers: *list* or *tuple* or *str* 
     
     @return: IK controls which were created to drive the driver joints passed in
     @rtype: *list*
     '''
     #create an empty list to store ik controls in so we can return them
     ikControls = list()
     
     drivers = common.toList(drivers)
     
     for i,driver in enumerate(drivers):
         nameDescription = common.getDescription(driver)
         ctrlName = '%s_%s_%s' % (self._getSide(),nameDescription,common.IK)
         ctrl = control.create(ctrlName, type = 'cube',
                               parent = self.controlsGrp,
                               color = common.SIDE_COLOR[self._getSide()])
         ctrlZero = common.getParent(ctrl)
         #driverParent = common.getParent(driver)
         #move control in to position of driver jnt
         transform.matchXform(driver, ctrlZero, 'pose')
         #cmds.parent(ctrlZero, driverParent)
         #cmds.parent(driver, ctrl)
         cmds.parentConstraint(ctrl, driver,mo = True)
         
         
         #connect ik/fk attr from group to  visibility of shapes
         reverse = cmds.createNode('reverse', n = '%s_%s_%s' % (self.name(),
                                                             common.IK,
                                                             common.REVERSE
                                                             ))
         attribute.connect('%s.ikfk' % self.ikFkGroup,'%s.inputX' % reverse)
         for shape in common.getShapes(ctrl):
             if self.ikFkGroup:
                 attribute.connect('%s.outputX' % reverse,
                                   '%s.v' % shape)
             #end if
         #end loop
         
         ikControls.append(ctrl)
         
         
         
     #end loop
         
     return ikControls
     
Пример #6
0
    def _fkControlSetup(self, joints):
        '''
        Creates FK control setup on the input joints
        
        Example:
            ...python:
                    self._fkControlSetup(["jnt1", "jnt2", "jnt3"])
                    #Return: ["ctrl1", "ctrl2", "ctrl3"]
                    
        :param joints: Joints to have controls drive
        :type joints: *list* or *tupple* or *str*
        
        
        '''
        joints = common.toList(joints)
        
        if not isinstance(joints, list) and not isinstance(joints, tuple):
            raise RuntimeError('%s must be a *list* or *tuple*' % joints)
        
        fkCtrls = list()
        parent = self.controlsGrp

        for jnt in joints:            
            ctrl = control.create(name= jnt.split('_%s' % common.JOINT)[0],
                    type = 'circle',
                    parent = parent,
                    color = common.SIDE_COLOR[self._getSide()])

            ctrlParent = common.getParent(ctrl)
            transform.matchXform(jnt, ctrlParent, type = 'pose')
            cmds.parentConstraint(ctrl, jnt, mo = True) #----> might change this to connect rotations and not use translation
            
            #connect visibility of shapes to foot control
            for shape in common.getShapes(ctrl):
                if self.ikFkGroup:
                    attribute.connect('%s.ikfk' % self.ikFkGroup,
                                      '%s.v' % shape)
                #end if
            #end loop

            parent = ctrl
            fkCtrls.append(ctrl)
        #end loop
            
        return fkCtrls
Пример #7
0
 def setupCtrl(self, name, obj, color = None):
     '''
     :param name: The name of control created
     :type name: *str*	
     
     :param obj: object to be controled
     :type obj: str
     
     :param color: object to be controled
     :type color: str
     
     :return: Guide control
     :rtype: str	
     '''
     #create hierarchy
     guideZero = cmds.createNode('transform', n = '%s_%s' % (name, common.ZERO))
     guideShape = cmds.createNode('implicitSphere',n = '%s_%sShape' % (name,common.GUIDES))
     guide = common.getParent(guideShape)
     guide = cmds.rename(guide, name + '_' + common.GUIDES)
     
     #set color
     if color:
         common.setColor(guideShape, color)
     else:
         common.setColor(guideShape, common.SIDE_COLOR[self._getSide()])
     
     #parent guide to zero group
     cmds.parent(guide, guideZero)
     
     cmds.delete(cmds.parentConstraint(obj, guideZero, mo = False))
     
     constraint = cmds.pointConstraint(guide, obj)
     
     cmds.parent([guideZero, constraint[0]],self.masterGuide)
     
     #lock and hide attributes
     attribute.lockAndHide(['r','s', 'v'], guide)
     
     #tag the guide control with a tag_guides attribute
     tagAttr = attribute.addAttr(guide, 'tag_guides', attrType = 'message')
     
     #connect attribute to the setupRigGrp
     attribute.connect('%s.tag_guides' % self.setupRigGrp, tagAttr)
     
     return guide
Пример #8
0
    def build(self):
        """
        build rig hierarchy and attach components
        """
        # if there is no rig node in the scene, we will run the setup first
        if not cmds.ls(type="rig"):
            self.preBuild()
            self.run()

        for node in self.nodes():
            if not isinstance(node, component.Component):
                continue

            if not common.isValid(node.rigGrp):
                node.runRig()

            trsChildren = cmds.listRelatives(self._trsCtrl, c=True)
            if node.controlsGrp in trsChildren:
                continue
            cmds.parent(node.controlsGrp, self._trsCtrl)
            cmds.parent(node.jointsGrp, self.jointsGrp)
            for attr in ["displayJnts", "jointVis"]:
                fullAttrPath = "%s.%s" % (self.rigGrp, attr)
                componentAttr = "%s.%s" % (node.rigGrp, attr)
                if cmds.objExists(componentAttr):
                    if not cmds.objExists(fullAttrPath):
                        attribute.copy(attr, node.rigGrp, self.rigGrp, reverseConnect=False)
                    # end if

                    connectedAttrs = attribute.getConnections(attr, node.rigGrp, incoming=False)
                    if connectedAttrs:
                        for connectedAttr in connectedAttrs:
                            cmds.disconnectAttr(componentAttr, connectedAttr)
                            attribute.connect(fullAttrPath, connectedAttr)
                        # end for
                    # end if
                # end if
            # end for
            cmds.delete(node.rigGrp)
Пример #9
0
    def setupRig(self):
        if super(Hand, self).setupRig():
            return True
        

        if self._getSide() == common.LEFT:
        #move master  guide into position
            cmds.xform(common.getParent(self.masterGuide), ws = True,
                       t = self.handPosition)

            for i,obj in enumerate(self.fingers):
                self.__fingers[obj] = finger.Finger('%s_%s' % (self._getPrefix(),
                                                               obj))
                self.__fingers[obj].initialize(numJoints = self.numJoints,
                                               position=[self.position[0] + 10,
                                                 self.position[1],
                                                 (self.position[2] + 2 )- i],
                                               parent = self.parent)
                self.__fingers[obj].setupRig()

                cmds.parentConstraint(self.masterGuide,
                            common.getParent(self.__fingers[obj].masterGuide),
                            mo = True)
                for guide in self.__fingers[obj].getGuides():
                    #tag the guide control with a tag_guides attribute
                    tagAttr = attribute.addAttr(guide, 'hand_guides',
                                                attrType = 'message')
                    attribute.connect('%s.tag_guides' % self.setupRigGrp,
                                      tagAttr)
                #end loop
            #end loop
        #end if

        elif self._getSide() == common.RIGHT:
        #move master  guide into position
            cmds.xform(common.getParent(self.masterGuide), ws = True, t = self.handPosition)

            for i,obj in enumerate(self.fingers):
                self.__fingers[obj] = finger.Finger('%s_%s' % (self._getPrefix(), obj))
                self.__fingers[obj].initialize(numJoints = self.numJoints, position = [self.position[0] - 10, self.position[1], (self.position[2] + 2 ) - i], parent = self.parent)
                self.__fingers[obj].setupRig()
            
                cmds.parentConstraint(self.masterGuide, common.getParent(self.__fingers[obj].masterGuide), mo = True)
        
                for guide in self.__fingers[obj].getGuides():
                    #tag the guide control with a tag_guides attribute
                    tagAttr = attribute.addAttr(guide, 'hand_guides', attrType = 'message')
                    attribute.connect('%s.tag_guides' % self.setupRigGrp, tagAttr)
                #end loop
            #end loop
        #end elif
        else:
        #move master  guide into position
            cmds.xform(common.getParent(self.masterGuide), ws = True, t = self.handPosition)

            for i,obj in enumerate(self.fingers):
                self.__fingers[obj] = finger.Finger('%s_%s' % (self._getPrefix(), obj))
                self.__fingers[obj].initialize(numJoints = self.numJoints, position = [self.position[0] - 10, self.position[1], (self.position[2] + 2 ) - i], parent = self.parent)
                self.__fingers[obj].setupRig()
            
                cmds.parentConstraint(self.masterGuide, common.getParent(self.__fingers[obj].masterGuide), mo = True)
        
                for guide in self.__fingers[obj].getGuides():
                    #tag the guide control with a tag_guides attribute
                    tagAttr = attribute.addAttr(guide, 'hand_guides', attrType = 'message')
                    attribute.connect('%s.tag_guides' % self.setupRigGrp, tagAttr)
                #end loop
            #end loop
        #end elif
        
        
        #create joint and guide
        if not common.isValid(self.handJoint):
            joint.create(self.handJoint, self.skeletonGrp, self.handPosition)
        if not common.isValid(self.handJoint.replace(common.JOINT,common.CONTROL)):
            self.setupCtrl(self.handGuide,self.handJoint, common.SIDE_COLOR[self._getSide()])
Пример #10
0
    def setupRig(self):
        if super(Chain, self).setupRig():
            return True
        
        self.skinClusterJnts = [self.startJoint, self.endJoint]
                
        if self._getSide() == common.LEFT:
            positions = (
            [self.position[0] + 2, self.position[1], self.position[2]],
            [self.position[0] + 9, self.position[1], self.position[2]]
            )
            
            aimCtrlPosition = [positions[0][0],
                    positions[0][1] + 5,
                    positions[0][2]]
        #end if    
        elif self._getSide() == common.RIGHT:
            positions = (
            [self.position[0] - 2, self.position[1], self.position[2]],
            [self.position[0] - 9, self.position[1], self.position[2]]
            )
            
            aimCtrlPosition = [positions[0][0],
                    positions[0][1] + 5,
                    positions[0][2]]
        #end elif    
            
        else:
            positions = (
            [self.position[0], self.position[1], self.position[2]],
            [self.position[0], self.position[1] + 9, self.position[2]]
            )
            
            aimCtrlPosition = [positions[0][0],
                    positions[0][1],
                    positions[0][2] + 5]
        #end elif
        for i,jnt in enumerate(self.skinClusterJnts):
            if not common.isValid(jnt):
                cmds.joint(n = jnt,position = positions[i])
            
            if i == 0:
                cmds.parent(jnt, self.skeletonGrp)
                #place Master Guide control in the same position
                #  as the first joint
                transform.matchXform(jnt,
                        common.getParent(self.masterGuide),
                        type = 'position')
            else:
                cmds.parent(jnt, self.skinClusterJnts[i - 1])
            #end if/else
                
            ctrl = self.setupCtrl(jnt.replace('_%s' % common.JOINT, ''),jnt)
            #create template control
            #control.createTemplate(ctrl)
            cmds.select(cl = True)
        #end loop
        

        # ----------------------------------------------------------------------
        # CREATE GUIDES
        startJointGuide = self.startJoint.replace(common.JOINT, common.GUIDES)
        endJointGuide   = self.endJoint.replace(common.JOINT, common.GUIDES)



        # ----------------------------------------------------------------------
        # ORIENTATION 
        #
        if self._getSide() == common.RIGHT:
            aimVectorAttr = attribute.switch ('aimVector',
                    node= self.masterGuide,
                    value=4,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])
            upVectorAttr  = attribute.switch ('upVector',
                    node=self.masterGuide,
                    value=3,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])
        else:
            aimVectorAttr = attribute.switch ('aimVector',
                    node=self.masterGuide,
                    value=1,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])

            upVectorAttr  = attribute.switch ('upVector',
                    node=self.masterGuide,
                    value=3,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])
        
        #create in-between joints and guides and make connections 
        step   = 1.0 / (self.numJoints - 1)
        parent = self.startJoint
        for i in range( 1, self.numJoints - 1 ):
            j = '%s_%s_%s_%s_%s' % (self._getPrefix(),
                    common.getDescription(self.name()),
                    common.padNumber(i,3),
                    common.SKINCLUSTER,
                    common.JOINT)
            if not common.isValid(j):
                joint.create( name= j)

            transform.matchXform( self.startJoint,j, type='rotate' )
            ctrl = self.setupCtrl(j.replace('_%s' % common.JOINT, ''),j)
            ctrlParent = common.getParent(ctrl)
            #create point constraint and figure out percentage for position
            constraint = cmds.pointConstraint( self.startJoint,
                    endJointGuide, ctrlParent )[0]

            weightAliasList = cmds.pointConstraint( constraint,
                    q=True,
                    weightAliasList=True)

            cmds.setAttr( '%s.%s' % (constraint, weightAliasList[0]), 1-(step*i) )
            cmds.setAttr( '%s.%s' % (constraint, weightAliasList[1]),  step*i )

            #adding the joint to skincluster joints list
            self.skinClusterJnts.insert(-1, j)
            relatives = cmds.listRelatives(j, p = True)
            if not relatives:
                cmds.parent(j, parent)
            parent = j

            if i == self.numJoints - 2:
                cmds.parent(self.endJoint, j)
                constraint = cmds.orientConstraint(j, self.endJoint)[0]
                #add constraints to setup constraint list
                self._addSetupConstraints(constraint)


        #create aim control
        aimLocator = self._createAimLocator(aimCtrlPosition,
                color = common.SIDE_COLOR_SECONDARY[self._getSide()])
        
        #create aim constraints
        for i, jnt in enumerate(self.skinClusterJnts):
            if jnt == self.endJoint:
                break
            constraint = cmds.aimConstraint(
                    self.skinClusterJnts[i+1].replace('_%s' % common.JOINT, '_%s' % common.GUIDES),
                    jnt,
                    worldUpType = "object",
                    worldUpObject = aimLocator)[0]

            attribute.connect(aimVectorAttr, '%s.aimVector' % constraint)
            attribute.connect(upVectorAttr, '%s.upVector' % constraint)
            #add constraints to setup constraint list
            self._addSetupConstraints(constraint)
Пример #11
0
    def setupRig(self):
        if super(Limb,self).setupRig():
            return True

        self.skinClusterJnts = [ self.startJoint,
                                 self.midJoint,
                                 self.tipJoint,
                                 self.endJoint ]

        if self._getSide() == common.LEFT:
            positions = (
            [self.position[0] + 2, self.position[1], self.position[2]],
            [self.position[0] + 5, self.position[1], self.position[2] - 1],
            [self.position[0] + 8, self.position[1], self.position[2]],
                [self.position[0] + 9, self.position[1], self.position[2]]
            )
        elif self._getSide() == common.RIGHT:
            positions = (
            [self.position[0] - 2, self.position[1], self.position[2]],
            [self.position[0] - 5, self.position[1], self.position[2] - 1],
            [self.position[0] - 8, self.position[1], self.position[2]],
            [self.position[0] - 9, self.position[1], self.position[2]]
            )
        else:
            positions = (
            [self.position[0] - 2, self.position[1], self.position[2]],
            [self.position[0] - 5, self.position[1], self.position[2] - 1],
            [self.position[0] - 8, self.position[1], self.position[2]],
            [self.position[0] - 9, self.position[1], self.position[2]]
            )

        for i,jnt in enumerate(self.skinClusterJnts):
            if not common.isValid(jnt):
                cmds.joint(n = jnt,position = positions[i])

            if i == 0:
                cmds.parent(jnt, self.skeletonGrp)
                #place Master Guide control in the same position as the first joint
                transform.matchXform(jnt, common.getParent(self.masterGuide), type = 'position')
            else:
                cmds.parent(jnt, self.skinClusterJnts[i - 1])

            ctrl = self.setupCtrl(jnt.replace('_%s' % common.JOINT, ''),jnt)
            #create template control
            #control.createTemplate(ctrl)
            cmds.select(cl = True)


        # ----------------------------------------------------------------------
        # CREATE GUIDES
        startJointGuide = self.startJoint.replace(common.JOINT, common.GUIDES)
        midJointGuide   = self.midJoint.replace(common.JOINT, common.GUIDES)
        tipJointGuide   = self.tipJoint.replace(common.JOINT, common.GUIDES)
        endJointGuide   = self.endJoint.replace(common.JOINT, common.GUIDES)

        #templateNullGroup = cmds.createNode('transform', n = endJointGuide.replace(common.GUIDES, common.GROUP))
        #transform.matchXform(locator, endJointGuide, type = 'position')
        #cmds.pointConstraint(tipJointGuide, templateNullGroup)
        #cmds.parent(templateNullGroup, self.guidesGrp)
        #control.createTemplate(templateNullGroup, defaultType = 'implicitSphere')


        # ----------------------------------------------------------------------
        # ORIENTATION 
        #
        if self._getSide() == common.RIGHT:
            aimVectorAttr = \
                attribute.switch ('aimVector',
                    node= self.masterGuide,
                    value=4,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])

            upVectorAttr  = \
                attribute.switch ('upVector',
                    node=self.masterGuide,
                    value=3,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])
        else:
            aimVectorAttr = \
                attribute.switch ('aimVector',
                    node=self.masterGuide,
                    value=1,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])

            upVectorAttr  = \
                attribute.switch ('upVector',
                    node=self.masterGuide,
                    value=3,
                    choices=['x','y','z','-x','-y','-z'],
                    outputs=[(1,0,0),(0,1,0),(0,0,1),(-1,0,0),(0,-1,0),(0,0,-1)])

        #Get Vectors for the cross product
        #Decompose matrix nodes 
        startJointDcm = \
            cmds.createNode('decomposeMatrix',
                name = self.startJoint.replace('%s_%s' % (common.SKINCLUSTER, common.JOINT), common.DECOMPOSEMATRIX ))

        attribute.connect('%s.worldMatrix' % startJointGuide,'%s.inputMatrix' % startJointDcm)

        midJointDcm = \
            cmds.createNode('decomposeMatrix', name = self.midJoint.replace('%s_%s' % (common.SKINCLUSTER, common.JOINT), common.DECOMPOSEMATRIX ))

        attribute.connect('%s.worldMatrix' % midJointGuide, '%s.inputMatrix' % midJointDcm)

        tipJointDcm = \
            cmds.createNode('decomposeMatrix', name = self.tipJoint.replace('%s_%s' % (common.SKINCLUSTER, common.JOINT), common.DECOMPOSEMATRIX ))
        attribute.connect('%s.worldMatrix' % tipJointGuide, '%s.inputMatrix' % tipJointDcm)

        #plus minus average nodes
        v1Node = cmds.createNode('plusMinusAverage')
        v2Node = cmds.createNode('plusMinusAverage')
        cmds.setAttr('%s.operation' % v1Node, 2)
        cmds.setAttr('%s.operation' % v2Node, 2)

        #connect Decompose Matrix and Plus Minus Average nodes
        attribute.connect('%s.outputTranslate' % tipJointDcm, '%s.input3D[0]' % v1Node)
        attribute.connect('%s.outputTranslate' % startJointDcm, '%s.input3D[1]' % v1Node)
        attribute.connect('%s.outputTranslate' % midJointDcm, '%s.input3D[0]' % v2Node)
        attribute.connect('%s.outputTranslate' % startJointDcm, '%s.input3D[1]' % v2Node)

        #Get the cross product
        crossNode = cmds.createNode('vectorProduct')
        cmds.setAttr( '%s.%s' % (crossNode,'operation') , 2 )
        attribute.connect( '%s.%s' % (v1Node,'output3D'), '%s.%s' % (crossNode,'input1') )
        attribute.connect( '%s.%s' % (v2Node,'output3D'), '%s.%s' % (crossNode,'input2') )
        crossVectorAttr = '%s.%s' % (crossNode,'output')

        #Aim start joint to the middle joint
        constraint = \
            cmds.aimConstraint(midJointGuide,
                    self.startJoint,
                    aimVector = (1,0,0),
                    upVector = (0,1,0),
                    worldUpType = 'vector',
                    worldUpVector = (0,1,0))[0]

        attribute.connect(aimVectorAttr, '%s.aimVector' % constraint)
        attribute.connect(upVectorAttr, '%s.upVector' % constraint)
        attribute.connect(crossVectorAttr, '%s.worldUpVector' % constraint)
        self.setupConstraints.append(constraint)

        #Aim middle joint to the tip joint
        constraint = \
            cmds.aimConstraint(tipJointGuide,
                    self.midJoint,
                    aimVector = (1,0,0),
                    upVector = (0,1,0),
                    worldUpType = 'vector',
                    worldUpVector = (0,1,0))[0]

        attribute.connect(aimVectorAttr, '%s.aimVector' % constraint)
        attribute.connect(upVectorAttr, '%s.upVector' % constraint)
        attribute.connect(crossVectorAttr, '%s.worldUpVector' % constraint)
        self.setupConstraints.append(constraint)

        constraint = cmds.orientConstraint(self.midJoint, self.tipJoint)[0]
        self.setupConstraints.append(constraint)

        cmds.setAttr('%s.normalizeOutput' % crossNode, True)

        self.upTwistJnts = list()
        step   = 1.0 / (self.numSegments + 1)
        parent = self.startJoint
        for i in range( 1, self.numSegments + 1 ):
            j = joint.create( name='%s' % (self.startJoint.replace('_%s' % common.SKINCLUSTER, 'Twist_%s_%s' % (common.padNumber(i,3), common.SKINCLUSTER))), parent=parent )
            transform.matchXform( self.startJoint,j, type='rotate' )
            constraint = cmds.pointConstraint( self.startJoint, self.midJoint, j )[0]
            weightAliasList = cmds.pointConstraint( constraint, q=True, weightAliasList=True )
            cmds.setAttr( '%s.%s' % (constraint, weightAliasList[0]), 1-(step*i) )
            cmds.setAttr( '%s.%s' % (constraint, weightAliasList[1]),  step*i )
            self.upTwistJnts.append(j)
            self.skinClusterJnts.append(j) #adding the joint to skincluster joints list

        # Create MiddleJoint Segments
        self.loTwistJnts = list()
        parent = self.midJoint
        for i in range( 1, self.numSegments + 1):
            j = joint.create( name='%s' % (self.midJoint.replace('_%s' % common.SKINCLUSTER, 'Twist_%s_%s' % (common.padNumber(i,3), common.SKINCLUSTER))), parent=parent )
            transform.matchXform( self.midJoint,j, type='rotate' )
            constraint = cmds.pointConstraint( self.midJoint, self.tipJoint, j )[0]
            weightAliasList = cmds.pointConstraint( constraint, q=True, weightAliasList=True )
            cmds.setAttr( '%s.%s' % (constraint, weightAliasList[0]), 1-(step*i) )
            cmds.setAttr( '%s.%s' % (constraint, weightAliasList[1]),  step*i )
            self.loTwistJnts.append(j)
            self.skinClusterJnts.append(j) #adding the joint to skincluster joints list
Пример #12
0
    def rig(self):
        if not self._puppetNode:
            self.runSetupRig()
        if cmds.objExists('%s.master_guide' % self.setupRigGrp):
            self.masterGuide = attribute.getConnections('master_guide', self.setupRigGrp)[0].split('.')[0]
        if common.isValid(self.masterGuide):
            #get orientations for controls
            fkOrient  = self.__fkOrient()
            ikOrient  = self.__ikOrient()
            upVector  = self.upVector
            aimVector = self.aimVector

        #call parent class rig function
        if super(Limb, self).rig():
            return True
        
        #create ik fk switch
        ikfkDict = ikfk.create(jointChain = [self.startJoint, self.midJoint, self.tipJoint], stretch = self.stretch)
        ikfkDict['group'] = cmds.rename(ikfkDict['group'], '%s_%s' % (self.name(),ikfkDict['group']))

        #set the visibility on the ik/fk/blend joints to off
        cmds.setAttr('%s.v' % ikfkDict['fkJoints'][0], 0)
        cmds.setAttr('%s.v' % ikfkDict['ikJoints'][0], 0)
        cmds.setAttr('%s.v' % ikfkDict['blendJoints'][0], 0)

        ikfkAttr = attribute.addAttr(self.rigGrp, attr = 'ikfk', attrType = 'enum', defValue = ['off','on'],value = 0)

        cmds.connectAttr(ikfkAttr, '%s.ikfk' % ikfkDict['group'], l = True, f = True)

        #parent ikfk group under joints group
        cmds.parent(ikfkDict['group'], self.jointsGrp)

        #rename all ik and blend joints
        for i,jnt in enumerate(ikfkDict['ikJoints']):
            jnt = cmds.rename(jnt, jnt.replace('%s_%s_%s' % (common.SKINCLUSTER,common.JOINT, common.IK), '%s_%s' % (common.IK, common.JOINT)))
            ikfkDict['ikJoints'][i] = jnt

        for i,jnt in enumerate(ikfkDict['blendJoints']):
            jnt = cmds.rename(jnt, jnt.replace('%s_%s_%s' % (common.SKINCLUSTER,common.JOINT, common.BLEND), '%s_%s' % (common.BLEND, common.JOINT)))
            ikfkDict['blendJoints'][i] = jnt

        #create ik setup
        ikCtrl = control.create(name = ikfkDict['ikJoints'][2].replace('_%s' % common.JOINT, ''),type = 'cube', parent = self.controlsGrp, color = common.SIDE_COLOR[self._getSide()])
        ikCtrlZero = common.getParent(ikCtrl)
        attribute.copy('stretch', ikfkDict['group'], destination = ikCtrl, connect = True,reverseConnect = False)
        attribute.copy('stretchTop', ikfkDict['group'], destination = ikCtrl, connect = True,reverseConnect = False)
        attribute.copy('stretchBottom', ikfkDict['group'], destination = ikCtrl, connect = True,reverseConnect = False)

        if ikOrient == 'Local':
            transform.matchXform(ikfkDict['ikJoints'][2], ikCtrlZero, type = 'pose')
        else:
            transform.matchXform(ikfkDict['ikJoints'][2], ikCtrlZero, type = 'position')
            cmds.orientConstraint(ikCtrl, ikfkDict['ikJoints'][2], mo = True)
            common.setColor(ikCtrl, common.SIDE_COLOR[self._getSide()])

            #setup poleVector
            pvCtrl = control.create(name = ikfkDict['ikJoints'][2].replace('_%s' % common.JOINT, '_%s' % common.POLEVECTOR),type = 'cube', parent = self.controlsGrp, color = common.SIDE_COLOR[self._getSide()])
            #size polevector control

        for i in range(len(common.getShapes(pvCtrl))):
            control.scaleShape(pvCtrl, scale = [self.controlScale * .5, self.controlScale * .5, self.controlScale * .5], index = i)

        pvCtrlZero = common.getParent(pvCtrl)
        pvDisplayLineAttr = attribute.addAttr(pvCtrl, attr = 'pvLine', attrType = 'enum', defValue = 'off:on', value = 1)
        transform.matchXform(ikfkDict['ikJoints'][1], pvCtrlZero, type = 'position')
        #cmds.parent(ikfkDict['ikHandle'], w = True)
        pvPos = ikfk.getPoleVectorPosition(ikfkDict['ikJoints'][1], ikfkDict['ikHandle'])
        cmds.xform(pvCtrlZero, ws = True, t = pvPos)
        common.setColor(pvCtrlZero, common.SIDE_COLOR[self._getSide()])

        #create polevector constraint and parent under control
        cmds.poleVectorConstraint(pvCtrl, ikfkDict['ikHandle'])
        targetConstraint = cmds.pointConstraint(ikCtrl, ikfkDict['targetJnts'][1], mo = True) #ikhandle is under target joint
        pvDisplayLine = control.displayLine(ikfkDict['ikJoints'][0], pvCtrl, name = pvCtrl.replace(common.CONTROL, common.DISPLAYLINE), parent = self.controlsGrp)


        cmds.orientConstraint(ikCtrl,ikfkDict['ikJoints'][0], mo = True)

        #adding attribute to ik ctrl
        ikTwistAttr = attribute.addAttr(ikCtrl, attr = 'twist')
        cmds.connectAttr(ikTwistAttr, '%s.twist' % ikfkDict['ikHandle'], f = True)

        #connecting to shapes
        ikfkReverse = cmds.createNode('reverse', n = ikCtrl.replace('%s_%s' % (common.IK, common.CONTROL), '%s_%s' % (common.REVERSE, common.UTILITY)))
        attribute.connect('%s.ikfk' % ikfkDict['group'], '%s.inputX' % ikfkReverse)
        for shape in common.getShapes(ikCtrl):
            attribute.connect('%s.outputX' % ikfkReverse,'%s.v' % shape)

        for shape in common.getShapes(pvCtrl):
            attribute.connect('%s.outputX' % ikfkReverse,'%s.v' % shape)

        #connect pvDisplayLineAttr in pvDisplayLine visibility
        displayLineMultiply = cmds.createNode('multiplyDivide', n = pvDisplayLine.replace(common.DISPLAYLINE, common.MULTIPLYDIVIDE))
        attribute.connect(pvDisplayLineAttr, '%s.input1X' % displayLineMultiply)
        attribute.connect('%s.outputX' % ikfkReverse, '%s.input2X' % displayLineMultiply)
        attribute.connect('%s.outputX' % displayLineMultiply, '%s.v' % common.getChildren(pvDisplayLine)[0])

        #create fk setup
        fkCtrls = list()
        parent = self.controlsGrp
        for i,jnt in enumerate(ikfkDict['fkJoints']):
            cmds.select(cl = True)
            #rename fk joint
            jnt = cmds.rename(jnt,jnt.replace('%s_%s_%s' % (common.SKINCLUSTER,common.JOINT,common.FK), '%s_%s' % (common.FK,common.JOINT)))
            ikfkDict['fkJoints'][i] = jnt #re-assign fk joint intop ikfkDict
            #create controls, set color, and make connections
            fkCtrl = control.create(name = jnt.replace('_%s' % common.JOINT, ''),type = 'circle', parent = parent, color = common.SIDE_COLOR[self._getSide()])
            fkCtrlZero = common.getParent(fkCtrl)
            
            if fkOrient == 'Local':
                transform.matchXform(jnt, fkCtrlZero, type = 'pose')
            #end if
            else:
                transform.matchXform(jnt, fkCtrlZero, type = 'position')
            #end else
            
            cmds.connectAttr('%s.ikfk' % ikfkDict['group'], '%s.v' % common.getShapes(fkCtrl)[0], f = True)
            cmds.parentConstraint(fkCtrl, jnt, mo = True)
            attribute.lockAndHide('t', fkCtrl)
            attribute.lockAndHide('s', fkCtrl)
            attribute.lockAndHide('v', fkCtrl)
            #get joint rotate order and apply to control and parent group
            rotateOrder = attribute.getValue('rotateOrder', jnt)
            for node in [fkCtrl, fkCtrlZero]:
                cmds.setAttr('%s.rotateOrder' % node, rotateOrder)
    
                fkCtrls.append(fkCtrl)
                parent = fkCtrl
            #end loop
        #end loop

        aimAxis = transform.getAimAxis(ikfkDict['blendJoints'][0], allowNegative = False)    
        #Up Twist Joint Setup
        if self.upTwistJnts:
            noTwistJnt = common.duplicate(self.startJoint, name = self.startJoint.replace('%s' % common.SKINCLUSTER, 'NoTwist_%s' % common.SKINCLUSTER), parent = self.startJoint)

            inverseMultNode = cmds.createNode('multiplyDivide', n = noTwistJnt.replace('%s_%s' % (common.SKINCLUSTER,common.JOINT), '%s_%s' % (common.UTILITY, common.MULTIPLYDIVIDE)))
            cmds.connectAttr('%s.r%s' % (ikfkDict['blendJoints'][0], aimAxis), '%s.input1X' % inverseMultNode, f = True)
            cmds.setAttr('%s.input2X' % inverseMultNode, -1)
            cmds.connectAttr('%s.outputX' % inverseMultNode, '%s.r%s' % (noTwistJnt, aimAxis), f = True)


            step   = 1.0 / (len(self.upTwistJnts) +1)
            for i in range( 1, (len(self.upTwistJnts)+1) ):
                twsitMultNode = cmds.createNode('multiplyDivide', n = self.upTwistJnts[i - 1].replace('%s_%s' % (common.SKINCLUSTER,common.JOINT), '%s_%s' % (common.UTILITY, common.MULTIPLYDIVIDE)))
                cmds.connectAttr('%s.r%s' % (ikfkDict['blendJoints'][0], aimAxis), '%s.input1X' % twsitMultNode, f = True)
                cmds.setAttr('%s.input2X' % twsitMultNode, -(1-(step*i))  )
                cmds.connectAttr('%s.outputX' % twsitMultNode, '%s.r%s' % (self.upTwistJnts[i -1], aimAxis),f = True)
            #end loop

            self.upTwistJnts.insert(0, noTwistJnt)
        #end if

        if self.loTwistJnts:
            twistJnt = common.duplicate(self.midJoint,name = self.midJoint.replace('%s' % common.SKINCLUSTER, 'loTwist_%s' % common.SKINCLUSTER), parent = self.midJoint)
            constraint = cmds.aimConstraint(ikfkDict['blendJoints'][2],twistJnt,aimVector =  aimVector, upVector  = upVector,  worldUpType ="objectrotation", worldUpVector = upVector, worldUpObject = self.tipJoint)
            cmds.setAttr('%s.v' % twistJnt, 0)
        #end if

        step   = 1.0 / (len(self.loTwistJnts) +1)
        for i in range( 1, (len(self.loTwistJnts)+1) ):
            twsitMultNode = cmds.createNode('multiplyDivide', n = self.loTwistJnts[i - 1].replace('%s_%s' % (common.SKINCLUSTER,common.JOINT), '%s_%s' % (common.UTILITY, common.MULTIPLYDIVIDE)))
            cmds.connectAttr('%s.r%s' % (ikfkDict['blendJoints'][2], aimAxis), '%s.input1X' % twsitMultNode, f = True)
            cmds.setAttr('%s.input2X' % twsitMultNode, 1-(step*i) )
            cmds.connectAttr('%s.outputX' % twsitMultNode, '%s.r%s' % (self.loTwistJnts[i -1], aimAxis),f = True)
        #end loop

        #------------------------
        #Add to class variables
        #------------------------
        #assign joints to the joints list
        self.joints = {'ik' : ikfkDict['ikJoints'], 'fk' : ikfkDict['fkJoints'], 'blend' : ikfkDict['blendJoints'], 'target' : ikfkDict['targetJnts']}
        #assign controls to the controls list
        #assign fkCtrls into the controls dictionary 
        self.controls = {'ik' : [ikCtrl, pvCtrl],'fk' : fkCtrls }
        self.ikfkGroup = ikfkDict['group']
        #assign hooks
        self.hookRoot = [ikfkDict['ikJoints'][0], common.getParent(fkCtrls[0]), ikCtrl, ikfkDict['targetJnts'][-1]]
        self.hookPoint = [ikfkDict['blendJoints'][-1]]
        #add no twist joint to the skincluster list
        self.skinClusterJnts.append(noTwistJnt)
Пример #13
0
    def rig(self):
        if not self._puppetNode:
            self.runSetupRig()
        
        if common.isValid('%s_%s%s' % (self.name(), common.IK, common.FK)):
            return True
        
        cmds.parent([self.__bankInPivot,
                self.__bankOutPivot,
                self.__heelPivot],
                w = True)

        if super(Foot,self).rig():
            return True

        #create foot ik/fk chain and parent group to joints group
        self.__footIkFk = \
                ikfk.IkFkFoot(self.ankleJoint,
                        self.toeJoint,
                        name = self.name())

        #list the groups for the foot ik setup
        self.__footRollGroups.insert(0, 'anklePivot')
        footRollGrpList = self.__footRollGroups

        #create foot setup
        self.__footIkFk.create(searchReplace = '%s' % common.SKINCLUSTER,
                footRollGrpList = footRollGrpList)

        #parent to joints group
        cmds.parent(self.__footIkFk.group, self.jointsGrp)

        #get position of joints
        anklePosition    = \
            cmds.xform(self.ankleJoint, q = True, ws = True, rp = True)

        ballPosition     = \
            cmds.xform(self.ballJoint, q = True, ws = True, rp = True)

        toePosition      = \
            cmds.xform(self.toeJoint, q = True, ws = True, rp = True)

        bankInPosition   = \
            cmds.xform(self.__bankInPivot, q = True, ws = True, rp = True)

        bankOutPosition  = \
            cmds.xform(self.__bankOutPivot, q = True, ws = True, rp = True)

        heelPosition     = \
            cmds.xform(self.__heelPivot, q = True, ws = True, rp = True)

        #delete pivot joints
        for jnt in (self.__heelPivot,self.__bankOutPivot, self.__bankInPivot):
            cmds.delete(jnt)
        #end loop

        #get foot roll groups
        footRollGroups = self.__footIkFk.getFootRolls()
        handles = self.__footIkFk.getIkHandles()

        #position foot roll groups
        for grp in footRollGroups:
            if grp in ['ballRoll', 'toeBend']:
                cmds.xform(footRollGroups[grp], ws = True, rp = ballPosition)
            elif grp in ['heelRoll', 'heelPivot']:
                if grp == self.__heelPivotName:
                    cmds.setAttr('%s.rotateOrder' % footRollGroups[grp], 2)
                cmds.xform(footRollGroups[grp], ws = True, rp = heelPosition)
            elif grp in ['toeRoll', 'toePivot']: 
                cmds.xform(footRollGroups[grp], ws = True, rp = toePosition)
            elif grp in ['bankIn', self.__bankInZero]: 
                cmds.xform(footRollGroups[grp], ws = True, rp = bankInPosition)
            elif grp in ['bankOut', self.__bankOutZero]: 
                cmds.xform(footRollGroups[grp], ws = True, rp = bankOutPosition)
                cmds.setAttr('%s.rotateOrder' % footRollGroups[grp], 2)
            elif grp in ['anklePivot']: 
                cmds.xform(footRollGroups[grp], ws = True, rp = anklePosition)
        #end loop


        #create controls
        self.__footCtrl      = \
            control.create(name= self.name(),
                    type = 'implicitSphere',
                    parent = self.controlsGrp,
                    color = common.SIDE_COLOR[self._getSide()])

        self.__bankInCtrl    = \
            control.create(name= footRollGroups[self.__bankIn] ,
                    type = 'implicitSphere',
                    parent = self.controlsGrp,
                    color = common.SIDE_COLOR_SECONDARY[self._getSide()])

        self.__bankOutCtrl   = \
            control.create(name= footRollGroups[self.__bankOut] ,
                    type = 'implicitSphere',
                    parent = self.controlsGrp,
                    color = common.SIDE_COLOR_SECONDARY[self._getSide()])

        self.__heelPivotCtrl = \
            control.create(name= footRollGroups[self.__heelPivotName] ,
                    type = 'implicitSphere',
                    parent = self.controlsGrp,
                    color = common.SIDE_COLOR_SECONDARY[self._getSide()])

        #parent of controls
        parentBankOutCtrl   = common.getParent(self.__bankOutCtrl)
        parentBankInCtrl    = common.getParent(self.__bankInCtrl)
        parentHeelPivotCtrl = common.getParent(self.__heelPivotCtrl)

        #scale controls
        for ctrl in [self.__footCtrl,self.__bankOutCtrl, self.__bankInCtrl, self.__heelPivotCtrl]:
            for i in range(len(common.getShapes(ctrl))):
                control.scaleShape (ctrl, scale = [.3, .3, .3], index = i)


        #place controls in correct positions
        transform.matchXform(self.ankleJoint,
                common.getParent(self.__footCtrl),
                type = 'pose')

        cmds.xform(common.getParent(self.__footCtrl),
                ws = True,
                r = True,
                t = [0,0,-2])

        cmds.delete(cmds.parentConstraint(footRollGroups['bankIn'],
                parentBankInCtrl))

        cmds.delete(cmds.parentConstraint(footRollGroups['bankOut'],
                parentBankOutCtrl))

        cmds.delete(cmds.parentConstraint(footRollGroups['heelPivot'],
                parentHeelPivotCtrl))

        #Decompose matrix nodes for pivots and connect the controls to them
        for ctrl, grp in zip([self.__bankInCtrl, self.__bankOutCtrl, self.__heelPivotCtrl] , [footRollGroups['bankIn'], footRollGroups['bankOut'], footRollGroups[self.__heelRoll]]):
            grpZero = common.getChildren(grp)[0]

            dcm = cmds.createNode('decomposeMatrix',
                    n = '%s_%s' % (grp, common.DECOMPOSEMATRIX))

            mdn = cmds.createNode('multiplyDivide',
                    n = '%s_%s' % (grp, common.MULTIPLYDIVIDE))

            attribute.connect('%s.worldMatrix[0]' % ctrl, '%s.inputMatrix' % dcm)

            #connect controls to pivots
            attribute.connect('%s.outputTranslate' % dcm, '%s.rotatePivot' % grp)
            attribute.connect('%s.outputTranslate' % dcm, '%s.rotatePivot' % grpZero)
            #Change attributes on Multiply divide node and make connections
            cmds.setAttr('%s.input2Y' % mdn, -1)
            attribute.connect('%s.ry' % ctrl, '%s.input1Y' % mdn)
            attribute.connect('%s.outputY' % mdn, '%s.ry' % grpZero)
            attribute.connect('%s.ry' % ctrl, '%s.ry' % grp)


        #parent constrain the foot control to the ankle joint
        for node in [self.__footCtrl,parentBankOutCtrl,  parentBankInCtrl, parentHeelPivotCtrl]:
            cmds.parentConstraint(footRollGroups['anklePivot'], node, mo = True)


        #add attributes to the foot control and connect them to the pivots
        ikfkAttr      = \
            attribute.addAttr(self.__footCtrl,
                    'ikfk' ,
                    attrType = 'enum',
                    defValue = ['off', 'on'],
                    value = 0)

        bankAttr      = \
            attribute.addAttr(self.__footCtrl,
                    'bank' ,
                    attrType = 'double',
                    defValue = 0,
                    min = -10,
                    max = 10)

        ballRollAttr  = \
            attribute.addAttr(self.__footCtrl,
                    self.__ballRoll ,
                    attrType = 'double',
                    defValue = 0,
                    min = 0,
                    max = 10)

        toeRollAttr   = \
            attribute.addAttr(self.__footCtrl,
                    self.__toeRoll ,
                    attrType = 'double',
                    defValue = 0,
                    min = 0,
                    max = 10)

        toePivotAttr  = \
            attribute.addAttr(self.__footCtrl,
                    self.__toePivot ,
                    attrType = 'double',
                    defValue = 0,
                    min = -10,
                    max = 10)

        toeBendAttr   = \
            attribute.addAttr(self.__footCtrl,
                    self.__toeBend ,
                    attrType = 'double',
                    defValue = 0,
                    min = -10,
                    max = 10)

        heelRollAttr  = \
            attribute.addAttr(self.__footCtrl,
                    self.__heelRoll ,
                    attrType = 'double',
                    defValue = 0,
                    min = -10,
                    max = 0)

        heelPivotAttr = \
            attribute.addAttr(self.__footCtrl,
                    self.__heelPivotName ,
                    attrType = 'double',
                    defValue = 0,
                    min = -10,
                    max = 10)

        self.__footRollAttrs.extend([ikfkAttr,
                bankAttr,
                ballRollAttr,
                toeRollAttr ,
                toePivotAttr,
                toeBendAttr,
                heelRollAttr,
                heelPivotAttr])

        #create remap dictionary to place remap nodes in based on foot roll group names
        ramapNodes = dict()

        #create remap nodes and connect them to foot roll groups
        for attr in [bankAttr,toePivotAttr,toeBendAttr,heelPivotAttr]:
            node, attrName = attr.split('.')
            ramapNodes[attrName] = \
                cmds.createNode('remapValue',
                        n = '%s_%s_%s' % (node, attrName, common.REMAP))

            attribute.connect(attr, '%s.inputValue' % ramapNodes[attrName])
            cmds.setAttr('%s.outputMax' % ramapNodes[attrName], 100)
            cmds.setAttr('%s.outputMin' % ramapNodes[attrName], -100)
            cmds.setAttr('%s.inputMax' % ramapNodes[attrName], 10)
            cmds.setAttr('%s.inputMin' % ramapNodes[attrName], -10)
        #end loop

        for attr in [ballRollAttr,toeRollAttr, heelRollAttr]:
            node, attrName = attr.split('.')
            ramapNodes[attrName] = \
                cmds.createNode('remapValue',
                        n = '%s_%s_%s' % (node, attrName, common.REMAP))
            attribute.connect(attr, '%s.inputValue' % ramapNodes[attrName])
            cmds.setAttr('%s.outputMax' % ramapNodes[attrName], 100)
            cmds.setAttr('%s.outputMin' % ramapNodes[attrName], 0)
            cmds.setAttr('%s.inputMax' % ramapNodes[attrName], 10)
            cmds.setAttr('%s.inputMin' % ramapNodes[attrName], 0)

            if attr == heelRollAttr:
                cmds.setAttr('%s.outputMax' % ramapNodes[attrName], 0)
                cmds.setAttr('%s.outputMin' % ramapNodes[attrName], -100)
                cmds.setAttr('%s.inputMax' % ramapNodes[attrName], 0)
                cmds.setAttr('%s.inputMin' % ramapNodes[attrName], -10)
            #end if
        #end loop

        #connect remap nodes to roll groups    
        #---Bank In/Out---
        if self._getSide() == common.LEFT:
            attribute.connect('%s.outValue' % ramapNodes['bank'],
                              '%s.rz' % footRollGroups[self.__bankIn])

            attribute.connect('%s.outValue' % ramapNodes['bank'],
                              '%s.rz' % footRollGroups[self.__bankOut])

            cmds.transformLimits(footRollGroups[self.__bankIn],
                    rz =[0, 100],
                    erz = [1, 1])

            cmds.transformLimits(footRollGroups[self.__bankOut],
                    rz =[-100, 0],
                    erz = [1, 1])
        elif self._getSide() == common.RIGHT:
            invertMDN = \
                cmds.createNode('multiplyDivide',
                        n = '%s_bankInvert_%s' % (self._getSide(),
                        common.MULTIPLYDIVIDE))

            cmds.setAttr('%s.input2X' % invertMDN, -1)
            attribute.connect('%s.outValue' % ramapNodes['bank'],
                    '%s.input1X' % invertMDN)

            attribute.connect('%s.outputX' % invertMDN,
                    '%s.rz' % footRollGroups[self.__bankIn])

            attribute.connect('%s.outputX' % invertMDN,
                    '%s.rz' % footRollGroups[self.__bankOut])

            cmds.transformLimits(footRollGroups[self.__bankIn],
                    rz =[-100, 0],
                    erz = [1, 1])

            cmds.transformLimits(footRollGroups[self.__bankOut],
                    rz =[0, 100],
                    erz = [1, 1])

        #---Ball Roll---
        attribute.connect('%s.outValue' % ramapNodes[self.__ballRoll],
                '%s.rx' % footRollGroups[self.__ballRoll])
        #---Toe Roll---
        attribute.connect('%s.outValue' % ramapNodes[self.__toeRoll],
                '%s.rx' % footRollGroups[self.__toeRoll])
        #---Toe Pivot---
        attribute.connect('%s.outValue' % ramapNodes[self.__toePivot],
                '%s.ry' % footRollGroups[self.__toePivot])
        #---Heel Roll---
        attribute.connect('%s.outValue' % ramapNodes[self.__heelRoll],
                '%s.rx' % footRollGroups[self.__heelRoll])
        #---Heel Pivot---
        attribute.connect('%s.outValue' % ramapNodes[self.__heelPivotName],
                '%s.ry' % footRollGroups[self.__heelPivotName])
        #---IK/FK---
        attribute.connect(ikfkAttr,
                '%s.ikfk' % self.__footIkFk.group)
        #---Ball Roll---
        attribute.connect('%s.outValue' % ramapNodes[self.__toeBend],
                '%s.rx' % footRollGroups[self.__toeBend])

        #connect fk joints to the ankle pivot
        #cmds.parentConstraint(footRollGroups['anklePivot'], self.__footIkFk.fkJoints[0], mo = True)

        #connecting visibility of control shapes to the controls
        ikfkReverse = \
            cmds.createNode('reverse', n = '%s_%s' % (self.name(),common.REVERSE))

        attribute.connect(ikfkAttr, '%s.inputX' % ikfkReverse)

        for ikCtrl in [self.__bankInCtrl,self.__bankOutCtrl,self.__heelPivotCtrl]:
            cmds.setAttr('%s.rotateOrder' % ikCtrl, 2)
            for shape in common.getShapes(ikCtrl):
                if shape:
                    attribute.connect('%s.outputX' % ikfkReverse, '%s.v' % shape)

        #----FK Setup---
        fkCtrls = list()
        parent = self.controlsGrp
        for jnt in self.__footIkFk.fkJoints:
            if jnt == self.__footIkFk.fkJoints[-1]:
                continue
            #end if

            ctrl = \
                control.create(name= jnt.split('_%s' % common.JOINT)[0],
                        type = 'circle',
                        parent = parent,
                        color = common.SIDE_COLOR[self._getSide()])

            ctrlParent = common.getParent(ctrl)
            transform.matchXform(jnt, ctrlParent, type = 'pose')
            cmds.parentConstraint(ctrl, jnt, mo = True) #----> might change this to connect rotations and not use translation
            if jnt == self.__footIkFk.fkJoints[0]:
                cmds.parentConstraint(footRollGroups['anklePivot'],
                    ctrlParent,
                    mo = True)
            #end if

            #connect visibility of shapes to foot control
            for shape in common.getShapes(ctrl):
                attribute.connect(ikfkAttr, '%s.v' % shape)
            #end for    
            parent = ctrl
            fkCtrls.append(ctrl)

        #assign hooks
        self.hookRoot.extend([footRollGroups['anklePivot'], common.getParent(fkCtrls[0])])
        self.hookPoint.extend([footRollGroups['ballRoll']])