Ejemplo n.º 1
0
def createBuffer(self):
    b = BufferFactory('Buffer')
    b.doStoreSelected()
    self.reset()
Ejemplo n.º 2
0
    def verify(self):
        """ 
        Verifies the various components a masterNull for a character/asset. If a piece is missing it replaces it.
        
        RETURNS:
        success(bool)
        """
        #Puppet null
        try:
            if not mc.objExists(self.nameBase):
                buffer = mc.group(empty=True)
                self.PuppetNull = ObjectFactory(buffer)
            else:
                self.PuppetNull = ObjectFactory(self.nameBase)

            self.PuppetNull.store('cgmName', self.nameBase, True)
            self.PuppetNull.store('cgmType', 'ignore')
            self.PuppetNull.store('cgmModuleType', 'master')

            if self.PuppetNull.nameShort != self.nameBase:
                self.PuppetNull.doName(False)

            attributes.doSetLockHideKeyableAttr(self.PuppetNull.nameShort,
                                                channels=[
                                                    'tx', 'ty', 'tz', 'rx',
                                                    'ry', 'rz', 'sx', 'sy',
                                                    'sz'
                                                ])
        except:
            guiFactory.warning("Puppet null failed!")

        #Checks our modules container null
        created = False
        #Initialize message attr
        self.msgModulesGroup = AttrFactory(self.PuppetNull, 'modulesGroup',
                                           'message')
        if not self.msgModulesGroup.get():
            self.ModulesGroup = ObjectFactory(mc.group(empty=True))
            self.msgModulesGroup.doStore(self.ModulesGroup.nameShort)
            created = True
        else:
            self.ModulesGroup = ObjectFactory(self.msgModulesGroup.get())

        self.ModulesGroup.store('cgmName', 'modules')
        self.ModulesGroup.store('cgmType', 'group')

        self.ModulesGroup.doParent(self.PuppetNull.nameShort)

        if created:
            self.ModulesGroup.doName(False)

        self.msgModulesGroup.updateData()

        attributes.doSetLockHideKeyableAttr(self.ModulesGroup.nameShort)

        #Checks our noTransform container null
        created = False
        self.msgNoTransformGroup = AttrFactory(self.PuppetNull,
                                               'noTransformGroup', 'message')
        if not self.msgNoTransformGroup.get():
            self.NoTransformGroup = ObjectFactory(mc.group(empty=True))
            self.msgNoTransformGroup.doStore(self.NoTransformGroup.nameShort)
            created = True
        else:
            self.NoTransformGroup = ObjectFactory(
                self.msgNoTransformGroup.get())

        self.NoTransformGroup.store('cgmName', 'noTransform')
        self.NoTransformGroup.store('cgmType', 'group')

        self.NoTransformGroup.doParent(self.PuppetNull.nameShort)

        if created:
            self.NoTransformGroup.doName(False)

        self.msgNoTransformGroup.updateData()

        attributes.doSetLockHideKeyableAttr(self.NoTransformGroup.nameShort)

        #Checks our geo container null
        created = False
        self.msgGeoGroup = AttrFactory(self.PuppetNull, 'geoGroup', 'message')
        if not self.msgGeoGroup.get():
            self.GeoGroup = ObjectFactory(mc.group(empty=True))
            self.msgGeoGroup.doStore(self.GeoGroup.nameShort)
            created = True
        else:
            self.GeoGroup = ObjectFactory(self.msgGeoGroup.get())

        self.GeoGroup.store('cgmName', 'geo')
        self.GeoGroup.store('cgmType', 'group')

        self.GeoGroup.doParent(self.msgNoTransformGroup.get())

        if created:
            self.GeoGroup.doName(False)

        self.msgGeoGroup.updateData()

        attributes.doSetLockHideKeyableAttr(self.GeoGroup.nameShort)

        #Checks master info null
        created = False
        self.msgPuppetInfo = AttrFactory(self.PuppetNull, 'info', 'message')
        if not self.msgPuppetInfo.get():
            self.PuppetInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgPuppetInfo.doStore(self.PuppetInfoNull.nameShort)
            created = True
        else:
            self.PuppetInfoNull = ObjectFactory(self.msgPuppetInfo.get())

        self.PuppetInfoNull.store('cgmName', 'master')
        self.PuppetInfoNull.store('cgmType', 'info')

        self.PuppetInfoNull.doParent(self.PuppetNull.nameShort)

        if created:
            self.PuppetInfoNull.doName(False)

        self.msgPuppetInfo.updateData()

        attributes.doSetLockHideKeyableAttr(self.PuppetInfoNull.nameShort)

        #Checks modules info null
        created = False
        self.msgModuleInfo = AttrFactory(self.msgPuppetInfo.get(), 'modules',
                                         'message')
        if not self.msgModuleInfo.get():
            self.ModuleInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgModuleInfo.doStore(self.ModuleInfoNull.nameShort)
            created = True
        else:
            self.ModuleInfoNull = ObjectFactory(self.msgModuleInfo.get())

        self.ModuleInfoNull.store('cgmName', 'modules')
        self.ModuleInfoNull.store('cgmType', 'info')

        self.ModuleInfoNull.doParent(self.PuppetInfoNull.nameShort)

        if created:
            self.ModuleInfoNull.doName(False)

        self.msgModuleInfo.updateData()

        attributes.doSetLockHideKeyableAttr(self.ModuleInfoNull.nameShort)

        #Initialize our modules null as a buffer
        self.ModulesBuffer = BufferFactory(self.ModuleInfoNull.nameShort)

        #Checks geo info null
        created = False
        self.msgGeoInfo = AttrFactory(self.msgPuppetInfo.get(), 'geo',
                                      'message')
        if not self.msgGeoInfo.get():
            self.GeoInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgGeoInfo.doStore(self.GeoInfoNull.nameShort)
            created = True
        else:
            self.GeoInfoNull = ObjectFactory(self.msgGeoInfo.get())

        self.GeoInfoNull.store('cgmName', 'geo')
        self.GeoInfoNull.store('cgmType', 'info')

        self.GeoInfoNull.doParent(self.msgPuppetInfo.get())

        if created:
            self.GeoInfoNull.doName(False)

        self.msgGeoInfo.updateData()

        attributes.doSetLockHideKeyableAttr(self.GeoInfoNull.nameShort)

        #Checks settings info null
        created = False
        self.msgSettingsInfo = AttrFactory(self.msgPuppetInfo.get(),
                                           'settings', 'message')
        if not self.msgSettingsInfo.get():
            self.SettingsInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgSettingsInfo.doStore(self.SettingsInfoNull.nameShort)
            created = True
        else:
            self.SettingsInfoNull = ObjectFactory(self.msgSettingsInfo.get())

        self.SettingsInfoNull.store('cgmName', 'settings')
        self.SettingsInfoNull.store('cgmType', 'info')
        defaultFont = modules.returnSettingsData('defaultTextFont')
        self.SettingsInfoNull.store('font', defaultFont)

        self.SettingsInfoNull.doParent(self.msgPuppetInfo.get())

        if created:
            self.SettingsInfoNull.doName(False)

        self.msgSettingsInfo.updateData()

        self.optionPuppetMode = AttrFactory(self.SettingsInfoNull,
                                            'optionPuppetTemplateMode',
                                            'int',
                                            initialValue=0)

        self.optionAimAxis = AttrFactory(self.SettingsInfoNull,
                                         'axisAim',
                                         'enum',
                                         enum='x+:y+:z+:x-:y-:z-',
                                         initialValue=2)
        self.optionUpAxis = AttrFactory(self.SettingsInfoNull,
                                        'axisUp',
                                        'enum',
                                        enum='x+:y+:z+:x-:y-:z-',
                                        initialValue=1)
        self.optionOutAxis = AttrFactory(self.SettingsInfoNull,
                                         'axisOut',
                                         'enum',
                                         enum='x+:y+:z+:x-:y-:z-',
                                         initialValue=0)

        attributes.doSetLockHideKeyableAttr(self.SettingsInfoNull.nameShort)

        return True
Ejemplo n.º 3
0
def keyBuffer(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.key()  
Ejemplo n.º 4
0
def purgeBuffer(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.purge()  
Ejemplo n.º 5
0
def addSelected(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.doStoreSelected()
Ejemplo n.º 6
0
def removeSelected(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.doRemoveSelected()
Ejemplo n.º 7
0
def createBuffer(self):
    b = BufferFactory('Buffer')
    b.doStoreSelected()
    self.reset()
Ejemplo n.º 8
0
class Limb(ModuleFactory):
    """
    Limb class which inherits the ModuleFactory master class
    """
    def __init__(self,*a,**kw):
        initializeOnly = kw.pop('initializeOnly',False)
        self.handles = kw.pop('handles',3) or defaultSettings['handles']
        
        guiFactory.doPrintReportStart()
        
        #Initialize the standard module
        ModuleFactory.__init__(self,initializeOnly = initializeOnly,handles=self.handles,*a,**kw)
        
        self.moduleClass = 'Limb'
        
        #Then check the subclass specific stuff
        if self.refState or initializeOnly:
            guiFactory.report("'%s' Limb initializing..."%self.ModuleNull.nameShort)
            if not self.initializeModule():
                guiFactory.warning("'%s' failed to initialize. Please go back to the non referenced file to repair!"%self.ModuleNull.nameShort)
                return False
            
        else:
            if not self.verifyModule():
                guiFactory.warning("'%s' failed to verify!"%self.ModuleNull.nameShort)
                return False

            
        guiFactory.report("'%s' checks out"%self.ModuleNull.nameShort)
        guiFactory.doPrintReportEnd()
            
    def verifyModule(self,*a,**kw):
        """
        Verifies the integrity of the Limb module. Repairing and restoring broken connections or deleted items.
        """        
        #Initialize all of our options
        ModuleFactory.verifyModule(self,*a,**kw)
        
        for k in defaultSettings.keys():
            try:
                self.__dict__[k]
            except:
                self.__dict__[k] = defaultSettings[k]
            
        self.afModuleType = AttrFactory(self.ModuleNull,'moduleType','string',value= self.partType,lock=True)
        
        if self.infoNulls['setupOptions']:
            self.SetupOptionsNull = ObjectFactory( self.infoNulls['setupOptions'].value )
            self.optionFK = AttrFactory(self.SetupOptionsNull,'fk','bool',initialValue= self.fk,lock=True)
            self.optionIK = AttrFactory(self.SetupOptionsNull,'ik','bool',initialValue= self.ik,lock=True)
            self.optionStretchy = AttrFactory(self.SetupOptionsNull,'stretchy','bool',initialValue= self.stretchy,lock=True)
            self.optionBendy = AttrFactory(self.SetupOptionsNull,'bendy','bool',initialValue= self.bendy,lock=True)
            
            self.optionRollJoints = AttrFactory(self.SetupOptionsNull,'rollJoints','int',initialValue=self.rollJoints,lock=True)
            self.optionStiffIndex= AttrFactory(self.SetupOptionsNull,'stiffIndex','int',initialValue=self.stiffIndex,lock=True)
            self.optionCurveDegree= AttrFactory(self.SetupOptionsNull,'curveDegree','int',initialValue=self.curveDegree,lock=True)
        else:
            guiFactory.warning("Setup options null is missing from '%s'. Rebuild"%self.ModuleNull.nameShort)
            return False
        if self.infoNulls['visibilityOptions']:
            self.VisibilityOptionsNull = ObjectFactory( self.infoNulls['visibilityOptions'].value )
            
            self.visOrientHelpers = AttrFactory(self.VisibilityOptionsNull,'visOrientHelpers','bool',initialValue=0,lock=True)
            self.visControlHelpers = AttrFactory(self.VisibilityOptionsNull,'visControlHelpers','bool',initialValue=0,lock=True)
        else:
            guiFactory.warning("Visibility options null is missing from '%s'. Rebuild"%self.ModuleNull.nameShort)
            return False
        
        return True
    
    def initializeModule(self):
        """
        Verifies the integrity of the Limb module. Repairing and restoring broken connections or deleted items.
        """        
        #Initialize all of our options
        ModuleFactory.initializeModule(self)
        
        self.afModuleType = AttrFactory(self.ModuleNull,'moduleType',lock=True)
        
        if self.infoNulls['setupOptions']:
            self.SetupOptionsNull = ObjectFactory( self.infoNulls['setupOptions'].value )
            self.optionFK = AttrFactory(self.SetupOptionsNull,'fk',lock=True)
            self.optionIK = AttrFactory(self.SetupOptionsNull,'ik',lock=True)
            self.optionStretchy = AttrFactory(self.SetupOptionsNull,'stretchy',lock=True)
            self.optionBendy = AttrFactory(self.SetupOptionsNull,'bendy',lock=True)
            
            self.optionRollJoints = AttrFactory(self.SetupOptionsNull,'rollJoints',lock=True)
            self.optionStiffIndex= AttrFactory(self.SetupOptionsNull,'stiffIndex',lock=True)
            self.optionCurveDegree= AttrFactory(self.SetupOptionsNull,'curveDegree',lock=True)
            
        if self.infoNulls['visibilityOptions']:
            self.VisibilityOptionsNull = ObjectFactory( self.infoNulls['visibilityOptions'].value )
            self.visOrientHelpers = AttrFactory(self.VisibilityOptionsNull,'visOrientHelpers',lock=True)
            self.visControlHelpers = AttrFactory(self.VisibilityOptionsNull,'visControlHelpers',lock=True)
                    
        return True
    
    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    #>> Sizing
    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    def getInitialSize(self,PuppetInstance,*a,**kw):
        """
        Class specific sizer.
        
        Keyword arguments:
        PuppetInstance(instance) -- should be the module's puppet instance          
        """
        guiFactory.report("Sizing via Limb - '%s'"%self.ModuleNull.nameBase)
        
        #>>> If it's a root
        if not self.moduleParent:
            guiFactory.report("Root module mode!")            
            #>>>Get some info
            locInfoBuffer = ModuleFactory.doCreateStartingPositionLoc(self,'innerChild',PuppetInstance.templateSizeObjects['start'],PuppetInstance.templateSizeObjects['end'])
            print locInfoBuffer
            baseDistance = ModuleFactory.getPartBaseDistance(self,PuppetInstance,locInfoBuffer[0])
            print "buffer is '%s'"%baseDistance

            modulePosInfoBuffer = template.getGeneratedInitialPositionData(self, PuppetInstance,locInfoBuffer,baseDistance)
        
        
        if not modulePosInfoBuffer:
            guiFactory.warning("Failed to get a size return on '%s'"%m)
            return False
        
        #Store the necessary info back to the Puppet for children processes to have access to
        PuppetInstance.sizeCorePositionList[self.ModuleNull.nameBase] = modulePosInfoBuffer['positions']
        PuppetInstance.sizeLocInfo[self.ModuleNull.nameBase] = modulePosInfoBuffer['locator']
        
        return True
    
    
        try:pass################### Need to come back to do these...woot
        except:      
            if self.afModuleTyp.value in ['arm','wing','tail']:
                locInfoBuffer = ModuleFactory.doCreateStartingPositionLoc(self,'innerChild',PuppetInstance.templateSizeObjects['start'],PuppetInstance.templateSizeObjects['end'])
                PuppetInstance.locInfoDict[m] = createStartingPositionLoc(m,modeDict.get(self.afModuleTyp.value),typeWorkingCurveDict.get(self.afModuleTyp.value),typeAimingCurveDict.get(self.afModuleTyp.value),cvDict.get(directionKey))
                orderedModules.remove(m) 
                checkList.pop(m)
                
            elif self.afModuleTyp.value == 'clavicle':
                locInfoBuffer[m] = createStartingPositionLoc(m,modeDict.get(self.afModuleTyp.value),templateSizeObjects[1],templateSizeObjects[0],cvDict.get(directionKey))
                orderedModules.remove(m) 
                checkList.pop(m)
            elif self.afModuleTyp.value == 'finger':
                moduleParent = attributes.returnMessageObject(m,'moduleParent')
                parentLoc = locInfo.get(moduleParent)
                locInfoBuffer[m] = createStartingPositionLoc(m,modeDict.get(self.afModuleTyp.value),parentLoc)
                orderedModules.remove(m) 
            elif self.afModuleTyp.value == 'foot':
                moduleParent = attributes.returnMessageObject(m,'moduleParent')
                parentLoc = locInfo.get(moduleParent)
                locInfoBuffer[m] = createStartingPositionLoc(m,modeDict.get(self.afModuleTyp.value),parentLoc)
                orderedModules.remove(m) 
                checkList.pop(m)
            elif self.afModuleTyp.value == 'head':
                locInfoBuffer[m] = createStartingPositionLoc(m,modeDict.get(self.afModuleTyp.value),templateSizeObjects[1],templateSizeObjects[0],cvDict.get(directionKey))
                orderedModules.remove(m) 
                checkList.pop(m)
            elif self.afModuleTyp.value == 'leg':
                if basicOrientation == 'vertical':
                    locInfoBuffer[m] = createStartingPositionLoc(m,modeDict.get(self.afModuleTyp.value),typeWorkingCurveDict.get(self.afModuleTyp.value),typeAimingCurveDict.get(self.afModuleTyp.value),cvDict.get(directionKey))
                else:
                    horizontalLegInfoBuffer = horiztonalLegDict.get(directionKey)
                    locInfoBuffer[m] = createStartingPositionLoc(m,modeDict.get(self.afModuleTyp.value),horizontalLegInfoBuffer[1],horizontalLegInfoBuffer[2],horizontalLegInfoBuffer[0])
        
    def doTemplate(self,PuppetInstance):       
        """
        
        """
        def makeLimbTemplate (self):
            #>>>Curve degree finder
            if self.optionCurveDegree.get() == 0:
                doCurveDegree = 1
            else:
                if len(corePositionList) <= 3:
                    doCurveDegree = 1
                else:
                    doCurveDegree = len(corePositionList) - 1
                    
            #Make some storage vehicles
            self.templatePosObjectsBuffer = BufferFactory(self.infoNulls['templatePosObjects'].get())
            self.templatePosObjectsBuffer.purge()
            
            LocatorCatcher = ObjectFactory('')
            LocatorBuffer = BufferFactory(LocatorCatcher.nameLong)
            LocatorBuffer.purge()
            
            returnList = []
            self.templHandleList = []
            
            moduleColors = modules.returnModuleColors(self.ModuleNull.nameShort)
            
            #>>>Scale stuff
            moduleParent = self.msgModuleParent.get()
            
            if not moduleParent:
                length = (distance.returnDistanceBetweenPoints (corePositionList[0],corePositionList[-1]))
                size = length / self.optionHandles.get()
            else:
                #>>>>>>>>>>>>>>>>>>>>> NOT TOUCHED YET
                parentTemplatePosObjectsInfoNull = modules.returnInfoTypeNull(moduleParent,'templatePosObjects')
                parentTemplatePosObjectsInfoData = attributes.returnUserAttrsToDict (parentTemplatePosObjectsInfoNull)
                parentTemplateObjects = []
                for key in parentTemplatePosObjectsInfoData.keys():
                    if (mc.attributeQuery (key,node=parentTemplatePosObjectsInfoNull,msg=True)) == True:
                        if search.returnTagInfo((parentTemplatePosObjectsInfoData[key]),'cgmType') != 'templateCurve':
                            parentTemplateObjects.append (parentTemplatePosObjectsInfoData[key])
                createBuffer = curves.createControlCurve('sphere',1)
                pos = corePositionList[0]
                mc.move (pos[0], pos[1], pos[2], createBuffer, a=True)
                closestParentObject = distance.returnClosestObject(createBuffer,parentTemplateObjects)
                boundingBoxSize = distance.returnBoundingBoxSize (closestParentObject)
                maxSize = max(boundingBoxSize)
                size = maxSize *.25
                mc.delete(createBuffer)
                if partType == 'clavicle':
                    size = size * .5
                elif partType == 'head':
                    size = size * .75
                if (search.returnTagInfo(moduleParent,'cgmModuleType')) == 'clavicle':
                    size = size * 2
        
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            # Making the template objects
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            self.TemplateObject = {}
            
            #>>> Template objects
            for cnt,pos in enumerate(corePositionList):
                #Size multiplier based on PuppetMode, make it take into account module mode eventually
                if PuppetInstance.optionPuppetMode.get() == 0:
                    if cnt == 0:
                        sizeMultiplier = 1
                    elif cnt == len(corePositionList) -1:
                        sizeMultiplier = .8
                    else:
                        sizeMultiplier = .5
                else:
                    sizeMultiplier = 1
                    
                #make a sphere and move it
                createBuffer = curves.createControlCurve('sphere',(size * sizeMultiplier))
                self.TemplateObject[cnt] = ObjectFactory(createBuffer) # Instance the control to our module
                obj = self.TemplateObject[cnt]
                curves.setCurveColorByName(obj.nameLong,moduleColors[0])
                obj.store('cgmName',coreNames[cnt])
                
                obj.getNameTagsFromObject(self.ModuleNull.nameLong,['cgmName','cgmType'])

                obj.store('cgmType','templateObject')
                obj.doName()
                mc.move (pos[0], pos[1], pos[2], [obj.nameLong], a=True)
                            
                #adds it to the list
                self.templHandleList.append (obj.nameLong) 
                self.templatePosObjectsBuffer.store(obj.nameLong)
            
             
            #Aim the objects           
            position.aimObjects(self.templHandleList,
                                dictionary.axisDirectionsByString[ self.optionAimAxis.get() ],
                                dictionary.axisDirectionsByString[ self.optionUpAxis.get() ],
                                dictionary.axisDirectionsByString[ PuppetInstance.optionUpAxis.get() ])            
            
            #>>> Template curve
            crvName = mc.curve (d=doCurveDegree, p = corePositionList , os=True, n=('%s_%s' %(partName,(typesDictionary.get('templateCurve')))))            
            self.afTemplateCurve = AttrFactory(self.infoNulls['templatePosObjects'].get(),
                                               'curve','message', value=crvName)# connect it back to our template objects info null
            
            curve = ObjectFactory(crvName) # instance it
            curve.getNameTagsFromObject(self.ModuleNull.nameLong,['cgmType']) #get name tags from the module

            attributes.storeInfo(crvName,'cgmType','templateCurve') # store type
            curves.setCurveColorByName(crvName,moduleColors[1]) # set curve color
            
            # Make locators to connect the cv's to
            for cnt,obj in enumerate(self.templHandleList):
                pointLoc = locators.locMeObject(obj) # make the loc
                loc = ObjectFactory(pointLoc) #instance it
                mc.setAttr ((loc.nameShort+'.visibility'),0) # turn off visibility
                mc.parentConstraint ([obj],[loc.nameShort],mo=False) # parent constrain
                mc.connectAttr ( (loc.nameShort+'.translate'),
                                 ('%s.controlPoints[%i]' % (crvName, cnt)), f=True ) # connect the cv to the loc
                self.TemplateObject[cnt].store('loc',loc.nameLong)
                LocatorBuffer.store(loc.nameLong)
                
            #>>> Direction and size Stuff
            """
            # Directional data derived from joints 
            generalDirection = logic.returnHorizontalOrVertical(self.templHandleList)
            if generalDirection == 'vertical' and 'leg' not in self.afModuleType.get():
                worldUpVector = [0,0,-1]
            elif generalDirection == 'vertical' and 'leg' in self.afModuleType.get():
                worldUpVector = [0,0,1]
            else:
                worldUpVector = [0,1,0]
            """            
            
            # Create root control
            templateNull = self.msgTemplateNull.get()
            handleList = copy.copy(self.templatePosObjectsBuffer.bufferList)
            
            rootSize = (distance.returnBoundingBoxSizeToAverage(self.templHandleList[0])*1.5)
            rootCtrl = ObjectFactory(curves.createControlCurve('cube',rootSize))
            rootCtrl.getNameTagsFromObject(self.ModuleNull.nameLong)
            self.msgTemplateRoot = AttrFactory(self.infoNulls['templatePosObjects'].get(), 'root', 'message', value = rootCtrl.nameLong)
            curves.setCurveColorByName(rootCtrl.nameLong,moduleColors[0])
            
            # move the root
            if self.afModuleType.get() == 'clavicle':
                position.movePointSnap(rootCtrl.nameLong,self.templHandleList[0])
            else:
                position.movePointSnap(rootCtrl.nameLong,self.templHandleList[0])
            # aim the root
            position.aimSnap(rootCtrl.nameShort,self.templHandleList[-1],  
                            dictionary.axisDirectionsByString[ self.optionAimAxis.get() ],
                            dictionary.axisDirectionsByString[ self.optionUpAxis.get() ],
                            dictionary.axisDirectionsByString[ PuppetInstance.optionUpAxis.get() ]) 
            
            rootCtrl.store('cgmType','templateRoot')
            rootCtrl.doName()
            
            #>>> Parent the main objcts
            rootGroup = rootCtrl.doGroup()
            rootGroup = rigging.doParentReturnName(rootGroup,templateNull)
            curve.doParent(templateNull)
            
            for obj in LocatorBuffer.bufferList:
                rigging.doParentReturnName(obj,templateNull)
            mc.delete(LocatorCatcher.nameShort) # delete the locator buffer obj
            
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Orientation helpers
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            # Make our Orientation Helpers 
            """
            orientHelpersReturn = template.addOrientationHelpers(self)
            masterOrient = orientHelpersReturn[0]
            orientObjects = orientHelpersReturn[1]
            return
            
        
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Control helpers
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            print orientObjects
            print self.ModuleNull.nameShort
            print (templateNull+'.visControlHelpers')
            controlHelpersReturn = addControlHelpers(orientObjects,self.ModuleNull.nameShort,(templateNull+'.visControlHelpers'))"""
    
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Input the saved values if there are any
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            # Orientation Helpers 
            """rotBuffer = coreRotationList[-1]
            #actualName = mc.spaceLocator (n= wantedName)
            rotCheck = sum(rotBuffer)
            if rotCheck != 0:
                mc.rotate(rotBuffer[0],rotBuffer[1],rotBuffer[2],masterOrient,os=True)
            
            cnt = 0
            for obj in orientObjects:
                rotBuffer = coreRotationList[cnt]
                rotCheck = sum(rotBuffer)
                if rotCheck != 0:
                    mc.rotate(rotBuffer[0],rotBuffer[1],rotBuffer[2],obj,os=True)
                cnt +=1 
                    
            # Control Helpers 
            controlHelpers = controlHelpersReturn[0]
            cnt = 0
            for obj in controlHelpers:
                posBuffer = controlPositionList[cnt]
                posCheck = sum(posBuffer)
                if posCheck != 0:
                    mc.xform(obj,t=[posBuffer[0],posBuffer[1],posBuffer[2]],ws=True)
                
                rotBuffer = controlRotationList[cnt]
                rotCheck = sum(rotBuffer)
                if rotCheck != 0:
                    mc.rotate(rotBuffer[0],rotBuffer[1],rotBuffer[2],obj,ws=True)
                
                scaleBuffer = controlScaleList[cnt]
                scaleCheck = sum(scaleBuffer)
                if scaleCheck != 0:
                    mc.scale(scaleBuffer[0],scaleBuffer[1],scaleBuffer[2],obj,absolute=True)
                cnt +=1 """
            
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Final stuff
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            """
            returnList.append(templObjNameList)
            returnList.append(self.templHandleList)
            returnList.append(rootCtrl)"""
            return True	



        # Start objects stuff 
        partName = NameFactory.returnRawGeneratedName(self.ModuleNull.nameShort,ignore=['cgmType','cgmTypeModifier'])
        templateStarterDataInfoNull = self.infoNulls['templateStarterData'].value
        initialObjectsPosData = mc.listAttr(templateStarterDataInfoNull,userDefined=True)
        corePositionList = []
        coreRotationList = []
        corePositionDict = {}
        coreRotationDict = {}        
        for a in initialObjectsPosData:
            buffer = attributes.doGetAttr(templateStarterDataInfoNull,a)                            
            if 'cgm' not in a and type(buffer) is list:
                if 'pos' in a:
                    split = a.split('pos_')
                    corePositionDict[int(split[1])] =  buffer[0]
                    corePositionList.append(buffer[0])
                elif 'rot' in a:
                    split = a.split('rot_')
                    coreRotationDict[int(split[1])] =  buffer[0] 
                    coreRotationList.append(buffer[0])
   
        print corePositionList
        print coreRotationList
        
        # template control objects stuff #
        templateControlObjectsDataNull = self.infoNulls['templateControlObjects'].value
        templateControlObjectsData = mc.listAttr(templateControlObjectsDataNull,userDefined=True)
        controlPositionList = []
        controlRotationList = []
        controlScaleList = []
        controlPositionDict = {}
        controlRotationDict = {}
        controlScaleDict = {}
        
        for a in templateControlObjectsData:
            buffer = attributes.doGetAttr(templateControlObjectsDataNull,a)                            
            if 'cgm' not in a and type(buffer) is list:
                if 'pos' in a:
                    split = a.split('pos_')
                    controlPositionDict[int(split[1])] =  buffer[0] 
                    controlPositionList.append(buffer[0])                    
                elif 'rot' in a:
                    split = a.split('rot_')
                    controlRotationDict[int(split[1])] =  buffer[0] 
                    controlRotationList.append(buffer[0])
                elif 'scale' in a:
                    split = a.split('scale_')
                    controlScaleDict[int(split[1])] =  buffer[0]   
                    controlScaleList.append(buffer[0])
                    
                  
        print controlPositionList
        print controlRotationList
        print controlScaleList
        
        # Names Info #
        coreNamesInfoNull = self.infoNulls['coreNames'].value
        coreNamesBuffer = mc.listAttr(coreNamesInfoNull,userDefined=True)
        coreNames = {}
        for a in coreNamesBuffer:
            if 'cgm' not in a and 'name_' in a:
                split = a.split('name_')
                coreNames[int(split[1])] =  attributes.doGetAttr(coreNamesInfoNull,a) 
                
        print coreNames            
        print ('%s data aquired...'%self.ModuleNull.nameShort)
        
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        #>> make template objects
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
        #makes template objects#
        assert len(corePositionList) == self.optionHandles.get(),"There isn't enough data to template. Needs to be sized"
        
        templateObjects = makeLimbTemplate(self)
        guiFactory.report( 'Template Limb made....')
        
        
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        #>> Parent objects
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
        for cnt,obj in enumerate(self.templHandleList): 
            self.TemplateObject[cnt].doParent(self.msgTemplateNull.get())
    
        guiFactory.report('Template objects parented')
        
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        #>> Transform groups and Handles...handling
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        self.templatePosObjectsBuffer.updateData()
        root = self.msgTemplateRoot.get()
        handles = copy.copy( self.templatePosObjectsBuffer.bufferList )
        stiffIndex = self.optionStiffIndex.get()
        
        """ Don't remember why I did this stiff index thing....
        #>>> Break up the handles into the sets we need 
        if stiffIndex == 0:
            splitHandles = False
            handlesToSplit = handles
            handlesRemaining = [handles[0],handles[-1]]
        elif stiffIndex < 0:
            splitHandles = True
            handlesToSplit = handles[:stiffIndex]
            handlesRemaining = handles[stiffIndex:]
            handlesRemaining.append(handles[0])
        elif stiffIndex > 0:
            splitHandles = True
            handlesToSplit = handles[stiffIndex:]
            handlesRemaining = handles[:stiffIndex]
            handlesRemaining.append(handles[-1]) 
        if len(handlesToSplit)>2:"""
        
        # makes our mid transform groups#
        if len(handles)>2:
            constraintGroups = constraints.doLimbSegmentListParentConstraint(handles)
            print 'Constraint groups created...'
            for group in constraintGroups:
                mc.parent(group,root)
            
        # zero out the first and last#
        for handle in [handles[0],handles[-1]]:
            groupBuffer = (rigging.groupMeObject(handle,maintainParent=True))
            mc.parent(groupBuffer,root)
           
        #>>> Break up the handles into the sets we need 
        if stiffIndex < 0:
            for handle in handles[(stiffIndex+-1):-1]:
                groupBuffer = (rigging.groupMeObject(handle,maintainParent=True))
                mc.parent(groupBuffer,handles[-1])
        elif stiffIndex > 0:
            for handle in handles[1:(stiffIndex+1)]:
                groupBuffer = (rigging.groupMeObject(handle,maintainParent=True))
                mc.parent(groupBuffer,handles[0])
                
        print 'Constraint groups parented...'
        
        #>>> Lock off handles
        self.templatePosObjectsBuffer.updateData()
        for obj in self.templatePosObjectsBuffer.bufferList:
            attributes.doSetLockHideKeyableAttr(obj,True,False,False,['sx','sy','sz','v'])
            
        
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Parenting constraining parts
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        """ COME BACK AFTER DONE WITH SEGMENT
        if self.moduleParent:
            if self.afModuleType.get() == 'clavicle':
                self.moduleParent = attributes.returnMessageObject(self.moduleParent,'self.moduleParent')
            parentTemplatePosObjectsInfoNull = modules.returnInfoTypeNull(self.moduleParent,'templatePosObjects')
            parentTemplatePosObjectsInfoData = attributes.returnUserAttrsToDict (parentTemplatePosObjectsInfoNull)
            parentTemplateObjects = []
            for key in parentTemplatePosObjectsInfoData.keys():
                if (mc.attributeQuery (key,node=parentTemplatePosObjectsInfoNull,msg=True)) == True:
                    if search.returnTagInfo((parentTemplatePosObjectsInfoData[key]),'cgmType') != 'templateCurve':
                        parentTemplateObjects.append (parentTemplatePosObjectsInfoData[key])
            closestParentObject = distance.returnClosestObject(rootName,parentTemplateObjects)
            if (search.returnTagInfo(self.ModuleNull.nameShort,'cgmModuleType')) != 'foot':
                constraintGroup = rigging.groupMeObject(rootName,maintainParent=True)
                constraintGroup = NameFactory.doNameObject(constraintGroup)
                mc.pointConstraint(closestParentObject,constraintGroup, maintainOffset=True)
                mc.scaleConstraint(closestParentObject,constraintGroup, maintainOffset=True)
            else:
                constraintGroup = rigging.groupMeObject(closestParentObject,maintainParent=True)
                constraintGroup = NameFactory.doNameObject(constraintGroup)
                mc.parentConstraint(rootName,constraintGroup, maintainOffset=True)
                
        # grab the last clavicle piece if the arm has one and connect it to the arm  #
        if self.moduleParent:
            if (search.returnTagInfo(self.ModuleNull.nameShort,'cgmModuleType')) == 'arm':
                if (search.returnTagInfo(self.moduleParent,'cgmModuleType')) == 'clavicle':
                    print '>>>>>>>>>>>>>>>>>>>>> YOU FOUND ME'
                    parentTemplatePosObjectsInfoNull = modules.returnInfoTypeNull(self.moduleParent,'templatePosObjects')
                    parentTemplatePosObjectsInfoData = attributes.returnUserAttrsToDict (parentTemplatePosObjectsInfoNull)
                    parentTemplateObjects = []
                    for key in parentTemplatePosObjectsInfoData.keys():
                        if (mc.attributeQuery (key,node=parentTemplatePosObjectsInfoNull,msg=True)) == True:
                            if search.returnTagInfo((parentTemplatePosObjectsInfoData[key]),'cgmType') != 'templateCurve':
                                parentTemplateObjects.append (parentTemplatePosObjectsInfoData[key])
                    closestParentObject = distance.returnClosestObject(rootName,parentTemplateObjects)
                    endConstraintGroup = rigging.groupMeObject(closestParentObject,maintainParent=True)
                    endConstraintGroup = NameFactory.doNameObject(endConstraintGroup)
                    mc.pointConstraint(handles[0],endConstraintGroup, maintainOffset=True)
                    mc.scaleConstraint(handles[0],endConstraintGroup, maintainOffset=True)
        """    
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        #>> Final stuff
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
        
        #>>> Set our new module rig process state
        self.afTemplateState.set(1)
        print ('%s done!'%self.ModuleNull.nameShort)
        
        #>>> Tag our objects for easy deletion
        children = mc.listRelatives (self.msgTemplateNull.get(), allDescendents = True,type='transform')
        for obj in children:
            attributes.storeInfo(obj,'cgmOwnedBy',self.msgTemplateNull.get())
            
        #>>> Visibility Connection
        """
Ejemplo n.º 9
0
def keyBuffer(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.key()  
Ejemplo n.º 10
0
def purgeBuffer(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.purge()  
Ejemplo n.º 11
0
def removeSelected(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.doRemoveSelected()
Ejemplo n.º 12
0
def addSelected(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.doStoreSelected()
Ejemplo n.º 13
0
def selectBufferObjects(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.select()
Ejemplo n.º 14
0
    def initialize(self):
        """ 
        Verifies the various components a masterNull for a character/asset. If a piece is missing it replaces it.
        
        RETURNS:
        success(bool)
        """
        #Puppet null
        if not attributes.doGetAttr(self.PuppetNull.nameShort, 'cgmName'):
            return False
        if attributes.doGetAttr(self.PuppetNull.nameShort,
                                'cgmType') != 'ignore':
            return False
        if attributes.doGetAttr(self.PuppetNull.nameShort,
                                'cgmModuleType') != 'master':
            return False

        self.msgModulesGroup = AttrFactory(self.PuppetNull, 'modulesGroup')
        if not self.msgModulesGroup.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgModulesGroup.attr)
            return False
        else:
            self.ModulesGroup = ObjectFactory(self.msgModulesGroup.get())

        self.msgNoTransformGroup = AttrFactory(self.PuppetNull,
                                               'noTransformGroup')
        if not self.msgNoTransformGroup.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgNoTransformGroup.attr)
            return False
        else:
            self.NoTransformGroup = ObjectFactory(
                self.msgNoTransformGroup.get())

        self.msgGeoGroup = AttrFactory(self.PuppetNull, 'geoGroup')
        if not self.msgGeoGroup.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgGeoGroup.attr)
            return False
        else:
            self.GeoGroup = ObjectFactory(self.msgGeoGroup.get())

        self.msgPuppetInfo = AttrFactory(self.PuppetNull, 'info')
        if not self.msgPuppetInfo.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgPuppetInfo.attr)
            return False

        else:
            self.PuppetInfoNull = ObjectFactory(self.msgPuppetInfo.get())
            self.msgModuleInfo = AttrFactory(self.PuppetInfoNull, 'modules')
            if not self.msgModuleInfo.get():
                guiFactory.warning(
                    "'%s' looks to be missing. Go back to unreferenced file" %
                    self.msgModuleInfo.attr)
                return False
            else:
                #Initialize our modules null as a buffer
                self.ModuleInfoNull = ObjectFactory(self.msgModuleInfo.get())
                self.ModulesBuffer = BufferFactory(self.msgModuleInfo.get())

            self.msgGeoInfo = AttrFactory(self.PuppetInfoNull, 'geo')
            if not self.msgGeoInfo.get():
                guiFactory.warning(
                    "'%s' looks to be missing. Go back to unreferenced file" %
                    self.msgGeoInfo.attr)
                return False
            else:
                self.GeoInfoNull = ObjectFactory(self.msgGeoInfo.get())

            self.msgSettingsInfo = AttrFactory(self.PuppetInfoNull, 'settings')
            if not self.msgSettingsInfo.get():
                guiFactory.warning(
                    "'%s' looks to be missing. Go back to unreferenced file" %
                    self.msgSettingsInfo.attr)
                return False
            else:
                self.SettingsInfoNull = ObjectFactory(
                    self.msgSettingsInfo.get(), )

                self.optionPuppetMode = AttrFactory(
                    self.SettingsInfoNull, 'optionPuppetTemplateMode')
                self.optionAimAxis = AttrFactory(self.SettingsInfoNull,
                                                 'axisAim')
                self.optionUpAxis = AttrFactory(self.SettingsInfoNull,
                                                'axisUp')
                self.optionOutAxis = AttrFactory(self.SettingsInfoNull,
                                                 'axisOut')

        return True
Ejemplo n.º 15
0
def selectBufferObjects(objectBufferName):
    tmp = BufferFactory(objectBufferName)
    tmp.select()
Ejemplo n.º 16
0
class PuppetFactory():
    """ 
    Character
    
    """
    def __init__(self, characterName='', *a, **kw):
        """ 
        Intializes an optionVar class handler
        
        Keyword arguments:
        varName(string) -- name for the optionVar
        
        ObjectFactories:
        self.PuppetNull - main null
        self.NoTransformGroup        
        >>> self.GeoGroup - group where geo is stored to
        self.PuppetInfoNull - master puppet info null under which the other nulls live        
        >>> self.GeoInfoNull
        >>> self.ModuleInfoNull
        >>> self.ModulesGroup
        
        BufferFactories:
        self.ModulesBuffer - buffer for modules. Instanced from self.ModuleInfoNull
        
        """
        #>>>Keyword args
        characterType = kw.pop('characterType', '')
        initializeOnly = kw.pop('initializeOnly', False)

        #Default to creation of a var as an int value of 0
        ### input check
        self.masterNulls = modules.returnPuppetObjects()
        self.nameBase = characterName

        for l in initLists:
            self.__dict__[l] = []
        for d in initDicts:
            self.__dict__[d] = {}
        for o in initStores:
            self.__dict__[o] = False

        guiFactory.doPrintReportStart()

        if mc.objExists(characterName):
            #Make a name dict to check
            if search.findRawTagInfo(characterName,
                                     'cgmModuleType') == 'master':
                self.nameBase = characterName
                self.PuppetNull = ObjectFactory(characterName)
                self.refState = self.PuppetNull.refState
                guiFactory.report("'%s' exists. Checking..." % characterName)

            else:
                guiFactory.warning(
                    "'%s' isn't a puppet module. Can't initialize" %
                    characterName)
                return
        else:
            if self.nameBase == '':
                randomOptions = [
                    'ReallyNameMe', 'SolarSystem_isADumbName', 'David', 'Josh',
                    'Ryan', 'NameMe', 'Homer', 'Georgie', 'PleaseNameMe',
                    'NAMEThis', 'PleaseNameThisPuppet'
                ]
                buffer = random.choice(randomOptions)
                cnt = 0
                while mc.objExists(buffer) and cnt < 10:
                    cnt += 1
                    buffer = random.choice(randomOptions)
                self.nameBase = buffer

        if self.refState or initializeOnly:
            guiFactory.report("'%s' Initializing..." % characterName)
            if not self.initialize():
                guiFactory.warning(
                    "'%s' failed to initialize. Please go back to the non referenced file to repair!"
                    % moduleName)
                return

        else:
            if not self.verify():
                guiFactory.warning("'%s' failed to verify!" % characterName)
                return

        self.checkGeo()
        self.verifyTemplateSizeObject(False)
        self.getModules(initializeOnly=initializeOnly, *a, **kw)
        guiFactory.report("'%s' checks out" % self.nameBase)
        guiFactory.doPrintReportEnd()

    def verify(self):
        """ 
        Verifies the various components a masterNull for a character/asset. If a piece is missing it replaces it.
        
        RETURNS:
        success(bool)
        """
        #Puppet null
        try:
            if not mc.objExists(self.nameBase):
                buffer = mc.group(empty=True)
                self.PuppetNull = ObjectFactory(buffer)
            else:
                self.PuppetNull = ObjectFactory(self.nameBase)

            self.PuppetNull.store('cgmName', self.nameBase, True)
            self.PuppetNull.store('cgmType', 'ignore')
            self.PuppetNull.store('cgmModuleType', 'master')

            if self.PuppetNull.nameShort != self.nameBase:
                self.PuppetNull.doName(False)

            attributes.doSetLockHideKeyableAttr(self.PuppetNull.nameShort,
                                                channels=[
                                                    'tx', 'ty', 'tz', 'rx',
                                                    'ry', 'rz', 'sx', 'sy',
                                                    'sz'
                                                ])
        except:
            guiFactory.warning("Puppet null failed!")

        #Checks our modules container null
        created = False
        #Initialize message attr
        self.msgModulesGroup = AttrFactory(self.PuppetNull, 'modulesGroup',
                                           'message')
        if not self.msgModulesGroup.get():
            self.ModulesGroup = ObjectFactory(mc.group(empty=True))
            self.msgModulesGroup.doStore(self.ModulesGroup.nameShort)
            created = True
        else:
            self.ModulesGroup = ObjectFactory(self.msgModulesGroup.get())

        self.ModulesGroup.store('cgmName', 'modules')
        self.ModulesGroup.store('cgmType', 'group')

        self.ModulesGroup.doParent(self.PuppetNull.nameShort)

        if created:
            self.ModulesGroup.doName(False)

        self.msgModulesGroup.updateData()

        attributes.doSetLockHideKeyableAttr(self.ModulesGroup.nameShort)

        #Checks our noTransform container null
        created = False
        self.msgNoTransformGroup = AttrFactory(self.PuppetNull,
                                               'noTransformGroup', 'message')
        if not self.msgNoTransformGroup.get():
            self.NoTransformGroup = ObjectFactory(mc.group(empty=True))
            self.msgNoTransformGroup.doStore(self.NoTransformGroup.nameShort)
            created = True
        else:
            self.NoTransformGroup = ObjectFactory(
                self.msgNoTransformGroup.get())

        self.NoTransformGroup.store('cgmName', 'noTransform')
        self.NoTransformGroup.store('cgmType', 'group')

        self.NoTransformGroup.doParent(self.PuppetNull.nameShort)

        if created:
            self.NoTransformGroup.doName(False)

        self.msgNoTransformGroup.updateData()

        attributes.doSetLockHideKeyableAttr(self.NoTransformGroup.nameShort)

        #Checks our geo container null
        created = False
        self.msgGeoGroup = AttrFactory(self.PuppetNull, 'geoGroup', 'message')
        if not self.msgGeoGroup.get():
            self.GeoGroup = ObjectFactory(mc.group(empty=True))
            self.msgGeoGroup.doStore(self.GeoGroup.nameShort)
            created = True
        else:
            self.GeoGroup = ObjectFactory(self.msgGeoGroup.get())

        self.GeoGroup.store('cgmName', 'geo')
        self.GeoGroup.store('cgmType', 'group')

        self.GeoGroup.doParent(self.msgNoTransformGroup.get())

        if created:
            self.GeoGroup.doName(False)

        self.msgGeoGroup.updateData()

        attributes.doSetLockHideKeyableAttr(self.GeoGroup.nameShort)

        #Checks master info null
        created = False
        self.msgPuppetInfo = AttrFactory(self.PuppetNull, 'info', 'message')
        if not self.msgPuppetInfo.get():
            self.PuppetInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgPuppetInfo.doStore(self.PuppetInfoNull.nameShort)
            created = True
        else:
            self.PuppetInfoNull = ObjectFactory(self.msgPuppetInfo.get())

        self.PuppetInfoNull.store('cgmName', 'master')
        self.PuppetInfoNull.store('cgmType', 'info')

        self.PuppetInfoNull.doParent(self.PuppetNull.nameShort)

        if created:
            self.PuppetInfoNull.doName(False)

        self.msgPuppetInfo.updateData()

        attributes.doSetLockHideKeyableAttr(self.PuppetInfoNull.nameShort)

        #Checks modules info null
        created = False
        self.msgModuleInfo = AttrFactory(self.msgPuppetInfo.get(), 'modules',
                                         'message')
        if not self.msgModuleInfo.get():
            self.ModuleInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgModuleInfo.doStore(self.ModuleInfoNull.nameShort)
            created = True
        else:
            self.ModuleInfoNull = ObjectFactory(self.msgModuleInfo.get())

        self.ModuleInfoNull.store('cgmName', 'modules')
        self.ModuleInfoNull.store('cgmType', 'info')

        self.ModuleInfoNull.doParent(self.PuppetInfoNull.nameShort)

        if created:
            self.ModuleInfoNull.doName(False)

        self.msgModuleInfo.updateData()

        attributes.doSetLockHideKeyableAttr(self.ModuleInfoNull.nameShort)

        #Initialize our modules null as a buffer
        self.ModulesBuffer = BufferFactory(self.ModuleInfoNull.nameShort)

        #Checks geo info null
        created = False
        self.msgGeoInfo = AttrFactory(self.msgPuppetInfo.get(), 'geo',
                                      'message')
        if not self.msgGeoInfo.get():
            self.GeoInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgGeoInfo.doStore(self.GeoInfoNull.nameShort)
            created = True
        else:
            self.GeoInfoNull = ObjectFactory(self.msgGeoInfo.get())

        self.GeoInfoNull.store('cgmName', 'geo')
        self.GeoInfoNull.store('cgmType', 'info')

        self.GeoInfoNull.doParent(self.msgPuppetInfo.get())

        if created:
            self.GeoInfoNull.doName(False)

        self.msgGeoInfo.updateData()

        attributes.doSetLockHideKeyableAttr(self.GeoInfoNull.nameShort)

        #Checks settings info null
        created = False
        self.msgSettingsInfo = AttrFactory(self.msgPuppetInfo.get(),
                                           'settings', 'message')
        if not self.msgSettingsInfo.get():
            self.SettingsInfoNull = ObjectFactory(mc.group(empty=True))
            self.msgSettingsInfo.doStore(self.SettingsInfoNull.nameShort)
            created = True
        else:
            self.SettingsInfoNull = ObjectFactory(self.msgSettingsInfo.get())

        self.SettingsInfoNull.store('cgmName', 'settings')
        self.SettingsInfoNull.store('cgmType', 'info')
        defaultFont = modules.returnSettingsData('defaultTextFont')
        self.SettingsInfoNull.store('font', defaultFont)

        self.SettingsInfoNull.doParent(self.msgPuppetInfo.get())

        if created:
            self.SettingsInfoNull.doName(False)

        self.msgSettingsInfo.updateData()

        self.optionPuppetMode = AttrFactory(self.SettingsInfoNull,
                                            'optionPuppetTemplateMode',
                                            'int',
                                            initialValue=0)

        self.optionAimAxis = AttrFactory(self.SettingsInfoNull,
                                         'axisAim',
                                         'enum',
                                         enum='x+:y+:z+:x-:y-:z-',
                                         initialValue=2)
        self.optionUpAxis = AttrFactory(self.SettingsInfoNull,
                                        'axisUp',
                                        'enum',
                                        enum='x+:y+:z+:x-:y-:z-',
                                        initialValue=1)
        self.optionOutAxis = AttrFactory(self.SettingsInfoNull,
                                         'axisOut',
                                         'enum',
                                         enum='x+:y+:z+:x-:y-:z-',
                                         initialValue=0)

        attributes.doSetLockHideKeyableAttr(self.SettingsInfoNull.nameShort)

        return True

    def initialize(self):
        """ 
        Verifies the various components a masterNull for a character/asset. If a piece is missing it replaces it.
        
        RETURNS:
        success(bool)
        """
        #Puppet null
        if not attributes.doGetAttr(self.PuppetNull.nameShort, 'cgmName'):
            return False
        if attributes.doGetAttr(self.PuppetNull.nameShort,
                                'cgmType') != 'ignore':
            return False
        if attributes.doGetAttr(self.PuppetNull.nameShort,
                                'cgmModuleType') != 'master':
            return False

        self.msgModulesGroup = AttrFactory(self.PuppetNull, 'modulesGroup')
        if not self.msgModulesGroup.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgModulesGroup.attr)
            return False
        else:
            self.ModulesGroup = ObjectFactory(self.msgModulesGroup.get())

        self.msgNoTransformGroup = AttrFactory(self.PuppetNull,
                                               'noTransformGroup')
        if not self.msgNoTransformGroup.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgNoTransformGroup.attr)
            return False
        else:
            self.NoTransformGroup = ObjectFactory(
                self.msgNoTransformGroup.get())

        self.msgGeoGroup = AttrFactory(self.PuppetNull, 'geoGroup')
        if not self.msgGeoGroup.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgGeoGroup.attr)
            return False
        else:
            self.GeoGroup = ObjectFactory(self.msgGeoGroup.get())

        self.msgPuppetInfo = AttrFactory(self.PuppetNull, 'info')
        if not self.msgPuppetInfo.get():
            guiFactory.warning(
                "'%s' looks to be missing. Go back to unreferenced file" %
                self.msgPuppetInfo.attr)
            return False

        else:
            self.PuppetInfoNull = ObjectFactory(self.msgPuppetInfo.get())
            self.msgModuleInfo = AttrFactory(self.PuppetInfoNull, 'modules')
            if not self.msgModuleInfo.get():
                guiFactory.warning(
                    "'%s' looks to be missing. Go back to unreferenced file" %
                    self.msgModuleInfo.attr)
                return False
            else:
                #Initialize our modules null as a buffer
                self.ModuleInfoNull = ObjectFactory(self.msgModuleInfo.get())
                self.ModulesBuffer = BufferFactory(self.msgModuleInfo.get())

            self.msgGeoInfo = AttrFactory(self.PuppetInfoNull, 'geo')
            if not self.msgGeoInfo.get():
                guiFactory.warning(
                    "'%s' looks to be missing. Go back to unreferenced file" %
                    self.msgGeoInfo.attr)
                return False
            else:
                self.GeoInfoNull = ObjectFactory(self.msgGeoInfo.get())

            self.msgSettingsInfo = AttrFactory(self.PuppetInfoNull, 'settings')
            if not self.msgSettingsInfo.get():
                guiFactory.warning(
                    "'%s' looks to be missing. Go back to unreferenced file" %
                    self.msgSettingsInfo.attr)
                return False
            else:
                self.SettingsInfoNull = ObjectFactory(
                    self.msgSettingsInfo.get(), )

                self.optionPuppetMode = AttrFactory(
                    self.SettingsInfoNull, 'optionPuppetTemplateMode')
                self.optionAimAxis = AttrFactory(self.SettingsInfoNull,
                                                 'axisAim')
                self.optionUpAxis = AttrFactory(self.SettingsInfoNull,
                                                'axisUp')
                self.optionOutAxis = AttrFactory(self.SettingsInfoNull,
                                                 'axisOut')

        return True

    def delete(self):
        """
        Delete the Puppet
        """
        mc.delete(self.PuppetNull.nameLong)
        self = False

    def getState(self):
        """
        Return a Puppet's state
        
        Returns:
        state/False -- (int)/(bool)
        """
        checkList = []
        if self.getModuleStates() is False:
            return False
        for k in self.moduleStates.keys():
            checkList.append(self.moduleStates[k])
        return min(checkList)

    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    # Modules
    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    def changeModuleCGMTag(self, moduleName, tag, newInfo, *a, **kw):
        """
        Function to change a cgm tag on a module and push a rename through that moudule's instance
        
        moduleName(string)
        tag(string) which tag to use. For a list
        ###
        from cgm.lib.classes import NameFactory
        NameFactory.cgmNameTags   
        ###
        newInfo(*a,**kw) - info to pass into the attributes.storeInfo() function
        """
        if moduleName in self.ModulesBuffer.bufferList:
            #Clear our instanced module
            index = self.ModulesBuffer.bufferList.index(moduleName)
            modType = search.returnTagInfo(
                self.Module[index].ModuleNull.nameShort, 'moduleType') or False
            if index is not False:
                if modType in moduleTypeToFunctionDict.keys():
                    if self.Module[index].changeCGMTag(tag, newInfo, *a, **kw):
                        self.Module[index] = moduleTypeToFunctionDict[modType](
                            self.Module[index].ModuleNull.nameShort)
                    self.ModulesBuffer.updateData()
                else:
                    guiFactory.warning(
                        "'%s' is not a module type found in the moduleTypeToFunctionDict. Cannot initialize"
                        % modType)
                    return False
            else:
                guiFactory.warning("%s is not a valid index. Cannot continue" %
                                   index)
                return False
        else:
            guiFactory.warning(
                "'%s' doesn't seem to be a connected module. Cannot change tag"
                % moduleName)
            return False

    def getModules(self, *a, **kw):
        """
        Intializes all connected modules of a puppet
        """
        self.Module = {}
        self.moduleIndexDict = {}
        self.moduleParents = {}
        self.ModulesBuffer.updateData()
        if self.ModulesBuffer.bufferList:
            for i, m in enumerate(self.ModulesBuffer.bufferList):
                modType = search.returnTagInfo(m, 'moduleType') or False
                if modType in moduleTypeToFunctionDict.keys():
                    self.Module[i] = moduleTypeToFunctionDict[modType](m, *a,
                                                                       **kw)
                    self.Module[i].ModuleNull.doParent(
                        self.ModulesGroup.nameLong)
                    self.moduleIndexDict[m] = i
                else:
                    guiFactory.warning(
                        "'%s' is not a module type found in the moduleTypeToFunctionDict. Cannot initialize"
                        % modType)

    def getModuleStates(self, *a, **kw):
        """
        Get's a dictionary of module states indexed to same indexes as the self.Module[i] format
        """
        self.ModuleStates = {}
        if self.ModulesBuffer.bufferList:
            for i, m in enumerate(self.ModulesBuffer.bufferList):
                self.moduleStates[i] = self.Module[i].getState()
        else:
            return False
        return self.moduleStates

    def createModule(self, moduleType, *a, **kw):
        """
        Create and connect a new module
        
        moduleType(string) - type of module to create
        """
        if moduleType in moduleTypeToFunctionDict.keys():
            tmpModule = moduleTypeToFunctionDict[moduleType](forceNew=True,
                                                             *a,
                                                             **kw)
            self.ModulesBuffer.store(tmpModule.ModuleNull.nameShort)
            tmpModule.ModuleNull.doParent(self.ModulesGroup.nameShort)
            self.Module[self.ModulesBuffer.bufferList.index(
                tmpModule.ModuleNull.nameShort)] = tmpModule
        else:
            guiFactory.warning(
                "'%s' is not a module type found in the moduleTypeToFunctionDict. Cannot initialize"
                % moduleType)

    def addModule(self, module, *a, **kw):
        """
        Adds a module to a puppet
        
        module(string)
        """
        if module in self.ModulesBuffer.bufferList:
            return guiFactory.warning("'%s' already connnected to '%s'" %
                                      (module, self.nameBase))

        elif mc.objExists(module):
            # If it exists, check type to initialize and add
            modType = search.returnTagInfo(module, 'moduleType') or False
            if modType in moduleTypeToFunctionDict.keys():
                self.ModulesBuffer.store(module)
                moduleNullBuffer = rigging.doParentReturnName(
                    module, self.msgModulesGroup.get())
                self.Module[self.ModulesBuffer.bufferList.index(
                    module)] = moduleTypeToFunctionDict[modType](
                        moduleNullBuffer)

            else:
                guiFactory.warning(
                    "'%s' is not a module type found in the moduleTypeToFunctionDict. Cannot initialize"
                )

        else:
            guiFactory.warning(
                "'%s' is not a module type found in the moduleTypeToFunctionDict. Cannot initialize"
                % module)

    def removeModule(self, moduleName):
        """
        Removes a module from a puppet
        
        module(string)
        """
        if moduleName in self.ModulesBuffer.bufferList:
            #Clear our instanced module
            index = self.ModulesBuffer.bufferList.index(moduleName)
            if index is not False:
                self.Module[index] = False
            self.ModulesBuffer.remove(moduleName)
            buffer = rigging.doParentToWorld(moduleName)
            self.getModules()
        else:
            guiFactory.warning(
                "'%s' doesn't seem to be a connected module. Cannot remove" %
                moduleName)

    def deleteModule(self, moduleName, *a, **kw):
        """
        Removes a module from a puppet
        
        module(string)
        """
        if moduleName in self.ModulesBuffer.bufferList:
            #Clear our instanced module
            index = self.ModulesBuffer.bufferList.index(moduleName)
            if index:
                self.Module[index] = False

            self.ModulesBuffer.remove(moduleName)
            buffer = rigging.doParentToWorld(moduleName)
            mc.delete(buffer)
            self.getModules()
        else:
            guiFactory.warning(
                "'%s' doesn't seem to be a connected module. Cannot delete" %
                moduleName)

    def getOrderedModules(self):
        """ 
        Returns ordered modules of a character
        
        Stores:
        self.orderedModules(list)       
        
        Returns:
        self.orderedModules(list)
        """
        assert self.ModulesBuffer.bufferList, "'%s' has no modules" % self.nameBase
        self.orderedModules = []
        self.rootModules = []
        moduleParents = {}

        for i, m in enumerate(self.ModulesBuffer.bufferList):
            if self.Module[i].moduleParent:
                moduleParents[m] = self.Module[i].moduleParent
            else:
                self.orderedModules.append(m)
                self.rootModules.append(m)

        while len(moduleParents):
            for module in self.orderedModules:
                for k in moduleParents.keys():
                    if moduleParents.get(k) == module:
                        self.orderedModules.append(k)
                        moduleParents.pop(k)

        return self.orderedModules

    def getOrderedParentModules(self):
        """ 
        Returns ordered list of parent modules of a character
        
        Stores:
        self.moduleChildren(dict)
        self.orderedParentModules(list)       
        self.rootModules(list)
        
        Returns:
        self.orderedParentModules(list)
        """
        moduleParents = {}
        self.orderedParentModules = []
        self.moduleChildren = {}

        #First get our module children stored tothe instance as a dict
        for i, m in enumerate(self.ModulesBuffer.bufferList):
            if not self.Module[i].moduleParent:
                self.orderedParentModules.append(m)
            else:
                moduleParents[m] = self.Module[i].moduleParent

            childrenBuffer = []
            for iCheck, mCheck in enumerate(self.ModulesBuffer.bufferList):
                if self.Module[iCheck].moduleParent == m:
                    childrenBuffer.append(mCheck)
            if childrenBuffer:
                self.moduleChildren[m] = childrenBuffer

        moduleChildrenD = copy.copy(self.moduleChildren)

        # Pop the
        if self.orderedParentModules:
            for p in self.orderedParentModules:
                try:
                    moduleChildrenD.pop(p)
                except:
                    pass

        cnt = 0
        #Process the childdren looking for parents as children and so on and so forth, appending them as it finds them
        while len(moduleChildrenD) > 0 and cnt < 100:
            for module in self.orderedParentModules:
                print module
                for child in moduleChildrenD.keys():
                    cnt += 1
                    if child in moduleParents.keys(
                    ) and moduleParents[child] == module:
                        self.orderedParentModules.append(child)
                        moduleChildrenD.pop(child)

        guiFactory.report("Children dict is - '%s'" % self.moduleChildren)
        guiFactory.report("Module Parents dict is - '%s'" % moduleParents)
        guiFactory.report("Ordered Parents dict is - '%s'" %
                          self.orderedParentModules)

        return self.orderedParentModules

    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    # Size objects
    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    def verifyTemplateSizeObject(self, create=False):
        """ 
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        DESCRIPTION:
        Returns an existing template size object or makes one and returns it
        
        ARGUMENTS:
        masterNull(list)
        
        RETURNS:
        returnList(list) - size object controls
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        """
        templateSizeObject = attributes.returnMessageObject(
            self.PuppetNull.nameShort, 'templateSizeObject')
        if not mc.objExists(templateSizeObject) and create:
            self.createSizeTemplateControl()
            guiFactory.report("'%s' has template object '%s'" %
                              (self.PuppetNull.nameShort, templateSizeObject))
            return True
        elif templateSizeObject:
            self.templateSizeObjects['root'] = templateSizeObject
            self.templateSizeObjects['start'] = attributes.returnMessageObject(
                templateSizeObject, 'controlStart')
            self.templateSizeObjects['end'] = attributes.returnMessageObject(
                templateSizeObject, 'controlEnd')
            for key in self.templateSizeObjects.keys():
                if not self.templateSizeObjects[key]:
                    #self.templateSizeObjects = {}
                    guiFactory.warning(
                        "'%s' didn't check out. Rebuildling..." % (key))
                    try:
                        mc.delete(templateSizeObject)
                        self.createSizeTemplateControl()
                    except:
                        guiFactory.warning("Rebuild failed")
                    return False
            guiFactory.report("'%s' has template object '%s'" %
                              (self.PuppetNull.nameShort, templateSizeObject))
            return True

        guiFactory.warning("Size template failed to verify")
        return False

    def isRef(self):
        """
        Basic ref check. Stores to self
        """
        if mc.referenceQuery(self.PuppetNull.nameShort, isNodeReferenced=True):
            self.refState = True
            self.refPrefix = search.returnReferencePrefix(
                self.PuppetNull.nameShort)
            return
        self.refState = False
        self.refPrefix = None

    def createSizeTemplateControl(self):
        """ 
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   
        DESCRIPTION:
        Generates a sizeTemplateObject. It's been deleted, it recreates it. Guess the size based off of there
        being a mesh there. If there is no mesh, it sets sets an intial size of a 
        [155,170,29] unit character.
        
        ARGUMENTS:
        self.PuppetNull.nameShort(string)
        
        RETURNS:
        returnList(list) = [startCrv(string),EndCrv(list)]
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        """
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Get info
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        startColors = modules.returnSettingsData('colorStart')
        endColors = modules.returnSettingsData('colorEnd')

        font = mc.getAttr((self.msgSettingsInfo.get() + '.font'))
        """ checks for there being anything in our geo group """
        if not self.geo:
            return guiFactory.warning(
                'Need some geo defined to make this tool worthwhile')
            boundingBoxSize = modules.returnSettingsDataAsFloat(
                'meshlessSizeTemplate')
        else:
            boundingBoxSize = distance.returnBoundingBoxSize(
                self.msgGeoGroup.get())
            boundingBox = mc.exactWorldBoundingBox(self.msgGeoGroup.get())
        """determine orienation """
        maxSize = max(boundingBoxSize)
        matchIndex = boundingBoxSize.index(maxSize)
        """Find the pivot of the bounding box """
        pivotPosition = distance.returnCenterPivotPosition(
            self.msgGeoGroup.get())

        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Get our positions
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        if self.optionPuppetMode.get() == 0:
            #If bio...
            if matchIndex == 1 or matchIndex == 0:
                #Vertical
                posBuffers = [[0, .5, 0], [0, .75, 0]]
                width = (boundingBoxSize[0] / 2)
                height = (boundingBoxSize[1])
                depth = boundingBoxSize[2]

                for cnt, pos in enumerate(posBuffers):
                    posBuffer = posBuffers[cnt]
                    posBuffer[0] = 0
                    posBuffer[1] = (posBuffer[1] * height)
                    posBuffer[2] = 0

            elif matchIndex == 2:
                #Horizontal
                posBuffers = [[0, 0, -.33], [0, 0, .66]]
                width = boundingBoxSize[1]
                height = boundingBoxSize[2] / 2
                depth = (boundingBoxSize[0])

                for cnt, pos in enumerate(posBuffers):
                    posBuffer = posBuffers[cnt]
                    posBuffer[0] = 0
                    posBuffer[1] = boundingBoxSize[1] * .75
                    posBuffer[2] = (posBuffer[2] * height)

        else:
            #Otherwise
            if matchIndex == 1 or matchIndex == 0:
                #Vertical
                width = (boundingBoxSize[0] / 2)
                height = (boundingBoxSize[1])
                depth = boundingBoxSize[2]
                posBuffers = [[0, boundingBox[1], 0], [0, boundingBox[4], 0]]

            elif matchIndex == 2:
                #Horizontal
                width = boundingBoxSize[0]
                height = boundingBoxSize[2] / 2
                depth = (boundingBoxSize[1])
                startHeight = max([boundingBox[4], boundingBox[1]]) - depth / 2
                print startHeight
                posBuffers = [[0, startHeight, boundingBox[2]],
                              [0, startHeight, boundingBox[5]]]
        # Simple reverse of start pos buffers if the object is pointing negative
        if self.optionAimAxis < 2:
            posBuffers.reverse()

        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Making the controls
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        """ make our control object """
        startCurves = []
        startCurve = curves.createControlCurve('circle', depth * .8)
        mc.xform(startCurve, t=posBuffers[0], ws=True)
        attributes.doSetAttr(startCurve, 'rotateOrder', 5)
        curves.setCurveColorByName(startCurve, startColors[1])
        startCurves.append(startCurve)

        startText = curves.createTextCurve('start',
                                           size=depth * .75,
                                           font=font)
        mc.xform(startText, t=posBuffers[0], ws=True)
        curves.setCurveColorByName(startText, startColors[0])
        startCurves.append(startText)

        endCurves = []
        endCurve = curves.createControlCurve('circle', depth * .8)
        mc.xform(endCurve, t=posBuffers[1], ws=True)
        curves.setCurveColorByName(endCurve, endColors[1])
        attributes.doSetAttr(endCurve, 'rotateOrder', 5)
        endCurves.append(endCurve)

        endText = curves.createTextCurve('end', size=depth * .6, font=font)
        mc.xform(endText, t=posBuffers[1], ws=True)
        curves.setCurveColorByName(endText, endColors[0])
        endCurves.append(endText)
        """ aiming """
        position.aimSnap(startCurve, endCurve, [0, 0, 1], [0, 1, 0])
        position.aimSnap(startText, endCurve, [0, 0, 1], [0, 1, 0])

        position.aimSnap(endCurve, startCurve, [0, 0, -1], [0, 1, 0])
        position.aimSnap(endText, startCurve, [0, 0, -1], [0, 1, 0])

        sizeCurveControlStart = curves.combineCurves(startCurves)
        sizeCurveControlEnd = curves.combineCurves(endCurves)
        """ store our info to name our objects"""
        attributes.storeInfo(sizeCurveControlStart, 'cgmName',
                             (self.PuppetNull.nameShort + '.cgmName'))
        attributes.storeInfo(sizeCurveControlStart, 'cgmDirection', 'start')
        attributes.storeInfo(sizeCurveControlStart, 'cgmType',
                             'templateSizeObject')
        sizeCurveControlStart = NameFactory.doNameObject(sizeCurveControlStart)
        mc.makeIdentity(sizeCurveControlStart,
                        apply=True,
                        t=True,
                        s=True,
                        r=True)

        attributes.storeInfo(sizeCurveControlEnd, 'cgmName',
                             (self.PuppetNull.nameShort + '.cgmName'))
        attributes.storeInfo(sizeCurveControlEnd, 'cgmDirection', 'end')
        attributes.storeInfo(sizeCurveControlEnd, 'cgmType',
                             'templateSizeObject')
        sizeCurveControlEnd = NameFactory.doNameObject(sizeCurveControlEnd)

        endGroup = rigging.groupMeObject(sizeCurveControlEnd)
        mc.makeIdentity(sizeCurveControlEnd,
                        apply=True,
                        t=True,
                        s=True,
                        r=True)

        mc.parentConstraint(sizeCurveControlStart,
                            endGroup,
                            maintainOffset=True)
        """ make control group """
        controlGroup = rigging.groupMeObject(sizeCurveControlStart)
        attributes.storeInfo(controlGroup, 'cgmName',
                             (self.PuppetNull.nameShort + '.cgmName'))
        attributes.storeInfo(controlGroup, 'cgmType',
                             'templateSizeObjectGroup')
        controlGroup = NameFactory.doNameObject(controlGroup)

        endGroup = rigging.doParentReturnName(endGroup, controlGroup)
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Getting data ready
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        attributes.storeInfo(controlGroup, 'controlStart',
                             sizeCurveControlStart)
        attributes.storeInfo(controlGroup, 'controlEnd', sizeCurveControlEnd)
        attributes.storeInfo(self.PuppetNull.nameShort, 'templateSizeObject',
                             controlGroup)

        self.templateSizeObjects['root'] = controlGroup
        self.templateSizeObjects['start'] = sizeCurveControlStart
        self.templateSizeObjects['end'] = sizeCurveControlEnd

        returnList = []
        returnList.append(sizeCurveControlStart)
        returnList.append(sizeCurveControlEnd)
        return returnList

    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    # Geo Stuff
    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    def addGeo(self):
        """ 
        Add geo to a puppet
        """
        assert self.msgGeoGroup.get() is not False, "No geo group found!"

        selection = mc.ls(sl=True, flatten=True, long=True) or []

        if not selection:
            guiFactory.warning("No selection found to add to '%s'" %
                               self.nameBase)

        returnList = []
        for o in selection:
            if search.returnObjectType(o) in geoTypes:
                if self.msgGeoGroup.get() not in search.returnAllParents(
                        o, True):
                    o = rigging.doParentReturnName(o, self.msgGeoGroup.get())
                    self.geo.append(o)
                else:
                    guiFactory.warning("'%s' already a part of '%s'" %
                                       (o, self.nameBase))
            else:
                guiFactory.warning(
                    "'%s' doesn't seem to be geo. Not added to '%s'" %
                    (o, self.nameBase))

    def checkGeo(self):
        """
        Check a puppet's geo that it is actually geo
        """
        assert self.msgGeoGroup.get() is not False, "No geo group found!"

        children = search.returnAllChildrenObjects(self.msgGeoGroup.get())
        if not children:
            return False

        for o in children:
            if search.returnObjectType(o) in geoTypes:
                buff = mc.ls(o, long=True)
                self.geo.append(buff[0])
            else:
                rigging.doParentToWorld(o)
                guiFactory.warning("'%s' isn't geo, removing from group." % o)
        return True

    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    # Data setting stuff
    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    def doSetMode(self, i):
        assert i < (
            len(CharacterTypes)), "%i isn't a viable base pupppet type" % i
        self.optionPuppetMode.set(i)

    def doSetAimAxis(self, i):
        """
        Set the aim axis. if up or out have that axis. They will be changed. Aim is the priority.
        Then Up, and Out is last.
        
        """
        assert i < 6, "%i isn't a viable aim axis integer" % i

        self.optionAimAxis.set(i)
        if self.optionUpAxis.get() == self.optionAimAxis.get():
            self.doSetUpAxis(i)
        if self.optionOutAxis.get() == self.optionAimAxis.get():
            self.doSetOutAxis(i)

        return True

    def doSetUpAxis(self, i):
        """
        Set the aim axis. if up or out have that axis. They will be changed. Aim is the priority.
        Then Up, and Out is last.
        
        """
        assert i < 6, "%i isn't a viable up axis integer" % i
        axisBuffer = range(6)
        axisBuffer.remove(self.optionAimAxis.get())

        if i != self.optionAimAxis.get():
            self.optionUpAxis.set(i)
        else:
            self.optionUpAxis.set(axisBuffer[0])
            guiFactory.warning(
                "Aim axis has '%s'. Changed up axis to '%s'. Change aim setting if you want this seeting"
                % (axisDirectionsByString[self.optionAimAxis.get()],
                   axisDirectionsByString[self.optionUpAxis.get()]))
            axisBuffer.remove(axisBuffer[0])

        if self.optionOutAxis.get() in [
                self.optionAimAxis.get(),
                self.optionUpAxis.get()
        ]:
            for i in axisBuffer:
                if i not in [
                        self.optionAimAxis.get(),
                        self.optionUpAxis.get()
                ]:
                    self.doSetOutAxis(i)
                    guiFactory.warning(
                        "Setting conflict. Changed out axis to '%s'" %
                        axisDirectionsByString[i])
                    break
        return True

    def doSetOutAxis(self, i):
        assert i < 6, "%i isn't a viable aim axis integer" % i

        if i not in [self.optionAimAxis.get(), self.optionUpAxis.get()]:
            self.optionOutAxis.set(i)
        else:
            axisBuffer = range(6)
            axisBuffer.remove(self.optionAimAxis.get())
            axisBuffer.remove(self.optionUpAxis.get())
            self.optionOutAxis.set(axisBuffer[0])
            guiFactory.warning("Setting conflict. Changed out axis to '%s'" %
                               axisDirectionsByString[axisBuffer[0]])

    def doRenamePuppet(self, newName):
        """
        Rename Puppet null
        """
        if newName == self.PuppetNull.cgm['cgmName']:
            return guiFactory.warning("Already named '%s'" % newName)

        self.PuppetNull.store('cgmName ', newName)
        self.nameBase = newName
        self.PuppetNull.doName()
        self.verify()
        self.getModules()
        guiFactory.warning("Puppet renamed as '%s'" % newName)

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#>> Sizing
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    def doSize(self):
        """ 
        Function to size a puppet
    
        """
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Get Info
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        ### TemplateSizeObject Check ###
        if not self.ModulesBuffer.bufferList:
            raise StandardError, "'%s' has no modules" % self.PuppetNull.nameLong

        if not self.templateSizeObjects:
            raise StandardError, "'%s' has no size template" % self.PuppetNull.nameLong

        basicOrientation = logic.returnHorizontalOrVertical([
            self.templateSizeObjects['start'], self.templateSizeObjects['end']
        ])
        print basicOrientation

        # Get module info
        if not self.getOrderedModules() and self.getOrderedParentModules():
            guiFactory.warning(
                "Failed to get ordered module info, here's what we got...")
            guiFactory.report("Ordered modules - %s" % self.orderedModules)
            guiFactory.report("Ordered parent modules - %s" %
                              self.orderedParentModules)
            guiFactory.report("Module children- %s" % self.moduleChildren)

        ##Delete this later
        guiFactory.report("Ordered modules - %s" % self.orderedModules)
        guiFactory.report("Ordered parent modules - %s" %
                          self.orderedParentModules)
        guiFactory.report("Module children- %s" % self.moduleChildren)

        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Get our initial data
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        self.sizeCorePositionList = {}
        self.sizeLocInfo = {}

        checkList = {}
        orderedListCopy = copy.copy(self.orderedModules)

        for m in self.orderedModules:
            checkList[m] = False

        # first do the root modules """
        for m in self.rootModules:
            #Size each module and store it
            if not self.Module[self.moduleIndexDict[m]].doInitialSize(self):
                guiFactory.warning("Failed to get a size return on '%s'" % m)
                return False

            checkList.pop(m)
            orderedListCopy.remove(m)

        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # NEED TO DO CHILDREN MODULES NEXT
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        # Delete the temp locs
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        """
        for i,m in enumerate(self.ModulesBuffer.bufferList):
            buffer = self.sizeLocInfo[m] 
            parentBuffer = search.returnAllParents( buffer )
            if mc.objExists(parentBuffer[-1]):
                mc.delete(parentBuffer[-1])"""
        return
Ejemplo n.º 17
0
        def makeLimbTemplate (self):
            #>>>Curve degree finder
            if self.optionCurveDegree.get() == 0:
                doCurveDegree = 1
            else:
                if len(corePositionList) <= 3:
                    doCurveDegree = 1
                else:
                    doCurveDegree = len(corePositionList) - 1
                    
            #Make some storage vehicles
            self.templatePosObjectsBuffer = BufferFactory(self.infoNulls['templatePosObjects'].get())
            self.templatePosObjectsBuffer.purge()
            
            LocatorCatcher = ObjectFactory('')
            LocatorBuffer = BufferFactory(LocatorCatcher.nameLong)
            LocatorBuffer.purge()
            
            returnList = []
            self.templHandleList = []
            
            moduleColors = modules.returnModuleColors(self.ModuleNull.nameShort)
            
            #>>>Scale stuff
            moduleParent = self.msgModuleParent.get()
            
            if not moduleParent:
                length = (distance.returnDistanceBetweenPoints (corePositionList[0],corePositionList[-1]))
                size = length / self.optionHandles.get()
            else:
                #>>>>>>>>>>>>>>>>>>>>> NOT TOUCHED YET
                parentTemplatePosObjectsInfoNull = modules.returnInfoTypeNull(moduleParent,'templatePosObjects')
                parentTemplatePosObjectsInfoData = attributes.returnUserAttrsToDict (parentTemplatePosObjectsInfoNull)
                parentTemplateObjects = []
                for key in parentTemplatePosObjectsInfoData.keys():
                    if (mc.attributeQuery (key,node=parentTemplatePosObjectsInfoNull,msg=True)) == True:
                        if search.returnTagInfo((parentTemplatePosObjectsInfoData[key]),'cgmType') != 'templateCurve':
                            parentTemplateObjects.append (parentTemplatePosObjectsInfoData[key])
                createBuffer = curves.createControlCurve('sphere',1)
                pos = corePositionList[0]
                mc.move (pos[0], pos[1], pos[2], createBuffer, a=True)
                closestParentObject = distance.returnClosestObject(createBuffer,parentTemplateObjects)
                boundingBoxSize = distance.returnBoundingBoxSize (closestParentObject)
                maxSize = max(boundingBoxSize)
                size = maxSize *.25
                mc.delete(createBuffer)
                if partType == 'clavicle':
                    size = size * .5
                elif partType == 'head':
                    size = size * .75
                if (search.returnTagInfo(moduleParent,'cgmModuleType')) == 'clavicle':
                    size = size * 2
        
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            # Making the template objects
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            self.TemplateObject = {}
            
            #>>> Template objects
            for cnt,pos in enumerate(corePositionList):
                #Size multiplier based on PuppetMode, make it take into account module mode eventually
                if PuppetInstance.optionPuppetMode.get() == 0:
                    if cnt == 0:
                        sizeMultiplier = 1
                    elif cnt == len(corePositionList) -1:
                        sizeMultiplier = .8
                    else:
                        sizeMultiplier = .5
                else:
                    sizeMultiplier = 1
                    
                #make a sphere and move it
                createBuffer = curves.createControlCurve('sphere',(size * sizeMultiplier))
                self.TemplateObject[cnt] = ObjectFactory(createBuffer) # Instance the control to our module
                obj = self.TemplateObject[cnt]
                curves.setCurveColorByName(obj.nameLong,moduleColors[0])
                obj.store('cgmName',coreNames[cnt])
                
                obj.getNameTagsFromObject(self.ModuleNull.nameLong,['cgmName','cgmType'])

                obj.store('cgmType','templateObject')
                obj.doName()
                mc.move (pos[0], pos[1], pos[2], [obj.nameLong], a=True)
                            
                #adds it to the list
                self.templHandleList.append (obj.nameLong) 
                self.templatePosObjectsBuffer.store(obj.nameLong)
            
             
            #Aim the objects           
            position.aimObjects(self.templHandleList,
                                dictionary.axisDirectionsByString[ self.optionAimAxis.get() ],
                                dictionary.axisDirectionsByString[ self.optionUpAxis.get() ],
                                dictionary.axisDirectionsByString[ PuppetInstance.optionUpAxis.get() ])            
            
            #>>> Template curve
            crvName = mc.curve (d=doCurveDegree, p = corePositionList , os=True, n=('%s_%s' %(partName,(typesDictionary.get('templateCurve')))))            
            self.afTemplateCurve = AttrFactory(self.infoNulls['templatePosObjects'].get(),
                                               'curve','message', value=crvName)# connect it back to our template objects info null
            
            curve = ObjectFactory(crvName) # instance it
            curve.getNameTagsFromObject(self.ModuleNull.nameLong,['cgmType']) #get name tags from the module

            attributes.storeInfo(crvName,'cgmType','templateCurve') # store type
            curves.setCurveColorByName(crvName,moduleColors[1]) # set curve color
            
            # Make locators to connect the cv's to
            for cnt,obj in enumerate(self.templHandleList):
                pointLoc = locators.locMeObject(obj) # make the loc
                loc = ObjectFactory(pointLoc) #instance it
                mc.setAttr ((loc.nameShort+'.visibility'),0) # turn off visibility
                mc.parentConstraint ([obj],[loc.nameShort],mo=False) # parent constrain
                mc.connectAttr ( (loc.nameShort+'.translate'),
                                 ('%s.controlPoints[%i]' % (crvName, cnt)), f=True ) # connect the cv to the loc
                self.TemplateObject[cnt].store('loc',loc.nameLong)
                LocatorBuffer.store(loc.nameLong)
                
            #>>> Direction and size Stuff
            """
            # Directional data derived from joints 
            generalDirection = logic.returnHorizontalOrVertical(self.templHandleList)
            if generalDirection == 'vertical' and 'leg' not in self.afModuleType.get():
                worldUpVector = [0,0,-1]
            elif generalDirection == 'vertical' and 'leg' in self.afModuleType.get():
                worldUpVector = [0,0,1]
            else:
                worldUpVector = [0,1,0]
            """            
            
            # Create root control
            templateNull = self.msgTemplateNull.get()
            handleList = copy.copy(self.templatePosObjectsBuffer.bufferList)
            
            rootSize = (distance.returnBoundingBoxSizeToAverage(self.templHandleList[0])*1.5)
            rootCtrl = ObjectFactory(curves.createControlCurve('cube',rootSize))
            rootCtrl.getNameTagsFromObject(self.ModuleNull.nameLong)
            self.msgTemplateRoot = AttrFactory(self.infoNulls['templatePosObjects'].get(), 'root', 'message', value = rootCtrl.nameLong)
            curves.setCurveColorByName(rootCtrl.nameLong,moduleColors[0])
            
            # move the root
            if self.afModuleType.get() == 'clavicle':
                position.movePointSnap(rootCtrl.nameLong,self.templHandleList[0])
            else:
                position.movePointSnap(rootCtrl.nameLong,self.templHandleList[0])
            # aim the root
            position.aimSnap(rootCtrl.nameShort,self.templHandleList[-1],  
                            dictionary.axisDirectionsByString[ self.optionAimAxis.get() ],
                            dictionary.axisDirectionsByString[ self.optionUpAxis.get() ],
                            dictionary.axisDirectionsByString[ PuppetInstance.optionUpAxis.get() ]) 
            
            rootCtrl.store('cgmType','templateRoot')
            rootCtrl.doName()
            
            #>>> Parent the main objcts
            rootGroup = rootCtrl.doGroup()
            rootGroup = rigging.doParentReturnName(rootGroup,templateNull)
            curve.doParent(templateNull)
            
            for obj in LocatorBuffer.bufferList:
                rigging.doParentReturnName(obj,templateNull)
            mc.delete(LocatorCatcher.nameShort) # delete the locator buffer obj
            
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Orientation helpers
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            # Make our Orientation Helpers 
            """
            orientHelpersReturn = template.addOrientationHelpers(self)
            masterOrient = orientHelpersReturn[0]
            orientObjects = orientHelpersReturn[1]
            return
            
        
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Control helpers
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            print orientObjects
            print self.ModuleNull.nameShort
            print (templateNull+'.visControlHelpers')
            controlHelpersReturn = addControlHelpers(orientObjects,self.ModuleNull.nameShort,(templateNull+'.visControlHelpers'))"""
    
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Input the saved values if there are any
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            # Orientation Helpers 
            """rotBuffer = coreRotationList[-1]
            #actualName = mc.spaceLocator (n= wantedName)
            rotCheck = sum(rotBuffer)
            if rotCheck != 0:
                mc.rotate(rotBuffer[0],rotBuffer[1],rotBuffer[2],masterOrient,os=True)
            
            cnt = 0
            for obj in orientObjects:
                rotBuffer = coreRotationList[cnt]
                rotCheck = sum(rotBuffer)
                if rotCheck != 0:
                    mc.rotate(rotBuffer[0],rotBuffer[1],rotBuffer[2],obj,os=True)
                cnt +=1 
                    
            # Control Helpers 
            controlHelpers = controlHelpersReturn[0]
            cnt = 0
            for obj in controlHelpers:
                posBuffer = controlPositionList[cnt]
                posCheck = sum(posBuffer)
                if posCheck != 0:
                    mc.xform(obj,t=[posBuffer[0],posBuffer[1],posBuffer[2]],ws=True)
                
                rotBuffer = controlRotationList[cnt]
                rotCheck = sum(rotBuffer)
                if rotCheck != 0:
                    mc.rotate(rotBuffer[0],rotBuffer[1],rotBuffer[2],obj,ws=True)
                
                scaleBuffer = controlScaleList[cnt]
                scaleCheck = sum(scaleBuffer)
                if scaleCheck != 0:
                    mc.scale(scaleBuffer[0],scaleBuffer[1],scaleBuffer[2],obj,absolute=True)
                cnt +=1 """
            
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
            #>> Final stuff
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
            """
            returnList.append(templObjNameList)
            returnList.append(self.templHandleList)
            returnList.append(rootCtrl)"""
            return True