def getInstalledAnimModules(): modSets = [] characters = utils.findInstalledCharacters() for character in characters: characterContainer = character + ":character_container" blueprintInstances = utils.findInstalledBlueprintInstances(character) for blueprintInstance in blueprintInstances: moduleContainer = character+":"+blueprintInstance+":module_container" #print moduleContainer """ Do we have animation modules installed? """ blueprintJointsGrp = character+":"+blueprintInstance+":blueprint_joints_grp" if cmds.getAttr(blueprintJointsGrp+".controlModulesInstalled"): #print "This is the group holding the blueprint joints that the animation module is installed on """ #print blueprintJointsGrp nodes = cmds.container(moduleContainer, q=True, nl=True) for node in nodes: suffix = ":module_container" result = node.endswith(suffix) if result == True: tmpVar = node.rpartition(":module_container") tmpVar = tmpVar[0].rpartition(":") className = tmpVar[2] modSets.append([blueprintInstance, className]) print (blueprintInstance + " has this anim mod installed " + className) print modSets
def setModuleMaintenanceVisibility(self,vis=True): characters = utils.findInstalledCharacters() for c in characters: characterContainer = c + ':character_container' cmds.lockNode(characterContainer,lock=False,lockUnpublished=False) characterGroup = c + ':character_grp' cmds.setAttr(characterGroup + '.moduleMaintenanceVisibility', vis) cmds.lockNode(characterContainer,lock=True,lockUnpublished=True)
def findCharacterNames(self, *args): characterNamespace = utils.findInstalledCharacters() if len(characterNamespace) != 0: characterNamespace = characterNamespace[0] characterName = (characterNamespace) else: cmds.headsUpMessage("No valid character in the scene") return return (characterNamespace, characterName)
def setModuleMaintenanceVisibility(self, vis=True): characters = utils.findInstalledCharacters() for c in characters: characterContainer = c + ":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) characterGroup = c + ":character_grp" cmds.setAttr(characterGroup + ".moduleMaintenanceVisibility", vis) cmds.lockNode(characterContainer, l=True, lu=True)
def setupSelectionScriptJob(self): # Find all the characters in the scene and delete related animation UI. installedCharacters = utils.findInstalledCharacters() for characterNamespace in installedCharacters: characterName = characterNamespace.partition("__")[2] windowName = characterName + "_window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) scriptJobNum = cmds.scriptJob(event=["SelectionChanged", self.objectSelected], runOnce=True, killWithScene=True) self.shelfTool_instance.setScriptJobNum(scriptJobNum)
def setupSelectionScriptJob(self): installedCharacters = utils.findInstalledCharacters() for characterNamespace in installedCharacters: characterName = characterNamespace.partition('__')[2] windowName = characterName + '_window' if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) scriptJobNum = cmds.scriptJob(event=['SelectionChanged', self.objectSelected], runOnce=True,killWithScene=True) self.shelfTool_instance.setScriptJobNum(scriptJobNum)
def setModuleMaintenanceVisibility(self, vis=True): characters = utils.findInstalledCharacters() for c in characters: characterContainer = c+":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) characterGroup = c+":character_grp" cmds.setAttr(characterGroup+".moduleMaintenanceVisibility", vis) """ tHIS WOULD BE A GOOD TIME TO LOD THE MESH """ cmds.lockNode(characterContainer, lock=True, lockUnpublished=True)
def setupSelectionScriptJob(self): # Find all the characters in the scene and delete related animation UI. installedCharacters = utils.findInstalledCharacters() for characterNamespace in installedCharacters: characterName = characterNamespace.partition("__")[2] windowName = characterName + "_window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) scriptJobNum = cmds.scriptJob( event=["SelectionChanged", self.objectSelected], runOnce=True, killWithScene=True) self.shelfTool_instance.setScriptJobNum(scriptJobNum)
def setModuleMaintenanceVisibility(self, vis=True): characters = utils.findInstalledCharacters() for c in characters: print c characterContainer = c + ":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) characterGroup = c + ":character_grp" cmds.setAttr(characterGroup + ".moduleMaintenanceVisibility", vis) """ tHIS WOULD BE A GOOD TIME TO LOD THE MESH """ cmds.lockNode(characterContainer, lock=True, lockUnpublished=True)
def getInstalledAnimModules(self): modSets = [] characters = utils.findInstalledCharacters() for character in characters: characterContainer = character + ":character_container" """ Find the blueprints in the scene""" blueprintInstances = utils.findInstalledBlueprintInstances( character) for blueprintInstance in blueprintInstances: moduleContainer = character + ":" + blueprintInstance + ":module_container" """ Do we have animation modules installed? """ blueprintJointsGrp = character + ":" + blueprintInstance + ":blueprint_joints_grp" if cmds.getAttr(blueprintJointsGrp + ".controlModulesInstalled"): nodes = cmds.container(moduleContainer, q=True, nl=True) for node in nodes: suffix = ":module_container" result = node.endswith(suffix) if result == True: """ The module container holds all the attr info we need to save""" animContainer = node tmpVar = node.rpartition(":module_container") tmpVar = tmpVar[0].rpartition(":") className = tmpVar[2] modSets.append([ blueprintInstance, className, animContainer, moduleContainer ]) return ( modSets ) # Contains the bp module name, anim mod class name, anim mod container
def objectSelected(self): print "objectSelected 58" objects = cmds.ls(selection = True) cmds.select(clear=True) """ Find the installed characters """ characters = utils.findInstalledCharacters() """ Unlock the containers """ for character in characters: characterContainer = character + ":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) # Find every module installed on that character. blueprintInstances = utils.findInstalledBlueprintInstances(character) for blueprintInstance in blueprintInstances: moduleContainer = character+":"+blueprintInstance+":module_container" cmds.lockNode(moduleContainer, lock=False, lockUnpublished=False) """ Do we have modules installed? If so, set the joint color to blue. """ blueprintJointsGrp = character+":"+blueprintInstance+":blueprint_joints_grp" if cmds.getAttr(blueprintJointsGrp+".controlModulesInstalled"): #Blue cmds.setAttr(blueprintJointsGrp+".overrideColor", 6) else: cmds.setAttr(blueprintJointsGrp+".overrideColor", 2) cmds.lockNode(moduleContainer, lock=True, lockUnpublished=True) cmds.lockNode(characterContainer, lock=True, lockUnpublished=True) if len(objects) > 0: lastSelected = objects[len(objects)-1] lastSelected_stripNamespaces = utils.stripAllNamespaces(lastSelected) if lastSelected_stripNamespaces != None: lastSelected_withoutNamespaces = lastSelected_stripNamespaces[1] if lastSelected_withoutNamespaces.find("blueprint_") == 0: blueprintModuleNamespace_incCharNamespace = lastSelected_stripNamespaces[0] moduleContainer = blueprintModuleNamespace_incCharNamespace + ":module_container" cmds.select(moduleContainer, replace=True) # set color of the joints characterNamespace = utils.stripLeadingNamespace(lastSelected)[0] characterContainer = characterNamespace + ":character_container" containers = [characterContainer, moduleContainer] for container in containers: cmds.lockNode(container, lock=False, lockUnpublished=False) blueprintJointsGrp = blueprintModuleNamespace_incCharNamespace+":blueprint_joints_grp" # This was not in the video. I needed to add this to allow overrides. cmds.setAttr(blueprintJointsGrp+".overrideEnabled", 1) cmds.setAttr(blueprintJointsGrp+".overrideColor", 13) for container in containers: cmds.lockNode(container, lock=True, lockUnpublished=True) self.currentBlueprintModule['currentMod'] = (blueprintModuleNamespace_incCharNamespace) print "ModMaintEX cureent bp mod name " print self.currentBlueprintModule['currentMod']
def objectSelected(self): objects = cmds.ls(selection = True) cmds.select(clear=True) if cmds.window('modMaintain_UI_window',exists=True): cmds.deleteUI('modMaintain_UI_window') characters = utils.findInstalledCharacters() for character in characters: characterContainer = character + ':character_container' cmds.lockNode(characterContainer,lock=False,lockUnpublished=False) blueprintInstances = utils.findInstalledBlueprintInstances(character) for blueprintInstance in blueprintInstances: moduleContainer = character + ':' + blueprintInstance + ':module_container' cmds.lockNode(moduleContainer,lock=False,lockUnpublished=False) blueprintJointsGrp = character + ':' + blueprintInstance + ':blueprint_joints_grp' if cmds.getAttr(blueprintJointsGrp + '.controlModulesInstalled'): #blue cmds.setAttr(blueprintJointsGrp + '.overrideColor', 6) else: #Grey cmds.setAttr(blueprintJointsGrp + '.overrideColor', 2) cmds.lockNode(moduleContainer,lock=True,lockUnpublished=True) cmds.lockNode(characterContainer,lock=True,lockUnpublished=True) if len(objects) > 0: lastSelected = objects[len(objects)-1] lastSelected_stripNamespaces = utils.stripAllNamespaces(lastSelected) if lastSelected_stripNamespaces != None: lastSelected_withoutNamespaces = lastSelected_stripNamespaces[1] if lastSelected_withoutNamespaces.find('blueprint_') == 0: blueprintModuleNamespace_incCharNamespace = lastSelected_stripNamespaces[0] moduleContainer = blueprintModuleNamespace_incCharNamespace + ':module_container' cmds.select(moduleContainer,replace=True) characterNamespace = utils.stripLeadingNamespace(lastSelected)[0] characterContainer = characterNamespace + ':character_container' containers = [characterContainer, moduleContainer] for container in containers: cmds.lockNode(container, lock=False, lockUnpublished=False) blueprintJointsGrp = blueprintModuleNamespace_incCharNamespace + ':blueprint_joints_grp' cmds.setAttr(blueprintJointsGrp + '.overrideColor', 13) self.createUserInterface(blueprintModuleNamespace_incCharNamespace) for container in containers: cmds.lockNode(container, lock=True, lockUnpublished=True) self.setupSelectionScriptJob()
def objectSelected(self): objects = cmds.ls(selection=True) cmds.select(clear=True) if cmds.window("modMaintain_UI_window", exists=True): cmds.deleteUI("modMaintain_UI_window") characters = utils.findInstalledCharacters() for character in characters: characterContainer = character + ":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) blueprintInstances = utils.findInstalledBlueprintInstances( character) for blueprintInstance in blueprintInstances: moduleContainer = character + ":" + blueprintInstance + ":module_container" cmds.lockNode(moduleContainer, lock=False, lockUnpublished=False) blueprintJointsGrp = character + ":" + blueprintInstance + ":blueprint_joints_grp" if cmds.getAttr(blueprintJointsGrp + ".controlModulesInstalled"): #blue cmds.setAttr(blueprintJointsGrp + ".overrideColor", 6) else: #Grey cmds.setAttr(blueprintJointsGrp + ".overrideColor", 2) cmds.lockNode(moduleContainer, lock=True, lockUnpublished=True) cmds.lockNode(characterContainer, lock=True, lockUnpublished=True) if len(objects) > 0: lastSelected = objects[len(objects) - 1] lastSelected_scripNamespaces = utils.stripAllNamespaces( lastSelected) if lastSelected_scripNamespaces != None: lastSelected_withoutNamespaces = lastSelected_scripNamespaces[ 1] if lastSelected_withoutNamespaces.find("blueprint_") == 0: blueprintModuleNamespace_incCharNamespace = lastSelected_scripNamespaces[ 0] moduleContainer = blueprintModuleNamespace_incCharNamespace + ":module_container" cmds.select(moduleContainer, replace=True) characterNamespace = utils.stripLeadingNamespace( lastSelected)[0] characterContainer = characterNamespace + ":character_container" containers = [characterContainer, moduleContainer] for container in containers: cmds.lockNode(container, lock=False, lockUnpublished=False) blueprintJointsGrp = blueprintModuleNamespace_incCharNamespace + ":blueprint_joints_grp" cmds.setAttr(blueprintJointsGrp + ".overrideColor", 13) self.createUserInterface( blueprintModuleNamespace_incCharNamespace) for container in containers: cmds.lockNode(container, lock=True, lockUnpublished=True) self.setupSelectionScriptJob()
def objectSelected(self): print "objectSelected 58" objects = cmds.ls(selection=True) cmds.select(clear=True) """ Find the installed characters """ characters = utils.findInstalledCharacters() """ Unlock the containers """ for character in characters: characterContainer = character + ":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) # Find every module installed on that character. blueprintInstances = utils.findInstalledBlueprintInstances( character) for blueprintInstance in blueprintInstances: moduleContainer = character + ":" + blueprintInstance + ":module_container" cmds.lockNode(moduleContainer, lock=False, lockUnpublished=False) """ Do we have modules installed? If so, set the joint color to blue. """ blueprintJointsGrp = character + ":" + blueprintInstance + ":blueprint_joints_grp" if cmds.getAttr(blueprintJointsGrp + ".controlModulesInstalled"): #Blue cmds.setAttr(blueprintJointsGrp + ".overrideColor", 6) else: cmds.setAttr(blueprintJointsGrp + ".overrideColor", 2) cmds.lockNode(moduleContainer, lock=True, lockUnpublished=True) cmds.lockNode(characterContainer, lock=True, lockUnpublished=True) if len(objects) > 0: lastSelected = objects[len(objects) - 1] lastSelected_stripNamespaces = utils.stripAllNamespaces( lastSelected) if lastSelected_stripNamespaces != None: lastSelected_withoutNamespaces = lastSelected_stripNamespaces[ 1] if lastSelected_withoutNamespaces.find("blueprint_") == 0: blueprintModuleNamespace_incCharNamespace = lastSelected_stripNamespaces[ 0] moduleContainer = blueprintModuleNamespace_incCharNamespace + ":module_container" cmds.select(moduleContainer, replace=True) # set color of the joints characterNamespace = utils.stripLeadingNamespace( lastSelected)[0] characterContainer = characterNamespace + ":character_container" containers = [characterContainer, moduleContainer] for container in containers: cmds.lockNode(container, lock=False, lockUnpublished=False) blueprintJointsGrp = blueprintModuleNamespace_incCharNamespace + ":blueprint_joints_grp" # This was not in the video. I needed to add this to allow overrides. cmds.setAttr(blueprintJointsGrp + ".overrideEnabled", 1) cmds.setAttr(blueprintJointsGrp + ".overrideColor", 13) for container in containers: cmds.lockNode(container, lock=True, lockUnpublished=True) self.currentBlueprintModule['currentMod'] = ( blueprintModuleNamespace_incCharNamespace) print "ModMaintEX cureent bp mod name " print self.currentBlueprintModule['currentMod']
def objectSelected(self): objects = cmds.ls(selection = True) cmds.select(clear=True) if cmds.window("modMaintain_UI_window", exists=True): cmds.deleteUI("modMaintain_UI_window") characters = utils.findInstalledCharacters() for character in characters: characterContainer = character + ":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) # Find every module installed on that character. blueprintInstances = utils.findInstalledBlueprintInstances(character) for blueprintInstance in blueprintInstances: moduleContainer = character+":"+blueprintInstance+":module_container" cmds.lockNode(moduleContainer, lock=False, lockUnpublished=False) # Do we have modules installed? If so, set the joint color to blue. blueprintJointsGrp = character+":"+blueprintInstance+":blueprint_joints_grp" if cmds.getAttr(blueprintJointsGrp+".controlModulesInstalled"): #Blue cmds.setAttr(blueprintJointsGrp+".overrideColor", 6) else: cmds.setAttr(blueprintJointsGrp+".overrideColor", 2) cmds.lockNode(moduleContainer, lock=True, lockUnpublished=True) cmds.lockNode(characterContainer, lock=True, lockUnpublished=True) if len(objects) > 0: lastSelected = objects[len(objects)-1] lastSelected_stripNamespaces = utils.stripAllNamespaces(lastSelected) if lastSelected_stripNamespaces != None: lastSelected_withoutNamespaces = lastSelected_stripNamespaces[1] if lastSelected_withoutNamespaces.find("blueprint_") == 0: blueprintModuleNamespace_incCharNamespace = lastSelected_stripNamespaces[0] moduleContainer = blueprintModuleNamespace_incCharNamespace + ":module_container" cmds.select(moduleContainer, replace=True) # set color of the joints characterNamespace = utils.stripLeadingNamespace(lastSelected)[0] characterContainer = characterNamespace + ":character_container" containers = [characterContainer, moduleContainer] for container in containers: cmds.lockNode(container, lock=False, lockUnpublished=False) blueprintJointsGrp = blueprintModuleNamespace_incCharNamespace+":blueprint_joints_grp" # This was not in the video. I needed to add this to allow overrides. cmds.setAttr(blueprintJointsGrp+".overrideEnabled", 1) cmds.setAttr(blueprintJointsGrp+".overrideColor", 13) # Bring up UI self.createUserInterface(blueprintModuleNamespace_incCharNamespace) for container in containers: cmds.lockNode(container, lock=True, lockUnpublished=True) self.setupSelectionScriptJob()
def objectSelected(self): objects = cmds.ls(selection=True) cmds.select(clear=True) if cmds.window("modMaintain_UI_window", exists=True): cmds.deleteUI("modMaintain_UI_window") characters = utils.findInstalledCharacters() for character in characters: characterContainer = character + ":character_container" cmds.lockNode(characterContainer, lock=False, lockUnpublished=False) # Find every module installed on that character. blueprintInstances = utils.findInstalledBlueprintInstances( character) for blueprintInstance in blueprintInstances: moduleContainer = character + ":" + blueprintInstance + ":module_container" cmds.lockNode(moduleContainer, lock=False, lockUnpublished=False) # Do we have modules installed? If so, set the joint color to blue. blueprintJointsGrp = character + ":" + blueprintInstance + ":blueprint_joints_grp" if cmds.getAttr(blueprintJointsGrp + ".controlModulesInstalled"): #Blue cmds.setAttr(blueprintJointsGrp + ".overrideColor", 6) else: cmds.setAttr(blueprintJointsGrp + ".overrideColor", 2) cmds.lockNode(moduleContainer, lock=True, lockUnpublished=True) cmds.lockNode(characterContainer, lock=True, lockUnpublished=True) if len(objects) > 0: lastSelected = objects[len(objects) - 1] lastSelected_stripNamespaces = utils.stripAllNamespaces( lastSelected) if lastSelected_stripNamespaces != None: lastSelected_withoutNamespaces = lastSelected_stripNamespaces[ 1] if lastSelected_withoutNamespaces.find("blueprint_") == 0: blueprintModuleNamespace_incCharNamespace = lastSelected_stripNamespaces[ 0] moduleContainer = blueprintModuleNamespace_incCharNamespace + ":module_container" cmds.select(moduleContainer, replace=True) # set color of the joints characterNamespace = utils.stripLeadingNamespace( lastSelected)[0] characterContainer = characterNamespace + ":character_container" containers = [characterContainer, moduleContainer] for container in containers: cmds.lockNode(container, lock=False, lockUnpublished=False) blueprintJointsGrp = blueprintModuleNamespace_incCharNamespace + ":blueprint_joints_grp" # This was not in the video. I needed to add this to allow overrides. cmds.setAttr(blueprintJointsGrp + ".overrideEnabled", 1) cmds.setAttr(blueprintJointsGrp + ".overrideColor", 13) # Bring up UI self.createUserInterface( blueprintModuleNamespace_incCharNamespace) for container in containers: cmds.lockNode(container, lock=True, lockUnpublished=True) self.setupSelectionScriptJob()