Example #1
0
 def __add_mod_attributes(self):
     #--- this method adds attributes to the main mod
     attr = attribute.Attribute()
     #--- showJoints
     if not cmds.objExists(self.main_mod + '.showJoints'):
         attr.addAttr(node=self.main_mod,
                      attrName='showJoints',
                      attrType='short',
                      min=0,
                      max=1,
                      default=0,
                      keyable=False,
                      channelBox=True)
     #--- showUpVectors
     if not cmds.objExists(self.main_mod + '.showUpVectors'):
         attr.addAttr(node=self.main_mod,
                      attrName='showUpVectors',
                      attrType='short',
                      min=0,
                      max=1,
                      default=0,
                      keyable=False,
                      channelBox=True)
     #--- showLabels
     if not cmds.objExists(self.main_mod + '.showLabels'):
         attr.addAttr(node=self.main_mod,
                      attrName='showLabels',
                      attrType='short',
                      min=0,
                      max=1,
                      default=0,
                      keyable=False,
                      channelBox=True)
Example #2
0
 def __prepare_auto_hip(self):
     #--- this method prepares attributes for the autoHip
     attr = attribute.Attribute()
     #--- add autoHip attributes
     attr.addAttr(node=self.control.transform,
                  attrName='autoHip',
                  attrType='float',
                  min=0,
                  max=1,
                  default=1)
     if self.softHip:
         attr.addAttr(node=self.control.transform,
                      attrName='softness',
                      attrType='float',
                      min=1,
                      default=10)
         attr.addAttr(node=self.control.transform,
                      attrName='smoothRotateY',
                      attrType='float',
                      min=0,
                      max=1,
                      default=0.5)
         attr.addAttr(node=self.control.transform,
                      attrName='smoothRotateZ',
                      attrType='float',
                      min=0,
                      max=1,
                      default=0.5)
     #--- lock unnecessary attributes on the hip control
     attr.lockAttr(node=self.control.transform, attribute=['t', 's', 'v'])
Example #3
0
 def __hook_message(self):
     #--- this method connects the message attributes between the joints
     attr = attribute.Attribute()
     #--- get the guide joints of the selections
     parent_jnt = cmds.listRelatives(self.hookParent,
                                     allDescendents=True,
                                     type='joint')[0]
     if cmds.objExists(parent_jnt + '.connection'):
         if isinstance(self.hookChild, list):
             for child in self.hookChild:
                 child_jnt = cmds.listRelatives(child,
                                                allDescendents=True,
                                                type='joint')[0]
                 if cmds.objExists(child_jnt + '.connection'):
                     cmds.setAttr(child_jnt + '.connection', lock=False)
                     cmds.connectAttr(parent_jnt + '.message',
                                      child_jnt + '.connection',
                                      force=True)
         else:
             child_jnt = cmds.listRelatives(self.hookChild,
                                            allDescendents=True,
                                            type='joint')[0]
             if cmds.objExists(child_jnt + '.connection'):
                 cmds.setAttr(child_jnt + '.connection', lock=False)
                 cmds.connectAttr(parent_jnt + '.message',
                                  child_jnt + '.connection',
                                  force=True)
Example #4
0
    def __connect_guides(self,
                         mod=None,
                         side=None,
                         obj=None,
                         position=[0, 0, 0]):
        #--- this method creates the curve which connects the guide controls
        attr = attribute.Attribute()
        nd = node.Node()
        #--- create curves
        crv = cmds.curve(degree=1, point=self.position)
        cmds.parent(crv, self.gd.extras)
        crvShp = cmds.listRelatives(crv, allDescendents=True)[0]
        crvShp = cmds.rename(crvShp, crv + 'Shape')
        rel = cmds.listRelatives(crv, allDescendents=1)[0]

        #--- connect the cvs to the controls by matrix
        for i in range(len(obj)):
            #--- create decomposeMatrix nodes
            dcm = nd.decomposeMatrix(name=obj[i])
            #--- connect the control with the decomposeMatrix
            attr.connectAttr(node=[obj[i], dcm],
                             attribute=['worldMatrix[0]', 'inputMatrix'])
            attr.connectAttr(
                node=[dcm, rel],
                attribute=['outputTranslate', 'controlPoints[' + ` i ` + ']'])
        #--- set the displayType of the curve Shape to template
        attr.setColor(node=crvShp, displayType=1)
Example #5
0
 def __setup_joints(self):
     #--- this method setups the eye joints
     attr = attribute.Attribute()
     #--- parent the first eye joint to the joint of the puppetObj
     cmds.parent(self.joints[0], self.puppetObj.joints[0])
     #--- disable skin tag on last joint
     attr.setAttr(self.joints[-1], ['SKIN'], 0)        
Example #6
0
 def __eye_setup(self,
                  mod = None,
                  side = None,
                  name = None,
                  size = 1,
                  shape = 0, 
                  color = 0, 
                  position = [0,0,0],
                  upVectorOffset = [6,0,0],
                  aimVector = [0,1,0],
                  upVector = [1,0,0],
                  mirror = True):
     #--- this method is a mod specific setup
     #--- unlock all necessary attributes from specified nodes 
     attr = attribute.Attribute()               
     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])
     #--- connect messages
     self.__connect_message()
Example #7
0
File: ear.py Project: jonntd/Public
 def __ear_cleanup(self):
     #--- this method is a mod specific cleanup
     #--- hide unnecessary attributes from the guide controls
     attr = attribute.Attribute()
     attr.lockAll(node=self.gd.g_grp)
     attr.lockAttr(node=self.gd.g_ctl, attribute=['s', 'v'])
     cmds.select(clear=True)
Example #8
0
    def __create_connection_curve(self, obj=None, parent=None):
        #--- this method creates the curves whicht connects the guides
        attr = attribute.Attribute()
        nd = node.Node()
        #--- create the curve
        crv = cmds.curve(degree=1, point=self.position)
        cmds.parent(crv, self.extras)
        crvShp = cmds.listRelatives(crv, allDescendents=True)[0]
        crvShp = cmds.rename(crvShp, crv + 'Shape')
        rel = cmds.listRelatives(crv, allDescendents=1)[0]
        #--- connect the cvs to the controls by matrix
        for i in range(len(obj)):
            #--- create decomposeMatrix nodes
            dcm = nd.decomposeMatrix(name=obj[i])
            #--- connect the control with the decomposeMatrix
            attr.connectAttr(node=[obj[i], dcm],
                             attribute=['worldMatrix[0]', 'inputMatrix'])
            attr.connectAttr(
                node=[dcm, rel],
                attribute=['outputTranslate', 'controlPoints[' + ` i ` + ']'])

            #--- create the visibility connections of the main mod node
            if cmds.nodeType(obj[i]) == 'joint':
                attr.connectAttr(node=[self.main_mod, obj[i]],
                                 attribute=['showJoints', 'v'])
                attr.connectAttr(node=[self.main_mod, self.g_loc[i]],
                                 attribute=['showUpVectors', 'v'])
        #--- set the displayType of the curve Shape to template
        attr.setColor(node=crvShp, displayType=1)
Example #9
0
File: jaw.py Project: jonntd/Public
 def __jaw_cleanup(self):
     #--- this method is a mod specific cleanup
     attr = attribute.Attribute()
     #--- hide unnecessary attributes from the guide controls        
     attr.lockAll(node = self.gd.g_grp)        
     attr.lockAttr(node = self.gd.g_ctl[1:], attribute = ['tx'])
     attr.lockAttr(node = self.gd.g_ctl[-1], attribute = ['r'])
     attr.lockAttr(node = self.gd.g_ctl, attribute = ['s', 'v'])
Example #10
0
 def __add_space_switch_attribute(self):
     #--- this method adds a space switch control
     attr = attribute.Attribute()
     #--- follow
     attr.addAttr(node=self.control_head.transform,
                  attrName='follow',
                  attrType='float',
                  min=0,
                  max=1)
Example #11
0
 def __setup_main_control(self):
     #--- this method setups the main control
     if not cmds.objExists(self.main_ctl + '.globalScale'):
         attr = attribute.Attribute()
         attr.addAttr(node=self.main_ctl,
                      attrName='globalScale',
                      attrType='double',
                      min=0,
                      default=1)
         #--- connect the scale attributes of the main control with the gs
         for axis in 'xyz':
             attr.connectAttr(node=[self.main_ctl, self.main_ctl],
                              attribute=['globalScale', 's' + axis])
         #--- limit the scale minimum to 0.01
         cmds.transformLimits(self.main_ctl,
                              scaleX=(0.01, 1),
                              scaleY=(0.01, 1),
                              scaleZ=(0.01, 1),
                              enableScaleX=(1, 0),
                              enableScaleY=(1, 0),
                              enableScaleZ=(1, 0))
         #--- lock the scale attributes of the main control
         attr.lockAttr(node=self.main_ctl, attribute=['s'])
     if not cmds.objExists(self.main_ctl + '.displayType'):
         attr = attribute.Attribute()
         attr.addAttr(node=self.main_ctl,
                      attrName='displayType',
                      attrType='enum',
                      enum=['normal', 'template', 'reference'])
         #--- connect the meshes
         for i in cmds.ls(type='mesh'):
             if cmds.objExists(i):
                 attr.setAttr(node=i,
                              attribute=['overrideEnabled'],
                              value=1,
                              lock=True)
                 attr.connectAttr(node=[self.main_ctl, i],
                                  attribute=[
                                      'displayType',
                                      'drawOverride.overrideDisplayType'
                                  ])
         attr.setAttr(node=self.main_ctl,
                      attribute=['displayType'],
                      value=2)
Example #12
0
 def __head_cleanup(self):
     #--- this method is a mod specific cleanup
     attr = attribute.Attribute()
     #--- hide unnecessary attributes from the guide controls
     attr.lockAll(node=self.gd.g_grp)
     attr.lockAttr(node=self.gd.g_ctl,
                   attribute=['tx', 'ry', 'rz', 's', 'v'])
     for i in cmds.ls('*DCM*', '*PAC*', '*Constraint*', '*curve*'):
         cmds.setAttr(i + '.ihi', 0)
     cmds.select(clear=True)
Example #13
0
 def __add_finger_attributes(self):
     #--- this method adds the foot roll attributes
     attr = attribute.Attribute()
     #--- finger controls
     finger_ctl = self.puppetObj.ikfk_blend
     name = (self.mod + self.name[0][0].upper() + self.name[0][1:])
     #--- finger name
     attr.addAttr(node=finger_ctl.transform,
                  attrName=self.guideObj.original_name,
                  attrType='enum',
                  enum=['       '])
     attr.lockAttr(node=finger_ctl.transform,
                   attribute=[self.guideObj.original_name],
                   show=True)
     #--- curl attribute
     for iter in range(len(self.guideObj.name) - 1):
         attr_name = self.guideObj.name[iter] + '_Curl'
         attr.addAttr(node=finger_ctl.transform,
                      attrName=attr_name,
                      attrType='float')
         attr.connectAttr(
             node=[finger_ctl.transform, self.finger_grp[iter]],
             attribute=[attr_name, 'rz'])
     #--- swivel attribute
     for iter in range(len(self.guideObj.name) - 1):
         attr_name = self.guideObj.name[iter] + '_Swivel'
         attr.addAttr(node=finger_ctl.transform,
                      attrName=attr_name,
                      attrType='float')
         attr.connectAttr(
             node=[finger_ctl.transform, self.finger_grp[iter]],
             attribute=[attr_name, 'ry'])
     #--- twist attribute
     for iter in range(len(self.guideObj.name) - 1):
         attr_name = self.guideObj.name[iter] + '_Twist'
         attr.addAttr(node=finger_ctl.transform,
                      attrName=attr_name,
                      attrType='float')
         attr.connectAttr(
             node=[finger_ctl.transform, self.finger_grp[iter]],
             attribute=[attr_name, 'rx'])
     #--- finger visibility
     attr_name = self.guideObj.original_name + 'ShowControls'
     attr.addAttr(node=finger_ctl.transform,
                  attrName=attr_name,
                  attrType='short',
                  min=0,
                  max=1,
                  keyable=False,
                  channelBox=True)
     attr.connectAttr(
         node=[finger_ctl.transform, self.controls_finger[0].transform],
         attribute=[attr_name, 'v'])
Example #14
0
 def load(self, dirName=None, assetName=None, dataType='attribute'):
     ########################################################################
     attr = attribute.Attribute()
     result = self._read_data(dirName=dirName, fileName=assetName)
     if dataType == 'attribute':
         for i in result:
             if cmds.objExists(i.split(',')[0]):
                 attr.setAttr(node=i.split(',')[0].split('.')[0],
                              attribute=i.split(',')[0].split('.')[1],
                              value=i.split(', ')[1])
     elif dataType == 'shape':
         return result
Example #15
0
File: jaw.py Project: jonntd/Public
 def __connect_message(self):
     #--- this method connects the message attributes between the joints
     attr = attribute.Attribute()
     #--- create the message connections
     for i in range(len(self.gd.g_jnt)):
         j = i + 1
         if not j == len(self.gd.g_jnt):
             #--- get the guide joints of the selections
             if cmds.objExists(self.gd.g_jnt[j] + '.connection'):
                 if cmds.objExists(self.gd.g_jnt[i] + '.connection'):
                     cmds.setAttr(self.gd.g_jnt[j] + '.connection', lock = False)
                     cmds.connectAttr(self.gd.g_jnt[i] + '.message', 
                                      self.gd.g_jnt[j] + '.connection')
Example #16
0
 def __setup_eye_controls(self):
     #--- this method setups the eye controls
     ik = ikhandle.IkHandle()
     attr = attribute.Attribute()
     #--- create ikHandles for the eye joints and parent it under the control
     ikh = ik.ikSCsolver(startJoint = self.joints[0], 
                         endEffector = self.joints[1], 
                         side = self.side, 
                         name = self.mod, 
                         suffix = 'IK', 
                         parent = self.control_eye.transform, 
                         hide = True)
     attr.setAttr(ikh[0], ['t'], 0)
Example #17
0
 def __setup_joints(self):
     #--- this method connects the ik fk joints with the bind one
     attr = attribute.Attribute()
     nd = node.Node()
     #--- constraint fk joints to the bind ones
     self.pac = nd.parentConstraint(objA=self.joints_fk,
                                    objB=self.joints,
                                    maintainOffset=False)
     #--- connect the bind joints to the last joint of the puppetObj
     cmds.parent(self.joints[0], self.puppetObj.joints[-1])
     #--- disable skin tag
     for fk in self.joints_fk:
         attr.setAttr(fk, ['SKIN'], 0)
Example #18
0
    def __head_setup(self,
                     character=None,
                     mod=None,
                     side=None,
                     name=None,
                     size=1,
                     shape=0,
                     color=0,
                     position=[0, 0, 0],
                     eye=True,
                     eyesAmount=1,
                     jaw=True,
                     mouth=True,
                     ear=True,
                     earsAmount=1,
                     upVectorOffset=[6, 0, 0],
                     aimVector=[0, 1, 0],
                     upVector=[1, 0, 0],
                     mirror=True):
        #--- this method is a mod specific setup
        #--- unlock all necessary attributes from specified nodes
        attr = attribute.Attribute()
        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])
        #--- create the message connection setup
        self.__connect_message()

        #--- mouth setup
        if mouth:
            self.__head_mouth_setup(character=character, mirror=mirror)
        #--- jaw setup
        if jaw:
            self.__head_jaw_setup(character=character, mirror=mirror)
        #--- eye setup
        if eye:
            self.__head_eye_setup(character=character,
                                  eyesAmount=eyesAmount,
                                  mouth=mouth,
                                  mirror=True)
        #--- ear setup
        if ear:
            self.__head_ear_setup(character=character,
                                  earsAmount=earsAmount,
                                  mirror=True)
Example #19
0
 def __cleanup(self):
     #--- this method is a mod specific cleanup
     attr = attribute.Attribute()
     #--- hide unnecessary attributes from the guide controls
     attr.lockAll(node=self.gd.g_grp)
     attr.lockAttr(node=self.gd.g_ctl[1:],
                   attribute=['tz'],
                   lock=True,
                   show=False)
     attr.lockAttr(node=self.gd.g_ctl,
                   attribute=['s', 'v'],
                   lock=True,
                   show=False)
     cmds.select(clear=True)
Example #20
0
 def __cleanup_setup(self):
     #--- this method hides and locks unnecessary nodes and attributes
     attr = attribute.Attribute()
     attr.lockAll(node=[self.guide_grp, self.char_grp])
     attr.lockAll(node=self.g_jnt)
     attr.lockAll(node=self.g_jnt_off)
     attr.lockAll(node=self.g_loc)
     attr.lockAll(node=self.main_mod)
     attr.lockAll(node=self.extras)
     attr.lockAttr(node=self.side_mod,
                   attribute=['t', 'r', 's', 'v', 'ihi'],
                   lock=True,
                   show=False)
     for i in cmds.ls('*GCRV', '*DCM', '*AIM', '*Shapes', '*MLT', 'curve*'):
         attr.lockAll(node=i)
Example #21
0
File: jaw.py Project: jonntd/Public
 def __jaw_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]) 
     #--- create the message connection setup
     self.__connect_message()                
Example #22
0
    def __create_eye_controls(self):
        #--- this method creates the eye controls
        attr = attribute.Attribute()
        #--- main eye control
        name = self.mod + 'Main'
        if not cmds.objExists('C_' + name + '_CTL'):
            ctl = control.Control(side = 'C', 
                                  name = name, 
                                  suffix = 'CTL', 
                                  size = self.size, 
                                  shape = 1, 
                                  color = 17, 
                                  position = [0,0,0], 
                                  rotation = [0,0,0],
                                  offset = [0,0,0],
                                  orientation = [0,0,90], 
                                  parent = self.joints[0],
                                  lockAttrs = ['s', 'r'])
            cmds.parent(ctl.group, world = True)
            attr.setAttr(node = ctl.group, attribute = 'tx', value = 0)
            attr.setAttr(node = ctl.group, attribute = 'tz', value = 20)            
            cmds.parent(ctl.group, self.puppetObj.control_head.transform) 
            self.control_eyes = ctl
        else:
            self.control_eyes= 'C_' + name + '_CTL'

        #--- jaw control
        name = self.mod + self.name[0][0].upper() + self.name[0][1:]
        ctl = control.Control(side = self.side, 
                              name = name, 
                              suffix = 'CTL', 
                              size = self.size, 
                              shape = 0, 
                              color = self.guideObj.color, 
                              position = [0,0,0], 
                              rotation = [0,0,0],
                              offset = [0,0,0],
                              orientation = [0,0,90], 
                              parent = self.joints[0],
                              lockAttrs = ['s', 'r'])
        try:
            cmds.parent(ctl.group, self.control_eyes.transform)
            cmds.setAttr(ctl.group +'.tx', 0)
        except:
            cmds.parent(ctl.group, self.control_eyes)
        attr.setAttr(ctl.group, ['tx'], 0)
        self.control_eye = ctl
Example #23
0
 def __mirror_guides(self):
     #--- this method mirrors the guides properly and set them up
     attr = attribute.Attribute()
     nd = node.Node()
     #--- create the mirror node and the proper connections
     guides = self.mirrorGuideObj
     mirrors = []
     if isinstance(guides.name, list):
         for obj in range(len(guides.name)):
             mirror = nd.mirrorSwitch(name=(self.side + '_' + self.mod +
                                            guides.name[obj][0].upper() +
                                            guides.name[obj][1:]))
             attr.connectAttr(node=[guides.gd.g_ctl[obj], mirror],
                              attribute=['worldMatrix', 'inputMatrix'])
             for axis in 'xyz':
                 attr.lockAttr(node=[self.g_grp[obj]],
                               attribute=['t', 'r'],
                               lock=False,
                               show=True)
                 #--- connect outPos and outRot with translate and rotate
                 attr.connectAttr(node=[mirror, self.g_grp[obj]],
                                  attribute=['op' + axis, 't' + axis])
                 attr.connectAttr(node=[mirror, self.g_grp[obj]],
                                  attribute=['or' + axis, 'r' + axis])
             cmds.setAttr(mirror + '.ihi', 0)
             mirrors.append(mirror)
     else:
         mirror = nd.mirrorSwitch(name=(self.side + '_' + self.mod +
                                        guides.name[0].upper() +
                                        guides.name[1:]))
         attr.connectAttr(node=[guides.gd.g_ctl[0], mirror],
                          attribute=['worldMatrix', 'inputMatrix'])
         for axis in 'xyz':
             attr.lockAttr(node=[self.g_grp[0]],
                           attribute=['t', 'r'],
                           lock=False,
                           show=True)
             #--- connect outPos and outRot with translate and rotate
             attr.connectAttr(node=[mirror, self.g_grp[0]],
                              attribute=['op' + axis, 't' + axis])
             attr.connectAttr(node=[mirror, self.g_grp[0]],
                              attribute=['or' + axis, 'r' + axis])
         cmds.setAttr(mirror + '.ihi', 0)
         mirrors.append(mirror)
     self.mirrors = mirrors
Example #24
0
 def __head_cleanup(self, mouth=True, jaw=True, eye=True, ear=True):
     #--- this method is a mod specific cleanup
     #--- hide unnecessary attributes from the guide controls
     attr = attribute.Attribute()
     attr.lockAll(node=self.gd.g_grp)
     if mouth:
         attr.lockAll(node=self.mouth.gd.g_grp)
     if jaw:
         attr.lockAll(node=self.jaw.gd.g_grp)
     if eye:
         attr.lockAll(node=self.eye.gd.g_grp)
     if ear:
         attr.lockAll(node=self.ear.gd.g_grp)
     attr.lockAttr(node=self.gd.g_ctl,
                   attribute=['tx', 'ry', 'rz', 's', 'v'])
     for i in cmds.ls('*DCM*', '*PAC*', '*Constraint*', '*curve*'):
         cmds.setAttr(i + '.ihi', 0)
     cmds.select(clear=True)
Example #25
0
 def __rename_guide_joints(self):
     #--- this method renames the proper information of the guide joints
     attr = attribute.Attribute()
     sel = cmds.ls('*_GJNT', type = 'joint')
     #--- change the suffix of the hidden attributes to JNT
     for i in sel:
         if cmds.objExists(i + '.suffix'):
             attr.lockAttr(node = i, 
                           attribute = ['suffix'], 
                           lock = False)
             attr.setAttr(node = i, 
                          attribute = 'suffix', 
                          value = 'JNT', 
                          lock = True)
         #--- rename the suffix of the guide joints
         rnm = cmds.rename(i, i.split('GJNT')[0] + 'JNT')
         self.joints.append(rnm)
     cmds.select(clear = True)
     print 'Skeleton created!'        
Example #26
0
 def __add_mirror_attributes(self):
     #--- this method adds mirror attributes to the main mod
     attr = attribute.Attribute()
     #--- mirror
     attr.addAttr(node=self.main_mod,
                  attrName='mirror',
                  attrType='short',
                  min=0,
                  max=1,
                  default=1,
                  keyable=False,
                  channelBox=True)
     #--- mirrorLock
     attr.addAttr(node=self.main_mod,
                  attrName='mirrorLock',
                  attrType='short',
                  min=0,
                  max=1,
                  default=1,
                  keyable=False,
                  channelBox=True)
     #--- mirrorAxis
     cmds.addAttr(self.main_mod,
                  longName='mirrorAxis',
                  attributeType='enum',
                  enumName='yz:xz:xy',
                  keyable=True)
     cmds.setAttr(self.main_mod + '.mirrorAxis',
                  edit=True,
                  keyable=False,
                  channelBox=True)
     #--- connect the mirror attributes properly with the main mod
     for i in self.mirrors:
         attr.connectAttr(node=[self.main_mod, i],
                          attribute=['mirror', 'mirror'])
         attr.connectAttr(node=[self.main_mod, i],
                          attribute=['mirrorAxis', 'mirrorAxis'])
     for i in self.g_ctl:
         attr.connectAttr(
             node=[self.main_mod, i + 'Shape'],
             attribute=['mirrorLock', 'drawOverride.overrideDisplayType'])
Example #27
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() 
Example #28
0
 def __create_flexiplane(self):
     #--- this method creates the spine flexiplane
     attr = attribute.Attribute()
     nd = node.Node()
     #--- create the first flexiplane for the humerus bone
     self.spine_flexiplane = flexiplane.FlexiPlane(
         character=self.character,
         mod=self.mod,
         side=self.side,
         name='vertebrae',
         color=self.color,
         size=self.size,
         length=5,
         rotation=[0, 0, 90],
         constraintTo=[
             self.hip_control.transform, self.ribcage_control.transform
         ],
         constraintType='point',
         follow=False,
         parent=self.side_extra_grp,
         inheritsTransform=False)
Example #29
0
    def load_guide(self, dirName=None, assetName=None):
        #--- this method loads the guide data
        attr = attribute.Attribute()
        dirName = 'guideData'
        if assetName:
            result = self.read_data(dirName=dirName,
                                    folder='data',
                                    fileName=assetName)
            if result:
                for obj in result:
                    for i in obj:
                        ctl = i[0].split('.')[0]
                        att = i[0].split('.')[-1]
                        val = i[1]
                        if 'translate' in att:
                            if cmds.objExists(ctl):
                                if cmds.objExists(i[0]):
                                    attr.setAttr(node=ctl,
                                                 attribute=att,
                                                 value=val)
                        elif 'rotate' in att:
                            if cmds.objExists(ctl):
                                if cmds.objExists(i[0]):
                                    attr.setAttr(node=ctl,
                                                 attribute=att,
                                                 value=val)
            else:
                raise Exception('There is no guide data!')
        else:
            raise Exception('There is no guide data of ' + assetName + '!')
        print 'Guides loaded!'

    #END def load_guide()


#END class Data()

#Data().save(dirName = 'guideData', assetName = 'ACHILLES', dataType = 'guides')
#Data().save(dirName = 'shapes', assetName = 'ctl_shape16_foot', dataType = 'shape')
#Data().load_guide(dirName = 'guideData', assetName = 'ACHILLES')
Example #30
0
 def __parent_guide_joints(self):
     #--- this method parents the guide joints together
     attr = attribute.Attribute()
     non_central = []
     #--- get the message infos of each joint
     for gjnt in self.guide_joints:
         for jnt in gjnt:
             if cmds.objExists(jnt + '.connection'):
                 cnt = cmds.listConnections(jnt + '.connection')
                 if cnt:
                     #--- unparent the jnt to the world
                     cmds.parent(jnt, world = True)
                     #--- parent the child joints by message infos
                     cmds.parent(jnt, cnt[0])
                     #--- filter all the joints which need to be mirrored
                     if cnt[0][0] == 'C':
                         if not jnt[0] == 'C':
                             non_central.append(jnt)
                 else:
                     #--- filter all the left joints which need to be mirrored
                     if not jnt[0] == 'C':
                         non_central.append(jnt)