Пример #1
0
    def __head_ear_setup(self, character=None, earsAmount=1, mirror=True):
        #--- this method creates the ear setup
        self.ear = ear.QuadrupedEarGuide(character=character,
                                         earsAmount=earsAmount,
                                         mirror=mirror)

        #--- setup the connection lines of the guides
        if earsAmount:
            for iter in range(earsAmount):
                #--- connect the ear guides properly
                self.__connect_guides(
                    mod=self.ear.gd.mod,
                    side=self.ear.gd.side,
                    obj=[self.gd.g_jnt[0], self.ear.jnt[iter][0]],
                    position=[self.gd.position[0], self.ear.position[iter][0]])
                if mirror:
                    self.__connect_guides(
                        mod=self.ear.gd.mod,
                        side=self.ear.gd.mirror_side,
                        obj=[self.gd.g_jnt[0], self.ear.mirror_ctl[iter][0]],
                        position=[
                            self.gd.position[0], self.ear.mirror_pos[iter][0]
                        ])
                #--- hook the ear guides to the midSkull
                hook.Hook(mod=self.ear,
                          hookParent=self.gd.g_ctl[0],
                          hookChild=self.ear.grp[iter][0],
                          hookType='parentConstraint')
Пример #2
0
    def __eye_setup(self):
        #--- this method is a mod specific setup
        attr = attribute.Attribute()  
        #--- unlock all necessary attributes from specified nodes
        if not self.mirrorGuideObj:
            attr.lockAttr(node = self.gd.g_grp, 
                          attribute = ['t', 'r', 's'], 
                          lock = False, show = True)        
            #--- parent the guides properly
            for i in range(len(self.gd.g_grp)):
                j = i + 1
                if not j == len(self.gd.g_grp):
                    cmds.parent(self.gd.g_grp[j], self.gd.g_ctl[i])

        #--- parent the first guide to the given parent object
        if self.parent:
            if self.mirrorGuideObj:
                try:
                    #--- hook the finger guide to the hand
                    hook.Hook(mod = self.parent, 
                              hookParent = self.parent, 
                              hookChild = self, 
                              hookType = None,
                              hookMessage = False,
                              hookParentIndex=0)
                except:
                    pass
            else:
                try:
                    #--- hook the guide to the parent
                    hook.Hook(mod = self.parent, 
                              hookParent = self.parent, 
                              hookChild = self, 
                              hookType = 'parentConstraint',
                              hookMessage = False,
                              hookParentIndex=0)
                except:
                    pass

        #--- connect messages
        self.__connect_message() 
Пример #3
0
 def __hooks(self, character=None):
     #--- this method creates the guide hooks
     #--- hook head into neck
     hook.Hook(mod=self.guide_head.gd.mod,
               hookParent=self.guide_neck.gd.g_ctl[-1],
               hookChild=self.guide_head.gd.g_grp[0])
     #--- hook frontLeg and neck into spine
     hook.Hook(mod=self.guide_spine.gd.mod,
               hookParent=self.guide_spine.gd.g_ctl[-1],
               hookChild=[
                   self.guide_front_leg.scapula.gd.g_grp[0],
                   self.guide_neck.gd.g_grp[0]
               ])
     #--- hook guide_front_foot into guide_front_leg
     hook.Hook(mod=self.guide_front_leg.gd.mod,
               hookParent=self.guide_front_leg.gd.g_ctl[-1],
               hookChild=self.guide_front_foot.gd.g_grp[0])
     #--- hook guide_hind_leg into spine
     hook.Hook(mod=self.guide_hind_leg.hip.gd.mod,
               hookParent=self.guide_spine.gd.g_ctl[0],
               hookChild=self.guide_hind_leg.hip.gd.g_grp[0])
     #--- hook guide_hind_foot into guide_hind_leg
     hook.Hook(mod=self.guide_hind_leg.gd.mod,
               hookParent=self.guide_hind_leg.gd.g_ctl[-1],
               hookChild=self.guide_hind_foot.gd.g_grp[0],
               hookType='pointConstraint')
     #--- hook guide_tail into guide_spine
     hook.Hook(mod=self.guide_head.gd.mod,
               hookParent=self.guide_spine.gd.g_ctl[0],
               hookChild=self.guide_tail.gd.g_grp[0])
     print 'Hooks created!'
Пример #4
0
 def __hooks(self, character=None):
     #--- this method creates the guide hooks
     #--- hook head into neck
     hook.Hook(mod=self.guide_head,
               hookParent=self.guide_neck,
               hookChild=self.guide_head)
     #--- hook clavicle and neck into chest
     hook.Hook(mod=self.guide_spine,
               hookParent=self.guide_spine,
               hookChild=[
                   self.left_guide_arm, self.left_guide_arm.clavicle,
                   self.guide_neck
               ])
     #--- hook leg into spine
     hook.Hook(mod=self.left_guide_leg.hip,
               hookParent=self.guide_spine,
               hookChild=self.left_guide_leg.hip,
               hookParentIndex=0)
     #--- hook left foot into leg
     hook.Hook(mod=self.left_guide_leg,
               hookParent=self.left_guide_leg,
               hookChild=self.left_guide_foot,
               hookType='pointConstraint')
     print 'Hooks created!'
Пример #5
0
    def __head_jaw_setup(self, character=None, mirror=True):
        #--- this method creates the eye setup
        self.jaw = jaw.QuadrupedJawGuide(character=character)

        #--- connect the mouth guides properly regarding the mirror boolean
        self.__connect_guides(
            mod=self.jaw.gd.mod,
            side=self.jaw.gd.side,
            obj=[self.gd.g_jnt[0], self.jaw.gd.g_jnt[0]],
            position=[self.gd.position[0], self.jaw.gd.position[0]])
        if mirror:
            self.__connect_guides(
                mod=self.jaw.gd.mod,
                side=self.jaw.gd.mirror_side,
                obj=[self.gd.g_jnt[0], self.jaw.gd.mirror_ctl[0]],
                position=[self.gd.position[0], self.jaw.gd.mirror_pos[0]])
        #--- hook the jaw guides to the midSkull
        hook.Hook(mod=self.jaw,
                  hookParent=self.gd.g_ctl[0],
                  hookChild=self.jaw.gd.g_grp[0],
                  hookType='parentConstraint')
Пример #6
0
    def __head_mouth_setup(self, character=None, mirror=False):
        #--- this method creates the eye setup
        self.mouth = mouth.QuadrupedMouthGuide(character=character)

        #--- connect the mouth guides properly regarding the mirror boolean
        self.__connect_guides(
            mod=self.mouth.gd.mod,
            side=self.mouth.gd.side,
            obj=[self.gd.g_jnt[0], self.mouth.gd.g_jnt[0]],
            position=[self.gd.position[0], self.mouth.gd.position[0]])
        if mirror:
            self.__connect_guides(
                mod=self.mouth.gd.mod,
                side=self.mouth.gd.mirror_side,
                obj=[self.mouth.gd.mirror_ctl[0], self.gd.g_jnt[0]],
                position=[self.gd.position[0], self.mouth.gd.mirror_pos[0]])
        #--- hook the mouth guides to the midSkull
        hook.Hook(mod=self.mouth,
                  hookParent=self.gd.g_ctl[0],
                  hookChild=self.mouth.gd.g_grp[0],
                  hookType='parentConstraint')
        #--- lock unnecessary attributes on guide controls
        attr = attribute.Attribute()
        attr.lockAttr(node=self.mouth.gd.g_ctl, attribute=['tx', 'r'])
Пример #7
0
    def __finger_setup(self):
        #--- this method creates the finger guides and setup them properly
        attr = attribute.Attribute()
        nd = node.Node()
        #--- create the finger guide controls
        guide_names = []
        for p in range(len(self.position)):
            #--- create an alphabetical iterator
            abc = string.uppercase
            #--- create the guide names
            guide_names.append(self.name + abc[p])
        self.name = guide_names
        if self.mirrorGuideObj:
            self.upVectorOffset = [0, -6, 0]
            self.upVector = [0, -1, 0]
        #--- create the guides
        self.create(character=self.character,
                    mod=self.mod,
                    side=self.side,
                    name=self.name,
                    suffix=self.suffix,
                    size=self.size,
                    shape=self.shape,
                    orientation=self.orientation,
                    color=self.color,
                    position=self.position,
                    rotation=self.rotation,
                    upVectorOffset=self.upVectorOffset,
                    aimVector=self.aimVector,
                    upVector=self.upVector,
                    rotateOrder=self.rotateOrder,
                    flip=self.flip,
                    mirrorGuideObj=self.mirrorGuideObj)

        #--- unlock all necessary attributes from specified nodes
        attr.lockAttr(node=self.gd.g_grp,
                      attribute=['t', 'r', 's'],
                      lock=False,
                      show=True)

        if not self.mirrorGuideObj:
            #--- parent the controls fk style
            for i in range(len(self.gd.g_grp)):
                j = i + 1
                if not j == len(self.gd.g_grp):
                    cmds.parent(self.gd.g_grp[j], self.gd.g_ctl[i])

        #--- parent the first index to the given parent object
        if self.parent:
            if self.mirrorGuideObj:
                try:
                    #--- hook the finger guide to the hand
                    hook.Hook(mod=self.parent,
                              hookParent=self.parent,
                              hookChild=self,
                              hookType=None,
                              hookMessage=False)
                except:
                    pass
            else:
                try:
                    #--- hook the finger guide to the hand
                    hook.Hook(mod=self.parent,
                              hookParent=self.parent,
                              hookChild=self,
                              hookType='parentConstraint',
                              hookMessage=False)
                except:
                    pass
        #--- connect messages
        self.__connect_message()
        #--- mod specific cleanup
        self.__cleanup()
Пример #8
0
    def __head_eye_setup(self,
                         character=None,
                         eyesAmount=1,
                         mouth=True,
                         mirror=True):
        #--- this method creates the eye setup
        self.eye = eye.QuadrupedEyeGuide(character=character,
                                         eyesAmount=eyesAmount,
                                         mirror=mirror)

        #--- get the attr and nd tools
        nd = node.Node()
        attr = attribute.Attribute()
        #--- setup the connection lines of the guides
        if eyesAmount:
            for iter in range(eyesAmount):
                #--- connect the eye guides properly
                if mouth:
                    self.__connect_guides(
                        mod=self.eye.gd.mod,
                        side=self.eye.gd.side,
                        obj=[self.mouth.gd.g_jnt[0], self.eye.jnt[iter][0]],
                        position=[
                            self.mouth.gd.position[0],
                            self.eye.position[iter][0]
                        ])
                    if mirror:
                        self.__connect_guides(mod=self.eye.gd.mod,
                                              side=self.eye.gd.mirror_side,
                                              obj=[
                                                  self.mouth.gd.g_jnt[0],
                                                  self.eye.mirror_ctl[iter][0]
                                              ],
                                              position=[
                                                  self.mouth.gd.position[0],
                                                  self.eye.mirror_pos[iter][0]
                                              ])
                    #--- hook the eye guides to the mouth
                    hook.Hook(mod=self.eye,
                              hookParent=self.mouth.gd.g_ctl[0],
                              hookChild=self.eye.grp[iter][0],
                              hookType='parentConstraint')
                else:
                    self.__connect_guides(
                        mod=self.eye.gd.mod,
                        side=self.eye.gd.side,
                        obj=[self.gd.g_jnt[0], self.eye.jnt[iter][0]],
                        position=[
                            self.gd.position[0], self.eye.position[iter][0]
                        ])
                    if mirror:
                        self.__connect_guides(mod=self.eye.gd.mod,
                                              side=self.eye.gd.mirror_side,
                                              obj=[
                                                  self.gd.g_jnt[0],
                                                  self.eye.mirror_ctl[iter][0]
                                              ],
                                              position=[
                                                  self.gd.position[0],
                                                  self.eye.mirror_pos[iter][0]
                                              ])
                    #--- hook the eye guides to the midSkull
                    hook.Hook(mod=self.eye,
                              hookParent=self.gd.g_ctl[0],
                              hookChild=self.eye.grp[iter][0],
                              hookType='parentConstraint')