def remapNamespaces(self, *args): winName = "remapNamespacesWindow" if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName) window = cmds.window( winName, title = "Remap Namespaces") cmds.columnLayout(adjustableColumn=True) cmds.rowColumnLayout( numberOfColumns=3) animData = aToolsMod.loadInfoWithUser("copyPasteAnim", "animData") inputNameSpaces = list(set(utilMod.getNameSpace(animData["objects"])[0])) outputNameSpaces = utilMod.listAllNamespaces() for loopNameSpace in inputNameSpaces: nameSpace = loopNameSpace[:-1] eval("cmds.text('input%s', align='right', w=150, h=26, label='%s: ')"%(nameSpace, nameSpace)) eval("cmds.textField('output%s', w=150, h=26, text='%s')"%(nameSpace, nameSpace)) eval("cmds.button('output%s', w=26, h=26, label='...')"%(nameSpace)) if outputNameSpaces: cmds.popupMenu(button=1) for loopOutput in outputNameSpaces: cmds.menuItem ("menu%s"%loopOutput, label=str(loopOutput), command=lambda x, loopOutput=loopOutput, nameSpace=nameSpace, *args: self.setOutputValue(loopOutput, nameSpace)) cmds.setParent( '..' ) cmds.button(label="Paste Animation in Place", command=lambda *args: self.remapAndPasteAnimation(animData, inputNameSpaces, pasteInPlace=True)) cmds.button(label="Paste Original Animation", command=lambda *args: self.remapAndPasteAnimation(animData, inputNameSpaces, pasteInPlace=False)) cmds.showWindow( window )
def populateDuplicateButtonMenu(self, menu, selSet, colorName): outputNameSpaces = utilMod.listAllNamespaces() uiMod.clearMenuItems(menu) if not outputNameSpaces: return for loopNameSpace in outputNameSpaces: newMenu = cmds.menuItem(subMenu=True, label=loopNameSpace, parent=menu) for loopColor in self.colors: loopColorName = loopColor["name"] if colorName != loopColorName: cmds.menuItem(label=utilMod.toTitle(loopColorName), parent=newMenu, command=lambda x, loopNameSpace=loopNameSpace, loopColorName=loopColorName, *args:self.duplicateSet(selSet,loopNameSpace,loopColorName))
def populateDuplicateButtonMenu(self, menu, selSet, colorName): outputNameSpaces = utilMod.listAllNamespaces() uiMod.clearMenuItems(menu) if not outputNameSpaces: return for loopNameSpace in outputNameSpaces: newMenu = cmds.menuItem(subMenu=True, label=loopNameSpace, parent=menu) for loopColor in self.colors: loopColorName = loopColor["name"] if colorName != loopColorName: cmds.menuItem( label=utilMod.toTitle(loopColorName), parent=newMenu, command=lambda x, loopNameSpace=loopNameSpace, loopColorName=loopColorName, *args: self.duplicateSet( selSet, loopNameSpace, loopColorName))