def launchAnimUI(*args): import ART_animationUI reload(ART_animationUI) UI = ART_animationUI.AnimationUI()
def addCharacter(self, close, *args): project = cmds.optionMenu(self.widgets["project"], q=True, value=True) selectedCharacter = cmds.textScrollList(self.widgets["characterList"], q=True, si=True)[0] rigPath = self.mayaToolsDir + "/General/ART/Projects/" + project + "/AnimRigs/" + selectedCharacter + ".mb" #find existing namespaces in scene namespaces = cmds.namespaceInfo(listOnlyNamespaces=True) #reference the rig file cmds.file(rigPath, r=True, type="mayaBinary", loadReferenceDepth="all", namespace=selectedCharacter, options="v=0") #clear selection and fit view cmds.select(clear=True) #query autoKeyFrame state if not cmds.autoKeyframe(q=True, state=True): cmds.viewFit() #cmds.viewFit() panels = cmds.getPanel(type='modelPanel') #turn on smooth shading for panel in panels: editor = cmds.modelPanel(panel, q=True, modelEditor=True) cmds.modelEditor(editor, edit=True, displayAppearance="smoothShaded", displayTextures=True, textures=True) #find new namespaces in scene (this is here in case I need to do something later and I need the new name that was created) newCharacterName = selectedCharacter newNamespaces = cmds.namespaceInfo(listOnlyNamespaces=True) for name in newNamespaces: if name not in namespaces: newCharacterName = name #launch UI import ART_animationUI reload(ART_animationUI) ART_animationUI.AnimationUI() if close: cmds.deleteUI(self.widgets["window"])
import maya.cmds as cmds
import traceback