def visCntrls(curParent): ''' Different visibility controls for character. ''' imgDef = lambda x: os.path.join( iconPath, x ) visRC = cmds.rowColumnLayout( nc=5, cw=[[1,60],[2,60],[3,60],[4,60],[5,60]], parent=curParent) cmds.symbolButton( image=imgDef( 'outliner.xpm' ), w=60, h=45 ) cmds.symbolButton( image=imgDef( 'mainRig.xpm' ), w=60, h=45 ) jointVis = cmds.symbolCheckBox(image=imgDef("JointVis_On.xpm"), w=60, h=45, oni=imgDef("JointVis_On.xpm") , ofi=imgDef("JointVis_Off.xpm") ) # cmds.connectControl( jointVis, "rig.v") ctrlVis = cmds.symbolCheckBox(image=imgDef("ctrlVis_On.xpm"), w=60, h=45, oni=imgDef("ctrlVis_On.xpm") , ofi=imgDef("ctrlVis_Off.xpm") ) cmds.symbolCheckBox(image=imgDef("keySel_on.xpm"), w=60, h=45, oni=imgDef("keySel_on.xpm") , ofi=imgDef("keySel_off.xpm") ) # cmds.connectControl( ctrlVis, "move_all_control.visibility") # Row and High Rez # Dress # Face Controls # T-Pose cmds.setParent(curParent)
def brushButtonClicked(self,clickedIndex): ''' handler for brush button click ''' self.brushShape.set(clickedIndex) for index,button in enumerate(self.controls.brushShapeButtons): cmds.symbolCheckBox(button,e=True,value=index==clickedIndex) self.paintValuesChanged()
def symbol_check_box(*args, **kwargs): try: if kwargs.get('query') or kwargs.get('q'): return cmds.symbolCheckBox(*args, **kwargs) return cmds.symbolCheckBox(*args, onImage="precompExportChecked.png", offImage="precompExportUnchecked.png", **kwargs) except Exception as exp: LOG.debug("MayaAPI exception in 'symbol_check_box': {0}".format( exp).strip()) return None
def addCurrentToSelection(self, *args): currentTree = self.getCurrentWeights() self.generationSelection.append(currentTree) IMG_PATH = 'C:/Users/cs/Documents/maya/projects/rigGAShri/images/tmp/' SELECTION_SIZE = len(self.generationSelection) currentRenderFile = "GASelectionGen%i" % SELECTION_SIZE cmds.setAttr("defaultRenderGlobals.imageFilePrefix", currentRenderFile, type="string") cmds.render('renderCam') print "Rendering %s\n" % currentRenderFile selectionUI = 'selectionUI' if cmds.window(selectionUI, exists=True): cmds.deleteUI(selectionUI) cmds.window(selectionUI, width=300, height=100) cmds.columnLayout("allLayout", adjustableColumn=True) cmds.columnLayout("topLayout", parent="allLayout") cmds.button('selectAll', label='Select All', command=partial(self.changeAllSelection, True), parent="topLayout") cmds.button('clearAll', label='Clear All', command=partial(self.changeAllSelection, False), parent="topLayout") cmds.separator(parent="allLayout") cmds.gridLayout("gridLayout", numberOfColumns=6, cellWidthHeight=(256, 256), parent="allLayout") buttonList = [] for face in range(SELECTION_SIZE): currentImg = IMG_PATH + "GASelectionGen" + str(face + 1) + ".jpeg" print currentImg buttonName = 'button%i' % face buttonList.append(buttonName) print buttonList cmds.symbolCheckBox(buttonName, image=currentImg, parent="gridLayout") cmds.showWindow(selectionUI) self.buttonList = buttonList
def create(self, parent): ''' Checks to see the type of control it is. ''' if (parent): self.parent = parent if (self.parent and self.ctrlType == "img"): if (".xpm" == self.fileExt): self.gui = cmds.picture(image=self.imgPath, w=self.width, h=self.height) else: self.gui = cmds.image(image=self.imgPath, w=self.width, h=self.height) elif (self.parent and self.ctrlType == "ctrl"): self.gui = cmds.symbolButton(image=self.imgPath, w=self.width, h=self.height) elif (self.parent and self.ctrlType == "chk"): imgDef = lambda x: os.path.join(os.path.split(self.imgPath)[0], x) self.gui = cmds.symbolCheckBox(image=self.imgPath, w=self.width, h=self.height, onImage=self.imgPath, offImage=imgDef(self.ctrlOff))
def getSelectedBrushShape(self): for button, shape in zip(self.controls.brushShapeButtons, ["gaussian", "poly", "solid", "square"]): if cmds.symbolCheckBox(button, q=True, value=True): return shape return "solid"
def createBrushShapeButtons(self): class ButtonClickHandler: def __init__(self, number, parent): self.number = number self.parent = parent def __call__(self, *args): self.parent.brushButtonClicked(self.number) newIcons = [ 'circleGaus.png', 'circlePoly.png', 'circleSolid.png', 'rect.png' ] oldIcons = [ 'circleGaus.xpm', 'circlePoly.xpm', 'circleSolid.xpm', 'rect.xpm' ] icons = newIcons if Utils.getMayaVersion( ) >= Utils.MAYA2011 else oldIcons for index, i in enumerate(icons): btn = cmds.symbolCheckBox(w=33, h=36, i=i, changeCommand=ButtonClickHandler( index, self), value=index == self.brushShape.get()) self.controls.brushShapeButtons.append(btn)
def addSymbolCheckBox(self, icon='pythonFamily.png', ann=_null, enable=_null, onCommand=_null, offCommand=_null): cmds.setParent(self.name) if icon: icon = self.iconPath + icon cmds.symbolCheckBox(self, width=32, height=32, nbg=True, image=icon, en=enable, onCommand=onCommand, offCommand=offCommand)
def setSymbolCheckable(ids, anns, ccs, types, icons, w=ICONWIDTH, *args): """ Make a checkable symbol button :param ids: set id for button (list) :param anns: annotation of button (list) :param ccs: command for button when click (list) :param w: width of button, also is the high :return: a symbol check box button """ for i in range(len(ids)): # get icon path from default path icon = geticon(icons[i]) cmd = ccs[i] var = types[i] cc = partial(cmd, var) cmds.symbolCheckBox(ids[i], ann=anns[i], i=icon, cc=cc, v=True, w=w, h=w) i += 1
def selectAll(self, select, *args): #selects all checkboxes #need to find all space switch nodes for the current character cmds.select(self.character + ":*_space_switcher_follow") nodes = cmds.ls(sl = True) spaceSwitchers = [] for node in nodes: if node.find("invis") == -1: control = node.partition("_space_")[0] spaceSwitchers.append(control) for control in spaceSwitchers: if select: cmds.symbolCheckBox(control + "_checkboxWidget", edit = True, v = True) else: cmds.symbolCheckBox(control + "_checkboxWidget", edit = True, v = False)
def manipState(*args): localState = cmds.symbolCheckBox( selectBtn, q=True, value=True ) # print("localState: %s" %localState) if( localState ): # Move tool in local mode cmds.manipMoveContext( "Move", e=1, mode=0 ) else: # Move tool in world mode. cmds.manipMoveContext( "Move", e=1, mode=2 )
def visCntrls(curParent): ''' Different visibility controls for character. ''' imgDef = lambda x: os.path.join(iconPath, x) visRC = cmds.rowColumnLayout(nc=5, cw=[[1, 60], [2, 60], [3, 60], [4, 60], [5, 60]], parent=curParent) cmds.symbolButton(image=imgDef('outliner.xpm'), w=60, h=45) cmds.symbolButton(image=imgDef('mainRig.xpm'), w=60, h=45) jointVis = cmds.symbolCheckBox(image=imgDef("JointVis_On.xpm"), w=60, h=45, oni=imgDef("JointVis_On.xpm"), ofi=imgDef("JointVis_Off.xpm")) # cmds.connectControl( jointVis, "rig.v") ctrlVis = cmds.symbolCheckBox(image=imgDef("ctrlVis_On.xpm"), w=60, h=45, oni=imgDef("ctrlVis_On.xpm"), ofi=imgDef("ctrlVis_Off.xpm")) cmds.symbolCheckBox(image=imgDef("keySel_on.xpm"), w=60, h=45, oni=imgDef("keySel_on.xpm"), ofi=imgDef("keySel_off.xpm")) # cmds.connectControl( ctrlVis, "move_all_control.visibility") # Row and High Rez # Dress # Face Controls # T-Pose cmds.setParent(curParent)
def getSelectedFromWindow(self): checkBoxNames = self.buttonList returnList = [] for i, cB in enumerate(checkBoxNames): flag = cmds.symbolCheckBox(cB, query=True, value=True) if flag: returnList.append(i) return returnList
def gui(): if( cmds.window( win, q=True, ex=True) ): cmds.deleteUI(win) cmds.window(win, title="Active List Script") mainCol = cmds.columnLayout() cmds.text(l="", h=3) cmds.rowColumnLayout( nc=2, cw=[[1,165],[2,25]], co=[1,"both",5] ) cmds.textScrollList("mecTSL", w=170, h=200, ams=True, append=cmds.ls(sl=True) ) cmds.columnLayout() ''' cmds.button( label="U", w=25, h=40 ) cmds.button( label="U", w=25, h=40 ) cmds.button( label="R", w=25, h=40 ) cmds.button( label="D", w=25, h=40 ) cmds.button( label="D", w=25, h=40 ) ''' cmds.symbolButton( i="top.xpm", w=25, h=40, c=moveTop ) cmds.symbolButton( i="up.xpm", w=25, h=40, c=moveUp) cmds.symbolButton( i="del.xpm", w=25, h=40, c=remItem ) cmds.symbolButton( i="down.xpm", w=25, h=40, c=moveDown ) cmds.symbolButton( i="bottom.xpm", w=25, h=40, c=moveBottom ) cmds.setParent( mainCol ) cmds.text(l="", h=5 ) cmds.rowColumnLayout( nc=2, cw=[[1,95],[2,100]], co=[[1,"left",5],[2,"right",5]]) cmds.symbolCheckBox( w=100, h=30, image="live.xpm", oni="live.xpm", ofi="pause.xpm", onc=live, ofc=liveOff, v=1) # cmds.button(label="Live", h=30, w=95) # cmds.button(label="Refresh", c=refresh) cmds.symbolButton( i="refreshAL.xpm", w=100, h=30, c=refresh ) cmds.setParent(mainCol) cmds.showWindow() live()
def fillButtons( self, *args ): # This fills gridLayout with the appropriate buttons. # Check if buttons already exist. If they do, delete them. gridChildren = cmds.gridLayout( self.frameGrid, query=True, childArray=True ) if gridChildren is not None: for c in gridChildren: cmds.deleteUI( c ) # Get the children of toggle buttons column. checkBoxChildren = cmds.rowColumnLayout( self.toggleColumn, query=True, childArray=True ) for checkBox in checkBoxChildren: # Loop through the children to see if they are active. boxValue = cmds.symbolCheckBox( checkBox, query=True, value=True ) if boxValue == True: # If the button is active then we need to make the appropriate frame # buttons in the grid layout. boxAnno = cmds.symbolCheckBox( checkBox, query=True, annotation=True ) frameFiles = XMLUtility.getXMLInFolder( XMLUtility.FRAME_PRESETS_PATH+boxAnno+'/' ) for frame in frameFiles: # Make the grid layout buttons. The label is the file name, while # the annotation is the folder name. cmds.button( parent=self.frameGrid, label=frame, annotation=boxAnno, command=lambda v, a1=frame, a2=boxAnno: buttonTest(v, a1, a2) )
def createBrushShapeButtons(self): class ButtonClickHandler: def __init__(self,number,parent): self.number=number self.parent=parent def __call__(self,*args): self.parent.brushButtonClicked(self.number) icons = ['circleGaus.png','circlePoly.png','circleSolid.png','rect.png'] for index,i in enumerate(icons): btn = cmds.symbolCheckBox(w=33,h=36,i=i,changeCommand=ButtonClickHandler(index,self),value=index==self.brushShape.get()) self.controls.brushShapeButtons.append(btn)
def controlSelect(obj, manip=None): selectMode = cmds.symbolCheckBox( localBtn, q=True, value=True) if( manip == "rot" ): # rotate tool cmds.RotateTool() elif( manip == "trans" ): # move tool cmds.MoveTool() if( selectMode ): cmds.select( obj, add=True ) else: cmds.select( obj, r=True )
def setCommand(self, cmd, cmdOff=False): if (self.ctrlType == "ctrl"): cmds.symbolButton(self.gui, edit=True, command=cmd) elif (self.ctrlType == "chk"): cmds.symbolCheckBox(self.gui, edit=True, command=cmd) cmds.symbolCheckBox(self.gui, edit=True, onCommand=cmd) if (cmdOff): cmds.symbolCheckBox(self.gui, edit=True, offCommand=cmdOff) if (cmdOff): self.command = [cmd, cmdOff] else: self.command = cmd
def setCommand(self, cmd, cmdOff=False): if( self.ctrlType == "ctrl" ): cmds.symbolButton( self.gui, edit=True, command=cmd) elif( self.ctrlType == "chk"): cmds.symbolCheckBox( self.gui, edit=True, command=cmd) cmds.symbolCheckBox( self.gui, edit=True, onCommand=cmd) if( cmdOff ): cmds.symbolCheckBox( self.gui, edit=True, offCommand=cmdOff) if( cmdOff ): self.command = [cmd, cmdOff] else: self.command = cmd
def create(self, parent): ''' Checks to see the type of control it is. ''' if(parent): self.parent = parent if( self.parent and self.ctrlType == "img"): if( ".xpm" == self.fileExt ): self.gui = cmds.picture( image=self.imgPath ,w=self.width, h=self.height ) else: self.gui = cmds.image( image=self.imgPath ,w=self.width, h=self.height ) elif( self.parent and self.ctrlType == "ctrl"): self.gui = cmds.symbolButton(image=self.imgPath ,w=self.width, h=self.height) elif( self.parent and self.ctrlType == "chk"): imgDef = lambda x: os.path.join( os.path.split(self.imgPath)[0], x ) self.gui = cmds.symbolCheckBox(image=self.imgPath ,w=self.width, h=self.height, onImage=self.imgPath, offImage=imgDef(self.ctrlOff))
def selectAllSpaceSwitchNodes(self, *args): #need to find all space switch nodes for the current character cmds.select(self.character + ":*_space_switcher_follow") nodes = cmds.ls(sl = True) spaceSwitchers = [] for node in nodes: if node.find("invis") == -1: spaceSwitchers.append(node) selectNodes = [] for node in spaceSwitchers: control = node.partition("_space")[0] spaceSwitchNode = node.partition("_follow")[0] value = cmds.symbolCheckBox(control + "_checkboxWidget", q = True, value = True) if value: selectNodes.append(spaceSwitchNode) cmds.select(clear = True) for node in selectNodes: cmds.select(node, add = True)
def uiCreate(self): self.onCloseClicked() self.window = m.window(WIN_NAME, title='Maya Window', maximizeButton=False) uiLAY_mainForm = m.formLayout() self.uiLAY_mainScroll = m.scrollLayout(childResizable=True) mainColumn = m.columnLayout( adjustableColumn=True) # main column layout with frames # -------- self.uiLAY_frameCheckBoxes = self.uiCreateFrame( 'uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame( 'uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiCHKGRP_test1 = m.checkBoxGrp('uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1') self.uiCHKGRP_test2 = m.checkBoxGrp('uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2')) self.uiCHKGRP_test3 = m.checkBoxGrp('uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3')) self.uiCHKGRP_test4 = m.checkBoxGrp('uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4')) m.setParent(mainColumn) # -------- self.uiLAY_frameColorSliders = self.uiCreateFrame( 'uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiCLRGRP_test1 = m.colorSliderGrp('uiCLRGRP_test1', label='test1') self.uiCLRGRP_test2 = m.colorSliderGrp('uiCLRGRP_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFields = self.uiCreateFrame( 'uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiFLF_test1 = m.floatField('uiFLF_test1') self.uiFLF_test2 = m.floatField('uiFLF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame( 'uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiFLFGRP_test1 = m.floatFieldGrp('uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1') self.uiFLFGRP_test2 = m.floatFieldGrp('uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2') self.uiFLFGRP_test3 = m.floatFieldGrp('uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3') self.uiFLFGRP_test4 = m.floatFieldGrp('uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatScrollBars = self.uiCreateFrame( 'uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliders = self.uiCreateFrame( 'uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame( 'uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiFLSGRP_test1 = m.floatSliderGrp('uiFLSGRP_test1', label='test1', field=True) self.uiFLSGRP_test2 = m.floatSliderGrp('uiFLSGRP_test2', label='test2', field=True) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame( 'uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITCHK_test1 = m.iconTextCheckBox('uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube') self.uiITCHK_test2 = m.iconTextCheckBox('uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone') m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame( 'uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.iconTextRadioCollection() self.uiITRAD_test1 = m.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube') self.uiITRAD_test2 = m.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone') self.uiITRAD_test3 = m.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus') m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame( 'uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITSLST_test1 = m.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) self.uiITSLST_test2 = m.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) m.setParent(mainColumn) # -------- self.uiLAY_frameIntFields = self.uiCreateFrame( 'uiLAY_frameIntFields', 'Int Fields (PMIntField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiINF_test1 = m.intField('uiINF_test1') self.uiINF_test2 = m.intField('uiINF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntFieldGroups = self.uiCreateFrame( 'uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiINFGRP_test1 = m.intFieldGrp('uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1') self.uiINFGRP_test2 = m.intFieldGrp('uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2') self.uiINFGRP_test3 = m.intFieldGrp('uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3') self.uiINFGRP_test4 = m.intFieldGrp('uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4') m.setParent(mainColumn) # -------- self.uiLAY_frameIntScrollBars = self.uiCreateFrame( 'uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliders = self.uiCreateFrame( 'uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliderGroups = self.uiCreateFrame( 'uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiINSGRP_test1 = m.intSliderGrp('uiINSGRP_test1', label='test1', field=True) self.uiINSGRP_test2 = m.intSliderGrp('uiINSGRP_test2', label='test2', field=True) m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenus = self.uiCreateFrame( 'uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=110, style='none') self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame( 'uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtons = self.uiCreateFrame( 'uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.radioCollection() self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame( 'uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiRADGRP_test1 = m.radioButtonGrp('uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1') self.uiRADGRP_test2 = m.radioButtonGrp('uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2')) self.uiRADGRP_test3 = m.radioButtonGrp('uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3')) self.uiRADGRP_test4 = m.radioButtonGrp('uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4')) m.setParent(mainColumn) # -------- self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame( 'uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSYMCHK_test1 = m.symbolCheckBox('uiSYMCHK_test1', image='polyCube') self.uiSYMCHK_test2 = m.symbolCheckBox('uiSYMCHK_test2', image='polyCone') m.setParent(mainColumn) # -------- self.uiLAY_frameScriptTables = self.uiCreateFrame( 'uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRTBL_test1 = m.scriptTable('uiSCRTBL_test1', selectionMode=3, rows=4, columns=2) self.uiSCRTBL_test2 = m.scriptTable('uiSCRTBL_test2', selectionMode=3, rows=4, columns=2) m.setParent(mainColumn) # -------- self.uiLAY_frameScrollField = self.uiCreateFrame( 'uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRFLD_test1 = m.scrollField('uiSCRFLD_test1', wordWrap=True) self.uiSCRFLD_test2 = m.scrollField('uiSCRFLD_test2', wordWrap=True) m.setParent(mainColumn) # -------- self.uiLAY_frameShelfTabLayout = self.uiCreateFrame( 'uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') m.columnLayout(adjustableColumn=True) self.uiSHLTAB_test1 = m.shelfTabLayout() m.shelfLayout('test1') m.setParent('..') m.shelfLayout('test2') m.setParent('..') m.shelfLayout('test3') m.setParent('..') m.setParent('..') self.uiSHLTAB_test2 = m.shelfTabLayout() m.shelfLayout('test4') m.setParent('..') m.shelfLayout('test5') m.setParent('..') m.shelfLayout('test6') m.setParent('..') m.setParent(mainColumn) # -------- self.uiLAY_frameTabLayout = self.uiCreateFrame( 'uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') m.columnLayout(adjustableColumn=True) self.uiTAB_test1 = m.tabLayout() uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout(self.uiTAB_test1, edit=True, tabLabel=( (uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'), )) self.uiTAB_test2 = m.tabLayout() uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout(self.uiTAB_test2, edit=True, tabLabel=( (uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'), )) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFields = self.uiCreateFrame( 'uiLAY_frameTextFields', 'Text Fields (PMTextField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiTXT_test1 = m.textField('uiTXT_test1') self.uiTXT_test2 = m.textField('uiTXT_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame( 'uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXBTGR_test1 = m.textFieldButtonGrp('uiTXBTGR_test1', label='test1', buttonLabel='button1') self.uiTXBTGR_test2 = m.textFieldButtonGrp('uiTXBTGR_test2', label='test2', buttonLabel='button2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldGroups = self.uiCreateFrame( 'uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXTGRP_test1 = m.textFieldGrp('uiTXTGRP_test1', label='test1') self.uiTXTGRP_test2 = m.textFieldGrp('uiTXTGRP_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextScrollLists = self.uiCreateFrame( 'uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiTXTLST_test1 = m.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) self.uiTXTLST_test2 = m.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) # -------- m.setParent(uiLAY_mainForm) self.uiBTN_savePrefs = m.button(label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked) self.uiBTN_loadPrefs = m.button(label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked) self.uiBTN_resetPrefs = m.button(label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked) m.setParent('..') # -> window m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'top', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachControl=[(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_savePrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_loadPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_resetPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)]) m.showWindow(self.window)
def __init__(self): # Setup the scene the Turbine way utils.sceneSetup(self) self.previousBlueprintListEntry = None self.previousBlueprintModule = None self.previousAnimationModule = None baseIconsDir = os.environ["GEPPETTO"] + "/Icons/" self.selectedCharacter = self.findSelectedCharacter() if self.selectedCharacter == None: return self.characterName = self.selectedCharacter.partition("__")[2] self.windowName = self.characterName + "_window" self.UIElements = {} if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) self.windowWidth = 420 self.windowHeight = 730 self.UIElements["window"] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight, title = "Animation UI: " + self.characterName, sizeable=False) self.UIElements["topColumnLayout"] = cmds.columnLayout(adj=True, rs=3) buttonWidth = 32 columnOffset = 5 buttonColumnWidth = buttonWidth + (2*columnOffset) textScrollWidth = (self.windowWidth - buttonColumnWidth - 8) /2 self.UIElements["listBoxRowLayout"] = cmds.rowLayout(nc=3, columnWidth3=[textScrollWidth, textScrollWidth, buttonColumnWidth], columnAttach=([1, "both", columnOffset], [2, "both", columnOffset], [3, "both", columnOffset])) self.UIElements["blueprintModule_textScroll"] = cmds.textScrollList(numberOfRows=12, allowMultiSelection=False, selectCommand=self.refreshAnimationModuleList) self.initialiseBlueprintModuleList() self.UIElements["animationModule_textScroll"] = cmds.textScrollList(numberOfRows=12, allowMultiSelection=False, selectCommand=self.setupModuleSpecificControls) self.UIElements["buttonColumnLayout"] = cmds.columnLayout() #self.UIElements["pinButton"] = cmds.symbolCheckBox(onImage=baseIconsDir+"_pinned.bmp", offImage=baseIconsDir+"_unpinned.bmp", width=buttonWidth, height=buttonWidth, onCommand=self.deleteScriptJob, offCommand=self.setupScriptJob) self.UIElements["zeroModulesButton"] = cmds.symbolButton(image=baseIconsDir+"_zeroPose.bmp", width=buttonWidth, height=buttonWidth, enable=False, annotation='Set all Animation Controls %100 to the Creation Pose', c=self.zeroModWeightsA) #if cmds.objExists(self.selectedCharacter+":non_blueprint_grp"): #value = cmds.getAttr(self.selectedCharacter+":non_blueprint_grp.display") #self.UIElements["nonBlueprintVisibility"] = cmds.symbolCheckBox(image=baseIconsDir+"_geoVis.bmp", width=buttonWidth, height=buttonWidth, onCommand=self.toggleNonBlueprintVisibility, offCommand=self.toggleNonBlueprintVisibility) value = cmds.getAttr(self.selectedCharacter + ":character_grp.animationControlVisibility") self.UIElements["animControlVisibility"] = cmds.symbolCheckBox(image=baseIconsDir+"_ctrlVis.bmp", width=buttonWidth, height=buttonWidth, onCommand=self.toggleAnimControlVisibility, annotation='Hide all Animation Controls', offCommand=self.toggleAnimControlVisibility) self.UIElements["deleteModuleButton"] = cmds.symbolButton(image=baseIconsDir+"_shelf_delete.bmp", width=buttonWidth, height=buttonWidth, enable=False, annotation='Delete an Animation Module', c=self.deleteSelectedModule) self.UIElements["duplicateModuleButton"] = cmds.symbolButton(image=baseIconsDir+"_duplicate.bmp", width=buttonWidth, height=buttonWidth, enable=False, annotation='Duplicate an Animation Module', c=self.duplicateSelectedModule) cmds.setParent(self.UIElements["topColumnLayout"]) cmds.separator() # 159 > self.UIElements["activeModuleColumn"] = cmds.columnLayout(adj=True) self.setupActiveModuleControls() cmds.setParent(self.UIElements["topColumnLayout"]) cmds.separator() self.UIElements["matchingButton"] = cmds.button(label="Match Controls to Result", annotation='This is the FK/IK Switch', enable=False) cmds.separator() # < 159 # 175 > # Setup space switching UI self.UIElements["spaceSwitchingColumn"] = cmds.columnLayout(adj=True) self.setupSpaceSwitchingControls() cmds.setParent(self.UIElements["topColumnLayout"]) cmds.separator() # < 175 cmds.rowColumnLayout(nr=1, rowAttach=[1, "both", 0], rowHeight=[1, self.windowHeight-395]) self.UIElements["moduleSpecificControlsScroll"] = cmds.scrollLayout(hst=0) scrollWidth = cmds.scrollLayout(self.UIElements["moduleSpecificControlsScroll"], q=True, scrollAreaWidth=True) self.UIElements["moduleSpecificControlsColumn"] = cmds.columnLayout(columnWidth=scrollWidth+300, columnAttach=["both", 5]) self.refreshAnimationModuleList() self.setupScriptJob() # Shows a new window for each character. Tab these? #cmds.showWindow (self.UIElements["window"]) #pane1 = cmds.paneLayout( configuration='single', parent=self.UIElements["window"]) #allowedAreas = ['right', 'left'] #cmds.dockControl( area='left', content=self.UIElements["window"], allowedArea=allowedAreas, l="AnimationUI") cmds.showWindow(self.windowName) self.selectionChanged()
def uiCreate(self): self.onCloseClicked() self.window = m.window( WIN_NAME, title='Maya Window', maximizeButton=False ) uiLAY_mainForm = m.formLayout() self.uiLAY_mainScroll = m.scrollLayout(childResizable=True) mainColumn = m.columnLayout(adjustableColumn=True) # main column layout with frames # -------- self.uiLAY_frameCheckBoxes = self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiCHKGRP_test1 = m.checkBoxGrp( 'uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1' ) self.uiCHKGRP_test2 = m.checkBoxGrp( 'uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2') ) self.uiCHKGRP_test3 = m.checkBoxGrp( 'uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiCHKGRP_test4 = m.checkBoxGrp( 'uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) m.setParent(mainColumn) # -------- self.uiLAY_frameColorSliders = self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiCLRGRP_test1 = m.colorSliderGrp( 'uiCLRGRP_test1', label='test1' ) self.uiCLRGRP_test2 = m.colorSliderGrp( 'uiCLRGRP_test2', label='test2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFields = self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiFLF_test1 = m.floatField('uiFLF_test1') self.uiFLF_test2 = m.floatField('uiFLF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiFLFGRP_test1 = m.floatFieldGrp( 'uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1' ) self.uiFLFGRP_test2 = m.floatFieldGrp( 'uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2' ) self.uiFLFGRP_test3 = m.floatFieldGrp( 'uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3' ) self.uiFLFGRP_test4 = m.floatFieldGrp( 'uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4' ) m.setParent(mainColumn) # -------- self.uiLAY_frameFloatScrollBars = self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliders = self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiFLSGRP_test1 = m.floatSliderGrp( 'uiFLSGRP_test1', label='test1', field=True ) self.uiFLSGRP_test2 = m.floatSliderGrp( 'uiFLSGRP_test2', label='test2', field=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITCHK_test1 = m.iconTextCheckBox( 'uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITCHK_test2 = m.iconTextCheckBox( 'uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.iconTextRadioCollection() self.uiITRAD_test1 = m.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITRAD_test2 = m.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) self.uiITRAD_test3 = m.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITSLST_test1 = m.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiITSLST_test2 = m.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) m.setParent(mainColumn) # -------- self.uiLAY_frameIntFields = self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiINF_test1 = m.intField('uiINF_test1') self.uiINF_test2 = m.intField('uiINF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntFieldGroups = self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiINFGRP_test1 = m.intFieldGrp( 'uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1' ) self.uiINFGRP_test2 = m.intFieldGrp( 'uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2' ) self.uiINFGRP_test3 = m.intFieldGrp( 'uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3' ) self.uiINFGRP_test4 = m.intFieldGrp( 'uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIntScrollBars = self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliders = self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliderGroups = self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiINSGRP_test1 = m.intSliderGrp( 'uiINSGRP_test1', label='test1', field=True ) self.uiINSGRP_test2 = m.intSliderGrp( 'uiINSGRP_test2', label='test2', field=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenus = self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=110, style='none') self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtons = self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.radioCollection() self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiRADGRP_test1 = m.radioButtonGrp( 'uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1' ) self.uiRADGRP_test2 = m.radioButtonGrp( 'uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2') ) self.uiRADGRP_test3 = m.radioButtonGrp( 'uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiRADGRP_test4 = m.radioButtonGrp( 'uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) m.setParent(mainColumn) # -------- self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSYMCHK_test1 = m.symbolCheckBox( 'uiSYMCHK_test1', image='polyCube' ) self.uiSYMCHK_test2 = m.symbolCheckBox( 'uiSYMCHK_test2', image='polyCone' ) m.setParent(mainColumn) # -------- self.uiLAY_frameScriptTables = self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRTBL_test1 = m.scriptTable( 'uiSCRTBL_test1', selectionMode=3, rows=4, columns=2 ) self.uiSCRTBL_test2 = m.scriptTable( 'uiSCRTBL_test2', selectionMode=3, rows=4, columns=2 ) m.setParent(mainColumn) # -------- self.uiLAY_frameScrollField = self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRFLD_test1 = m.scrollField( 'uiSCRFLD_test1', wordWrap=True ) self.uiSCRFLD_test2 = m.scrollField( 'uiSCRFLD_test2', wordWrap=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameShelfTabLayout = self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') m.columnLayout(adjustableColumn=True) self.uiSHLTAB_test1 = m.shelfTabLayout() m.shelfLayout('test1') m.setParent('..') m.shelfLayout('test2') m.setParent('..') m.shelfLayout('test3') m.setParent('..') m.setParent('..') self.uiSHLTAB_test2 = m.shelfTabLayout() m.shelfLayout('test4') m.setParent('..') m.shelfLayout('test5') m.setParent('..') m.shelfLayout('test6') m.setParent('..') m.setParent(mainColumn) # -------- self.uiLAY_frameTabLayout = self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') m.columnLayout(adjustableColumn=True) self.uiTAB_test1 = m.tabLayout() uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout( self.uiTAB_test1, edit=True, tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),) ) self.uiTAB_test2 = m.tabLayout() uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout( self.uiTAB_test2, edit=True, tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),) ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFields = self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiTXT_test1 = m.textField('uiTXT_test1') self.uiTXT_test2 = m.textField('uiTXT_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXBTGR_test1 = m.textFieldButtonGrp( 'uiTXBTGR_test1', label='test1', buttonLabel='button1' ) self.uiTXBTGR_test2 = m.textFieldButtonGrp( 'uiTXBTGR_test2', label='test2', buttonLabel='button2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldGroups = self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXTGRP_test1 = m.textFieldGrp( 'uiTXTGRP_test1', label='test1' ) self.uiTXTGRP_test2 = m.textFieldGrp( 'uiTXTGRP_test2', label='test2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextScrollLists = self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiTXTLST_test1 = m.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiTXTLST_test2 = m.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) # -------- m.setParent(uiLAY_mainForm) self.uiBTN_savePrefs = m.button( label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked ) self.uiBTN_loadPrefs = m.button( label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked ) self.uiBTN_resetPrefs = m.button( label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked ) m.setParent('..') # -> window m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'top', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachControl=[(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_savePrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_loadPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_resetPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)]) m.showWindow(self.window)
import maya.cmds as cmds
def ui_update(self): self.prefsSave() m.symbolCheckBox(self.ui_BTN_searchCase, e=True, value=self.state.searchCase) m.symbolCheckBox(self.ui_BTN_searchRegEx, e=True, value=self.state.searchRegex) m.symbolCheckBox(self.ui_BTN_searchType, e=True, value=self.state.searchType) m.symbolCheckBox(self.ui_BTN_searchSelect, e=True, value=self.state.searchSelect) m.symbolCheckBox(self.ui_BTN_searchShape, e=True, value=self.state.searchShape) ov = self.state.currentView m.button(self.ui_BTN_modeDropDown, edit=True, label=ov.name) m.outlinerEditor(self.ui_EDT_outliner, edit=True, mainListConnection=ov.mainListConnection) m.outlinerEditor(self.ui_EDT_outliner, edit=True, selectionConnection=ov.selectionConnection) m.outlinerEditor(self.ui_EDT_outliner, edit=True, filter=ov.filter) m.outlinerEditor(self.ui_EDT_outliner, edit=True, setFilter=ov.setFilter) m.outlinerEditor(self.ui_EDT_outliner, edit=True, showShapes=ov.showShapes) m.outlinerEditor(self.ui_EDT_outliner, edit=True, showSetMembers=ov.showSetMembers) m.outlinerEditor(self.ui_EDT_outliner, edit=True, showDagOnly=ov.showDagOnly) m.outlinerEditor(self.ui_EDT_outliner, edit=True, expandObjects=ov.expandObjects) m.outlinerEditor(self.ui_EDT_outliner, edit=True, selectCommand=(ov.selectCommand if ov.selectCommand else dummyFunc)) m.symbolCheckBox(self.ui_BTN_showShapes, e=True, enable=ov.showShapesEnable, value=ov.showShapes) m.symbolCheckBox(self.ui_BTN_showSetMembers, e=True, enable=ov.showSetMembersEnable, value=ov.showSetMembers) m.symbolCheckBox(self.ui_BTN_selectSetMembers, e=True, enable=ov.selectSetMembersEnable, value=ov.selectSetMembers)
def _manipWidgit(self, curParent): ''' This gui widgit contains the buttons to add & remove attributes Overall adjusts for all the attribute contained inside. ''' frame = cmds.frameLayout(parent=curParent, labelVisible=False, marginWidth=5, marginHeight=3) frm = cmds.formLayout( parent=frame, w=415 ) path = os.path.split(__file__)[0] fullPath = lambda x : os.path.join( path, "icons", x ) btn1 = cmds.symbolButton( image=fullPath('plus_16b.xpm'), h=20, command=Callback(self.addAttrGUI)) # self._attrGUI ) btn2 = cmds.symbolButton( image=fullPath('delete_16b.xpm'), h=20, command=Callback(self.removeAll ))#command=self._removeAttrs ) btn2a = cmds.symbolButton( image=fullPath('save_16.xpm'), h=20, command=Callback(self.addAttrGUI)) # self._attrGUI ) btn2b = cmds.symbolButton( image=fullPath('folder_16b.xpm'), h=20, command=Callback(self.addAttrGUI)) # self._attrGUI ) cmds.formLayout( frm, e=1, af=[[btn1, "left", 5],[btn1, "top", 0]]) cmds.formLayout( frm, e=1, ac=[btn2, "left", 5, btn1], af=[btn2, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn2a, "left", 5, btn2], af=[btn2a, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn2b, "left", 5, btn2a], af=[btn2b, "top", 0]) ''' btn1 = cmds.button( label="Add Attr", w=100, command=Callback(self.addAttrGUI)) # self._attrGUI ) btn2 = cmds.button( label="Remove Attrs", w=100, command=Callback(self.removeAll ))#command=self._removeAttrs ) ''' btn3 = cmds.symbolButton(image='MENUICONKEYS.XPM', h=20, ann="Keyframe", command=Callback(self.keyAll)) ''' btn3 = cmds.button( label="Keyframe", command=Callback(self.keyAll)) ''' btn4 = cmds.symbolButton(image='REDRAWPAINTEFFECTS.XPM', h=20, ann="Reset to Default", command=Callback(self.resetAll)) btn5 = cmds.symbolCheckBox( image='ONRADIOBTNICON.XPM', h=20, oni='ONRADIOBTNICON.XPM', ofi='OFFRADIOBTNICON.XPM', ann="Set Offset", onc=Callback(self.setOffset)) btn6 = cmds.symbolButton(image='AUTOLOAD.XPM', h=20, ann="Reset Offset", command=Callback(self.resetOffset)) ''' cmds.formLayout( frm, e=1, ac=[btn3, "left", 5, btn2], af=[btn3, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn4, "left", 5, btn3], af=[btn4, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn5, "left", 5, btn4], af=[btn5, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn6, "left", 5, btn5], af=[btn6, "top", 0]) ''' cmds.formLayout( frm, e=1, af=[[btn6, "top", 0], [btn6, "right", 5]]) cmds.formLayout( frm, e=1, ac=[btn5, "right", 5, btn6], af=[btn5, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn4, "right", 5, btn5], af=[btn4, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn3, "right", 5, btn4], af=[btn3, "top", 0]) return frame
def changeAllSelection(self, flag, *args): checkBoxNames = self.buttonList for cB in checkBoxNames: cmds.symbolCheckBox(cB, edit=True, value=flag)
def setOffset(self): self.attrs.setOffset() cmds.symbolCheckBox( self.symGUI, e=1, v=1 )
def moduleGUI( self ): col = cmds.columnLayout( adjustableColumn=True, columnAttach=('both', 5), parent=self.fillArea ) # Frame area. cmds.text( label='FRAMES', height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] ) cmds.separator( style='none', height=5 ) # Frame template section. cmds.rowColumnLayout( numberOfColumns=2, columnWidth=[(1, 40), (2, self.winWidth-40)] ) # Left column. self.toggleColumn = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.symbolCheckBox( image='icon_root.png', value=0, annotation='roots', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_spine.png', value=0, annotation='spines', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_arm.png', annotation='arms', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_leg.png', annotation='legs', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_hand.png', annotation='hands', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_foot.png', annotation='feet', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_head.png', annotation='heads', changeCommand=self.moduleButtons ) cmds.setParent( '..' )#toggleColumn # Right column. cmds.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16, height=100 ) self.frameGrid = cmds.gridLayout( numberOfColumns=4, cellWidthHeight=( 50, 50 ) ) self.moduleButtons() cmds.setParent( '..' )#frameGrid cmds.setParent( '..' )#scrollLayout cmds.setParent( '..' )#rowColumnLayout cmds.separator( style='none', height=10 ) cmds.setParent( '..' )#col
def bakeSpace(self, *args): cmds.select(self.character + ":*_space_switcher_follow") nodes = cmds.ls(sl = True) spaceSwitchers = [] bakeNodes = [] for node in nodes: if node.find("invis") == -1: if node.find(self.character + ":spine_01_space_switcher") == -1: spaceSwitchers.append(node) cmds.select(clear = True) #get the value of the bake toggle for control in spaceSwitchers: animControl = control.partition("_space_")[0] value = cmds.symbolCheckBox(animControl + "_checkboxWidget", q = True, v = True) if value: bakeNodes.append(control) if bakeNodes == []: cmds.confirmDialog(title = "Bake Selected", icon = "warning", message = "No controls were selected for bake! Please use the bake icon next to the controls you want to bake down to toggle them for baking.") return #now we have a list of nodes to bake locs = [] constraints = [] for node in bakeNodes: #create a locator constrained to the space switch node spaceSwitchNode = node.rpartition("_follow")[0] control = spaceSwitchNode.partition("_space_switcher")[0] loc = cmds.spaceLocator(name = spaceSwitchNode + "_loc")[0] locs.append(loc) constraint = cmds.parentConstraint(control, loc)[0] constraints.append(constraint) #bake all of the locators for loc in locs: cmds.select(loc, add = True) start = cmds.playbackOptions(q = True, min = True) end = cmds.playbackOptions(q = True, max = True) cmds.bakeResults(simulation = True, t = (start, end)) cmds.delete(constraints) cmds.select(clear = True) #delete keys on all space switch attrs for node in bakeNodes: spaceSwitchNode = node.rpartition("_follow")[0] attrs = [] try: attrs.extend(cmds.listAttr(spaceSwitchNode, string = "space_*")) except: pass try: attrs.extend(cmds.listAttr(control, string = "space_*")) except: pass for attr in attrs: #zero out all attrs on the space switcher if cmds.objExists(spaceSwitchNode + "." + attr): cmds.cutKey(spaceSwitchNode, at = attr) cmds.setAttr(spaceSwitchNode + "." + attr, 0) if cmds.objExists(control + "." + attr): cmds.cutKey(control, at = attr) cmds.setAttr(control + "." + attr, 0) #reverse the constraint so now the spaceSwitchNode will follow the loc for node in bakeNodes: spaceSwitchNode = node.rpartition("_follow")[0] control = node.rpartition("_space_switcher")[0] loc = spaceSwitchNode + "_loc" if control.find(self.character + ":ik_elbow") == 0: constraint = cmds.pointConstraint(loc, control)[0] else: constraint = cmds.parentConstraint(loc, control)[0] cmds.select(control, add = True) for attr in [".tx", ".ty", ".tz", ".rx", ".ry", ".rz"]: cmds.setAttr(spaceSwitchNode + attr, 0) cmds.bakeResults(simulation = True, t = (start, end)) cmds.delete(locs) #delete blendParent attr if exists if cmds.objExists(control + ".blendParent1"): try: cmds.deleteAttr(n = control, at = "blendParent1") except: pass
def ui_createUI(self): if m.window(UI_WIN_NAME, exists=True): if m.window(UI_WIN_NAME, q=True, visible=True): return else: m.deleteUI(UI_WIN_NAME, window=True) self.window = m.window( UI_WIN_NAME, title=UI_WIN_TITLE, maximizeButton=False, ) m.scriptJob(event=['deleteAll', self.scriptJobDeleteAll], parent=self.window, protected=True) self.delUIScriptJobID = m.scriptJob(uiDeleted=[self.window, self.ui_onDeleteMainWin], protected=True) self.ui_LAY_mainForm = m.formLayout() # - - - - - - - - - - - - - - - - - self.ui_LAY_searchRow = m.rowLayout( numberOfColumns=8, adjustableColumn=2 ) self.ui_BTN_miscOperations = m.symbolButton( image=ICON_POPUP_MENU, width=22, height=22 ) self.loadUserCommandsFromXML() self.ui_POP_miscOperations = m.popupMenu(button=1) for command in self.userMenu: m.menuItem( parent=self.ui_POP_miscOperations, label=command[0], command=ft.partial(self.evalMelCommand, command[1]) ) m.menuItem(divider=True) m.menuItem( parent=self.ui_POP_miscOperations, label='Open FX Outliner Configuration File', command=ft.partial(self.openFileInEditor, XML_OUTLINER_CFG_FILE) ) m.menuItem( parent=self.ui_POP_miscOperations, label='Open FX Outliner User Menu Configuration File', command=ft.partial(self.openFileInEditor, XML_USER_MENU_FILE) ) m.menuItem(divider=True) m.menuItem( parent=self.ui_POP_miscOperations, label='Help', command=ft.partial(self.openFileInEditor, README_FILE) ) m.setParent(self.ui_LAY_searchRow) self.ui_TFD_search = m.textField( enterCommand=self.ui_BTN_searchClick, alwaysInvokeEnterCommandOnReturn=True ) self.ui_BTN_search = m.symbolButton( image=ICON_SEARCH, width=22, height=22, annotation='Perform Search', command=self.ui_BTN_searchClick ) self.ui_BTN_searchCase = m.symbolCheckBox( image=ICON_CASE_SENSITIVE, width=22, height=22, annotation='Search: Case Sensitive', changeCommand=self.ui_BTN_searchCaseChange ) self.ui_BTN_searchRegEx = m.symbolCheckBox( image=ICON_REGEX, width=22, height=22, annotation='Search: Regular Expression', changeCommand=self.ui_BTN_searchRegExChange ) self.ui_BTN_searchType = m.symbolCheckBox( image=ICON_TYPE_SEARCH, width=22, height=22, annotation='Search: Search for Type', changeCommand=self.ui_BTN_searchTypeChange ) self.ui_BTN_searchSelect = m.symbolCheckBox( image=ICON_SELECT_FOUND, width=22, height=22, annotation='Search: Select Result', changeCommand=self.ui_BTN_searchSelectChange ) self.ui_BTN_searchShape = m.symbolCheckBox( image=ICON_SHAPE, width=22, height=22, annotation='Search: Include Shapes in Search', changeCommand=self.ui_BTN_searchShapeChange ) # - - - - - - - - - - - - - - - - - m.setParent(self.ui_LAY_mainForm) self.ui_SEP_searchSeparator = m.separator(style='in', height=6) # - - - - - - - - - - - - - - - - - self.ui_LAY_outlinerForm = m.formLayout() self.ui_BTN_modeDropDown = m.button( height=24 ) # - - - - - - - - - - - - - - - - - self.generateOutlinerViews() self.ui_POP_mode = m.popupMenu(button=1) for viewCfg in self.state.outlinerViews: m.menuItem( parent=self.ui_POP_mode, label=viewCfg.name, command=ft.partial(self.ui_POP_mode_onClick, viewCfg) ) lastPrebuildViewIndex = len(self.state.outlinerViews) self.loadOutlinerViewsFromXML() m.menuItem( parent=self.ui_POP_mode, divider=True, ) for i in range(lastPrebuildViewIndex, len(self.state.outlinerViews)): vc = self.state.outlinerViews[i] m.menuItem( parent=self.ui_POP_mode, label=vc.name, command=ft.partial(self.ui_POP_mode_onClick, vc) ) # - - - - - - - - - - - - - - - - - m.setParent(self.ui_LAY_outlinerForm) fxOutlinerPanels = [x for x in m.getPanel(type='outlinerPanel') if m.outlinerPanel(x, q=True, label=True) == OUTLINER_PANEL ] if fxOutlinerPanels: self.ui_PNL_outliner = fxOutlinerPanels[0] m.outlinerPanel(self.ui_PNL_outliner, e=True, unParent=True) m.outlinerPanel(self.ui_PNL_outliner, e=True, parent=self.ui_LAY_outlinerForm) else: self.ui_PNL_outliner = m.outlinerPanel( menuBarVisible=False, label=OUTLINER_PANEL ) self.ui_EDT_outliner = m.outlinerPanel( self.ui_PNL_outliner, query=True, outlinerEditor=True, ) # - - - - - - - - - - - - - - - - - m.setParent(self.ui_LAY_outlinerForm) self.ui_LAY_outlinerToolbar = m.columnLayout() self.ui_BTN_showShapes = m.symbolCheckBox( image=ICON_SHOW_SHAPES, height=35, width=35, changeCommand=self.ui_BTN_showShapesChange, annotation='Show Shapes' ) self.ui_BTN_showSetMembers = m.symbolCheckBox( image=ICON_SHOW_SET_MEMBERS, height=35, width=35, changeCommand=self.ui_BTN_showSetMembersChange, annotation='Show Set Members' ) self.ui_BTN_selectSetMembers = m.symbolCheckBox( image=ICON_SELECT_SET_MEMBERS, height=35, width=35, changeCommand=self.ui_BTN_selectSetMembersChange, annotation='Select Set Members \ Assigned Objects' ) # - - - - - - - - - - - - - - - - - m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_BTN_modeDropDown, 'top', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachControl=(self.ui_BTN_modeDropDown, 'right', 2, self.ui_LAY_outlinerToolbar)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachNone=(self.ui_BTN_modeDropDown, 'bottom')) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_BTN_modeDropDown, 'left', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachControl=(self.ui_PNL_outliner, 'top', 2, self.ui_BTN_modeDropDown)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachControl=(self.ui_PNL_outliner, 'right', 2, self.ui_LAY_outlinerToolbar)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_PNL_outliner, 'bottom', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_PNL_outliner, 'left', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_LAY_outlinerToolbar, 'top', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_LAY_outlinerToolbar, 'right', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_LAY_outlinerToolbar, 'bottom', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachNone=(self.ui_LAY_outlinerToolbar, 'left')) # - - - - - - - - - - - - - - - - - self.ui_LAY_attachFrame = m.frameLayout( marginHeight=2, marginWidth=2, borderVisible=False, labelVisible=False ) self.ui_QT_TBL_searchResult = self.searchResultDlg.getResultsTable() self.searchResultModel = SearchResultModel() self.ui_searchResultTableSetProps() self.ui_QT_TBL_searchResult.setModel(self.searchResultModel) # double ui_searchResultTableSetProps cause some props need to be set # double ui_searchResultTableSetProps cause some props need to be set self.ui_searchResultTableSetProps() self.ui_QT_TBL_searchResult.connect( self.ui_QT_TBL_searchResult.selectionModel(), QtCore.SIGNAL('selectionChanged(QItemSelection, QItemSelection)'), self.ui_QT_TBL_searchResult_selectionChanges ) # - - - - - - - - - - - - - - - - - m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_searchRow, 'top', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_searchRow, 'right', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachNone=(self.ui_LAY_searchRow, 'bottom')) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_searchRow, 'left', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachControl=(self.ui_SEP_searchSeparator, 'top', 2, self.ui_LAY_searchRow)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_SEP_searchSeparator, 'right', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachNone=(self.ui_SEP_searchSeparator, 'bottom')) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_SEP_searchSeparator, 'left', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachControl=(self.ui_LAY_outlinerForm, 'top', 2, self.ui_SEP_searchSeparator)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_outlinerForm, 'right', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_outlinerForm, 'bottom', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_outlinerForm, 'left', 2)) # - - - - - - - - - - - - - - - - - m.showWindow(self.window) # - - - - - - - - - - - - - - - - - self.prefSaver = prefsaver.PrefSaver(serializers.SerializerOptVar(OPT_VAR_NAME)) self.prefSaver.addControl(self.searchResultDlg, prefsaver.UIType.PYSIDEWindow, (200, 200, 500, 700)) self.prefSaver.addVariable('fx_outliner_state', self.prefsPack, self.prefsUnPack, None) self.prefsLoad() self.ui_update() m.setFocus(self.ui_LAY_outlinerForm)
def __init__(self, character, inst): #create class variables self.widgets = {} self.character = character self.animUIInst = inst #find out which project we are in references = cmds.ls(type = "reference") for ref in references: try: self.project = cmds.referenceQuery(ref, filename = True).rpartition("Projects/")[2].partition("/")[0] except: pass #get access to our maya tools toolsPath = cmds.internalVar(usd = True) + "mayaTools.txt" if os.path.exists(toolsPath): f = open(toolsPath, 'r') self.mayaToolsDir = f.readline() f.close() #check to see if window exists, if so, delete if cmds.window("spaceSwitcherUI", exists = True): cmds.deleteUI("spaceSwitcherUI") #build window self.widgets["window"] = cmds.window("spaceSwitcherUI", w = 450, h = 400, title = character + "_Space Switcher", sizeable = False) #create the main layout self.widgets["mainLayout"] = cmds.columnLayout(w = 430) self.widgets["scroll"] = cmds.scrollLayout(w = 440, h = 500, hst = -1, parent = self.widgets["mainLayout"]) self.widgets["topLevelLayout"] = cmds.columnLayout(w = 415, parent = self.widgets["scroll"]) #create the toolbar buttons self.widgets["leftColumnLayout"] = cmds.rowColumnLayout(parent = self.widgets["topLevelLayout"], nc = 6, cw = [(1, 170), (2, 60), (3, 35), (4, 40), (5, 35), (6, 50)], cat = [(1, "both", 5),(2, "both", 5),(3, "both", 5),(4, "both", 5),(5, "both", 1), (6, "left", 20 )]) self.widgets["createSpaceButton"] = cmds.symbolButton(ann = "Select space object, then control, and create a new space", w = 125, h = 50, parent = self.widgets["leftColumnLayout"], image = self.mayaToolsDir + "/General/Icons/ART/spaceSwitch_create.bmp", c = self.createSpaceSwitcherSpace) self.widgets["syncStatusButton"] = cmds.button("spaceSwitchSyncStatusButton", w = 50, h = 50, label = "!", ann = "Out of Sync!", bgc = [1, 0, 0], visible = False, c = self.relaunch) selectButton = cmds.symbolButton(ann = "Select space switch nodes for selected checkboxes", image = self.mayaToolsDir + "/General/Icons/ART/selectCurve.bmp", w = 30, h = 30, c = self.selectAllSpaceSwitchNodes) bake = cmds.symbolButton(ann = "Bake Selected checkboxes down to default space", image = self.mayaToolsDir + "/General/Icons/ART/bake.bmp", w = 30, h = 30, c = self.bakeSpace) transferButton = cmds.symbolButton(ann = "Push attributes from the space switch node down to the control on selected checkboxes", image = self.mayaToolsDir + "/General/Icons/ART/transfer.bmp", w = 30, h = 30, c = self.transferAttrs) selectAllButton = cmds.symbolCheckBox(ann = "Select All Checkboxes", w = 30, h = 30, oni = self.mayaToolsDir + "/General/Icons/ART/checkBox_on.bmp", ofi = self.mayaToolsDir + "/General/Icons/ART/checkBox.bmp", onc = partial(self.selectAll, True), ofc = partial(self.selectAll, False)) #get the animation UI settings for match and match method and set the space switch UI to match those self.matchVal = cmds.menuItem(self.animUIInst.widgets["spaceSwitch_MatchToggleCB"], q = True, cb = True) self.matchMethodVal = cmds.menuItem(self.animUIInst.widgets["spaceSwitch_MatchMethodCB"], q = True, cb = True) #create right click menu for bake button (bake all) menu = cmds.popupMenu(b = 3, parent = bake) cmds.menuItem(label = "Bake All", parent = menu, c = self.bakeAll) #create frames for controls #need to find all space switch nodes for the current character cmds.select(character + ":*_space_switcher_follow") nodes = cmds.ls(sl = True) spaceSwitchers = [] for node in nodes: if node.find("invis") == -1: spaceSwitchers.append(node) for control in spaceSwitchers: self.createSpaceInfoForControl(control) #show the window cmds.showWindow(self.widgets["window"]) cmds.select(clear = True) #create scriptJob self.createScriptJob()
def transferAttrs(self, *args): #get selected checkboxes cmds.select(self.character + ":*_space_switcher_follow") nodes = cmds.ls(sl = True) spaceSwitchers = [] for node in nodes: if node.find("invis") == -1: spaceSwitchers.append(node) selectNodes = [] for node in spaceSwitchers: control = node.partition("_space")[0] spaceSwitchNode = node.partition("_follow")[0] value = cmds.symbolCheckBox(control + "_checkboxWidget", q = True, value = True) if value: selectNodes.append(spaceSwitchNode) node = "" for node in selectNodes: control = node.partition("_space")[0] #need to add attr that is on spaceSwitchNode to control attrs = [] try: attrs.extend((cmds.listAttr(node, string = "space_*"))) except: pass #get the target list from the constraint constraint = cmds.listConnections(node, type = "parentConstraint") if constraint != None: targets = cmds.parentConstraint(constraint[0], q = True, weightAliasList = True) #we now have a list of attrs and targets that should match if attrs != None: for attr in reversed(attrs): cmds.addAttr(control, ln = attr, dv = 0, min = 0, max = 1, keyable = True) #setup the new constraint connection targetAttr = None for target in targets: try: cmds.disconnectAttr(node + "." + attr, constraint[0] + "." + target) targetAttr = target except: pass try: cmds.connectAttr(control + "." + attr, constraint[0] + "." + targetAttr) except: cmds.warning("Could not setup connections on " + control) #copy keys from original attr to new attr start = cmds.findKeyframe(node, at = attr, which = "first") end = cmds.findKeyframe(node, at = attr, which = "last") keys = cmds.copyKey(node, time=(start, end), attribute = attr, option = "curve") try: cmds.pasteKey(control, attribute = attr) except: pass #delete spaceSwitchNode attr cmds.deleteAttr(node, at = attr)
def _manipWidgit(self, curParent): ''' This gui widgit contains the buttons to add & remove attributes Overall adjusts for all the attribute contained inside. ''' frame = cmds.frameLayout(parent=curParent, labelVisible=False, marginWidth=5, marginHeight=3) frm = cmds.formLayout(parent=frame, w=415) path = os.path.split(__file__)[0] fullPath = lambda x: os.path.join(path, "icons", x) btn1 = cmds.symbolButton(image=fullPath('plus_16b.xpm'), h=20, command=Callback( self.addAttrGUI)) # self._attrGUI ) btn2 = cmds.symbolButton( image=fullPath('delete_16b.xpm'), h=20, command=Callback(self.removeAll)) #command=self._removeAttrs ) btn2a = cmds.symbolButton(image=fullPath('save_16.xpm'), h=20, command=Callback( self.addAttrGUI)) # self._attrGUI ) btn2b = cmds.symbolButton(image=fullPath('folder_16b.xpm'), h=20, command=Callback( self.addAttrGUI)) # self._attrGUI ) cmds.formLayout(frm, e=1, af=[[btn1, "left", 5], [btn1, "top", 0]]) cmds.formLayout(frm, e=1, ac=[btn2, "left", 5, btn1], af=[btn2, "top", 0]) cmds.formLayout(frm, e=1, ac=[btn2a, "left", 5, btn2], af=[btn2a, "top", 0]) cmds.formLayout(frm, e=1, ac=[btn2b, "left", 5, btn2a], af=[btn2b, "top", 0]) ''' btn1 = cmds.button( label="Add Attr", w=100, command=Callback(self.addAttrGUI)) # self._attrGUI ) btn2 = cmds.button( label="Remove Attrs", w=100, command=Callback(self.removeAll ))#command=self._removeAttrs ) ''' btn3 = cmds.symbolButton(image='MENUICONKEYS.XPM', h=20, ann="Keyframe", command=Callback(self.keyAll)) ''' btn3 = cmds.button( label="Keyframe", command=Callback(self.keyAll)) ''' btn4 = cmds.symbolButton(image='REDRAWPAINTEFFECTS.XPM', h=20, ann="Reset to Default", command=Callback(self.resetAll)) btn5 = cmds.symbolCheckBox(image='ONRADIOBTNICON.XPM', h=20, oni='ONRADIOBTNICON.XPM', ofi='OFFRADIOBTNICON.XPM', ann="Set Offset", onc=Callback(self.setOffset)) btn6 = cmds.symbolButton(image='AUTOLOAD.XPM', h=20, ann="Reset Offset", command=Callback(self.resetOffset)) ''' cmds.formLayout( frm, e=1, ac=[btn3, "left", 5, btn2], af=[btn3, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn4, "left", 5, btn3], af=[btn4, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn5, "left", 5, btn4], af=[btn5, "top", 0]) cmds.formLayout( frm, e=1, ac=[btn6, "left", 5, btn5], af=[btn6, "top", 0]) ''' cmds.formLayout(frm, e=1, af=[[btn6, "top", 0], [btn6, "right", 5]]) cmds.formLayout(frm, e=1, ac=[btn5, "right", 5, btn6], af=[btn5, "top", 0]) cmds.formLayout(frm, e=1, ac=[btn4, "right", 5, btn5], af=[btn4, "top", 0]) cmds.formLayout(frm, e=1, ac=[btn3, "right", 5, btn4], af=[btn3, "top", 0]) return frame
def gui(self): ''' Generates the interface for the AttrGUISingle object. ''' btnWidth = 30 btnSep = 2 # textWidth = 70 # fieldWidth # if( cmds.about( os=True ) == "mac" ): self.mainLayout = cmds.rowColumnLayout(parent=self.parent, nc=7, h=20, rat=[[1,"both", btnSep ],[2,"both", btnSep ],[3,"both", btnSep ],[4,"both", btnSep ],[5,"both", btnSep ],[6,"both", btnSep ],[7,"both", btnSep ]], cw=[[1,100],[2,70],[3,125],[4, btnWidth ],[5,btnWidth ],[6,btnWidth ],[7,btnWidth ]]) cmds.text(label=self.text, w=70, al="center") self.fieldGui = cmds.floatField( w=100, pre=2 ) pop = cmds.popupMenu(parent=self.fieldGui) cmds.menuItem(parent=pop, label="0 - 1", c=Callback( self.setMinMax, 0, 1)) cmds.menuItem(parent=pop, label="0 - 10", c=Callback( self.setMinMax, 0, 10)) cmds.menuItem(parent=pop, label="-10 - 10", c=Callback( self.setMinMax, -10, 10)) cmds.menuItem(parent=pop, label="Set Min/Max") cmds.menuItem( divider=1) cmds.menuItem(label="Step 1", c=Callback( self.setStep, 1 )) cmds.menuItem(label="Step .1", c=Callback( self.setStep, .1 )) cmds.menuItem(label="Step .01", c=Callback( self.setStep, .01 )) self.sliderGui = cmds.floatSlider( w=100, h=20) cmds.popupMenu(parent=self.sliderGui) cmds.menuItem(label="0 - 1", c=Callback( self.setMinMax, 0, 1)) cmds.menuItem(label="0 - 10", c=Callback( self.setMinMax, 0, 10)) cmds.menuItem(label="-10 - 10", c=Callback( self.setMinMax, -10, 10)) cmds.menuItem(label="Set Min/Max") cmds.menuItem( divider=1) cmds.menuItem(label="Step 1", c=Callback( self.setStep, 1 )) cmds.menuItem(label="Step .1", c=Callback( self.setStep, .1 )) cmds.menuItem(label="Step .01", c=Callback( self.setStep, .01 )) print("Min Value: " + str(self.attrs.min)) print("Max Value: " + str(self.attrs.max)) if( self.attrs.min != None ): cmds.floatField( self.fieldGui, e=1, min=self.attrs.min ) cmds.floatSlider( self.sliderGui, e=1, min=self.attrs.min ) if( self.attrs.max != None ): cmds.floatField( self.fieldGui, e=1, max=self.attrs.max ) cmds.floatSlider( self.sliderGui, e=1, max=self.attrs.max ) cmds.connectControl( self.fieldGui, self.attrNames ) cmds.connectControl( self.sliderGui, self.attrNames ) cmds.symbolButton(image='MENUICONKEYS.XPM', h=20, ann="Keyframe", command=Callback(self.key)) cmds.symbolButton(image='REDRAWPAINTEFFECTS.XPM', h=20, ann="Reset to Default", command=Callback(self.reset)) self.symGUI = cmds.symbolCheckBox( image='ONRADIOBTNICON.XPM', h=20, oni='ONRADIOBTNICON.XPM', ofi='OFFRADIOBTNICON.XPM', ann="Set Offset", onc=Callback(self.setOffset)) self.resOffName = cmds.symbolButton(image='AUTOLOAD.XPM', h=20, ann="Reset Offset", command=Callback( self.resetOffset ) ) cmds.setParent(self.parent)
def doIt( self, *args ): # Window settings. self.winWidth = 306 self.winHeight = 400 self.iconWidth = 32 self.iconHeight = 32 # Window colors self.rowColors = [[0.4,0.4,0.4],[0.5,0.5,0.5]] # Clean up old uis before opening a new one. try: cmds.deleteUI( self.winName ) except: pass # Setup the form layout. self.mainWindow = cmds.window( self.winName, title=self.winTitle, sizeable=False, resizeToFitChildren=False ) self.form = cmds.formLayout() self.tabs = cmds.tabLayout( innerMarginWidth=5, innerMarginHeight=5 ) # Attach the tabs layout to the form layout. cmds.formLayout( self.form, edit=True, attachForm=( (self.tabs, 'top', 0), (self.tabs, 'left', 0), (self.tabs, 'bottom', 0), (self.tabs, 'right', 0) ) ) # Create each of the tabs. # TAB LAYOUT TOOLS self.tabLayout = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='Frame Templates', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) # Frame template section. cmds.rowColumnLayout( numberOfColumns=2, columnWidth=[(1, 40), (2, self.winWidth-40)] ) # Left column. self.toggleColumn = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.symbolCheckBox( image='icon_root.png', value=0, annotation='roots', changeCommand=self.fillButtons ) cmds.symbolCheckBox( image='icon_spine.png', value=0, annotation='spines', changeCommand=self.fillButtons ) cmds.symbolCheckBox( image='icon_arm.png', annotation='arms', changeCommand=self.fillButtons ) cmds.symbolCheckBox( image='icon_leg.png', annotation='legs', changeCommand=self.fillButtons ) cmds.symbolCheckBox( image='icon_hand.png', annotation='hands', changeCommand=self.fillButtons ) cmds.symbolCheckBox( image='icon_foot.png', annotation='feet', changeCommand=self.fillButtons ) cmds.symbolCheckBox( image='icon_head.png', annotation='heads', changeCommand=self.fillButtons ) cmds.setParent( '..' )#toggleColumn # Right column. cmds.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16, height=100 ) self.frameGrid = cmds.gridLayout( numberOfColumns=4, cellWidthHeight=( 50, 50 ) ) self.fillButtons() cmds.setParent( '..' )#frameGrid cmds.setParent( '..' )#scrollLayout cmds.setParent( '..' )#rowColumnLayout # Other cmds.button( label='Save Selected Frame') cmds.button( label='Link Frames' ) cmds.button( label='Delete Frame' ) cmds.setParent( '..' )#tabLayout # TAB FRAME TOOLS self.tabFrame = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='Frame Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) # Top rows. self.moduleList = cmds.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16, height=100 ) self.fillModuleList() cmds.setParent( '..' )#moduleList # Bottom buttons cmds.button( label='Refresh List', command=self.fillModuleList ) cmds.button( label='Build All' ) cmds.setParent( '..' )#tabFrame # TAB RIGGING TOOLS self.tabRig = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.text( label='Rig Tools', width=self.winWidth, wordWrap=True, align='center', font='boldLabelFont', backgroundColor=(0.15,0.15,0.15) ) cmds.separator( style='none', height=4 ) cmds.button() cmds.button() cmds.button() cmds.setParent( '..' )#tabRig # Added the tabs to the tab layout. cmds.tabLayout( self.tabs, edit=True, tabLabel=( (self.tabLayout, 'Layout'), (self.tabFrame, 'Frame'), (self.tabRig, 'Rig') ) ) # Show the window. cmds.showWindow( self.winName )
def winCharSelect(curParent): imgPath = lambda x: os.path.join( os.path.split(__file__)[0], "icons", x + ".xpm") frm = cmds.formLayout() # (lambda x : controlSelect("controlIcon", "rotTrans")) # Row 1 global localBtn localBtn = cmds.symbolCheckBox(image=imgPath('advGirl_01_01_add'), w=85, h=70, onImage=imgPath('advGirl_01_01_add'), offImage=imgPath('advGirl_01_01_sub')) btn12 = cmds.symbolButton(image=imgPath('AdvGirl_01_02_ctrl'), w=16 , h=70, command=(lambda x : controlSelect("R_pigtail_end_anim", "trans")) ) btn13 = cmds.symbolButton(image=imgPath('AdvGirl_01_03_ctrl'), w=59 , h=70, command=(lambda x : controlSelect("head_anim", "rot")) ) btn14 = cmds.symbolButton(image=imgPath('AdvGirl_01_04_ctrl'), w=17 , h=70, command=(lambda x : controlSelect("L_pigtail_end_anim", "trans")) ) global selectBtn selectBtn = cmds.symbolCheckBox(image=imgPath('advGirl_01_05_local'), w=85, h=70, onImage=imgPath('advGirl_01_05_local'), offImage=imgPath('advGirl_01_05_world'), cc=manipState) # Position cmds.formLayout( frm, e=1, af=[[localBtn, "top", 0],[localBtn, "left", 0]] ) cmds.formLayout( frm, e=1, af=[btn12, "top", 0], ac=[btn12, "left", 0, localBtn] ) cmds.formLayout( frm, e=1, af=[btn13, "top", 0], ac=[btn13, "left", 0, btn12] ) cmds.formLayout( frm, e=1, af=[btn14, "top", 0], ac=[btn14, "left", 0, btn13] ) cmds.formLayout( frm, e=1, af=[selectBtn, "top", 0], ac=[selectBtn, "left", 0, btn14] ) # Row 2 btn21 = cmds.symbolButton(image=imgPath('AdvGirl_02_01_ctrl'), w=43 , h=15, command=(lambda x : controlSelect("R_hand_anim"))) btn22 = cmds.symbolButton(image=imgPath('AdvGirl_02_02_ctrl'), w=49 , h=15, command=(lambda x : controlSelect("R_elbow_pole_anim", "trans"))) btn23 = cmds.symbolButton(image=imgPath('AdvGirl_02_03_ctrl'), w=36 , h=15, command=(lambda x : controlSelect("R_shoulder_anim", "trans"))) btn24 = cmds.symbolButton(image=imgPath('AdvGirl_02_04_ctrl'), w=38 , h=15, command=(lambda x : controlSelect("L_shoulder_anim", "trans"))) btn25 = cmds.symbolButton(image=imgPath('AdvGirl_02_05_ctrl'), w=51 , h=15, command=(lambda x : controlSelect("L_elbow_pole_anim", "trans"))) btn26 = cmds.symbolButton(image=imgPath('AdvGirl_02_06_ctrl'), w=45 , h=15, command=(lambda x : controlSelect("L_hand_anim"))) # Position cmds.formLayout( frm, e=1, af=[btn21, "left", 0], ac=[btn21, "top", 0, btn12] ) cmds.formLayout( frm, e=1, ac=[[btn22, "left", 0, btn21],[btn22, "top", 0, btn12]] ) cmds.formLayout( frm, e=1, ac=[[btn23, "left", 0, btn22],[btn23, "top", 0, btn12]] ) cmds.formLayout( frm, e=1, ac=[[btn24, "left", 0, btn23],[btn24, "top", 0, btn12]] ) cmds.formLayout( frm, e=1, ac=[[btn25, "left", 0, btn24],[btn25, "top", 0, btn12]] ) cmds.formLayout( frm, e=1, ac=[[btn26, "left", 0, btn25],[btn26, "top", 0, btn12]] ) #cmds.formLayout( frm, e=1, ac=[[btn27, "left", 0, btn26],[btn27, "top", 0, btn12]] ) # Row 3 btn31 = cmds.symbolButton(image=imgPath('AdvGirl_03_01_ctrl'), w=42 , h=14, command=(lambda x : controlSelect("R_hand_FK_anim", "rot"))) btn32 = cmds.symbolButton(image=imgPath('AdvGirl_03_02_ctrl'), w=32 , h=14, command=(lambda x : controlSelect("R_elbow_FK_anim", "rot"))) btn33 = cmds.symbolButton(image=imgPath('AdvGirl_03_03_ctrl'), w=39 , h=14, command=(lambda x : controlSelect("R_shoulder_fk_anim", "rot"))) btn34 = cmds.symbolButton(image=imgPath('AdvGirl_03_04_ctrl'), w=30 , h=14, command=(lambda x : controlSelect("back_upper_rot_anim", "rot"))) btn35 = cmds.symbolButton(image=imgPath('AdvGirl_03_05_ctrl'), w=45 , h=14, command=(lambda x : controlSelect("L_shoulder_fk_anim", "rot"))) btn36 = cmds.symbolButton(image=imgPath('AdvGirl_03_06_ctrl'), w=28 , h=14, command=(lambda x : controlSelect("L_elbow_FK_anim", "rot"))) btn37 = cmds.symbolButton(image=imgPath('AdvGirl_03_07_ctrl'), w=46 , h=14, command=(lambda x : controlSelect("L_hand_FK_anim", "rot"))) # Position cmds.formLayout( frm, e=1, af=[btn31, "left", 0], ac=[btn31, "top", 0, btn21] ) cmds.formLayout( frm, e=1, ac=[[btn32, "left", 0, btn31],[btn32, "top", 0, btn21]] ) cmds.formLayout( frm, e=1, ac=[[btn33, "left", 0, btn32],[btn33, "top", 0, btn21]] ) cmds.formLayout( frm, e=1, ac=[[btn34, "left", 0, btn33],[btn34, "top", 0, btn21]] ) cmds.formLayout( frm, e=1, ac=[[btn35, "left", 0, btn34],[btn35, "top", 0, btn21]] ) cmds.formLayout( frm, e=1, ac=[[btn36, "left", 0, btn35],[btn36, "top", 0, btn21]] ) cmds.formLayout( frm, e=1, ac=[[btn37, "left", 0, btn36],[btn37, "top", 0, btn21]] ) # Row 4 btn41 = cmds.picture(image=imgPath('AdvGirl_04_01_img'), w=115 , h=14) btn42 = cmds.symbolButton(image=imgPath('AdvGirl_04_02_ctrl'), w=28 , h=14, command=(lambda x : controlSelect("back_mid_rot_anim", "rot"))) btn43 = cmds.picture(image=imgPath('AdvGirl_04_03_img'), w=119 , h=14) # Position cmds.formLayout( frm, e=1, af=[btn41, "left", 0], ac=[btn41, "top", 0, btn31] ) cmds.formLayout( frm, e=1, ac=[[btn42, "left", 0, btn41],[btn42, "top", 0, btn31]] ) cmds.formLayout( frm, e=1, ac=[[btn43, "left", 0, btn42],[btn43, "top", 0, btn31]] ) # Row 5 btn51 = cmds.picture(image=imgPath('AdvGirl_05_01_img'), w=54 , h=25) btn52 = cmds.symbolButton(image=imgPath('AdvGirl_05_02_ctrl'), w=45 , h=25, command=(lambda x : controlSelect("COG_anim", "rot"))) # bnt53 = cmds.picture(image=imgPath('AdvGirl_05_03_ctrl'), w=17 , h=25) btn53 = cmds.symbolButton(image=imgPath('AdvGirl_05_03_ctrl'), w=61 , h=25, command=(lambda x : controlSelect("back_lower_rot_anim"))) btn54 = cmds.symbolButton(image=imgPath('AdvGirl_05_04_ctrl'), w=56 , h=25, command=(lambda x : controlSelect("hips_anim"))) btn55 = cmds.picture(image=imgPath('AdvGirl_05_05_img'), w=46 , h=25) # COG # select -r COG_anim ; # Position cmds.formLayout( frm, e=1, af=[btn51, "left", 0], ac=[btn51, "top", 0, btn41] ) cmds.formLayout( frm, e=1, ac=[[btn52, "left", 0, btn51],[btn52, "top", 0, btn41]] ) cmds.formLayout( frm, e=1, ac=[[btn53, "left", 0, btn52],[btn53, "top", 0, btn41]] ) cmds.formLayout( frm, e=1, ac=[[btn54, "left", 0, btn53],[btn54, "top", 0, btn41]] ) cmds.formLayout( frm, e=1, ac=[[btn55, "left", 0, btn54],[btn55, "top", 0, btn41]] ) # Row 6 btn61 = cmds.picture( image=imgPath('AdvGirl_06_01_img'), w=262 , h=48 ) cmds.formLayout( frm, e=1, af=[btn61, "left", 0], ac=[btn61, "top", 0, btn51] ) # Row 7 btn71 = cmds.picture(image=imgPath('AdvGirl_07_01_img'), w=103 , h=22) btn72 = cmds.symbolButton(image=imgPath('AdvGirl_07_02_ctrl'), w=25 , h=22, command=(lambda x : controlSelect("R_knee_pole_anim", "trans"))) btn73 = cmds.symbolButton(image=imgPath('AdvGirl_07_03_ctrl'), w=25 , h=22, command=(lambda x : controlSelect("L_knee_pole_anim", "trans"))) btn74 = cmds.picture(image=imgPath('AdvGirl_07_04_img'), w=109 , h=22) # Position cmds.formLayout( frm, e=1, af=[btn71, "left", 0], ac=[btn71, "top", 0, btn61] ) cmds.formLayout( frm, e=1, ac=[[btn72, "left", 0, btn71],[btn72, "top", 0, btn61]] ) cmds.formLayout( frm, e=1, ac=[[btn73, "left", 0, btn72],[btn73, "top", 0, btn61]] ) cmds.formLayout( frm, e=1, ac=[[btn74, "left", 0, btn73],[btn74, "top", 0, btn61]] ) # Row 8 btn81 = cmds.picture( image=imgPath('AdvGirl_08_01_img'), w=262 , h=36 ) cmds.formLayout( frm, e=1, af=[btn81, "left", 0], ac=[btn81, "top", 0, btn71] ) # Row 9 btn91 = cmds.picture(image=imgPath('AdvGirl_09_01_img'), w=93 , h=33) btn92 = cmds.symbolButton(image=imgPath('AdvGirl_09_02_ctrl'), w=35 , h=33, command=(lambda x : controlSelect("R_foot_anim", "trans"))) btn93 = cmds.symbolButton(image=imgPath('AdvGirl_09_03_ctrl'), w=38 , h=33, command=(lambda x : controlSelect("L_foot_anim", "trans"))) btn94 = cmds.picture(image=imgPath('AdvGirl_09_04_img'), w=96 , h=33) # Position cmds.formLayout( frm, e=1, af=[btn91, "left", 0], ac=[btn91, "top", 0, btn81] ) cmds.formLayout( frm, e=1, ac=[[btn92, "left", 0, btn91],[btn92, "top", 0, btn81]] ) cmds.formLayout( frm, e=1, ac=[[btn93, "left", 0, btn92],[btn93, "top", 0, btn81]] ) cmds.formLayout( frm, e=1, ac=[[btn94, "left", 0, btn93],[btn94, "top", 0, btn81]] ) cmds.setParent(curParent) return frm
def getSelectedBrushShape(self): for button,shape in zip(self.controls.brushShapeButtons,["gaussian","poly","solid","square"]): if cmds.symbolCheckBox(button,q=True,value=True): return shape return "solid"
def createSpaceInfoForControl(self, control, *args): character = control.partition(":")[0] niceName = control.partition(":")[2].partition("_space")[0] parentSpace = cmds.listRelatives(control, parent = True)[0] parentSpace = parentSpace.partition(":")[2] #create the 2 columns self.widgets[control + "_spaceSwitch2Rows"] = cmds.columnLayout( parent = self.widgets["topLevelLayout"]) #create the spaces layout self.widgets[control + "_spaceSwitchSpacesLayout"] = cmds.rowColumnLayout(nc = 3,cw = [(1, 125), (2, 215), (3, 70), ], parent = self.widgets[control + "_spaceSwitch2Rows"], cat = [(1, "both", 5), (2, "both", 5), (3, "both", 10)]) #create the UI controls for each .space_ attr found on the space switch node animControl = control.partition("_space_")[0] spaceSwitchNode = control.rpartition("_follow")[0] #get space switch attrs from both control and space switch node attrs = [] try: attrs.extend(cmds.listAttr(spaceSwitchNode, string = "space_*")) except: pass try: attrs.extend(cmds.listAttr(animControl, string = "space_*")) except: pass #column 1 is the text cmds.text(label = niceName, parent = self.widgets[control + "_spaceSwitchSpacesLayout"]) #column 2 is the option menu self.widgets[control.partition(":")[2] + "_spacesOM"] = cmds.optionMenu(h = 30, w = 210, parent = self.widgets[control + "_spaceSwitchSpacesLayout"], cc = partial(self.switchSpace, control, False)) #column 3 is the select button selectButton = cmds.symbolCheckBox(animControl + "_checkboxWidget", w = 30, h = 30, oni = self.mayaToolsDir + "/General/Icons/ART/checkBox_on.bmp", ofi = self.mayaToolsDir + "/General/Icons/ART/checkBox.bmp", parent = self.widgets[control + "_spaceSwitchSpacesLayout"]) #create the menuItem for the default space cmds.menuItem(label = "default [" + parentSpace + "]", parent = self.widgets[control.partition(":")[2] + "_spacesOM"]) #create the menuItems for each attr in attrs found = False for attr in attrs: label = attr.partition("space_")[2] if cmds.objExists(spaceSwitchNode + "." + attr): value = cmds.getAttr(spaceSwitchNode + "." + attr) if cmds.objExists(animControl + "." + attr): value = cmds.getAttr(animControl + "." + attr) if value == True: found = True cmds.menuItem(ann = spaceSwitchNode, label = label, parent = self.widgets[control.partition(":")[2] + "_spacesOM"]) if found: cmds.optionMenu(self.widgets[control.partition(":")[2] + "_spacesOM"], edit = True, v = label) if found == False: cmds.optionMenu(self.widgets[control.partition(":")[2] + "_spacesOM"], edit = True, v = "default [" + parentSpace + "]")
def ui_createUI(self): if m.window(UI_WIN_NAME, exists=True): if m.window(UI_WIN_NAME, q=True, visible=True): return else: m.deleteUI(UI_WIN_NAME, window=True) self.window = m.window( UI_WIN_NAME, title=UI_WIN_TITLE, maximizeButton=False, ) m.scriptJob(event=['deleteAll', self.scriptJobDeleteAll], parent=self.window, protected=True) self.delUIScriptJobID = m.scriptJob( uiDeleted=[self.window, self.ui_onDeleteMainWin], protected=True) self.ui_LAY_mainForm = m.formLayout() # - - - - - - - - - - - - - - - - - self.ui_LAY_searchRow = m.rowLayout(numberOfColumns=8, adjustableColumn=2) self.ui_BTN_miscOperations = m.symbolButton(image=ICON_POPUP_MENU, width=22, height=22) self.loadUserCommandsFromXML() self.ui_POP_miscOperations = m.popupMenu(button=1) for command in self.userMenu: m.menuItem(parent=self.ui_POP_miscOperations, label=command[0], command=ft.partial(self.evalMelCommand, command[1])) m.menuItem(divider=True) m.menuItem(parent=self.ui_POP_miscOperations, label='Open FX Outliner Configuration File', command=ft.partial(self.openFileInEditor, XML_OUTLINER_CFG_FILE)) m.menuItem(parent=self.ui_POP_miscOperations, label='Open FX Outliner User Menu Configuration File', command=ft.partial(self.openFileInEditor, XML_USER_MENU_FILE)) m.menuItem(divider=True) m.menuItem(parent=self.ui_POP_miscOperations, label='Help', command=ft.partial(self.openFileInEditor, README_FILE)) m.setParent(self.ui_LAY_searchRow) self.ui_TFD_search = m.textField(enterCommand=self.ui_BTN_searchClick, alwaysInvokeEnterCommandOnReturn=True) self.ui_BTN_search = m.symbolButton(image=ICON_SEARCH, width=22, height=22, annotation='Perform Search', command=self.ui_BTN_searchClick) self.ui_BTN_searchCase = m.symbolCheckBox( image=ICON_CASE_SENSITIVE, width=22, height=22, annotation='Search: Case Sensitive', changeCommand=self.ui_BTN_searchCaseChange) self.ui_BTN_searchRegEx = m.symbolCheckBox( image=ICON_REGEX, width=22, height=22, annotation='Search: Regular Expression', changeCommand=self.ui_BTN_searchRegExChange) self.ui_BTN_searchType = m.symbolCheckBox( image=ICON_TYPE_SEARCH, width=22, height=22, annotation='Search: Search for Type', changeCommand=self.ui_BTN_searchTypeChange) self.ui_BTN_searchSelect = m.symbolCheckBox( image=ICON_SELECT_FOUND, width=22, height=22, annotation='Search: Select Result', changeCommand=self.ui_BTN_searchSelectChange) self.ui_BTN_searchShape = m.symbolCheckBox( image=ICON_SHAPE, width=22, height=22, annotation='Search: Include Shapes in Search', changeCommand=self.ui_BTN_searchShapeChange) # - - - - - - - - - - - - - - - - - m.setParent(self.ui_LAY_mainForm) self.ui_SEP_searchSeparator = m.separator(style='in', height=6) # - - - - - - - - - - - - - - - - - self.ui_LAY_outlinerForm = m.formLayout() self.ui_BTN_modeDropDown = m.button(height=24) # - - - - - - - - - - - - - - - - - self.generateOutlinerViews() self.ui_POP_mode = m.popupMenu(button=1) for viewCfg in self.state.outlinerViews: m.menuItem(parent=self.ui_POP_mode, label=viewCfg.name, command=ft.partial(self.ui_POP_mode_onClick, viewCfg)) lastPrebuildViewIndex = len(self.state.outlinerViews) self.loadOutlinerViewsFromXML() m.menuItem( parent=self.ui_POP_mode, divider=True, ) for i in range(lastPrebuildViewIndex, len(self.state.outlinerViews)): vc = self.state.outlinerViews[i] m.menuItem(parent=self.ui_POP_mode, label=vc.name, command=ft.partial(self.ui_POP_mode_onClick, vc)) # - - - - - - - - - - - - - - - - - m.setParent(self.ui_LAY_outlinerForm) fxOutlinerPanels = [ x for x in m.getPanel(type='outlinerPanel') if m.outlinerPanel(x, q=True, label=True) == OUTLINER_PANEL ] if fxOutlinerPanels: self.ui_PNL_outliner = fxOutlinerPanels[0] m.outlinerPanel(self.ui_PNL_outliner, e=True, unParent=True) m.outlinerPanel(self.ui_PNL_outliner, e=True, parent=self.ui_LAY_outlinerForm) else: self.ui_PNL_outliner = m.outlinerPanel(menuBarVisible=False, label=OUTLINER_PANEL) self.ui_EDT_outliner = m.outlinerPanel( self.ui_PNL_outliner, query=True, outlinerEditor=True, ) # - - - - - - - - - - - - - - - - - m.setParent(self.ui_LAY_outlinerForm) self.ui_LAY_outlinerToolbar = m.columnLayout() self.ui_BTN_showShapes = m.symbolCheckBox( image=ICON_SHOW_SHAPES, height=35, width=35, changeCommand=self.ui_BTN_showShapesChange, annotation='Show Shapes') self.ui_BTN_showSetMembers = m.symbolCheckBox( image=ICON_SHOW_SET_MEMBERS, height=35, width=35, changeCommand=self.ui_BTN_showSetMembersChange, annotation='Show Set Members') self.ui_BTN_selectSetMembers = m.symbolCheckBox( image=ICON_SELECT_SET_MEMBERS, height=35, width=35, changeCommand=self.ui_BTN_selectSetMembersChange, annotation='Select Set Members \ Assigned Objects') # - - - - - - - - - - - - - - - - - m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_BTN_modeDropDown, 'top', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachControl=(self.ui_BTN_modeDropDown, 'right', 2, self.ui_LAY_outlinerToolbar)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachNone=(self.ui_BTN_modeDropDown, 'bottom')) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_BTN_modeDropDown, 'left', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachControl=(self.ui_PNL_outliner, 'top', 2, self.ui_BTN_modeDropDown)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachControl=(self.ui_PNL_outliner, 'right', 2, self.ui_LAY_outlinerToolbar)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_PNL_outliner, 'bottom', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_PNL_outliner, 'left', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_LAY_outlinerToolbar, 'top', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_LAY_outlinerToolbar, 'right', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachForm=(self.ui_LAY_outlinerToolbar, 'bottom', 2)) m.formLayout(self.ui_LAY_outlinerForm, e=True, attachNone=(self.ui_LAY_outlinerToolbar, 'left')) # - - - - - - - - - - - - - - - - - self.ui_LAY_attachFrame = m.frameLayout(marginHeight=2, marginWidth=2, borderVisible=False, labelVisible=False) self.ui_QT_TBL_searchResult = self.searchResultDlg.getResultsTable() self.searchResultModel = SearchResultModel() self.ui_searchResultTableSetProps() self.ui_QT_TBL_searchResult.setModel(self.searchResultModel) # double ui_searchResultTableSetProps cause some props need to be set # double ui_searchResultTableSetProps cause some props need to be set self.ui_searchResultTableSetProps() self.ui_QT_TBL_searchResult.connect( self.ui_QT_TBL_searchResult.selectionModel(), QtCore.SIGNAL('selectionChanged(QItemSelection, QItemSelection)'), self.ui_QT_TBL_searchResult_selectionChanges) # - - - - - - - - - - - - - - - - - m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_searchRow, 'top', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_searchRow, 'right', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachNone=(self.ui_LAY_searchRow, 'bottom')) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_searchRow, 'left', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachControl=(self.ui_SEP_searchSeparator, 'top', 2, self.ui_LAY_searchRow)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_SEP_searchSeparator, 'right', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachNone=(self.ui_SEP_searchSeparator, 'bottom')) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_SEP_searchSeparator, 'left', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachControl=(self.ui_LAY_outlinerForm, 'top', 2, self.ui_SEP_searchSeparator)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_outlinerForm, 'right', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_outlinerForm, 'bottom', 2)) m.formLayout(self.ui_LAY_mainForm, e=True, attachForm=(self.ui_LAY_outlinerForm, 'left', 2)) # - - - - - - - - - - - - - - - - - m.showWindow(self.window) # - - - - - - - - - - - - - - - - - self.prefSaver = prefsaver.PrefSaver( serializers.SerializerOptVar(OPT_VAR_NAME)) self.prefSaver.addControl(self.searchResultDlg, prefsaver.UIType.PYSIDEWindow, (200, 200, 500, 700)) self.prefSaver.addVariable('fx_outliner_state', self.prefsPack, self.prefsUnPack, None) self.prefsLoad() self.ui_update() m.setFocus(self.ui_LAY_outlinerForm)
def __init__(self): self.previousBlueprintListEntry= None self.previousBlueprintModule = None self.previousAnimationModule= None baseIconsDir = os.environ['RIGGING_TOOL_ROOT'] + '/Icons/' self.selectedCharacter = self.findSelectedCharacter() if self.selectedCharacter == None: return self.characterName = self.selectedCharacter.partition('__')[2] self.windowName = self.characterName + '_window' self.UIElements = {} if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) self.windowWidth = 420 self.windowHeight = 730 self.UIElements['window'] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight,title='Animation UI: ' + self.characterName,sizeable=False) self.UIElements['topColumnLayout'] = cmds.columnLayout(adj=True,rs=3) buttonWidth = 32 columnOffset = 5 # Added scrollHeight constant scrollHeight = 158 buttonColumnWidth = buttonWidth + (2*columnOffset) textScrollWidth = (self.windowWidth - buttonColumnWidth - 8) /2 self.UIElements['listBoxRowLayout'] = cmds.rowLayout(nc=3, columnWidth3=[textScrollWidth,textScrollWidth,buttonColumnWidth], columnAttach=([1,'both',columnOffset],[2,'both',columnOffset],[3,'both',columnOffset])) self.UIElements['blueprintModule_textScroll'] = cmds.textScrollList(numberOfRows=12,height=scrollHeight, allowMultiSelection=False, selectCommand=self.refreshAnimationModuleList) self.initializeBlueprintModuleList() self.UIElements['animationModule_textScroll'] = cmds.textScrollList(numberOfRows=12,height=scrollHeight, allowMultiSelection=False, selectCommand=self.setupModuleSpecificControls) self.UIElements['buttonColumnLayout'] = cmds.columnLayout(height=scrollHeight) self.UIElements['pinButton'] = cmds.symbolCheckBox(onImage=baseIconsDir + '_pinned.xpm',offImage=baseIconsDir + '_unpinned.xpm', width=buttonWidth, height=buttonWidth, onCommand=self.deleteScriptJob, offCommand=self.setupScriptJob) if cmds.objExists(self.selectedCharacter + ':non_blueprint_grp'): value = cmds.getAttr(self.selectedCharacter + ':non_blueprint_grp.display') self.UIElements['nonBlueprintVisibility'] = cmds.symbolCheckBox(image=baseIconsDir + '_shelf_character.xpm',value=value, width=buttonWidth, height=buttonWidth, onCommand=self.toggleNonBlueprintVisibility,offCommand=self.toggleNonBlueprintVisibility) value = cmds.getAttr(self.selectedCharacter + ':character_grp.animationControlVisibility') self.UIElements['animControlVisibility'] = cmds.symbolCheckBox(image=baseIconsDir+'_visibility.xpm',value=value,width=buttonWidth,height=buttonWidth,onCommand=self.toggleAnimControlVisibility,offCommand=self.toggleAnimControlVisibility) self.UIElements['deleteModuleButton'] = cmds.symbolButton(image=baseIconsDir + '_shelf_delete.xpm', width=buttonWidth, height=buttonWidth, enable=False, c=self.deleteSelectedModule) self.UIElements['duplicateModuleButton'] = cmds.symbolButton(image=baseIconsDir + '_duplicate.xpm', width=buttonWidth, height=buttonWidth, enable=False, c=self.duplicateSelectedModule) cmds.setParent(self.UIElements['topColumnLayout']) cmds.separator() self.UIElements['activeModuleColumn'] = cmds.columnLayout(adj=True) self.setupActiveModuleControls() cmds.setParent(self.UIElements['topColumnLayout']) cmds.separator() self.UIElements['matchingButton'] = cmds.button(label='Match Controls to result', enable=False) cmds.separator() self.UIElements['spaceSwitchingColumn'] = cmds.columnLayout(adj=True) self.setupSpaceSwitchingControls() cmds.setParent(self.UIElements['topColumnLayout']) cmds.separator() cmds.rowColumnLayout(nr=1, rowAttach=[1,'both',0], rowHeight=[1,self.windowHeight-406]) rowColumnWidth = cmds.columnLayout(self.UIElements["topColumnLayout"], q=True, width=True) + 10 self.UIElements['moduleSpecificControlsScroll'] = cmds.scrollLayout(hst=0,width=rowColumnWidth) #scrollWidth = cmds.scrollLayout(self.UIElements['moduleSpecificControlsScroll'], q=True, scrollAreaWidth=True) scrollWidth = cmds.scrollLayout(self.UIElements["moduleSpecificControlsScroll"], q=True, width=True) - 26 self.UIElements['moduleSpecificControlsColumn'] = cmds.columnLayout(columnWidth=scrollWidth, columnAttach=['both',5]) self.refreshAnimationModuleList() self.setupScriptJob() cmds.showWindow(self.UIElements['window']) self.selectionChanged()