Python maya.cmds.showWindow() Examples
The following are 27
code examples of maya.cmds.showWindow().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
maya.cmds
, or try the search function
.
Example #1
Source File: ml_breakdown.py From ml_tools with MIT License | 7 votes |
def quickBreakDownUI(): winName = 'ml_quickBreakdownWin' if mc.window(winName, exists=True): mc.deleteUI(winName) mc.window(winName, title='ml :: QBD', iconName='Quick Breakdown', width=100, height=500) mc.columnLayout(adj=True) mc.paneLayout(configuration='vertical2', separatorThickness=1) mc.text('<<') mc.text('>>') mc.setParent('..') for v in (10,20,50,80,90,100,110,120,150): mc.paneLayout(configuration='vertical2',separatorThickness=1) mc.button(label=str(v)+' %', command=partial(weightPrevious,v/100.0)) mc.button(label=str(v)+' %', command=partial(weightNext,v/100.0)) mc.setParent('..') mc.showWindow(winName) mc.window(winName, edit=True, width=100, height=250)
Example #2
Source File: createSpiralWin.py From tutorials with MIT License | 7 votes |
def createSpiralWin(): window = cmds.window( title="Create Spiral", widthHeight=(200, 300) ) cmds.columnLayout( columnAttach=('both', 5), rowSpacing=5, adjustableColumn=True ) amp = cmds.floatFieldGrp( numberOfFields=1, label='Amp', value1=1.0) spin = cmds.floatFieldGrp( numberOfFields=1, label='Spin', value1=30) count = cmds.intFieldGrp( numberOfFields=1, label='Count', value1=20) width = cmds.floatFieldGrp( numberOfFields=1, label='Width', value1=3) def click(value): doCreateSpiral(amp, spin, count, width) cmds.button( label='Create Spiral!', command=click ) closeCmd = 'cmds.deleteUI("%s", window=True)' % window cmds.button( label='Close', command=closeCmd ) cmds.showWindow( window )
Example #3
Source File: dpAutoRig.py From dpAutoRigSystem with GNU General Public License v2.0 | 6 votes |
def info(self, title, description, text, align, width, height, *args): """ Create a window showing the text info with the description about any module. """ # declaring variables: self.info_title = title self.info_description = description self.info_text = text self.info_winWidth = width self.info_winHeight = height self.info_align = align # creating Info Window: if cmds.window('dpInfoWindow', query=True, exists=True): cmds.deleteUI('dpInfoWindow', window=True) dpInfoWin = cmds.window('dpInfoWindow', title='dpAutoRig - v'+DPAR_VERSION+' - '+self.langDic[self.langName]['i013_info']+' - '+self.langDic[self.langName][self.info_title], iconName='dpInfo', widthHeight=(self.info_winWidth, self.info_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False) # creating text layout: infoColumnLayout = cmds.columnLayout('infoColumnLayout', adjustableColumn=True, columnOffset=['both', 20], parent=dpInfoWin) cmds.separator(style='none', height=10, parent=infoColumnLayout) infoLayout = cmds.scrollLayout('infoLayout', parent=infoColumnLayout) if self.info_description: infoDesc = cmds.text(self.langDic[self.langName][self.info_description], align=self.info_align, parent=infoLayout) if self.info_text: infoText = cmds.text(self.info_text, align=self.info_align, parent=infoLayout) # call Info Window: cmds.showWindow(dpInfoWin)
Example #4
Source File: ml_arcTracer.py From ml_tools with MIT License | 6 votes |
def mini(): name = 'ml_arcTracer_win_mini' w = 100 h = 50 if mc.window(name, exists=True): mc.deleteUI(name) win = mc.window(name, width=w, height=h, title='arcs', iconName='arc') form = mc.formLayout() a1 = mc.button(label='camera', command=traceCamera) a2 = mc.button(label='world', command=traceWorld) b1 = mc.button(label='retrace', command=retraceArc) b2 = mc.button(label='clear', command=clearArcs) utl.formLayoutGrid(form, [[a1,a2],[b1,b2]], ) mc.showWindow(win) mc.window(win, edit=True, width=w, height=h)
Example #5
Source File: ml_utilities.py From ml_tools with MIT License | 6 votes |
def finish(self): ''' Finalize the UI ''' mc.setParent(self.form) frame = mc.frameLayout(labelVisible=False) mc.helpLine() mc.formLayout( self.form, edit=True, attachForm=((self.column, 'top', 0), (self.column, 'left', 0), (self.column, 'right', 0), (frame, 'left', 0), (frame, 'bottom', 0), (frame, 'right', 0)), attachNone=((self.column, 'bottom'), (frame, 'top')) ) mc.showWindow(self.name) mc.window(self.name, edit=True, width=self.width, height=self.height)
Example #6
Source File: dpLayoutClass.py From dpAutoRigSystem with GNU General Public License v2.0 | 6 votes |
def colorizeModuleUI(self, colorIndex, *args): """ Show a little window to choose the color of the button and the override the guide. """ # verify integrity of the guideModule: if self.verifyGuideModuleIntegrity(): # creating colorIndex Window: if cmds.window('dpColorIndexWindow', query=True, exists=True): cmds.deleteUI('dpColorIndexWindow', window=True) colorIndex_winWidth = 160 colorIndex_winHeight = 80 self.dpColorIndexWin = cmds.window('dpColorIndexWindow', title='Color Index', iconName='dpColorIndex', widthHeight=(colorIndex_winWidth, colorIndex_winHeight), menuBar=False, sizeable=False, minimizeButton=False, maximizeButton=False, menuBarVisible=False, titleBar=True) # creating layout: colorIndexLayout = cmds.gridLayout('colorIndexLayout', numberOfColumns=8, cellWidthHeight=(20,20)) # creating buttons: for colorIndex, colorValues in enumerate(self.colorList): cmds.button('indexColor_'+str(colorIndex)+'_BT', label=str(colorIndex), backgroundColor=(colorValues[0], colorValues[1], colorValues[2]), command=partial(self.setColorModule, colorIndex), parent=colorIndexLayout) # call colorIndex Window: cmds.showWindow(self.dpColorIndexWin)
Example #7
Source File: dpReorderAttr.py From dpAutoRigSystem with GNU General Public License v2.0 | 6 votes |
def dpReorderAttrUI(self, *args): """ Create a window in order to load the original model and targets to be mirrored. """ # creating dpReorderAttrUI Window: self.dpCloseReorderAttrUI() reorderAttr_winWidth = 175 reorderAttr_winHeight = 75 dpReorderAttrWin = cmds.window('dpReorderAttrWindow', title=self.langDic[self.langName]["m087_reorderAttr"]+" "+DPRA_VERSION, widthHeight=(reorderAttr_winWidth, reorderAttr_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False, menuBarVisible=False, titleBar=True) # creating layout: reorderAttrLayout = cmds.columnLayout('reorderAttrLayout', columnOffset=("left", 30)) cmds.separator(style='none', height=7, parent=reorderAttrLayout) cmds.button(label=self.langDic[self.langName]["i154_up"], annotation=self.langDic[self.langName]["i155_upDesc"], width=110, backgroundColor=(0.45, 1.0, 0.6), command=partial(self.dpMoveAttr, 1, None, None, True), parent=reorderAttrLayout) cmds.separator(style='in', height=10, width=110, parent=reorderAttrLayout) cmds.button(label=self.langDic[self.langName]["i156_down"], annotation=self.langDic[self.langName]["i157_downDesc"], width=110, backgroundColor=(1.0, 0.45, 0.45), command=partial(self.dpMoveAttr, 0, None, None, True), parent=reorderAttrLayout) # call dpReorderAttrUI Window: cmds.showWindow(dpReorderAttrWin)
Example #8
Source File: dpIkFkSnap.py From dpAutoRigSystem with GNU General Public License v2.0 | 6 votes |
def dpIkFkSnapUI(self, *args): """ Show a little window with buttons to change from Ik to Fk or from Fk to Ik snapping. """ # creating ikFkSnap Window: if cmds.window('dpIkFkSnapWindow', query=True, exists=True): cmds.deleteUI('dpIkFkSnapWindow', window=True) ikFkSnap_winWidth = 205 ikFkSnap_winHeight = 50 dpIkFkSnapWin = cmds.window('dpIkFkSnapWindow', title='IkFkSnap '+DPIKFK_VERSION, iconName='dpIkFkSnap', widthHeight=(ikFkSnap_winWidth, ikFkSnap_winHeight), menuBar=False, sizeable=True, minimizeButton=True, maximizeButton=False, menuBarVisible=False, titleBar=True) # creating layout: ikFkSnapLayout = cmds.columnLayout('ikFkSnapLayout', adjustableColumn=True, parent=dpIkFkSnapWin) # creating buttons: cmds.button('ikToFkSnap_BT', label="Ik --> Fk", backgroundColor=(0.8, 0.8, 1.0), command=self.IkToFkSnap, parent=ikFkSnapLayout) cmds.button('fkToIkSnap_BT', label="Fk --> Ik", backgroundColor=(1.0, 0.8, 0.8), command=self.FkToIkSnap, parent=ikFkSnapLayout) # call colorIndex Window: cmds.showWindow(dpIkFkSnapWin)
Example #9
Source File: dpAutoRig.py From dpAutoRigSystem with GNU General Public License v2.0 | 6 votes |
def donateWin(self, *args): """ Simple window with links to donate in order to support this free and openSource code via PayPal. """ # declaring variables: self.donate_title = 'dpAutoRig - v'+DPAR_VERSION+' - '+self.langDic[self.langName]['i167_donate'] self.donate_description = self.langDic[self.langName]['i168_donateDesc'] self.donate_winWidth = 305 self.donate_winHeight = 300 self.donate_align = "center" # creating Donate Window: if cmds.window('dpDonateWindow', query=True, exists=True): cmds.deleteUI('dpDonateWindow', window=True) dpDonateWin = cmds.window('dpDonateWindow', title=self.donate_title, iconName='dpInfo', widthHeight=(self.donate_winWidth, self.donate_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False) # creating text layout: donateColumnLayout = cmds.columnLayout('donateColumnLayout', adjustableColumn=True, columnOffset=['both', 20], rowSpacing=5, parent=dpDonateWin) cmds.separator(style='none', height=10, parent=donateColumnLayout) infoDesc = cmds.text(self.donate_description, align=self.donate_align, parent=donateColumnLayout) cmds.separator(style='none', height=10, parent=donateColumnLayout) brPaypalButton = cmds.button('brlPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - R$ - Real", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"BRL"), parent=donateColumnLayout) #usdPaypalButton = cmds.button('usdPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - USD - Dollar", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"USD"), parent=donateColumnLayout) # call Donate Window: cmds.showWindow(dpDonateWin)
Example #10
Source File: dpAutoRig.py From dpAutoRigSystem with GNU General Public License v2.0 | 5 votes |
def dpARLoadingWindow(): """ Just create a Loading window in order to show we are working to user when calling dpAutoRigSystem. """ loadingString = "Loading dpAutoRigSystem v%s ... " %DPAR_VERSION print loadingString, path = os.path.dirname(__file__) randImage = random.randint(0,7) clearDPARLoadingWindow() cmds.window('dpARLoadWin', title='dpAutoRigSystem', iconName='dpAutoRig', widthHeight=(285, 203), menuBar=False, sizeable=False, minimizeButton=False, maximizeButton=False) cmds.columnLayout('dpARLoadLayout') cmds.image('loadingImage', image=(path+"/Icons/dp_loading_0%i.png" %randImage), backgroundColor=(0.8, 0.8, 0.8), parent='dpARLoadLayout') cmds.text('versionText', label=loadingString, parent='dpARLoadLayout') cmds.showWindow('dpARLoadWin')
Example #11
Source File: dpColorOverride.py From dpAutoRigSystem with GNU General Public License v2.0 | 5 votes |
def dpColorizeUI(self, *args): """ Show a little window to choose the color of the button and the override the guide. """ #Get Maya colors #Manually add the "none" color colorList = [[0.627, 0.627, 0.627]] #WARNING --> color index in maya start to 1 colorList += [cmds.colorIndex(iColor, q=True) for iColor in range(1,32)] # creating colorOverride Window: if cmds.window('dpColorOverrideWindow', query=True, exists=True): cmds.deleteUI('dpColorOverrideWindow', window=True) colorOverride_winWidth = 170 colorOverride_winHeight = 115 dpColorOverrideWin = cmds.window('dpColorOverrideWindow', title='Color Override '+DPCO_VERSION, iconName='dpColorOverride', widthHeight=(colorOverride_winWidth, colorOverride_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False, menuBarVisible=False, titleBar=True) # creating layout: colorTabLayout = cmds.tabLayout('colorTabLayout', innerMarginWidth=5, innerMarginHeight=5, parent=dpColorOverrideWin) # Index layout: colorIndexLayout = cmds.gridLayout('colorIndexLayout', numberOfColumns=8, cellWidthHeight=(20,20), parent=colorTabLayout) # creating buttons for colorIndex, colorValues in enumerate(colorList): cmds.button('indexColor_'+str(colorIndex)+'_BT', label=str(colorIndex), backgroundColor=(colorValues[0], colorValues[1], colorValues[2]), command=partial(self.dpSetColorIndexToSelect, colorIndex), parent=colorIndexLayout) # RGB layout: colorRGBLayout = cmds.columnLayout('colorRGBLayout', adjustableColumn=True, columnAlign='left', rowSpacing=10, parent=colorTabLayout) cmds.separator(height=10, style='none', parent=colorRGBLayout) self.colorRGBSlider = cmds.colorSliderGrp('colorRGBSlider', label='Color', columnAlign3=('right', 'left', 'left'), columnWidth3=(30, 60, 50), columnOffset3=(10, 10, 10), rgbValue=(0, 0, 0), changeCommand=self.dpSetColorRGBToSelect, parent=colorRGBLayout) # renaming tabLayouts: cmds.tabLayout(colorTabLayout, edit=True, tabLabel=((colorIndexLayout, "Index"), (colorRGBLayout, "RGB"))) # call colorIndex Window: cmds.showWindow(dpColorOverrideWin)
Example #12
Source File: dpCopyPasteAttr.py From dpAutoRigSystem with GNU General Public License v2.0 | 5 votes |
def copyPasteAttrUI(self, *args): """ UI (window). """ self.closeCopyPasteAttrUI() # UI: dpCopyPasteAttrWin = cmds.window('dpCopyPasteAttrWin', title='CopyPasteAttr - v'+DPCP_VERSION, width=200, height=75, sizeable=True, minimizeButton=False, maximizeButton=False) # UI elements: mainLayout = cmds.columnLayout('mainLayout', width=150, height=75, adjustableColumn=True, parent=dpCopyPasteAttrWin) copyButton = cmds.button('copyButton', label=self.langDic[self.langName]['i122_copyAttr'], command=partial(self.ctrls.copyAttr, verbose=True), backgroundColor=(0.7, 1.0, 0.7), parent=mainLayout) pasteButton = cmds.button('pasteButton', label=self.langDic[self.langName]['i123_pasteAttr'], command=partial(self.ctrls.pasteAttr, verbose=True), backgroundColor=(1.0, 1.0, 0.7), parent=mainLayout) copyAndPasteButton = cmds.button('copyAndPasteButton', label=self.langDic[self.langName]['i124_copyPasteAttr'], command=partial(self.ctrls.copyAndPasteAttr, True), backgroundColor=(0.7, 0.9, 1.0), parent=mainLayout) # calling UI: cmds.showWindow(dpCopyPasteAttrWin)
Example #13
Source File: sqCopyPasteShapes.py From dpAutoRigSystem with GNU General Public License v2.0 | 5 votes |
def __init__(self, *args, **kwargs): if cmds.window("CopyPasteShapes", query=True, exists=True): cmds.deleteUI("CopyPasteShapes") win = cmds.window('sqCopyPasteShapesWindow', title='CopyPasteShapes', widthHeight=(200, 100), menuBar=False, sizeable=True, minimizeButton=True, maximizeButton=False, menuBarVisible=False, titleBar=True) layout = cmds.columnLayout('sqCopyPasteShapesLayout', adjustableColumn=True, parent=win) cmds.button('sqCopyPasteShapesBtnSave', label="Save", backgroundColor=(0.8, 0.8, 1.0), command=self.onBtnSavePressed, parent=layout) cmds.button('sqCopyPasteShapesBtnLoad', label="Load", backgroundColor=(1.0, 0.8, 0.8), command=self.onBtnLoadPressed, parent=layout) cmds.showWindow(win)
Example #14
Source File: playblast.py From dpa-pipe with MIT License | 5 votes |
def floatUI(): # Check to see if window exists if cmds.window("PBQuality", exists=True): cmds.deleteUI("PBQuality") # Create window window = cmds.window("PBQuality", title="DPA Playblast", w=300, h=100, mnb=False, mxb=False, sizeable=False) # Create a main layout mainLayout = cmds.columnLayout(adj=True) blastLayout = cmds.columnLayout("blastLayout", p=mainLayout, w=260, adj=False, rs=5, cat=('left', 5)) cmds.separator(p=blastLayout) cmds.text(label="Enter desired playbast quality:", p=blastLayout) qualityField = cmds.floatField("playblastValue", p=blastLayout, w=250, min=50, max=100, pre=0, step=1, v=90, ed=True) qualitySlider = cmds.floatSlider("playblastPercentage", p=blastLayout, w=250, min=50, max=100, step=1, v=90, dc=updatePercent) cmds.separator(p=blastLayout) sequenceOption = cmds.checkBox("sequenceOption", label="From Sequence", value=False) reviewOption = cmds.checkBox("reviewOption", label="Auto-bot review submission", value=False) cmds.separator(p=blastLayout) confirmLayout = cmds.rowColumnLayout("confirmLayout", p=mainLayout, w=250, nc=2, rs=(5, 5), co=[(1, 'left', 5), (2, 'right', 5)], cw=[(1, 125), (2, 125)]) cancelButton = cmds.button("cancelButton", p=confirmLayout, label="Cancel", c="cmds.deleteUI('PBQuality')", w=80, h=30) pbButton = cmds.button("pbButton", p=confirmLayout, label="Playblast", c=handlePB, w=100, h=30) cmds.separator(p=confirmLayout) cmds.showWindow(window)
Example #15
Source File: ml_puppet.py From ml_tools with MIT License | 5 votes |
def show(self): mc.showWindow(self.win_name) mc.window(self.win_name, edit=True, width=self.width, height=self.height)
Example #16
Source File: __init__.py From mGui with MIT License | 5 votes |
def show(self): cmds.showWindow(self.widget)
Example #17
Source File: dpAutoRig.py From dpAutoRigSystem with GNU General Public License v2.0 | 5 votes |
def updateWin(self, rawResult, text, *args): """ Create a window showing the text info with the description about any module. """ # declaring variables: self.update_checkedNumber = rawResult[0] self.update_remoteVersion = rawResult[1] self.update_remoteLog = rawResult[2] self.update_text = text self.update_winWidth = 305 self.update_winHeight = 300 # creating Update Window: if cmds.window('dpUpdateWindow', query=True, exists=True): cmds.deleteUI('dpUpdateWindow', window=True) dpUpdateWin = cmds.window('dpUpdateWindow', title='dpAutoRigSystem - '+self.langDic[self.langName]['i089_update'], iconName='dpInfo', widthHeight=(self.update_winWidth, self.update_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False) # creating text layout: updateLayout = cmds.columnLayout('updateLayout', adjustableColumn=True, columnOffset=['both', 20], rowSpacing=5, parent=dpUpdateWin) if self.update_text: updateDesc = cmds.text("\n"+self.langDic[self.langName][self.update_text], align="center", parent=updateLayout) cmds.text("\n"+DPAR_VERSION+self.langDic[self.langName]['i090_currentVersion'], align="left", parent=updateLayout) if self.update_remoteVersion: cmds.text(self.update_remoteVersion+self.langDic[self.langName]['i091_onlineVersion'], align="left", parent=updateLayout) cmds.separator(height=30) if self.update_remoteLog: remoteLog = self.update_remoteLog.replace("\\n", "\n") cmds.text(self.langDic[self.langName]['i171_updateLog']+":\n", align="center", parent=updateLayout) cmds.text(remoteLog, align="left", parent=updateLayout) cmds.separator(height=30) whatsChangedButton = cmds.button('whatsChangedButton', label=self.langDic[self.langName]['i117_whatsChanged'], align="center", command=partial(utils.visitWebSite, DPAR_WHATSCHANGED), parent=updateLayout) visiteGitHubButton = cmds.button('visiteGitHubButton', label=self.langDic[self.langName]['i093_gotoWebSite'], align="center", command=partial(utils.visitWebSite, DPAR_GITHUB), parent=updateLayout) if (int(cmds.about(version=True)[:4]) < 2019) and platform.system() == "Darwin": #Maya 2018 or older on macOS upgradeSSLmacOSButton = cmds.button('upgradeSSLmacOSButton', label=self.langDic[self.langName]['i164_sslMacOS'], align="center", backgroundColor=(0.8, 0.4, 0.4), command=partial(utils.visitWebSite, SSL_MACOS), parent=updateLayout) downloadButton = cmds.button('downloadButton', label=self.langDic[self.langName]['i094_downloadUpdate'], align="center", command=partial(self.downloadUpdate, DPAR_MASTERURL, "zip"), parent=updateLayout) installButton = cmds.button('installButton', label=self.langDic[self.langName]['i095_installUpdate'], align="center", command=partial(self.installUpdate, DPAR_MASTERURL, self.update_remoteVersion), parent=updateLayout) # automatically check for updates: cmds.separator(height=30) self.autoCheckUpdateCB = cmds.checkBox('autoCheckUpdateCB', label=self.langDic[self.langName]['i092_autoCheckUpdate'], align="left", value=self.userDefAutoCheckUpdate, changeCommand=self.setAutoCheckUpdatePref, parent=updateLayout) cmds.separator(height=30) # call Update Window: cmds.showWindow(dpUpdateWin) print self.langDic[self.langName][self.update_text]
Example #18
Source File: dpTranslator.py From dpAutoRigSystem with GNU General Public License v2.0 | 5 votes |
def dpGetUserInfoUI(self, *args): """ First window UI to get the basic user info for sentence ids starting with "_". """ self.dpClearTranslatorUI(1) # starting window: dpARTranslatorWin1 = cmds.window('dpARTranslatorWin1', title=self.translatorString, iconName='dpAutoRig', widthHeight=(500, 180), menuBar=False, sizeable=True, minimizeButton=True, maximizeButton=True) dpARTranslatorLayout1 = cmds.columnLayout('dpARTranslatorLayout1', adjustableColumn=True, columnOffset=('both', 10), rowSpacing=10, parent=dpARTranslatorWin1) cmds.separator(style='none', parent=dpARTranslatorLayout1) self.authorTFG = cmds.textFieldGrp('authorTFG', label=self.langDic[self.langName]['t002_yourName'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1) self.emailTFG = cmds.textFieldGrp('emailTFG', label=self.langDic[self.langName]['t003_emailContact'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1) self.websiteTFG = cmds.textFieldGrp('websiteTFG', label=self.langDic[self.langName]['t004_websiteContact'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1) self.newLanguageTFG = cmds.textFieldGrp('newLanguageTFG', label=self.langDic[self.langName]['t005_langName'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1) cmds.button('startTranslationBT', label=self.langDic[self.langName]['t006_startTranslator'], command=self.dpCollectUserInfo, parent=dpARTranslatorLayout1) # show UI: cmds.showWindow(dpARTranslatorWin1)
Example #19
Source File: reusableUI.py From PythonForMayaSamples with GNU General Public License v3.0 | 5 votes |
def show(self): if cmds.window(self.windowName, query=True, exists=True): self.close() cmds.window(self.windowName) self.buildUI() cmds.showWindow()
Example #20
Source File: tweener.py From PythonForMayaSamples with GNU General Public License v3.0 | 5 votes |
def show(self): # First we check if a window of this name already exists. # This prevents us having many tweener windows when we just want one if cmds.window(self.windowName, query=True, exists=True): # If another window of the same name exists, we close it by deleting it cmds.deleteUI(self.windowName) # Now we create a window using our name cmds.window(self.windowName) # Now we call our buildUI method to build out the insides of the UI self.buildUI() # Finally we must actually show the window cmds.showWindow()
Example #21
Source File: menu.py From cmt with MIT License | 5 votes |
def about(): """Displays the CMT About dialog.""" name = "cmt_about" if cmds.window(name, exists=True): cmds.deleteUI(name, window=True) if cmds.windowPref(name, exists=True): cmds.windowPref(name, remove=True) window = cmds.window( name, title="About CMT", widthHeight=(600, 500), sizeable=False ) form = cmds.formLayout(nd=100) text = cmds.scrollField(editable=False, wordWrap=True, text=cmt.__doc__.strip()) button = cmds.button( label="Documentation", command="import cmt.menu; cmt.menu.documentation()" ) margin = 8 cmds.formLayout( form, e=True, attachForm=( (text, "top", margin), (text, "right", margin), (text, "left", margin), (text, "bottom", 40), (button, "right", margin), (button, "left", margin), (button, "bottom", margin), ), attachControl=((button, "top", 2, text)), ) cmds.showWindow(window)
Example #22
Source File: ml_pivot.py From ml_tools with MIT License | 5 votes |
def editPivotDriver(self, driver): self.pivotDriver = driver #get driver range node,attr = driver.split('.',1) value = mc.getAttr(driver) minValue = mc.attributeQuery(attr, node=node, minimum=True)[0] maxValue = mc.attributeQuery(attr, node=node, maximum=True)[0] #create a ui with a slider self.pivotDriverWindow = 'ml_pivot_editPivotDriverUI' if mc.window(self.pivotDriverWindow, exists=True): mc.deleteUI(self.pivotDriverWindow) window = mc.window(self.pivotDriverWindow, width=1, height=1) mc.columnLayout() self.floatSlider = mc.floatSliderButtonGrp(label=attr, field=True, value=value, buttonLabel='Bake', minValue=minValue, maxValue=maxValue, buttonCommand=self.doEditPivotDriver ) mc.showWindow( window ) mc.window(self.pivotDriverWindow, edit=True, width=1, height=1)
Example #23
Source File: mlSSDS.py From ssds with MIT License | 4 votes |
def showBuildWindow(arg): labelWidth = 100 fieldWidth = 100 cmds.window(uiWindowName, title = 'SSDS') cmds.formLayout(uiFormName) cmds.columnLayout(uiFormLayoutName, rowSpacing = 5) # joints cmds.rowLayout(uiNumJointsName[0], numberOfColumns = 2, columnWidth2 = (labelWidth, fieldWidth), columnAlign2 = ('right', 'right')) cmds.text(label = '# Joints') cmds.intField(uiNumJointsName[1], minValue = 0, maxValue = 100, value = 1, width = fieldWidth) cmds.setParent('..') # max influences cmds.rowLayout(uiMaxInfluenceName[0], numberOfColumns = 2, columnWidth2 = (labelWidth, fieldWidth), columnAlign2 = ('right', 'right')) cmds.text(label = 'Max Influences') cmds.intField(uiMaxInfluenceName[1], minValue = 1, maxValue = 8, value = 4, width = fieldWidth) cmds.setParent('..') # iterations cmds.rowLayout(uiNumIterationsName[0], numberOfColumns = 2, columnWidth2 = (labelWidth, fieldWidth), columnAlign2 = ('right', 'right')) cmds.text(label = '# Iterations') cmds.intField(uiNumIterationsName[1], minValue = 0, maxValue = 100, value = 10, width = fieldWidth) cmds.setParent('..') # transform type cmds.rowLayout('SsdsTransformTypeLayout', numberOfColumns = 2, columnWidth2 = (labelWidth, fieldWidth), columnAlign2 = ('right', 'right')) cmds.text(label = 'Transform Type') cmds.columnLayout('temporary', rowSpacing = 3) cmds.radioCollection(uiTransformRadioCollectionName) cmds.radioButton(uiTransformNames[0], label = 'T') cmds.radioButton(uiTransformNames[1], label = 'R+T') cmds.radioButton(uiTransformNames[2], label = 'S+R+T') cmds.radioCollection(uiTransformRadioCollectionName, edit = True, select = uiTransformNames[2]) cmds.setParent(uiFormLayoutName) # concentrate cmds.rowLayout(uiConcentrateName[0], numberOfColumns = 2, columnWidth2 = (labelWidth, fieldWidth), columnAlign2 = ('right', 'right')) cmds.text(label = 'Concentrate') cmds.floatField(uiConcentrateName[1], minValue = 0, maxValue = 100, value = 0.0, precision = 3, width = fieldWidth) cmds.setParent('..') # build cmds.button(uiBuildButtonName, label='Build', command = invokeBuild, width = labelWidth + fieldWidth) cmds.formLayout(uiFormName, edit = True, attachForm = [(uiFormLayoutName, 'top', 5), (uiFormLayoutName, 'left', 5), (uiFormLayoutName, 'right', 5)]) cmds.showWindow(uiWindowName)
Example #24
Source File: dpTargetMirror.py From dpAutoRigSystem with GNU General Public License v2.0 | 4 votes |
def dpTargetMirrorUI(self, *args): """ Create a window in order to load the original model and targets to be mirrored. """ # creating targetMirrorUI Window: if cmds.window('dpTargetMirrorWindow', query=True, exists=True): cmds.deleteUI('dpTargetMirrorWindow', window=True) targetMirror_winWidth = 305 targetMirror_winHeight = 250 dpTargetMirrorWin = cmds.window('dpTargetMirrorWindow', title=self.langDic[self.langName]["m055_tgtMirror"]+" "+DPTM_VERSION, widthHeight=(targetMirror_winWidth, targetMirror_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False, menuBarVisible=False, titleBar=True) # creating layout: targetMirrorLayout = cmds.columnLayout('targetMirrorLayout') doubleLayout = cmds.rowColumnLayout('doubleLayout', numberOfColumns=2, columnWidth=[(1, 120), (2, 190)], columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'left', 10), (2, 'left', 20)], parent=targetMirrorLayout) cmds.button(label=self.langDic[self.langName]["i043_origModel"]+" >", annotation=self.langDic[self.langName]["i044_origDesc"], backgroundColor=(1.0, 1.0, 0.7), width=120, command=self.dpLoadOriginalModel, parent=doubleLayout) self.originalModelTextField = cmds.textField('originalModelTextField', width=160, text="", parent=doubleLayout) listMirrorLayout = cmds.columnLayout('listMirrorLayout', columnOffset=('left', 10), width=310, parent=targetMirrorLayout) cmds.text(label=self.langDic[self.langName]["i047_targetList"], height=30, parent=listMirrorLayout) self.targetScrollList = cmds.textScrollList('targetScrollList', width=290, height=100, allowMultiSelection=True, parent=listMirrorLayout) cmds.separator(style='none', parent=listMirrorLayout) middleLayout = cmds.rowColumnLayout('middleLayout', numberOfColumns=2, columnWidth=[(1, 150), (2, 150)], columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'left', 0), (2, 'left', 0)], parent=listMirrorLayout) cmds.button(label=self.langDic[self.langName]["i045_add"], annotation=self.langDic[self.langName]["i048_addDesc"], width=140, command=self.dpAddSelect, parent=middleLayout) cmds.button(label=self.langDic[self.langName]["i046_remove"], annotation=self.langDic[self.langName]["i051_removeDesc"], width=140, command=self.dpRemoveSelect, parent=middleLayout) cmds.separator(style='none', height=15, parent=middleLayout) renameLayout = cmds.rowColumnLayout('renameLayout', numberOfColumns=3, columnWidth=[(1, 100), (2, 100), (3, 100)], columnAlign=[(1, 'left'), (2, 'left'), (3, 'left')], columnAttach=[(1, 'left', 0), (2, 'left', 0), (3, 'left', 0)], parent=listMirrorLayout) self.autoRenameCB = cmds.checkBox('autoRenameCB', label=self.langDic[self.langName]["i056_autoRename"], value=1, onCommand=partial(self.dpChangeRename, 1), offCommand=partial(self.dpChangeRename, 0), parent=renameLayout) self.fromTxt = cmds.text('fromTxt', label="from", parent=renameLayout) self.toTxt = cmds.text('toTxt', label="to", parent=renameLayout) cmds.separator(style='none', height=15, parent=renameLayout) self.fromNameTF = cmds.textField('fromNameTF', width=80, text="L_", parent=renameLayout) self.toNameTF = cmds.textField('toNameTF', width=80, text="R_", parent=renameLayout) cmds.text(label="Axis:", height=20, parent=listMirrorLayout) tripleLayout = cmds.rowColumnLayout('tripleLayout', numberOfColumns=3, columnWidth=[(1, 100), (2, 100), (3, 100)], columnAlign=[(1, 'left'), (2, 'left'), (3, 'left')], columnAttach=[(1, 'left', 0), (2, 'left', 0), (3, 'left', 0)], parent=listMirrorLayout) self.mirrorAxisRC = cmds.radioCollection('mirrorAxisRC', parent=tripleLayout) rbX = cmds.radioButton("rbX", label="X = YZ", annotation="X", align="left", collection="mirrorAxisRC", parent=tripleLayout) rbY = cmds.radioButton("rbY", label="Y = XZ", annotation="Y", align="left", collection="mirrorAxisRC", parent=tripleLayout) rbZ = cmds.radioButton("rbZ", label="Z = XY", annotation="Z", align="left", collection="mirrorAxisRC", parent=tripleLayout) cmds.radioCollection('mirrorAxisRC', edit=True, select="rbX") cmds.separator(style='none', height=15, parent=listMirrorLayout) self.mirrorPosCB = cmds.checkBox('mirrorPosCB', label=self.langDic[self.langName]["i057_mirrorPosition"], value=1, parent=listMirrorLayout) self.cleanUndoCB = cmds.checkBox('cleanUndoCB', label=self.langDic[self.langName]["i049_clearUndo"], annotation=self.langDic[self.langName]["i050_clearUndoDesc"], align="left", value=1, parent=listMirrorLayout) self.checkHistoryCB = cmds.checkBox('checkHistoryCB', label=self.langDic[self.langName]["i162_checkHistory"], annotation=self.langDic[self.langName]["i161_historyMessage"], align="left", value=0, parent=listMirrorLayout) cmds.button(label=self.langDic[self.langName]["i054_targetRun"], annotation=self.langDic[self.langName]["i053_targetRunDesc"], width=290, backgroundColor=(0.6, 1.0, 0.6), command=self.dpRunMirror, parent=listMirrorLayout) # call targetMirrorUI Window: cmds.showWindow(dpTargetMirrorWin)
Example #25
Source File: capture.py From maya-capture with MIT License | 4 votes |
def _independent_panel(width, height, off_screen=False): """Create capture-window context without decorations Arguments: width (int): Width of panel height (int): Height of panel Example: >>> with _independent_panel(800, 600): ... cmds.capture() """ # center panel on screen screen_width, screen_height = _get_screen_size() topLeft = [int((screen_height-height)/2.0), int((screen_width-width)/2.0)] window = cmds.window(width=width, height=height, topLeftCorner=topLeft, menuBarVisible=False, titleBar=False, visible=not off_screen) cmds.paneLayout() panel = cmds.modelPanel(menuBarVisible=False, label='CapturePanel') # Hide icons under panel menus bar_layout = cmds.modelPanel(panel, q=True, barLayout=True) cmds.frameLayout(bar_layout, edit=True, collapse=True) if not off_screen: cmds.showWindow(window) # Set the modelEditor of the modelPanel as the active view so it takes # the playback focus. Does seem redundant with the `refresh` added in. editor = cmds.modelPanel(panel, query=True, modelEditor=True) cmds.modelEditor(editor, edit=True, activeView=True) # Force a draw refresh of Maya so it keeps focus on the new panel # This focus is required to force preview playback in the independent panel cmds.refresh(force=True) try: yield panel finally: # Delete the panel to fix memory leak (about 5 mb per capture) cmds.deleteUI(panel, panel=True) cmds.deleteUI(window)
Example #26
Source File: capture.py From pyblish-bumpybox with GNU Lesser General Public License v3.0 | 4 votes |
def _independent_panel(width, height, off_screen=False): """Create capture-window context without decorations Arguments: width (int): Width of panel height (int): Height of panel Example: >>> with _independent_panel(800, 600): ... cmds.capture() """ # center panel on screen screen_width, screen_height = _get_screen_size() topLeft = [int((screen_height-height)/2.0), int((screen_width-width)/2.0)] window = cmds.window(width=width, height=height, topLeftCorner=topLeft, menuBarVisible=False, titleBar=False, visible=not off_screen) cmds.paneLayout() panel = cmds.modelPanel(menuBarVisible=False, label='CapturePanel') # Hide icons under panel menus bar_layout = cmds.modelPanel(panel, q=True, barLayout=True) cmds.frameLayout(bar_layout, edit=True, collapse=True) if not off_screen: cmds.showWindow(window) # Set the modelEditor of the modelPanel as the active view so it takes # the playback focus. Does seem redundant with the `refresh` added in. editor = cmds.modelPanel(panel, query=True, modelEditor=True) cmds.modelEditor(editor, edit=True, activeView=True) # Force a draw refresh of Maya so it keeps focus on the new panel # This focus is required to force preview playback in the independent panel cmds.refresh(force=True) try: yield panel finally: # Delete the panel to fix memory leak (about 5 mb per capture) cmds.deleteUI(panel, panel=True) cmds.deleteUI(window)
Example #27
Source File: dpRivet.py From dpAutoRigSystem with GNU General Public License v2.0 | 4 votes |
def dpRivetUI(self, *args): """ Create a window in order to load the original model and targets to be mirrored. """ # creating dpRivetUI Window: if cmds.window('dpRivetWindow', query=True, exists=True): cmds.deleteUI('dpRivetWindow', window=True) rivet_winWidth = 305 rivet_winHeight = 470 dpRivetWin = cmds.window('dpRivetWindow', title=self.langDic[self.langName]["m083_rivet"]+" "+DPRV_VERSION, widthHeight=(rivet_winWidth, rivet_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False, menuBarVisible=False, titleBar=True) # creating layout: rivetLayout = cmds.columnLayout('rivetLayout', columnOffset=("left", 10)) cmds.text(label=self.langDic[self.langName]["m145_loadGeo"], height=30, font='boldLabelFont', parent=rivetLayout) doubleLayout = cmds.rowColumnLayout('doubleLayout', numberOfColumns=2, columnWidth=[(1, 100), (2, 210)], columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'left', 10), (2, 'left', 20)], parent=rivetLayout) cmds.button(label=self.langDic[self.langName]["m146_geo"]+" >", annotation="Load the Geometry here in order to be used to attach.", backgroundColor=(1.0, 0.7, 1.0), width=100, command=self.dpLoadGeoToAttach, parent=doubleLayout) self.geoToAttachTF = cmds.textField('geoToAttachTF', width=180, text="", changeCommand=partial(self.dpLoadGeoToAttach, None, True), parent=doubleLayout) uvSetLayout = cmds.rowColumnLayout('uvSetLayout', numberOfColumns=2, columnWidth=[(1, 110), (2, 210)], columnAlign=[(1, 'right'), (2, 'left')], columnAttach=[(1, 'right', 1), (2, 'left', 10)], parent=rivetLayout) cmds.text(label="UV Set:", font='obliqueLabelFont', parent=uvSetLayout) self.uvSetTF = cmds.textField('uvSetTF', width=180, text="", editable=False, parent=uvSetLayout) cmds.separator(style='in', height=15, width=300, parent=rivetLayout) cmds.text(label=self.langDic[self.langName]["m147_itemsFollowGeo"], height=30, font='boldLabelFont', parent=rivetLayout) itemsLayout = cmds.columnLayout('itemsLayout', columnOffset=('left', 10), width=310, parent=rivetLayout) self.itemScrollList = cmds.textScrollList('itemScrollList', width=290, height=100, allowMultiSelection=True, parent=itemsLayout) cmds.separator(style='none', height=5, parent=itemsLayout) middleLayout = cmds.rowColumnLayout('middleLayout', numberOfColumns=2, columnWidth=[(1, 150), (2, 150)], columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'left', 0), (2, 'left', 0)], parent=itemsLayout) cmds.button(label=self.langDic[self.langName]["i045_add"], annotation=self.langDic[self.langName]["i045_add"], width=140, command=self.dpAddSelect, parent=middleLayout) cmds.button(label=self.langDic[self.langName]["i046_remove"], annotation=self.langDic[self.langName]["i046_remove"], width=140, command=self.dpRemoveSelect, parent=middleLayout) cmds.separator(style='in', height=15, width=300, parent=rivetLayout) cmds.text(label=self.langDic[self.langName]["i002_options"]+":", height=30, font='boldLabelFont', parent=rivetLayout) fatherLayout = cmds.columnLayout('fatherLayout', columnOffset=("left", 10), parent=rivetLayout) self.attachTCB = cmds.checkBox('attachTCB', label=self.langDic[self.langName]["m148_attach"]+" Translate", value=True, parent=fatherLayout) self.attachRCB = cmds.checkBox('attachRCB', label=self.langDic[self.langName]["m148_attach"]+" Rotate", value=False, parent=fatherLayout) self.fatherGrpCB = cmds.checkBox('fahterGrpCB', label=self.langDic[self.langName]["m149_createGroupConst"], value=True, parent=fatherLayout) invertLayout = cmds.columnLayout('invertLayout', columnOffset=("left", 10), parent=rivetLayout) self.addInvertCB = cmds.checkBox('addInvertCB', label=self.langDic[self.langName]["m150_avoidDoubleTransf"], height=20, value=True, changeCommand=self.dpChangeInvert, parent=invertLayout) translateLayout = cmds.rowColumnLayout('translateLayout', numberOfColumns=2, columnWidth=[(1, 30), (2, 150)], columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'left', 10), (2, 'left', 5)], height=20, parent=rivetLayout) cmds.separator(style='none', parent=translateLayout) self.invertTCB = cmds.checkBox('invertTCB', label=self.langDic[self.langName]["m151_invert"]+" Translate", value=True, parent=translateLayout) rotateLayout = cmds.rowColumnLayout('rotateLayout', numberOfColumns=2, columnWidth=[(1, 30), (2, 150)], columnAlign=[(1, 'left'), (2, 'left')], columnAttach=[(1, 'left', 10), (2, 'left', 5)], height=20, parent=rivetLayout) cmds.separator(style='none', parent=rotateLayout) self.invertRCB = cmds.checkBox('invertRCB', label=self.langDic[self.langName]["m151_invert"]+" Rotate", value=False, parent=rotateLayout) cmds.separator(style='none', height=15, parent=rivetLayout) createLayout = cmds.columnLayout('createLayout', columnOffset=("left", 10), parent=rivetLayout) cmds.button(label=self.langDic[self.langName]["i158_create"]+" "+self.langDic[self.langName]["m083_rivet"], annotation=self.langDic[self.langName]["i158_create"]+" "+self.langDic[self.langName]["m083_rivet"], width=290, backgroundColor=(0.20, 0.7, 1.0), command=self.dpCreateRivetFromUI, parent=createLayout) # call dpRivetUI Window: cmds.showWindow(dpRivetWin)