def _buildSettings(s, *args): """ Load the settings page """ s.page = "settings" s._clear() cmds.columnLayout(adj=True, p=s.wrapper) cmds.iconTextButton( h=30, ann="Click to return to your Todo list.", image="revealSelected.png", label="<- Todo", style="iconAndTextHorizontal", c=s._buildTodo) cmds.separator() cmds.text(label="Settings are unique to each Maya scene.", h=50) frame = cmds.frameLayout(l="Archive options:") # Settings module s.fireHook("settings.archive", settings=s._buildSettings, callback=lambda x: cmds.setParent(frame)) cmds.setParent("..") cmds.frameLayout(l="Feedback:") cmds.iconTextButton( image="party.png", ann="Have any feedback? Good or bad. Love to hear it! :)", l="Leave Feedback...", style="iconAndTextHorizontal", c=lambda: universalOpen("mailto:[email protected]?subject=Todo Feedback")) # TODO errors when no folder is chosen because of 0 index
def installCopyRightInfo(self): """""" cmds.frameLayout(lv=False, bs='etchedIn', mh=6, mw=6, w=1) cmds.text(l="Soft Cluster EX", fn='boldLabelFont', align='center') cmds.rowColumnLayout( numberOfColumns=2, rowSpacing=[1, 8], columnAttach=[1, "right", 5], columnAlign=[1, "right"]) cmds.text(l="Version: ", fn='boldLabelFont') cmds.text(l=setup.getVersion(), align='left') cmds.text(l="Author: ", fn='boldLabelFont') cmds.text(l="Webber Huang", align='left') cmds.text(l="Contact: ", fn='boldLabelFont') cmds.text(l="*****@*****.**", align='left') cmds.text(l="Project Site: ", fn='boldLabelFont') cmds.iconTextButton( style='textOnly', l='http://riggingtd.com/downloads/soft-cluster-ex', ann="Click to open in brower.", c = lambda *args: setup.openBlog() ) cmds.setParent( ".." ) cmds.setParent( ".." )
def stretchButtonsWidth(self, buttonSets): if not cmds.window(self.mainWin, query=True, exists=True): return mayaWinSize = cmds.window(self.mainWin, query=True, width=True) buttonsLayoutSize = cmds.rowLayout(self.mainLayout, query=True, width=True) if buttonsLayoutSize < mayaWinSize: return diference = buttonsLayoutSize - mayaWinSize sizeChart = [cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, query=True, w=True) for loopSet in buttonSets] x = 0 while True: for n, loopSet in enumerate(buttonSets): x += 1 if x > diference: break if max(sizeChart) == 1: x = diference +1 break sizeChart[sizeChart.index(max(sizeChart))] = max(sizeChart) -1 if x > diference: break for n, loopSet in enumerate(buttonSets): cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, w=sizeChart[n])
def copyWorld(self, *args): #print "copyworld" self.selection = cmds.ls(selection=True) if len(self.selection) < 1: return if len(self.selection) > 20: message = "Too many objects selected, continue?" confirm = cmds.confirmDialog( title='Confirm', message=message, button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' ) if confirm != 'Yes': return cmds.refresh(suspend=True) cmds.undoInfo(stateWithoutFlush=False) self.flushCopyCache(force=True) self.scriptJob() self.sourceObjs = self.selection self.targetObj = "world" for loopObj in self.sourceObjs: matrix = cmds.xform(loopObj, query=True, ws=True, matrix=True) self.copyCache.append(matrix) cmds.iconTextButton("fakeConstrainBtn", edit=True, image= uiMod.getImagePath("specialTools_fake_constrain_active"), highlightImage= uiMod.getImagePath("specialTools_fake_constrain_active copy")) cmds.refresh(suspend=False) cmds.undoInfo(stateWithoutFlush=True)
def add_script_editor_toolbar(): # this is the last contorl on script editor tool bar goto_btn = mc.iconTextButton( 'scriptEditorToolbarGotoLineButton', q=1, fullPathName=1) flow_layout = re.search('.*(?=\|)', goto_btn).group() for x in reversed(mc.layout(flow_layout, q=1, ca=1)): if x == 'scriptEditorToolbarGotoLineButton': break else: mc.deleteUI(x) mc.setParent(flow_layout) iconSize = 23 mc.separator(height=iconSize, horizontal=0, style='single') mc.iconTextButton( width=iconSize, height=iconSize, annotation='save tabs', image="save.png", c=lambda *x: save_tabs() ) mc.iconTextButton( width=iconSize, height=iconSize, annotation='load tabs', image="refresh.png", c=lambda *x: load_tabs() )
def checkUpdates(self, gui, layout, *args): if self.tryUpdate(): if not G.GT_wasUpdated: hasUpdate = self.hasUpdate() if hasUpdate != False: cmds.iconTextButton(label="Updating...", style='textOnly', h=gui.hb, parent=layout) cmds.progressBar("aToolsProgressBar", maxValue=100, width=50, parent=layout) if hasUpdate == "offline_update": offlinePath = aToolsMod.loadInfoWithUser("userPrefs", "offlinePath") offlineFolder = offlinePath[0] offlineFilePath = "%s%saTools.zip"%(offlineFolder, os.sep) downloadUrl = "file:///%s%saTools.zip"%(offlineFolder, os.sep) fileModTime = os.path.getmtime(offlineFilePath) offline = [offlineFilePath, fileModTime] else: downloadUrl = DOWNLOAD_URL offline = None function = lambda *args:self.updateaTools(downloadUrl, offline) G.deferredManager.sendToQueue(function, 1, "checkUpdates") return self.warnUpdate()
def sortSelSetButtons(self, fromSelSet=None, renameSet=None): if not fromSelSet: index = 0 else: index = self.aToolsSets.index(fromSelSet) cmds.columnLayout(self.renameSetLayout, edit=True, parent=self.limboLayout) for loopSet in self.aToolsSets[index:]: extracted = self.extractInfoFromSelSet(loopSet) colorName = extracted["colorName"] if colorName not in G.SS_showColors: cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, parent=self.limboLayout, visible=False) continue if loopSet == renameSet: cmds.columnLayout(self.renameSetLayout, edit=True, parent=self.selSetsLayout) cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, visible=False, w=1) continue cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, parent=self.limboLayout) cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, parent=self.selSetsLayout, visible=True) if self.selSetButtonWidth.has_key(loopSet): cmds.iconTextButton('aToolsSetBtn_%s'%loopSet, edit=True, w=self.selSetButtonWidth[loopSet])
def createTextField(self, createRename, enterCommand, offCommand): mainLayout = cmds.columnLayout(w=1, columnWidth=self.createRenameLayoutW, parent=self.selSetsLayout, visible=False ) fistRowLayout = cmds.rowLayout(numberOfColumns=3, parent=mainLayout) textField = cmds.textField(height=20, width=self.createRenameLayoutW-21, alwaysInvokeEnterCommandOnReturn=True, parent=fistRowLayout, enterCommand=enterCommand ) # X button text field cmds.iconTextButton(style='iconOnly', h=18, w=18, image=uiMod.getImagePath("specialTools_x"), highlightImage=uiMod.getImagePath("specialTools_x copy"), command=offCommand, annotation="Cancel", parent=fistRowLayout ) cmds.rowLayout(numberOfColumns=len(self.colors)+1, parent=mainLayout) for loopColor in self.colors: colorName = loopColor["name"] colorValue = loopColor["value"] cmds.iconTextButton("colorButton%s%s"%(createRename, colorName), style='iconOnly', bgc=colorValue, height=15, width=15, command=lambda colorName=colorName, *args: enterCommand(colorName=colorName) ) return {"mainLayout":mainLayout, "textField":textField}
def createLayout(self): mainLayout = cmds.rowLayout(numberOfColumns=6, parent=self.parentLayout) #manipulator orientation #cmds.iconTextButton("manipOrientButton", style='textOnly', label='-', h=self.hb, annotation="Selected objects", command=updateManipOrient) #launchManipOrient() self.autoSmartSnapKeys = AutoSmartSnapKeys() self.selectionCounter = SelectionCounter() #selection cmds.iconTextButton("selectionCounterButton", style='textOnly', font="smallPlainLabelFont", label='0', h=self.hb, annotation="Selected objects") cmds.popupMenu("selectionCounterButtonMenu", button=1, postMenuCommand=self.selectionCounter.populateMenu) #animation crash recovery cmds.image("animationCrashRecoveryLed", w=14, h=14, annotation="Test") #menu cmds.iconTextButton(style='iconOnly', w=self.wb, h=self.hb, image= uiMod.getImagePath("aTools"), highlightImage= uiMod.getImagePath("aTools copy"), annotation="aTools Menu") self.popUpaToolsMenu() self.update = Update() self.update.about = self.about self.update.checkUpdates(self, mainLayout) # set default config and startup scripts self.setDefaultConfig()
def fillAttrList( self ): # Clean up UI elements for refreshing the list. lChildren = cmds.scrollLayout( self.attrList, query=True, childArray=True ) if lChildren is not None: for c in lChildren: cmds.deleteUI( c ) # Build list for UI. previousColor = 2 attList = getAttrXML() for attr in attList: attr = [{ 'attrName':attr['name'], 'attrType':attr['attrType'], 'attrDataType':attr['attrDataType'] }] # Set the row color. color = 1 if previousColor is 1: color = 2 previousColor = 2 else: color = 1 previousColor = 1 # Make the row. self.attrListColumn = cmds.rowColumnLayout( parent=self.attrList, numberOfColumns=3, columnWidth=[(1,104),(2,50),(3,20)], columnSpacing=[(1,2),(2,2),(3,2)], backgroundColor=self.rowColors[color-1] ) cmds.text( label=attr[0]['attrName'] ) cmds.iconTextButton( annotation='Add', style='iconOnly', width=16, image1='icon_plus16.png', command=lambda a1=attr: addAttr( a1 ) ) self.checkBox = cmds.checkBox( label='' ) cmds.setParent( '..' )#self.attrListColumn
def setup(): try: iconWH = 26 # modify the status line gStatusLine = mel.eval("global string $gStatusLine;\n $temp=$gStatusLine") if gStatusLine != "": tempwin = cmds.window() temp = cmds.formLayout(p=tempwin) savePlusSceneButton = cmds.iconTextButton( "savePlusSceneButton2", image1="save_32.png", w=iconWH, h=iconWH, c=save ) reloadMyShelfButton = cmds.iconTextButton( "reloadAWShelfButton", image1="reload_32.png", w=iconWH, h=iconWH, c=reloadAWShelf ) reloadShelfButton = cmds.iconTextButton( "reloadRiggingShelfButton", image1="riggingShelf_32.png", w=iconWH, h=iconWH, c=reloadRiggingShelf ) reloadAnimShelfButton = cmds.iconTextButton( "reloadAnimShelfButton", image1="animShelf_32.png", w=iconWH, h=iconWH, c=reloadAnimShelf ) addChildFlowLayout(gStatusLine, savePlusSceneButton, 5) addChildFlowLayout(gStatusLine, reloadMyShelfButton, 6) addChildFlowLayout(gStatusLine, reloadShelfButton, 7) addChildFlowLayout(gStatusLine, reloadAnimShelfButton, 8) except: print "andresMayaSetup.py trace: No GUI found"
def _showUI(self): if cmds.window(self.win, exists=True): cmds.deleteUI(self.win, window=True) cmds.window(self.win, title=self.win, widthHeight=(400, 220)) cmds.columnLayout('uicl_audioMain',adjustableColumn=True) cmds.separator(h=15, style='none') cmds.text(l='Select Audio to Offset') cmds.separator(h=15, style='in') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)]) cmds.button(label='<< Offset', ann='Nudge selected Audio Backwards', command=partial(self.offsetSelectedBy,'negative')) cmds.floatField('AudioOffsetBy', value=10) cmds.button(label='Offset >>', ann='Nudge selected Audio Forwards', command=partial(self.offsetSelectedBy,'positive')) cmds.setParent('..') cmds.separator(h=15, style='in') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)]) cmds.button(label='Offset Range to Start at:', ann='offset the selected range of audionodes such that they start at the given frame', command=self.offsetSelectedTo) cmds.floatField('AudioOffsetToo', value=10) cmds.setParent('..') cmds.separator(h=15, style='in') cmds.button(label='Ripple selected', ann="Ripple offset the selected audio nodes so they're timed one after another", command=self.offsetRipple) cmds.separator(h=15, style='none') cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp', c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200) cmds.showWindow(self.win) cmds.window(self.win, e=True, widthHeight=(290, 190))
def settings_archive(mayaFile, todo, settings): def filepicker(): result = cmds.fileDialog2(ds=2, cap="Select a Folder.", fm=3, okc="Select") return result[0] if result else "" archive = settings.get("FileArchive.active", False) path = settings.get("FileArchive.path") # Use File Archiving cmds.columnLayout( adjustableColumn=True, ann="Store a backup of the current scene into the provided folder upon each Todo completion.", bgc=[0.5, 0.5, 0.5] if archive else [0.2, 0.2, 0.2]) cmds.checkBox( l="Use File Archive", v=archive, cc=lambda x: settings.set("FileArchive.active", x)) # File archive path cmds.rowLayout(nc=2, ad2=2) cmds.text(label=" - ") cmds.iconTextButton( en=archive, image="fileOpen.png", l=path if path else "Pick archive folder.", style="iconAndTextHorizontal", c=lambda: settings.set("FileArchive.path", filepicker())) # TODO errors when no folder is chosen because of 0 index cmds.setParent("..") cmds.setParent("..")
def _GUI_Create(s, parent): s._attr["specialIcon"] = s._attr.get("specialIcon", None) s._attr["specialAnn"] = s._attr.get("specialAnn", None) complete = s._events["complete"] special = s._events["special"] delete = s._events["delete"] edit = s._events["edit"] s._root = cmds.rowLayout(nc=4, ad4=1, p=parent) s._labelBtn = cmds.iconTextButton( h=30, style="iconAndTextHorizontal", fn="fixedWidthFont", c=lambda: complete(s) ) s._specialBtn = cmds.iconTextButton( style="iconOnly", w=30, m=False, c=lambda: special(s) ) s._editBtn = cmds.iconTextButton( style="iconOnly", w=30, c=lambda: edit(s) ) s._deleteBtn = cmds.iconTextButton( style="iconOnly", w=30, c=lambda: delete(s) )
def _showUI(self): if cmds.window(self.win, exists=True): cmds.deleteUI(self.win, window=True) cmds.window(self.win, title=self.win, widthHeight=(400, 220)) cmds.columnLayout('uicl_audioMain',adjustableColumn=True) cmds.separator(h=15, style='none') cmds.separator(h=15, style='in') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)]) cmds.button(label='<< Offset', ann='Nudge selected Audio Backwards', command=partial(self.offsetSelectedBy,'negative')) cmds.floatField('AudioOffsetBy', value=10) cmds.button(label='Offset >>', ann='Nudge selected Audio Forwards', command=partial(self.offsetSelectedBy,'positive')) cmds.setParent('..') cmds.separator(h=15, style='in') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)]) cmds.button(label='Offset Range to Start at:', ann='offset the selected range of audionodes such that they start at the given frame', command=self.offsetSelectedTo) cmds.floatField('AudioOffsetToo', value=10) cmds.setParent('..') cmds.button(label='Ripple selected', ann="Ripple offset the selected audio nodes so they're timed one after another", command=self.offsetRipple) cmds.separator(h=15, style='none') cmds.frameLayout(label='PRO : Broadcast Wav support', cll=True, cl=False, borderStyle='etchedOut') cmds.columnLayout(adjustableColumn=True, en=r9Setup.has_pro_pack()) cmds.separator(h=5, style='none') cmds.text(label="NOTE: These will only run if the audio is\nin the Bwav format and has internal timecode data.") cmds.separator(h=10, style='none') cmds.button(label='Sync Bwavs to Internal Timecode', ann='Sync audio nodes to their originally recorded internal timecode reference', command=self.sync_bwavs) cmds.separator(h=10, style='in') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 100)], columnSpacing=[(2,20)]) cmds.button(label='Set Timecode Ref', ann="Set the audio node to use as the reference timecode so all other become relative to this offset", command=self.__uicb_setReferenceBwavNode) cmds.text('bwavRefTC', label='No Reference Set') cmds.setParent('..') cmds.button(label='Sync Bwavs Relative to Selected', ann="Sync audio nodes via their internal timecodes such that they're relative to that of the given reference", command=self.sync_bwavsRelativeToo) cmds.separator(h=10, style='in') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 140),(2,140)]) cmds.button(label='Timecode HUD : ON', ann="Live monitor internal Timecode - From a selected node with Timecode Attrs", command=self.timecodeHud) cmds.button(label='Timecode HUD : Kill', ann="Kill all HUD's", command=r9Meta.hardKillMetaHUD) cmds.setParent('uicl_audioMain') cmds.separator(h=10, style='none') cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp', c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200) cmds.showWindow(self.win) cmds.window(self.win, e=True, widthHeight=(290, 350))
def dynGUI( filePath, items, parent ): ''' filePath(string) is the filePath that each file will be at. items(string list) will be files or directories parent(string) which gui component will the the newly created gui components will be connected to. ''' # items will be formatted correctly so only what is needed is included. # keeping track of all the gui components created. guiCom = [] ''' newPath = os.path.join( filePath,item ) files = glob.glob( os.path.join(newPath,"*.mb") ) ''' # Mainlayout for the gui. items = glob.glob( os.path.join(filePath, "*.mb")) print("here is glob") print( os.path.join(filePath, "*.mb") ) print(items) cmds.setParent(parent) mainRow = cmds.rowColumnLayout( nc=2, cw=[[1,winWidth/2],[2, winWidth/2]] ) for item in items: # Need to check to see if there is an image version like it. # Extra the file name fileParts = os.path.split(item) fileParts = os.path.splitext(fileParts[1]) # Check to see if the image exists? ''' iconBtn = cmds.button( w=winWidth/2, h=30, label=fileParts[0], parent=mainRow, c="print('Load file: %s')" %(item)) ''' iconBtn = cmds.iconTextButton( label=fileParts[0], style="iconAndTextHorizontal", marginWidth=10, marginHeight=5, labelOffset=5, w=winWidth/2, h=50 , parent=mainRow, c=scriptName + ".cmds.file(r'%s', i=True )" %item) #c="print('Load file: %s')" %(item)) # file -i "C:/Users/mclavan/Documents/maya/testDir/body/frm1/bones.mb"; if( os.path.exists(os.path.join(filePath,fileParts[0]+".xpm")) ): cmds.iconTextButton(iconBtn, edit=True, image=os.path.join(filePath,fileParts[0]+".xpm") ) elif( os.path.exists(os.path.join(filePath,fileParts[0]+".bmp")) ): cmds.iconTextButton(iconBtn, edit=True, image=os.path.join(filePath,fileParts[0]+".bmp") ) else: print("Didn't find a match. %s != %s" %(os.path.join(filePath,fileParts[0]+".xmp"), item)) '''''' print("Icon Button:%s %s" %(item, iconBtn)) guiCom.append(iconBtn) return guiCom
def SundayUIToolsDockedShaderlinerSwatchToggle(): if cmds.optionVar(query = 'SundayShaderlinerSwatch'): cmds.optionVar(intValue = ('SundayShaderlinerSwatch', 0)) cmds.iconTextButton('SundayShaderlinerIcon', edit = True, image = SundayImage + 'SundaySolidSphereColor.png') else: cmds.optionVar(intValue = ('SundayShaderlinerSwatch', 1)) cmds.iconTextButton('SundayShaderlinerIcon', edit = True, image = SundayImage + 'SundaySolidSphere.png') SundayUIToolsDockedShaderlinerUpdate()
def toggleSelSetsButtonColor(self): visible = (len(G.SS_showColors) < len(self.colors)) w = 25 if visible else 1 cmds.iconTextButton(self.showAllColorsButton, edit=True, visible=visible, w=w) self.sortSelSetButtons() self.adjustButtonsWidth()
def core(self): uiInfo.addFrameLayout( self._uiName, self._label ) uiInfo.setSpace( 10 ) textScrollArea = (self._width-20) / 2 textScrollArea2 = self._width-20-textScrollArea cmds.rowColumnLayout( nc=4, cw=[(1,10), (2,textScrollArea),(3,textScrollArea2),(4,10)] ) uiInfo.setSpace() self._set = cmds.textScrollList( h=100, ams=1, sc = partial( self.selectOnSetCmd ) ) self._guideSet = cmds.textScrollList( h=100, ams=1, sc = partial( self.selectOnGuideSetCmd ) ) uiInfo.setSpace() cmds.setParent( '..' ) uiInfo.setSpace( 5 ) checkWidth = 25 textWidth = (self._width-checkWidth-20)*.45 - 5 sliderWidth = (self._width-checkWidth-20) - textWidth - checkWidth*2 + 5 cmds.rowColumnLayout( nc=7, cw=[(1,10),(2,textWidth),(3,checkWidth),(4,checkWidth),(5,checkWidth),(6,sliderWidth),(7,10)]) uiInfo.setSpace() cmds.frameLayout( lv=0, bs='out', h=20 ) cmds.text( l='ATTRIBUTE' ) cmds.setParent( '..' ) cmds.button( 'A', c=self.allCheckBoxOnCmd, bgc=[.8,.39,.41] ) cmds.button( 'C', c=self.allCheckBoxOffCmd, bgc=[.47,.72,.21] ) cmds.button( 'R', c=self.reverseCheckBoxCmd, bgc=[.09,.41,.51] ) cmds.frameLayout( lv=0, bs='out' ) cmds.text( l='VALUE' ) cmds.setParent( '..' ) uiInfo.setSpace() cmds.setParent( '..' ) cmds.rowColumnLayout( nc=5, cw=[(1,10),(2,textWidth),(3,20),(4,sliderWidth+checkWidth+20),(5,10)]) for i in self._sliderDefineList: uiInfo.setSpace() cuSlider = self.sliderSet( i[0], i[1], i[2], i[3], [(1,50),(2,150)] ) cmds.floatSliderGrp( cuSlider[1], e=1, step=0.01, fmx=100, cc=self.saveData ) uiInfo.setSpace() self._sliders.append( cuSlider ) cmds.setParent( '..' ) uiInfo.setSpace( 10 ) cmds.rowColumnLayout( nc=4, cw=[(1,10),(2,30),(3,self._width-20-30),(4,10)]) uiInfo.setSpace() cmds.iconTextButton( image= uiModel.iconPath +'/spoid.png', c= partial( self.getCmd ) ) uiInfo.setButton( partial( self.setCmd ) ) uiInfo.setSpace() cmds.setParent( '..' ) uiInfo.setSpace( 10 ) uiInfo.getOutFrameLayout()
def __init__(s, i18n, char, requestCharEdit, requestClipEdit, sendRunClip): s.i18n = i18n s.char = char s.requestClipEdit = requestClipEdit # We're asking to edit the clip s.sendRunClip = sendRunClip # User wants to place the clip s.clips = [] # Init clips! name = s.char.metadata.get("name", "CLips").title() if not char.data: # Does the character contain nothing? with warn: requestCharEdit(char, s.refresh) s.winName = "%sWin" % name if cmds.window(s.winName, ex=True): cmds.deleteUI(s.winName) s.window = cmds.window(s.winName, rtf=True, s=False, t="%s %s" % (name, i18n["clips.title"])) cmds.columnLayout(adj=True) cmds.rowLayout(nc=2, adj=2) # Open Row cmds.iconTextButton( ann=i18n["clips.editChar"], style="iconOnly", font="boldLabelFont", image="goToBindPose.png", h=50, w=50, bgc=[0.3,0.3,0.3], c=lambda: requestCharEdit(s.char, s.refresh) ) cmds.text( l="<h1>%s</h1>" % name, hl=True, h=50 ) cmds.setParent("..") # Close row cmds.columnLayout(adj=True) # Open Col cmds.button( l=i18n["clips.newClip"], h=50, c=lambda x: warn.run(requestClipEdit, s.char, s.refresh) ) cmds.setParent("..") # Close row cmds.floatSlider( min=50, max=200, v=100, dc=s.sizeClips, h=20 ) cmds.separator() cmds.frameLayout(l=i18n["clips.moreInfo"], font="tinyBoldLabelFont") cmds.scrollLayout(cr=True, bgc=[0.2,0.2,0.2], h=400) s.wrapper = cmds.gridLayout(w=400, cwh=[100, 120], cr=True, aec=False) cmds.setParent("..") # Close grid cmds.setParent("..") # Close Scroll cmds.separator() cmds.showWindow(s.window) cmds.scriptJob(uid=[s.window, s.cleanup], ro=True) s.refresh()
def ui(self): if mc.window(self.winName,ex=True): mc.deleteUI(self.winName,window=True) else: pass #----- window -----# mc.window(self.winName , t = 'Edit Crv v1.0',w = 235,h = 160 , sizeable=False) # main self.form = mc.formLayout() #1 rowColumnLayout row = mc.rowColumnLayout(nc = 2,cat = [1,'right',5],ro = [(1,'both',2),(2,'both',2),(3,'both',2),(4,'both',2)]) self.rotateBN = mc.iconTextButton( style='textOnly' , w=150 , bgc=[0.5, 0.4, 0.33] , label='r o t a t e - c r v' , c=lambda *args:self.uiRunCmd('rotate') ) self.rotateFLE = mc.textField( 'rotateText' , w=70 , ed=True , text='45' ) self.scaleBN = mc.iconTextButton( style='textOnly' , w=150 , bgc=[0.5, 0.4, 0.33] , label='s c a l e - c r v' , c=lambda *args:self.uiRunCmd('scale') ) self.scaleFLE = mc.textField( 'scaleText' , w=70 , ed=True ,text='0.5' ) mc.setParent('..') #2 columnLayout column = mc.columnLayout(adj = True) mc.separator( style="in" , h=10 ) #2.1 rowLayout self.RIDRow = mc.rowLayout(nc = 3,cat = [1,'left',30]) self.AxisRID = mc.radioCollection() self.xAxisTypeRID = mc.radioButton('x' , l='X', w=60) self.yAxisTypeRID = mc.radioButton('y' , l='Y', w=60) self.zAxisTypeRID = mc.radioButton('z' , l='Z', w=60) mc.radioCollection( self.AxisRID, edit=True, select=self.xAxisTypeRID ) mc.setParent('..') self.runBN = mc.iconTextButton( style='textOnly' , h=30 , bgc=[0.23,0.33,0.39] , label='m i r r o r' , c=lambda *args:self.uiRunCmd('mirror')) mc.separator( style="in" , h=10 ) #2.2 rowLayout self.eximRow = mc.rowLayout(nc = 2) self.exportBN = mc.iconTextButton( style='textOnly' , w=110 , bgc=[0.5, 0.4, 0.33] , label='e x p o r t - s h a p e' , c=lambda *args:self.exportCurveShape() ) self.importBN = mc.iconTextButton( style='textOnly' , w=110 , bgc=[0.5, 0.4, 0.33] , label='i m p o r t - s h a p e' , c=lambda *args:self.importCurveShape() ) mc.setParent('..') mc.formLayout(self.form, edit=True, attachForm=[(row, 'top', 5), (row, 'left', 5), (row, 'right', 5), (column, 'bottom', 5), (column, 'right', 5), (column, 'left', 5) ], attachControl=[(row, 'bottom', 5, column)]) mc.showWindow(self.winName)
def thumbnailUpdateButton_clicked(self, *args): if cmds.renderThumbnailUpdate(q=True): cmds.renderThumbnailUpdate(False) cmds.iconTextButton("thumbnailUpdateButton", edit=True, image = os.path.join(self.iconsPath, "ThumbnailUpdateSwitch_OFF.png")) print "#---------> Render Thumbnail Update: Disabled" else: cmds.renderThumbnailUpdate(True) cmds.iconTextButton("thumbnailUpdateButton", edit=True, image = os.path.join(self.iconsPath, "ThumbnailUpdateSwitch_ON.png")) print "#---------> Render Thumbnail Update: Enabled"
def turnOnCreateNewSetField(self): cmds.iconTextButton (self.plusBtn, edit=True, visible=False, w=1) cmds.columnLayout(self.createNewSetLayout, edit=True, visible=True, w=self.createRenameLayoutW) self.turnOffRenameSetField() cmds.textField(self.createNewSetTextField, edit=True, text=self.guessNewSetName()) self.highlightColorSelection() cmds.setFocus(self.createNewSetTextField) self.adjustButtonsWidth()
def turnOffCreateNewSetField(self): if not cmds.columnLayout(self.createNewSetLayout, query=True, visible=True): return cmds.iconTextButton (self.plusBtn, edit=True, visible=True, w=25) cmds.columnLayout(self.createNewSetLayout, edit=True, visible=False, w=1) viewports = [view for view in cmds.getPanel(type='modelPanel') if view in cmds.getPanel(visiblePanels=True)] if len(viewports) > 0: cmds.setFocus(viewports[0]) self.adjustButtonsWidth()
def addChar(char): cmds.iconTextButton( st="iconAndTextHorizontal", i="ghostOff.png", l=characters[char], ann="Open the character: %s." % characters[char], h=50, c=lambda: s.buildCharacter(char) )
def fileAccess(self,*args): self.selectedItem=str(os.path.join(cmds.textField('location',q=True,tx=True), str(cmds.textScrollList('fileLister',q=True,si=True)[0]).split(" ")[0])) self.displayThumb(self.selectedItem) for each in ['jpg','png','iff','tif','PNG']: if self.selectedItem.endswith(each): cmds.iconTextButton('thumbPreview',edit=True, image1=self.selectedItem)
def createEntry(self, item, layout, *args): #find the thumbnbail for the entry thumb = self.mayaToolsDir + "/General/Icons/Fortnite/" + item + ".bmp" if os.path.exists(thumb): #add the thumbnail to the passed in layout if layout == "weaponsList": cmds.iconTextButton(image = thumb, w = 300, h = 100, parent = self.widgets[layout], c = partial(self.importWeapon, item))
def _showUI(self): reportData=self.SceneReviewer.getReportData() allowEdit=False sceneName=None date=reportData['date'] if reportData.has_key('sceneName'): sceneName=reportData['sceneName'] author=None if not reportData['author']: #new sceneReport author=getpass.getuser() allowEdit=True elif reportData['author']==getpass.getuser(): #current author of comment == you author=getpass.getuser() allowEdit=True date=time.ctime() else: #current author != you author=reportData['author'] if not date: date=time.ctime() if not sceneName: sceneName=self.getSceneName() if cmds.window(self.win, exists=True): cmds.deleteUI(self.win, window=True) window = cmds.window(self.win, title=self.win, s=True, widthHeight=(260,300)) cmds.scrollLayout('reviewScrollLayout',rc=lambda *args:self.resizeTextScrollers()) cmds.columnLayout(adjustableColumn=True,columnAttach=('both',5)) cmds.textFieldGrp('author',label='Author', ed=False, text=author)#, tcc=partial(self.updateInternalDict)) cmds.textFieldGrp('date', label='Date', ed=False, text=date)#, tcc=partial(self.updateInternalDict)) cmds.textFieldGrp('sceneName', label='SceneName', ed=False, text=sceneName) cmds.separator(h=15,style='none') cmds.text(label='Comment') cmds.scrollField('comment', text=reportData['comment'], ed=allowEdit, h=200, wordWrap=False, kpc=partial(self.updateInternalDict), cc=partial(self.updateInternalDict)) cmds.button(label='New Comment',bgc=r9Setup.red9ButtonBGC(1),c=partial(self.addNewComment)) cmds.separator(h=15,style='none') cmds.text(label='History') cmds.scrollField('history', editable=False, en=True, wordWrap=False, h=200,text=reportData['history']) cmds.separator(h=15,style='none') cmds.rowColumnLayout('SceneNodeActivatorRC',numberOfColumns=2,columnWidth=[(1,200),(2,200)]) cmds.button('setReviewActive',label='Activate Live Review',bgc=r9Setup.red9ButtonBGC(1),c=lambda x:self._setReviewStatus('active')) cmds.button('setReviewInActive',label='Disable Live Review',bgc=r9Setup.red9ButtonBGC(1),c=lambda x:self._setReviewStatus('inactive')) cmds.setParent('..') cmds.separator(h=15,style='none') cmds.iconTextButton( style='iconOnly', bgc=(0.7,0,0),image1='Rocket9_buttonStrap2.bmp', c=lambda *args:(r9Setup.red9ContactInfo()),h=22,w=200 ) cmds.showWindow(window) if self.SceneReviewer.exists(): self._setReviewStatus('active') else: self._setReviewStatus('inactive')
def addItem(name, path, folder=False): cmds.iconTextButton( l=name.title(), style="iconAndTextHorizontal", font="boldLabelFont", image="SP_DirClosedIcon.png" if folder else "polyColorSetEditor.png", h=40, bgc=[0.22,0.22,0.22] if folder else [0.2,0.2,0.2], c=lambda: warn.run(s.openFolder if folder else s.sendOpen, path) )
def toggleAutoSelectMirrorObjects(self, *args): onOff = not cmds.menuItem("autoSelectMirrorObjectsMenu", query=True , checkBox=True) if args: onOff = not onOff #if checkbox pressed if onOff: cmds.iconTextButton("mirrorBtn", edit=True, image=uiMod.getImagePath("specialTools_mirror_active"), highlightImage= uiMod.getImagePath("specialTools_mirror_active")) else: cmds.iconTextButton("mirrorBtn", edit=True, image=uiMod.getImagePath("specialTools_mirror"), highlightImage= uiMod.getImagePath("specialTools_mirror copy")) self.setAutoSelectMirrorObjects(onOff) if not args:cmds.menuItem("autoSelectMirrorObjectsMenu", edit=True , checkBox=onOff)
def highlightColorSelection(self): fields = ["create", "rename"] for loopColor in self.colors: loopColorName = loopColor["name"] if loopColorName == G.SS_lastColorUsed: for loopField in fields: cmds.iconTextButton( "colorButton%s%s" % (loopField, loopColorName), edit=True, image=uiMod.getImagePath('specialTools_gray_dot_c'), style='iconOnly') else: for loopField in fields: cmds.iconTextButton("colorButton%s%s" % (loopField, loopColorName), edit=True, style='textOnly')
def build(parent, imagesPath, iconSize=25, height=20, marginSize=5): """ build widget @param parent : parent layout in maya @imagesPath : str path """ cmds.rowLayout(numberOfColumns=1, parent=parent) cmds.iconTextButton( style='iconOnly', image1=os.path.join(imagesPath, 'snapit.png'), hi=os.path.join(imagesPath, 'snapit_hi.png'), width=iconSize, mw=marginSize, height=iconSize, mh=marginSize, label='manager', annotation= 'second selected thing will be snapped to the first selected thing', c=snapIt) cmds.setParent("..")
def er_MIs(slmod = 'Animation'): bs = mc.scrollLayout('Er_CheckSL',q = True,ca = True) if bs: mc.deleteUI(bs) #slmod = mc.optionMenu('yy_Er_Mods_OM',q = True,v = True) num = 0 er_Checks = er_TypeChecks(slmod) if er_Checks: for er_Check in er_Checks: er_LayoutLabel = er_Check[0].split('(')[0] mc.rowLayout(er_LayoutLabel,p = 'Er_CheckSL',h = 30,nc = 4,cw4 = [50,80,200,100],co4 = [0,10,20,20],cl4 = ['right','center','center','center'],ct4 = ['right','both','both','both']) mc.iconTextButton('%s_icon'%er_LayoutLabel,style='iconOnly', image1='check_Right.png', vis = False,label='') if er_Check[2] and er_Check[3]: mc.button('%s_solve'%er_LayoutLabel,en = False,w = 50,vis = True,l = er_Check[3],c = 'er_Solves(solName = [%s])'%er_Check) else: mc.button('%s_solve'%er_LayoutLabel,en = False,w = 50,vis = False,l = '') mc.checkBox('%s_checkBox'%er_LayoutLabel,l = er_Check[1],ann = er_Check[5],v = 1) mc.button('%s_checkButton'%er_LayoutLabel,w = 50, l = '检查', c = 'er_CheckCmd(checkName =[%s])'%er_Check) print er_Check mc.setParent('..')
def selectCategory(self, index): print("ML Log: selectCategory") # Populate the materials view from the selected category. self.materials = self.manifest["categories"][index]["materials"] self.populateMaterials() # Update the folder open / closed state on the category list. cmds.iconTextButton("RPRCategory" + str(self.selectedCategoryIndex), edit=True, image='material_browser/folder_closed.png') cmds.iconTextButton("RPRCategory" + str(index), edit=True, image='material_browser/folder_open.png') self.selectedCategoryIndex = index # Clear the search field. cmds.textField(self.searchField, edit=True, text="")
def Ui(self): self.UiN = 'DataSaveUi' UiN = self.UiN if cmds.window(UiN, q=1, ex=1): cmds.deleteUI(UiN) cmds.window(UiN, t=UiN, rtf=1, mb=1, mxb=0, wh=(250, 150)) cmds.columnLayout('%s_MaincL' % UiN, cat=('both', 2), rs=2, cw=250, adj=1) cmds.rowLayout(nc=2, adj=1) cmds.text(l='', w=225) cmds.iconTextButton(i='addClip.png', w=20, h=20, c=lambda *args: self.addUiComponent()) cmds.setParent('..') cmds.showWindow(UiN) self.addUiComponent()
def build(parent, imagesPath, iconSize=25, height=20, marginSize=5): """ build widget @param parent : parent layout in maya @imagesPath : str path """ cmds.rowLayout(numberOfColumns=2, parent=parent) cmds.iconTextButton(style='iconOnly', image1=os.path.join(imagesPath, 'justin.png'), hi=os.path.join(imagesPath, 'justin_hi.png'), width=35, mw=marginSize, height=35, mh=marginSize, label='Justin', npm=1, annotation=' Menu for Justin rig', c = expandToolBar) cmds.setParent("..")
def createLayout(self): mainLayout = cmds.rowLayout(numberOfColumns=6, parent=self.parentLayout) #manipulator orientation #cmds.iconTextButton("manipOrientButton", style='textOnly', label='-', h=self.hb, annotation="Selected objects", command=updateManipOrient) #launchManipOrient() self.autoSmartSnapKeys = AutoSmartSnapKeys() self.selectionCounter = SelectionCounter() #selection cmds.iconTextButton("selectionCounterButton", style='textOnly', font="smallPlainLabelFont", label='0', h=self.hb, annotation="Selected objects") cmds.popupMenu("selectionCounterButtonMenu", button=1, postMenuCommand=self.selectionCounter.populateMenu) #animation crash recovery cmds.image("animationCrashRecoveryLed", w=14, h=14, annotation="Test") #menu cmds.iconTextButton(style='iconOnly', w=self.wb, h=self.hb, image=uiMod.getImagePath("aTools"), highlightImage=uiMod.getImagePath("aTools copy"), annotation="aTools Menu") self.popUpaToolsMenu() self.update = Update() self.update.about = self.about self.update.checkUpdates(self, mainLayout) # set default config and startup scripts self.setDefaultConfig()
def buildWin(self): if mc.window(winName, exists=True): mc.deleteUI(winName) mc.window(winName, width=winWidth, title='Forniture Generator') #reference to the main columnLayout self.mainCL = mc.columnLayout() self.mainRLWidth = [winWidth*0.6, winWidth*0.4] self.mainRL = mc.rowLayout(w=winWidth, numberOfColumns=2, columnWidth2=self.mainRLWidth, rowAttach=(2, 'top', 0)) mc.columnLayout(w=self.mainRLWidth[0]) # create a columnLayout under the first row of mainRL mc.text(label='Table', font='boldLabelFont') mc.text(label='') self.slider1 = mc.intSliderGrp(field=True, label='tablewidthz', minValue=4, maxValue=20, value=10, width=winWidth/2 ) self.slider2 = mc.intSliderGrp(field=True, label='tableWidthx', minValue=2, maxValue=20, value=10, width=winWidth/2 ) self.slider3 = mc.intSliderGrp(field=True, label='tableHeight', minValue=2, maxValue=20, value=6, width=winWidth/2 ) #------------------------------------------------------------------------------------------------------------------- mc.text(label='') mc.text(label='Chaise:', font='boldLabelFont') self.slider4 = mc.intSliderGrp(field=True, label='Chaisewidthz', minValue=4, maxValue=6, value=4, width=winWidth/2 ) self.slider5 = mc.intSliderGrp(field=True, label='ChaiseWidthx', minValue=2, maxValue=6, value=5, width=winWidth/2 ) self.slider6 = mc.intSliderGrp(field=True, label='ChaiseHeight', minValue=2, maxValue=10, value=4, width=winWidth/2 ) self.slider7 = mc.intSliderGrp(field=True, label='Distance', minValue=-10, maxValue=10, value=-5, width=winWidth/2 ) mc.setParent('..') # this will exit the rowLayout back to the mainRL, same as mc.setParent(mainRL) mc.columnLayout(width=self.mainRLWidth[1]) # start another vertical layout mc.text(label='Table', font='boldLabelFont') mc.text(label='') mc.button(label='runFirst', width=self.mainRLWidth[1]*0.95, height=70, c='variablesTopass()') mc.iconTextButton(style='iconAndTextVertical', image1='/home/fullarostaky/maya/2020/scripts/icons/Table_chaise_icon-01.png', label='Generate Table',width=self.mainRLWidth[1]*0.95, c='TableChaise.table(tablewidthz, tableWidthx, tableHeight)') mc.text(label='Chaise', font='boldLabelFont') mc.text(label='') mc.iconTextButton(style='iconAndTextVertical', image1='/home/fullarostaky/maya/2020/scripts/icons/Table_chaise_icon-01.png', label='Generate Chaise',width=self.mainRLWidth[1]*0.95, c='TableChaise.Chaise(Chaisewidthz, ChaiseWidthx, ChaiseHeight, Distance)') #mc.button(label='button', width=mainRLWidth[1]*0.95, height=70) # mc.setParent(mainCL) # set UI pointer back under the main columnLayout # mc.text(label='') # mc.button(label='full window width button', width=winWidth, height=40) mc.showWindow(winName) mc.window(winName, e=True, width=winWidth, height=1)
def drawFrameLayout( self, frameTitle, textureTypeAttrList ): # , attrNameList cw1 = 100 cw2 = 60 cmds.setParent( self.listTextures ) cmds.frameLayout( label = frameTitle, borderVisible = True, borderStyle = 'etchedIn', marginHeight = 0, cll = True, cl = False ) cmds.columnLayout( columnAttach=( 'left', 0 ), rowSpacing = 0, adjustableColumn = True ) for i in range( len( self.fileTextures ) ): labelType = "Not Found" labelColor = ( 0.5, 0.0, 0.0 ) fileNodeName = self.fileTextures[ i ] fileNodeType = cmds.objectType( fileNodeName ) fileName = '' for ( textureType, attrName ) in textureTypeAttrList : #print "textureType = %s attrName = %s" % ( textureType, attrName ) if fileNodeType != textureType : continue fileTextureName = cmds.getAttr( fileNodeName + "." + attrName ) print ( '>> fileTextureName = %s' ) % fileTextureName if fileTextureName is not None and fileTextureName != '' : fileName = str( fileTextureName ) if cmds.file( fileTextureName, q=True, exists=True ) : labelType = "Absolute" labelColor = (1.0, 0.5, 0.0) fileName = cmds.workspace( projectPath = fileTextureName ) if self.isRelative( fileName ): labelType = "Relative" labelColor = (0.0, 0.5, 0.0) cmds.rowLayout( numberOfColumns=2, columnWidth1=cw2, adjustableColumn2=2 ) cmds.iconTextButton( style='textOnly', label=labelType, width=cw2, h=16, bgc=labelColor ) cmds.textFieldButtonGrp( cw=( 1, cw1 ), adj=2, label=fileNodeName, buttonLabel="select", text=fileName, cc=partial( self.onFileNameChanged, fileNodeName, attrName ), bc=partial( self.selectFileNode, fileNodeName ) ) cmds.setParent( '..' )
def override_add_hypershade_panel(panel): # create HyperShade with Maya command if cmds.optionVar(exists=VAR_HS_CMD): mel.eval('%s("%s")' % (cmds.optionVar(query=VAR_HS_CMD), panel)) else: mel.eval('addHyperShadePanel("%s")' % panel) # set HyperShade toolbar current parent (name is hardcoded in mel files) cmds.setParent('hyperShadeToolbarForm') # add custom buttons cmds.separator(height=ICON_SIZE, horizontal=False, style='single') cmds.iconTextButton( image='nodeGrapherAddNodes.png', width=ICON_SIZE, height=ICON_SIZE, command=partial(hypershade_add_node, panel) ) cmds.iconTextButton( image='nodeGrapherRemoveNodes.png', width=ICON_SIZE, height=ICON_SIZE, command=partial(hypershade_remove_node, panel) ) cmds.separator(height=ICON_SIZE, horizontal=False, style='single') cmds.iconTextButton( image='MTT_CreateNode.png', width=ICON_SIZE, height=ICON_SIZE, command=create_nodes )
def UI(self, *args): if (mc.window('gggShaderUI', exists=True)): mc.deleteUI('gggShaderUI') GGGShaderWindow = mc.window('gggShaderUI', title='gggShaderUI') mc.rowColumnLayout(numberOfColumns=3) mc.text(label="colorMap") self.colorMap = mc.textField() colorButton = mc.iconTextButton( style='iconOnly', image1= "C:\\Users\\Jackson\\git_local\\personal\\openFileDialogIcon.png", c=Callback(self.openFiledialog, "colorMap")) mc.text(label="specularMap") self.specularMap = mc.textField() specButton = mc.iconTextButton( style='iconOnly', image1= "C:\\Users\\Jackson\\git_local\\personal\\openFileDialogIcon.png", c=Callback(self.openFiledialog, "specularMap")) mc.text(label="normalMap") self.normalMap = mc.textField() normButton = mc.iconTextButton( style='iconOnly', image1= "C:\\Users\\Jackson\\git_local\\personal\\openFileDialogIcon.png", c=Callback(self.openFiledialog, "normalMap")) mc.setParent("..") mc.rowColumnLayout(numberOfColumns=1) mc.button(label="makeNetwork", c=self.main) mc.showWindow(GGGShaderWindow) return colorButton, specButton, normButton
def build_ui(): name_ui = 'variableKinematicsUI' if cmds.window(name_ui, ex=1): cmds.deleteUI(name_ui) mainwin = cmds.window(name_ui, title='Variable Kinematics Window', w=100, h=50) cmds.formLayout(numberOfDivisions=100) cmds.columnLayout(adjustableColumn=True) cmds.intSliderGrp('intJoints_ISG_UI', field=True, label='joints', minValue=3, maxValue=100, fieldMaxValue=1000, value=10, step=1) cmds.separator() cmds.intSliderGrp('intControl_ISG_UI', field=True, label='controls', minValue=1, maxValue=25, fieldMaxValue=1000, value=2, step=1) cmds.separator() cmds.rowLayout('rl', nc=2, adjustableColumn=2) cmds.iconTextButton(label='FK', w=300, h=100, style='textOnly', c=lambda: run_command(1)) cmds.iconTextButton(label='IK', h=100, style='textOnly', c=lambda: run_command(0)) cmds.intSliderGrp('intJoints_ISG_UI', e=1, cw3=(50, 30, 500), adj=3, h=35) cmds.intSliderGrp('intControl_ISG_UI', e=1, cw3=(50, 30, 500), adj=3, h=35) cmds.showWindow(mainwin)
def createTextScrollList(self,objlist,tishi): cmds.text(self.imfor_text,e=True,bgc=[1,0,0],l=' ! Error Files Path:') if not cmds.rowLayout('file_coupleBack_%s'%tishi,ex=True): cmds.rowLayout('file_coupleBack_%s'%tishi,numberOfColumns=2, columnWidth2=(30,300), adjustableColumn=2, columnAlign=(1, 'right'),columnAttach=[(1, 'both', 0), (2, 'both', 0)],p='lingshi_col') Nsp_img=cmds.iconTextButton(style='iconOnly', image='open_biaoqian.png',h=20) Nsp_cb=cmds.iconTextButton(style='iconAndTextHorizontal',h=20,label='%s :'%tishi,fn="boldLabelFont") cmds.setParent('lingshi_col') self.ccc_col=cmds.columnLayout(adj=True,cat=['left',55]) # itcbname_img=[] subFileTextScor=cmds.textScrollList(ams=True,h=18) ll=len(objlist) cmds.textScrollList(subFileTextScor,e=True,append=objlist,h=13*ll+25) # for single in objlist: # File=cmds.iconTextCheckBox(style='iconAndTextHorizontal',i='lianjie_biaoqian.png',w=400,h=20, l=single,bgc=[0.265,0.265,0.265]) bb=TextCheckBox_class() bb.setlabe(subFileTextScor) cmds.textScrollList(subFileTextScor,e=1,sc=bb.sub_checkon_c) # itcbname_img.append(File) # print itcbname_img # for each in itcbname_img: aa=BiaozhiConvisions() aa.setname(Nsp_img,subFileTextScor) cmds.iconTextButton(Nsp_img,e=1,c=aa.biaozhi_c) cc=SelSub_TextCheckBox_class() cc.setFilesList(subFileTextScor,objlist) cmds.iconTextButton(Nsp_cb,e=1,dcc=cc.SelSub_chechon_c)
def materialSwitchWindow(): window = cmds.window(toolbox=True,title=" ",titleBar=True,widthHeight=(160, 112),sizeable=False ) formLayout = cmds.formLayout('formLayout') cl = cmds.columnLayout("cl",adj=1, rs=6) atrributeCol = cmds.columnLayout("atrributeCol",adj=1, rs=6) cmds.setParent('..') cmds.button(l="Add Material Switch",h=30,c="addHoldingAttrs()") #add switch attributes button cmds.setParent(formLayout) btn_viewport = cmds.iconTextButton('btn_viewport', flat=False,style='iconAndTextVertical',image='textured.png',l="Viewport",h=60,en=True,c='switchToViewport()') btn_render = cmds.iconTextButton('btn_render', flat=False,style='iconAndTextVertical',image='shaded.png',l="Render",h=60,en=True,c='switchToRender()') cmds.formLayout(formLayout,edit=True, attachForm=[ (cl,'left',5), (cl,'right',5), (btn_viewport,'bottom',6), (btn_viewport,'left',6), (btn_render,'bottom',6), (btn_render,'right',6) ], attachControl=[ (btn_render,'left',6,btn_viewport) ], ap=[ (btn_viewport,'right',6,50) ] ) formLayout; cmds.showWindow( window )
def createLayout(self): tangents = Tangents() buttons = [ "flow", "bounce", "auto", "spline", "linear", "flat", "step" ] cmds.rowLayout(numberOfColumns=8, parent=self.parentLayout) for loopButton in buttons: cmds.iconTextButton( style='iconAndTextVertical', image=uiMod.getImagePath("tangents_%s" % loopButton), highlightImage=uiMod.getImagePath("tangents_%s copy" % loopButton), w=self.wb, h=self.hb, command=lambda loopButton=loopButton, *args: tangents. setTangent(loopButton), annotation="%s tangent\\nRight click for options" % str.title(loopButton)) tangents.popupMenu(loopButton)
def show(width=_default_size[0], height=_default_size[1]): """Main UI.""" win_name = 'ArmorPaintLiveLink' if cmds.window(win_name, exists=True): cmds.deleteUI(win_name, window=True) cmds.window(win_name, title='ArmorPaintLiveLink', tlb=True) cmds.columnLayout(adj=True, rs=0, bgc=(0.3, 0.3, 0.3)) # BUTTONS # cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=os.path.join(_icons_path, 'ArmorPaintLogo.xpm'), c=cb(launchArmorPaint, path_base), ann='Paint selected') cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=os.path.join(_icons_path, 'Preferences.xpm'), c=cb(ArmorPaintDirFileDialog), ann='Prerences') cmds.showWindow(win_name) cmds.window(win_name, edit=True, widthHeight=(width, height)) sys.stdout.write('ArmorPaint Live Link %s https://github.com/PiloeGAO [email protected]\n' % __version__)
def override_add_node_editor_panel(panel): # create Node Editor with Maya command if cmds.optionVar(exists=VAR_NE_CMD): mel.eval('%s("%s")' % (cmds.optionVar(query=VAR_NE_CMD), panel)) else: mel.eval('nodeEdAddCallback("%s")' % panel) # set Node Editor toolbar current parent form_layout = cmds.layout(panel, query=True, childArray=True)[0] frame_layout = cmds.layout(form_layout, query=True, childArray=True)[0] flow_layout = cmds.layout(frame_layout, query=True, childArray=True)[0] cmds.setParent(flow_layout) # add custom buttons cmds.separator(height=ICON_SIZE, horizontal=False, style='single') cmds.iconTextButton( image='MTT_CreateNode.png', width=ICON_SIZE, height=ICON_SIZE, command=create_nodes )
def build(parent, imagesPath, iconSize=25, height=20, marginSize=5): """ build widget @param parent : parent layout in maya @imagesPath : str path """ cmds.rowLayout(numberOfColumns=2) cmds.iconTextButton(style='iconOnly', image1=os.path.join(imagesPath, 'arc_hi.png'), hi=os.path.join(imagesPath, 'arc.png'), width=iconSize, mw=marginSize, height=iconSize, mh=marginSize, label='arc', annotation='MotionTrail tool', c=drawArc) cmds.popupMenu() cmds.menuItem(label="Setting", c=drawArcToolbar) cmds.menuItem(label="---------------", c=drawArcToolbar) cmds.menuItem(label="Delete All", c=deleteAll) cmds.setParent("..")
def creaLayout(parentL=""): posesEnM = mc.getFileList(folder="D:\PH_SCRIPTS\ICONS\POSES", filespec='*.png') posesEnM.sort() indice = 0 lay0 = mc.columnLayout(p=parentL) lay1 = mc.rowColumnLayout(numberOfColumns=3, p=lay0) for i in range(len(posesEnM)): mc.iconTextButton(style='iconOnly', image1='D:\PH_SCRIPTS\ICONS\POSES\\' + posesEnM[i], width=150, height=150, c=partial(cargaPose, posesEnM[i][:-4]), dcc=partial(cargaPose, posesEnM[i][:-4], 1), ann=posesEnM[i][:-4].replace("_", " ")) lay2 = mc.columnLayout(p=lay0, bgc=[0.23, 0.23, 0.23]) mc.text( p=lay2, l="""Un click izquierdo asigna pose a mano izquierda. Doble click izquierdo asigna pose a mano derecha. \nDebido a que la mano derecha esta mal riggeada, el pulgar derecho lo van a ver raro.\n Si todo lo seleccionado es un 'hikFKJoint', carga solamente esos huesos de la pose.\nSi lo seleccionado no es 'hikFKJoint', carga la pose entera.""" ) mc.separator(p=lay2)
def change_difficulty(USERPATH): PATH_ICONS = USERPATH + "\\tic_tac_toe_icons\\" result = cmds.confirmDialog( title="tic tac toe", message="Which difficulty would you like to play?", messageAlign="center", icon="question", backgroundColor=[0.121, 0.50, 0.31], button=["EASY", "FAIR"], defaultButton="FAIR") if result == "FAIR": difficulty = "FAIR" cmds.iconTextButton("ttt_difficulty", edit=True, image=PATH_ICONS + 'ttt_settings_fair.png') else: difficulty = "EASY" cmds.iconTextButton("ttt_difficulty", edit=True, image=PATH_ICONS + 'ttt_settings_easy.png') return difficulty
def showUI(self): ''' Create UI ''' #Check and Delete Old UI if cmds.window('renderLayerMan', ex=True): cmds.deleteUI('renderLayerMan') cmds.window('renderLayerMan', w=255) UI_mainLayout = cmds.columnLayout('renderLayerman_mainLayout', adj=True, w=295, h=350) cmds.columnLayout('renderLayerman_Content', rs=3, adj=True, parent=UI_mainLayout) cmds.rowLayout(numberOfColumns=2, columnAlign=[(1, 'left'), (2, 'right')], adj=True) cmds.text(l='Render layer manager') focus_button_cmd = 'renderLayerMan_UI().update_layerList()' cmds.iconTextButton(image1='refresh.xpm', label='sphere', command=focus_button_cmd) cmds.setParent('..') cmds.formLayout('renderLayerman_mainForm') self.update_layerList() cmds.setParent('..') cmds.button(l='OK', command=self.Button_ok_onClick) cmds.separator(h=10) cmds.text('version_info', l='version : ' + self._AppVersion_) cmds.setParent('..') cmds.showWindow('renderLayerMan')
def copyWorld(self, *args): #print "copyworld" self.selection = cmds.ls(selection=True) if len(self.selection) < 1: return if len(self.selection) > 20: message = "Too many objects selected, continue?" confirm = cmds.confirmDialog(title='Confirm', message=message, button=['Yes', 'No'], defaultButton='Yes', cancelButton='No', dismissString='No') if confirm != 'Yes': return cmds.refresh(suspend=True) cmds.undoInfo(stateWithoutFlush=False) self.flushCopyCache(force=True) self.scriptJob() self.sourceObjs = self.selection self.targetObj = "world" for loopObj in self.sourceObjs: matrix = cmds.xform(loopObj, query=True, ws=True, matrix=True) self.copyCache.append(matrix) cmds.iconTextButton( "fakeConstrainBtn", edit=True, image=uiMod.getImagePath("specialTools_fake_constrain_active"), highlightImage=uiMod.getImagePath( "specialTools_fake_constrain_active copy")) cmds.refresh(suspend=False) cmds.undoInfo(stateWithoutFlush=True)
def kmClock(self): heure = strftime("%H:%M:%S", localtime()) print heure mc.iconTextButton(self.bt_h01, edit=True, image1=self.target + "digit" + heure[0] + ".png") mc.iconTextButton(self.bt_h02, edit=True, image1=self.target + "digit" + heure[1] + ".png") mc.iconTextButton(self.bt_m01, edit=True, image1=self.target + "digit" + heure[3] + ".png") mc.iconTextButton(self.bt_m02, edit=True, image1=self.target + "digit" + heure[4] + ".png")
def saveTransform(obj): loc = cmds.ls("xLEAVEMEALONE") if loc: cmds.iconTextButton( 'btnSaveLoadTransform', e=1, image='save_transform.png' ) loc = cmds.ls("xLEAVEMEALONE") cmds.matchTransform(obj, loc) cmds.delete(loc) cmds.select(obj) else: cmds.iconTextButton( 'btnSaveLoadTransform', e=1, image='load_transform.png' ) loc = cmds.spaceLocator(name="xLEAVEMEALONE")[0] cmds.matchTransform(loc, obj) cmds.setAttr("%s.v"%loc, 0) utility.fixedObj([loc]) cmds.select(obj)
def er_checkBoxSel(status = 0): print 'rrrr' currentMod = mc.optionMenu('Er_Mods_OM',q = True,v = True) rowlays = mc.scrollLayout('Er_CheckSL',q = True,ca = True) ern = 0 for rowlay in rowlays: if not status == 2: mc.checkBox('%s_checkBox'%rowlay,e = True,v = status) elif status == 2: if mc.iconTextButton('%s_icon'%rowlay,q = True, image1=True) == 'check_Wrong.png': mc.checkBox('%s_checkBox'%rowlay,e = True,v = 1) else: mc.checkBox('%s_checkBox'%rowlay,e = True,v = 0) ern += 1
def _showUI(self): self.close() cmds.window('MouseMoCap', title="MouseMoCap") # , widthHeight=(260, 180)) cmds.columnLayout(adjustableColumn=True, cw=200) cmds.separator(h=15, style='none') cmds.text(' Use the Mouse as a MoCap input devise ') cmds.separator(h=15, style='none') cmds.button(label='Set Attributes to Record (chBox)', ann='Prime Selected Attributes in the channelBox for Recording', command=partial(self.addAttrsToRecord)) cmds.separator(h=5, style='none') cmds.button(label='Remove Record Attributes (chBox)', ann='Remove Attrs from Record selected in the channelBox', command=partial(self.removeAttrsToRecord)) cmds.separator(h=15, style='none') cmds.button('MouseMoCapRecord', label='RECORD', bgc=[0.1, 0.8, 0.1], command=partial(self._runRecord)) cmds.separator(h=25, style='none') cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp', c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200) cmds.separator(h=15, style='none') cmds.showWindow('MouseMoCap')
def build(parent, imagesPath, iconSize=25, height=20, marginSize=5): """ build widget @param parent : parent layout in maya @imagesPath : str path """ cmds.rowLayout(numberOfColumns=2, parent=parent) cmds.iconTextButton( style='iconOnly', image1=os.path.join(imagesPath, 'conit.png'), hi=os.path.join(imagesPath, 'conit_hi.png'), width=iconSize, mw=marginSize, height=iconSize, mh=marginSize, label='conit', npm=1, annotation= 'Fake Constraint, select source and shift select destination. Right click for Reset Menu', c=fakeConIt) cmds.popupMenu() cmds.menuItem(label="Reset", command=fakeConItReset) cmds.setParent("..")
def dropCommand(self, targetGeo, sldrGrp, *args): print "dropCommand passingAttr = %s\ndrop passingSG = %s" % ( GeoObject.passingAttr, GeoObject.passingSG) #connect geo to passed sg cmds.sets(targetGeo, e=True, forceElement=GeoObject.passingSG) #connect slider to passed attr shd = cmds.listConnections("%s.surfaceShader" % GeoObject.passingSG)[0] cmds.attrColorSliderGrp(sldrGrp, e=True, at="%s.%s" % (shd, GeoObject.passingAttr)) #deactivate createButton cmds.button(self.createButton, e=True, bgc=(.5, .2, .2)) #activate drag functionality shd = cmds.listConnections("%s.surfaceShader" % GeoObject.passingSG)[0] self.shadingGroup = GeoObject.passingSG self.colorAttr = GeoObject.passingAttr self.shaderName = cmds.listConnections("%s.surfaceShader" % self.shadingGroup)[0] cmds.iconTextButton(self.dragBut, e=True, dgc=partial(self.dragCommand, self.shadingGroup, GeoObject.passingAttr)) cmds.textField(self.shadText, e=True, tx=self.shaderName)
def HbChangeColor(self, projectInfo): getTheSelect = mc.textScrollList("TheDateLibSc", q=1, si=1) questSets = mc.optionMenu("EPNUM", q=True, v=True) questEP = mc.optionMenu("EP", q=True, v=True) path = "//file-cluster/GDC/Projects/" + projectInfo + "/" + projectInfo + "_Scratch/TD/SetCam/" + questEP + "/" + questSets + "/images/" TheUpDateSc = os.listdir(path) TheBmp = [] for i in range(len(TheUpDateSc)): if TheUpDateSc[i].split(".")[-1] == "bmp": TheBmp.append(TheUpDateSc[i]) for j in range(len(TheBmp)): theCommand = 'HbImportReCam(\"' + TheBmp[j] + '\")' theCommand2 = 'HbImageOk(\"' + TheBmp[j] + '\")' theCommand3 = 'HbCancleHook(\"' + TheBmp[j] + '\")' if TheBmp[j].find(getTheSelect[0]) == -1: mc.iconTextButton("Temp" + str(j) , e=1, visible=1, bgc=(1, 1, 1), style='iconAndTextVertical', image1="Z:/Projects/ZoomWhiteDolphin/ZoomWhiteDolphin_Scratch/TD/SetCam/" + questEP + "/" + questSets + "/images/" + TheBmp[j], label=TheBmp[j].split(".")[0], c=theCommand) if TheBmp[j].find(getTheSelect[0]) != -1: mc.iconTextButton("Temp" + str(j) , e=1, visible=1, bgc=(1, 0, 0), style='iconAndTextVertical', image1="Z:/Projects/ZoomWhiteDolphin/ZoomWhiteDolphin_Scratch/TD/SetCam/" + questEP + "/" + questSets + "/images/" + TheBmp[j], label=TheBmp[j].split(".")[0], c=theCommand) mc.menuItem("TheObMenu" + str(j), e=1, l="This Camera is ok", c=theCommand2) mc.menuItem("Cancle" + str(j), e=1, l="cancle the hook", c=theCommand3)
def layoutForLayer( self, layer ): """ Build the UI for the specified layer. We need to access the UI data later in callbacks. So we store the data inside a dictionary for reference layer. """ ui = {} #frlt = cmds.frameLayout( collapsable=True, borderStyle="out", label="Layer %d" % layer ) locLayer = maya.stringTable['y_cameraSetTool.kLayerNumberString' ] frlt = cmds.frameLayout( collapsable=True, label= locLayer + " %d" % layer ) ui['frame'] = frlt self._layerFrameUI.append(ui) cmds.columnLayout( adjustableColumn=True ) ui['layerPrefix'] = cmds.textFieldGrp( label=maya.stringTable['y_cameraSetTool.kLabelPrefix'], text=self._template.layerPrefixForLayer(layer)) ui['menuGrp'] = cmds.optionMenuGrp( label=maya.stringTable['y_cameraSetTool.kRigType'] ) opValue = rigTypeLayer = self._template.rigTypeForLayer( layer ) rigs = cmds.stereoRigManager( listRigs=True ) for r in rigs: cmds.menuItem( label=r ) if not opValue in rigs: cmds.menuItem( label=opValue ) cmds.optionMenuGrp( ui['menuGrp'], edit=True, value=opValue ) # For some reason, the only way I can get the check box to line # up is if I embed it in a form layout. # form = cmds.formLayout() ui['ckbox'] = cmds.checkBox( label=maya.stringTable['y_cameraSetTool.kAutoCreate' ] ) ui['icon'] = cmds.iconTextButton(style="iconOnly", image="removeRenderable.png", annotation=maya.stringTable['y_cameraSetTool.kDelete' ], width=20, height=20) cmds.checkBox( ui['ckbox'], edit=True, value=self._template.autoCreateSet( layer ) ) cmds.formLayout( form, edit=True, attachForm=[(ui['ckbox'], "left", 125), (ui['ckbox'], "top", 0), (ui['ckbox'], "bottom", 0), (ui['icon'], "top", 0), (ui['icon'], "bottom",0), (ui['icon'], "right",5)], attachNone=[(ui['ckbox'],"right"), (ui['icon'], "left")] ) self._setCallbacks( layer ) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..')