Example #1
0
	def __init__( self):		
		self.toolName = 'cgm.puppetBox'
		self.description = 'This is a series of tools for working with cgm Sets'
		self.author = 'Josh Burton'
		self.owner = 'CG Monks'
		self.website = 'www.cgmonks.com'
		self.version =  __version__ 
		self.optionVars = []
		self.scenePuppets = []
		self.Puppet = False
		self.PuppetBridge = {}
		self.puppetStateOptions = ['define']
		self.puppetStateOptions.extend(ModuleFactory.moduleStates)
		#self.addModules = ['Spine','Leg','Arm','Limb','Finger','Foot','Neck','Head','Spine']
		self.addModules = ['Segment']
		self.moduleFrames = {}
		self.moduleBaseNameFields = {}
		self.moduleHandleFields = {}
		self.moduleRollFields = {}
		self.moduleCurveFields = {}
		self.moduleStiffIndexFields = {}
		
		self.moduleDirectionMenus = {}
		self.modulePositionMenus = {}
		
		self.moduleDirections = ['none','left','right']
		self.modulePositions = ['none','front','rear','forward','back','top','bottom']
		
		
		
		self.setModes = ['<<< All Loaded Sets >>>','<<< Active Sets >>>']
		self.scenePuppets = modules.returnPuppetObjects()
		self.UI_StateRows = {'define':[],'template':[],'skeleton':[],'rig':[]}
		
		self.showHelp = False
		self.helpBlurbs = []
		self.oldGenBlurbs = []
		
		#Menu
		self.setupVariables()
		
		self.UI_PuppetMenu = MelMenu( l='Puppet', pmc=self.buildPuppetMenu)
		self.UI_AddModulesMenu = MelMenu( l='Add', pmc=self.buildAddModulesMenu)
		self.UI_OptionsMenu = MelMenu( l='Options', pmc=self.buildOptionsMenu)		
		self.UI_HelpMenu = MelMenu( l='Help', pmc=self.buildHelpMenu)
		
		self.ShowHelpOption = mc.optionVar( q='cgmVar_AnimToolsShowHelp' )
		
		#GUI
						
		self.Main_buildLayout(self)
		
		if self.Puppet:
			puppetBoxLib.updateUIPuppet(self)
		
		
		if self.scenePuppets:
			puppetBoxLib.activatePuppet(self,self.scenePuppets[0])
			
		self.show()
Example #2
0
	def buildPuppetMenu( self, *a ):
		self.UI_PuppetMenu.clear()
		
		#>>> Puppet Options	
		MelMenuItem( self.UI_PuppetMenu, l="New",
	                 c=lambda *a:puppetBoxLib.doPuppetCreate(self))
		
		#Build load menu
		self.scenePuppets = modules.returnPuppetObjects()		
		loadMenu = MelMenuItem( self.UI_PuppetMenu, l='Pick Puppet:', subMenu=True)
		
		if self.scenePuppets:
			for i,m in enumerate(self.scenePuppets):
				MelMenuItem( loadMenu, l="%s"%m,
					         c= Callback(puppetBoxLib.activatePuppet,self,m))		
		else:
			MelMenuItem( loadMenu, l="None found")
			
		if self.Puppet:
			MelMenuItemDiv( self.UI_PuppetMenu )	
			MelMenuItem( self.UI_PuppetMenu, l="Initialize",
				         c=lambda *a:puppetBoxLib.initializePuppet(self))
			if not self.Puppet.refState:
				MelMenuItem( self.UI_PuppetMenu, l="Verify",
					         c=lambda *a:puppetBoxLib.verifyPuppet(self))	
				MelMenuItem( self.UI_PuppetMenu, l="Delete",
					         c=lambda *a:puppetBoxLib.deletePuppet(self))	
		#>>> Reset Options		
		MelMenuItemDiv( self.UI_PuppetMenu )
		MelMenuItem( self.UI_PuppetMenu, l="Reload",
			         c=lambda *a: self.reload())		
		MelMenuItem( self.UI_PuppetMenu, l="Reset",
			         c=lambda *a: self.reset())
Example #3
0
    def buildPuppetMenu( self, *a ):
        self.UI_PuppetMenu.clear()

        #>>> Puppet Options	
        MelMenuItem( self.UI_PuppetMenu, l="New",
                     c=lambda *a:puppetBoxLib.doPuppetCreate(self))

        #Build load menu
        self.scenePuppets = modules.returnPuppetObjects()		
        loadMenu = MelMenuItem( self.UI_PuppetMenu, l='Pick Puppet:', subMenu=True)

        if self.scenePuppets:
            for i,m in enumerate(self.scenePuppets):
                MelMenuItem( loadMenu, l="%s"%m,
                             c= Callback(puppetBoxLib.activatePuppet,self,m))		
        else:
            MelMenuItem( loadMenu, l="None found")

        if self.Puppet:
            MelMenuItemDiv( self.UI_PuppetMenu )	
            MelMenuItem( self.UI_PuppetMenu, l="Initialize",
                         c=lambda *a:puppetBoxLib.initializePuppet(self))
            if not self.Puppet.refState:
                MelMenuItem( self.UI_PuppetMenu, l="Verify",
                             c=lambda *a:puppetBoxLib.verifyPuppet(self))	
                MelMenuItem( self.UI_PuppetMenu, l="Delete",
                             c=lambda *a:puppetBoxLib.deletePuppet(self))	
        #>>> Reset Options		
        MelMenuItemDiv( self.UI_PuppetMenu )
        MelMenuItem( self.UI_PuppetMenu, l="Reload",
                     c=lambda *a: self.reload())		
        MelMenuItem( self.UI_PuppetMenu, l="Reset",
                     c=lambda *a: self.reset())
Example #4
0
    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()
Example #5
0
    def __init__(self):
        self.toolName = 'cgm.puppetBox'
        self.description = 'This is a series of tools for working with cgm Sets'
        self.author = 'Josh Burton'
        self.owner = 'CG Monks'
        self.website = 'www.cgmonks.com'
        self.dockCnt = 'cgmPuppetBoxDoc'
        self.version = __version__
        self.optionVars = []
        self.scenePuppets = []
        self.Puppet = False
        self.PuppetBridge = {}
        self.puppetStateOptions = ['define']
        self.puppetStateOptions.extend(ModuleFactory.moduleStates)
        #self.addModules = ['Spine','Leg','Arm','Limb','Finger','Foot','Neck','Head','Spine']
        self.addModules = ['Segment']
        self.moduleFrames = {}
        self.moduleBaseNameFields = {}
        self.moduleHandleFields = {}
        self.moduleRollFields = {}
        self.moduleCurveFields = {}
        self.moduleStiffIndexFields = {}

        self.moduleDirectionMenus = {}
        self.modulePositionMenus = {}

        self.moduleDirections = ['none', 'left', 'right']
        self.modulePositions = [
            'none', 'front', 'rear', 'forward', 'back', 'top', 'bottom'
        ]

        self.setModes = ['<<< All Loaded Sets >>>', '<<< Active Sets >>>']
        self.scenePuppets = modules.returnPuppetObjects()
        self.UI_StateRows = {
            'define': [],
            'template': [],
            'skeleton': [],
            'rig': []
        }

        self.showHelp = False
        self.helpBlurbs = []
        self.oldGenBlurbs = []

        #Menu
        self.setupVariables()

        self.UI_PuppetMenu = MelMenu(l='Puppet', pmc=self.buildPuppetMenu)
        self.UI_AddModulesMenu = MelMenu(l='Add', pmc=self.buildAddModulesMenu)
        self.UI_OptionsMenu = MelMenu(l='Options', pmc=self.buildOptionsMenu)
        self.UI_HelpMenu = MelMenu(l='Help', pmc=self.buildHelpMenu)

        self.ShowHelpOption = mc.optionVar(q='cgmVar_AnimToolsShowHelp')

        #GUI

        self.Main_buildLayout(self)

        if self.Puppet:
            puppetBoxLib.updateUIPuppet(self)

        if self.scenePuppets:
            puppetBoxLib.activatePuppet(self, self.scenePuppets[0])

        #====================
        # Show and Dock
        #====================
        #Maya2011 QT docking - from Red9's examples
        try:
            #'Maya2011 dock delete'
            if mc.dockControl(self.dockCnt, exists=True):
                mc.deleteUI(self.dockCnt, control=True)
        except:
            pass

        if self.dockOptionVar.value:
            try:
                allowedAreas = ['right', 'left']
                mc.dockControl(self.dockCnt,
                               area='right',
                               label=self.WINDOW_TITLE,
                               content=self.WINDOW_NAME,
                               floating=False,
                               allowedArea=allowedAreas,
                               width=400)
            except:
                #Dock failed, opening standard Window
                self.show()
        else:
            self.show()
Example #6
0
    def __init__( self):		
        self.toolName = 'cgm.puppetBox'
        self.description = 'This is a series of tools for working with cgm Sets'
        self.author = 'Josh Burton'
        self.owner = 'CG Monks'
        self.website = 'www.cgmonks.com'
        self.dockCnt = 'cgmPuppetBoxDoc'			
        self.version =  __version__ 
        self.optionVars = []
        self.scenePuppets = []
        self.Puppet = False
        self.PuppetBridge = {}
        self.puppetStateOptions = ['define']
        self.puppetStateOptions.extend(ModuleFactory.moduleStates)
        #self.addModules = ['Spine','Leg','Arm','Limb','Finger','Foot','Neck','Head','Spine']
        self.addModules = ['Segment']
        self.moduleFrames = {}
        self.moduleBaseNameFields = {}
        self.moduleHandleFields = {}
        self.moduleRollFields = {}
        self.moduleCurveFields = {}
        self.moduleStiffIndexFields = {}

        self.moduleDirectionMenus = {}
        self.modulePositionMenus = {}

        self.moduleDirections = ['none','left','right']
        self.modulePositions = ['none','front','rear','forward','back','top','bottom']



        self.setModes = ['<<< All Loaded Sets >>>','<<< Active Sets >>>']
        self.scenePuppets = modules.returnPuppetObjects()
        self.UI_StateRows = {'define':[],'template':[],'skeleton':[],'rig':[]}

        self.showHelp = False
        self.helpBlurbs = []
        self.oldGenBlurbs = []

        #Menu
        self.setupVariables()

        self.UI_PuppetMenu = MelMenu( l='Puppet', pmc=self.buildPuppetMenu)
        self.UI_AddModulesMenu = MelMenu( l='Add', pmc=self.buildAddModulesMenu)
        self.UI_OptionsMenu = MelMenu( l='Options', pmc=self.buildOptionsMenu)		
        self.UI_HelpMenu = MelMenu( l='Help', pmc=self.buildHelpMenu)

        self.ShowHelpOption = mc.optionVar( q='cgmVar_AnimToolsShowHelp' )

        #GUI

        self.Main_buildLayout(self)

        if self.Puppet:
            puppetBoxLib.updateUIPuppet(self)


        if self.scenePuppets:
            puppetBoxLib.activatePuppet(self,self.scenePuppets[0])

        #====================
        # Show and Dock
        #====================
        #Maya2011 QT docking - from Red9's examples
        try:
            #'Maya2011 dock delete'
            if mc.dockControl(self.dockCnt, exists=True):
                mc.deleteUI(self.dockCnt, control=True)  
        except:
            pass

        if self.dockOptionVar.value:
            try:
                allowedAreas = ['right', 'left']
                mc.dockControl(self.dockCnt, area='right', label=self.WINDOW_TITLE, content=self.WINDOW_NAME, floating=False, allowedArea=allowedAreas, width=400)
            except:
                #Dock failed, opening standard Window	
                self.show()
        else:self.show()