我们从Python开源项目中,提取了以下49个代码示例,用于说明如何使用maya.cmds.showWindow()。
def randomSelectionUI(*args): if cmds.window("win", exists = True): cmds.deleteUI("win") widgets["win"] = cmds.window("win", w=280, h=75, t="zbw_randomSelection") widgets["mainCLO"] = cmds.columnLayout() widgets["text"] = cmds.text("What percent of selection do you want to keep?") widgets["keepIFG"] = cmds.intFieldGrp(l=" % to keep:", v1=50, h=40, cw = ([1, 65], [2, 50]), cal = ([1,"left"], [2, "left"])) widgets["text2"] = cmds.text("Random: each obj has % chance to be removed") widgets["text3"] = cmds.text("Precise: exact num removed, but randomly chosen") cmds.separator(h=10) widgets["typeRBG"] = cmds.radioButtonGrp(l="Type:", l1 = "Random Remove", l2 = "Precise Remove", nrb = 2, sl = 1, cw = ([1, 30], [2,120], [3, 120], [4, 50]), cal = ([1, "left"], [2,"left"], [3, "left"], [4, "left"])) widgets["but"] = cmds.button(l="Reselect", w=280, h=40, bgc = (.6, .8, .6), c = doSel) cmds.window(widgets["win"], e=True, w=280, h=75) cmds.showWindow(widgets["win"])
def _create_ui(self): u"""UI???""" safe_delete_window(self._WINDOW_NAME) win = cmds.window(self._WINDOW_NAME, t="Convert Color Code", mb=True, w=480, h=128) cmds.menu(l="Option") cmds.menuItem(l="ColorEditor", c=self.get_color_from_editor) cmds.columnLayout(adj=True, rs=2) self.color_code_field = cmds.textFieldButtonGrp(l="Color code", bl="Convert", bc=self._convert) self.decimal_point_field = cmds.intFieldGrp(l="Decimal point", nf=1, v1=2) self.result_field = cmds.textFieldGrp(l="Result") cmds.setParent("..") cmds.columnLayout(adj=True) self.color_preview = cmds.text(l="", h=24) cmds.setParent("..") cmds.showWindow(win)
def findScriptUI(*args): if cmds.window("findScript", exists = True): cmds.deleteUI("findScript") widgets["win"] = cmds.window("findScript", t="zbw_findPath", w=300, h=200) widgets["mainCLO"] = cmds.columnLayout() cmds.separator(h=10) widgets["textTx"] = cmds.text(l="Will search your active python paths. \nNo need for suffix (.py or .mel)\nNo wildcards(*). Just string, 3 chars min", al="left") cmds.separator(h=20) widgets["nameTFG"] = cmds.textFieldGrp(l="search for:", cw = [(1, 75), (2,200)], cal = [(1, "left"),(2, "right")]) cmds.separator(h=20) widgets["searchBut"] = cmds.button(l="Search python paths!", w=300, h=50, bgc=(0,.6, 0), c=searchPaths) cmds.separator(h=20) widgets["resultTxt"] = cmds.textFieldGrp(l="results:", ed=False, w=300, cw = [(1, 75), (2,200)], bgc = (0,0,0) , cal = [(1, "left"),(2, "right")]) cmds.showWindow(widgets["win"])
def getScriptsUI(*args): if cmds.window("thisWin", exists = True): cmds.deleteUI("thisWin") widgets["win"] = cmds.window("thisWin", w=300, h=200) widgets["mainFLO"] = cmds.formLayout() widgets["list"] = cmds.textScrollList(nr=10, w=300, dcc = executeCommand) cmds.formLayout(widgets["mainFLO"], e=1, af = [(widgets["list"], "left", 0), (widgets["list"], "top", 0), (widgets["list"], "bottom", 30), (widgets["list"], "right", 0)]) widgets["button"] = cmds.button(l="Refresh List!", w=300, h= 30, bgc = (.8, .6, .3), c= getScripts) cmds.formLayout(widgets["mainFLO"], e=1, af = [(widgets["button"], "left", 0), (widgets["button"], "right", 0), (widgets["button"], "bottom", 0)]) cmds.showWindow(widgets["win"]) #populate the list with the contents of the path
def shadingTransferUI(*args): if cmds.window("win", exists=True): cmds.deleteUI("win") widgets["win"] = cmds.window("win", t="zbw_shadingTransfer", w=200, h=100, s=False) widgets["mainCLO"] = cmds.columnLayout() cmds.text(l="1. Select the source object (poly/nurbs)", al="left") cmds.text(l="2. Select the target object(s)", al="left") cmds.text(l="Note: deleteHistory on the transferUV\nwill try to avoid deleting deformers.\nNo promises:)", al="left") cmds.separator(h=10) widgets["shdBut"] = cmds.button(l="Copy Shaders to targets!", w=200, h=40, bgc=(.4, .7, .4), c=partial(getSelection, "copyShader")) cmds.separator(h=10) widgets["uvBut"] = cmds.button(l="Transfer UV's to targets!", w=200, h=40, bgc=(.7, .7, .5), c=partial(getSelection, "transferUV")) widgets["xferCBG"] = cmds.checkBoxGrp(l="Delete history after transfer?", v1=0, cal=[(1, "left"), (2,"left")], cw=[(1, 150), (2, 50)]) cmds.window(widgets["win"], e=True, w=200, h=100) cmds.showWindow(widgets["win"])
def snapUI(): """simple snap UI for snapping""" if cmds.window("snapWin", exists=True): cmds.deleteUI("snapWin", window=True) cmds.windowPref("snapWin", remove=True) widgets["win"] = cmds.window("snapWin", t="zbw_snap", w=210, h=100, rtf=True) widgets["mainCLO"] = cmds.columnLayout(w=210, h=100) cmds.text("Select the target object(s),\nthen the object(s) you want to snap", al="center", w=210) cmds.separator(h=5, style="single") widgets["cbg"] = cmds.checkBoxGrp(l="Options: ", ncb=2, v1=1, v2=1, l1="Translate", l2="Rotate", cal=[(1,"left"),(2,"left"), (3,"left")], cw=[(1,50),(2,75),(3,75)]) widgets["avgRBG"] = cmds.radioButtonGrp(nrb=2, l1="Snap all to first", l2="Snap last to avg", cal=[(1,"left"),(2,"left"),(3,"left")], cw=[(1,100),(2,100)],sl=1) widgets["rpCB"] = cmds.checkBox(l="Use Rotate Pivot To Query Position?", v=1) widgets["snapPivCB"] = cmds.checkBox(l="Snap via pivot? (vs. translate value)", v=1) cmds.separator(h=5, style="single") widgets["snapButton"] = cmds.button(l="Snap obj(s)!", w=210, h=40, bgc=(.6,.8,.6), c=partial(snapIt, False)) widgets["snapPivButton"] = cmds.button(l="Snap pivot!", w=210, h=20, bgc=(.8,.6,.6), c=partial(snapIt, True)) cmds.window(widgets["win"], e=True, w=5, h=5) cmds.showWindow(widgets["win"])
def selectionUI(*args): #window stuff, two buttons if cmds.window("selWin", exists=True): cmds.deleteUI("selWin") widgets["win"] = cmds.window("selWin", t="zbw_selectionBuffer", s=False) widgets["mainCLO"] = cmds.columnLayout(bgc = (.8, .8, .8)) widgets["getBut"] = cmds.button(l="Grab Selection", bgc = (.5, .5, .9), w=200, h=50, c=grabSel) cmds.separator(h=5) widgets["checkBut"] = cmds.button(l="Check Stored (in scipt ed.)", bgc = (.5, .5, .5), w=200, h=20, en=False, c=checkSel) cmds.separator(h=10) widgets["restoreBut"] = cmds.button(l="Restore Selection", bgc = (.5, .8, .5), w=200, h=50, c=restoreSel) cmds.window(widgets["win"], e=True, w=200, h=135) cmds.showWindow(widgets["win"])
def zbw_mmChangeConnectAttrUI(base, attr, obj, *args): if (cmds.window('zbw_mmChangeAttrUI', exists=True)): cmds.deleteUI('zbw_mmChangeAttrUI', window=True) cmds.windowPref('zbw_mmChangeAttrUI', remove=True) window=cmds.window('zbw_mmChangeAttrUI', widthHeight=(400,80), title='zbw_messageMapper_changeAttrName') cmds.columnLayout() #show old attr name cmds.text("old attribute name: " + attr) #asks for the new attr name cmds.textFieldGrp("zbw_mmChangeAttrTFG", l="new attr name (just attr name)") #button to do it (pass along attr, obj) cmds.button("zbw_mmChangeAttrB", l="change attr!", c=partial(zbw_mmChangeConnectAttr, base, attr, obj)) cmds.showWindow(window) #force window to size cmds.window('zbw_mmChangeAttrUI', e=True, widthHeight = (400,80)) pass
def zbw_mmChangeConnectObjUI(base, attr, obj, *args): if (cmds.window('zbw_mmChangeObjUI', exists=True)): cmds.deleteUI('zbw_mmChangeObjUI', window=True) cmds.windowPref('zbw_mmChangeObjUI', remove=True) window=cmds.window('zbw_mmChangeObjUI', widthHeight=(400,85), title='zbw_messageMapper_changeObjName') cmds.columnLayout() #show old attr name cmds.text("base attribute name: " + attr) cmds.text("old connected obj name: " + obj) #asks for the new attr name cmds.textFieldButtonGrp("zbw_mmChangeObjTFBG", l="select new obj: ", bl="get", bc=partial(zbw_mmAddTarget, "zbw_mmChangeObjTFBG")) #button to do it (pass along attr, obj) cmds.button("zbw_mmChangeObjB", l="change obj!", c=partial(zbw_mmChangeConnectObj, base, attr, obj)) cmds.showWindow(window) #force window to size cmds.window('zbw_mmChangeObjUI', e=True, widthHeight = (420,85))
def modelSequenceUI(*args): if (cmds.window("modSeq", exists=True)): cmds.deleteUI("modSeq") widgets["win"] = cmds.window("modSeq", w = 300, h = 220, t = "zbw_modelSequence") widgets["mainCLO"] = cmds.columnLayout(w = 300,h = 220) cmds.separator(h=10) cmds.text("Select ONE object to be duplicated \nThis will duplicate it for frames selected and group", al="left") cmds.separator(h=20) #textFieldGRP - name of objs widgets["sufTFG"] = cmds.textFieldGrp(l="Sequence Suffix:", cw = [(1, 100), (2,200)], cal = [(1, "left"),(2, "right")]) #radioButtonGrp - timeslider or frame range widgets["frmRBG"] = cmds.radioButtonGrp(l="Get Frames From:", nrb=2, sl=2, l1="Time Slider", l2="Frame Range", cw = [(1, 120), (2,80), (3,80)], cal = [(1, "left"),(2, "left")], cc=enableFR) #textFieldGrp - framerange (enable) widgets["frmRngIFG"] = cmds.intFieldGrp(l="Range:", nf=2, en=True, v1=0, v2 = 9, cw = [(1, 120), (2,80), (3,80)], cal = [(1, "left"),(2, "left")]) #int = by frame step widgets["stepIFG"] = cmds.intFieldGrp(l="Step By (frames):", v1 = 1, cw = [(1, 120), (2,80)], cal = [(1, "left"),(2, "right")]) cmds.separator(h=30) widgets["doBut"] = cmds.button(l="Create duplicates of objects!", w= 300, h=40, bgc = (0,.8, 0), c=getValues) cmds.showWindow(widgets["win"])
def follicleUI(*args): """UI for the script""" if cmds.window("folWin", exists=True): cmds.deleteUI("folWin") widgets["win"] = cmds.window("folWin", t="zbw_makeFollicle", w=300, h=100) widgets["mainCLO"] = cmds.columnLayout() # widgets["polyFrame"] = cmds.frameLayout(l="Polygon Vert(s) Follicle") # widgets["polyCLO"] = cmds.columnLayout() widgets["text"] = cmds.text("Select one or two vertices (2 will get avg position) and run") widgets["nameTFG"] = cmds.textFieldGrp(l="FollicleName:", cal=([1, "left"],[2,"left"]), cw=([1,100],[2,200]), tx="follicle") cmds.separator(h=10) widgets["button"] = cmds.button(w=300, h=50, bgc=(0.6,.8,.6), l="Add follicle to vert(s)", c=getUV) # cmds.setParent(widgets["mainCLO"]) # widgets["nurbsFrame"] = cmds.frameLayout(l="Nurbs select") cmds.showWindow(widgets["win"]) cmds.window(widgets["win"], e=True, w=300, h=100) #-------could also select edit point???? #-------multiple selection and average uv position? Orrrr option to create multiple UV's, one on each vertex #-------grab an edge and convert to 2 verts and get average. . . #-------have option for distributed (select 2 verts and number of follicles, spread that num between the two uv positions)
def dupeSwapUI(): """UI for script""" if cmds.window("dupeWin", exists=True): cmds.deleteUI("dupeWin") cmds.window("dupeWin", t="zbw_dupeSwap", w=250, h=100) cmds.columnLayout("dupeCLO") cmds.text("Select the initial object. then select the", al="center", w=250) cmds.text("duplicates and press button", al="center", w=250) cmds.separator(h=5, style ="single") cmds.radioButtonGrp("inputsRBG", l="inputs:", nrb=3, l1="none", l2="connect", l3="duplicate", cw=[(1, 50), (2,47), (3,63), (4,40)], cal=[(1,"left"), (2,"left"), (3,"left"), (4,"left")], sl=1) cmds.separator(h=5, style ="single") cmds.button("dupeButton", l="Swap Elements", w=250, h=50, bgc=(.6, .8,.6), c=dupeIt) cmds.showWindow("dupeWin") cmds.window("dupeWin", e=True, w=250, h=100)
def animNoiseUI(): if cmds.window('animNoiseWin', exists=True): cmds.deleteUI('animNoiseWin', window=True) cmds.windowPref('animNoiseWin', remove=True) widgets["win"] = cmds.window('animNoiseWin', widthHeight=(300,200), title='zbw_animNoise') widgets["CLO"] = cmds.columnLayout(cal='center') widgets["ampFFG"] = cmds.floatFieldGrp(cal=(1, 'left'), nf=2, l="set Min/Max Amp", v1=-1.0, v2=1.0) #add gradient? widgets["freqIFG"] = cmds.intFieldGrp(cal=(1,'left'), l='frequency(frames)', v1=5) #checkbox for random freq widgets["randFreqOnCBG"] = cmds.checkBoxGrp(cal=(1,'left'), cw=(1, 175),l='random frequency on', v1=0, cc=animNoiseRandom) widgets["randFreqFFG"] = cmds.floatFieldGrp(l='random freq (frames)', v1=1, en=0) #checkbox for avoid keys widgets["avoidCBG"] = cmds.checkBoxGrp(cal=(1,'left'), cw=(1, 175),l='buffer existing keys (by freq)', v1=0) #radiobutton group for tangents #checkbox for timeline range widgets["rangeRBG"] = cmds.radioButtonGrp(nrb=2,l="Frame Range:", l1="Timeslider", l2="Frame Range", sl=1, cw=[(1,100),(2,75),(3,75)],cc=enableFrameRange) #floatFieldGrp for range widgets["frameRangeIFG"] = cmds.intFieldGrp(nf=2, l='start/end frames', v1=1, v2=10, en=0) widgets["goBut"] = cmds.button(l='Add Noise', width=300, h=30, bgc=(.6,.8,.6), command=addNoise) cmds.showWindow(widgets["win"])
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)
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)
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()
def show(self): if cmds.window(self.windowName, query=True, exists=True): self.close() cmds.window(self.windowName) self.buildUI() cmds.showWindow()
def createMenu(): cmds.setParent(mel.eval("$temp1=$gMainWindow")) if cmds.control('NR_ImportMenu', exists=True): cmds.deleteUI('NR_ImportMenu', menu=True) menu = cmds.menu('NR_ImportMenu', label='Ninja Ripper', tearOff=True) cmds.menuItem( label='Import RIP v4', c="cmds.showWindow('NR_ImportWindow')" ) cmds.menuItem( label="Reload Script", c="reload(NinjaRipperMayaImportTools)" )
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)
def Show(): global MedicUIInstance if MedicUIInstance: cmds.showWindow(window.MainWindow.Name) else: if cmds.window(window.MainWindow.Name, q=True, ex=True): cmds.deleteUI(window.MainWindow.Name) MedicUIInstance = window.MainWindow(functions.getMayaMainWindow()) MedicUIInstance.show()
def show_ui(self): u"""Window???""" if cmds.window(self._WINDOW_NAME, exists=True): cmds.deleteUI(self._WINDOW_NAME) self.window = cmds.window(self._WINDOW_NAME, t=self._WINDOW_TITLE, width=340, maximizeButton=False, minimizeButton=False) form = cmds.formLayout() field_group = cmds.columnLayout(adj=True, cal="center", rs=self._MARGIN) cmds.text(u"""??????????????????????????????? ????????????????????????????""", al="left") self.text_scroll = cmds.textScrollList(append=self.get_windows(), ams=False, dcc=self.check_execute) self.text_field = cmds.textFieldGrp(l=u"????", ad2=2, cl2=["left", "left"], cw=[1, 60]) cmds.setParent("..") button_group = cmds.columnLayout(adj=True, cal="center") cmds.button(l="Check", c=self.check_execute) cmds.setParent("..") cmds.formLayout(form, e=True, attachForm=[(field_group, "top", self._MARGIN), (field_group, "left", self._MARGIN), (field_group, "right", self._MARGIN), (button_group, "bottom", self._MARGIN), (button_group, "left", self._MARGIN), (button_group, "right", self._MARGIN)], attachControl=[(button_group, "top", self._MARGIN, field_group)]) cmds.setParent("..") cmds.showWindow(self.window)
def show(self): u"""Window???""" self.safe_delete_ui(RecentFileWindow._WINDOW_NAME) cmds.window(RecentFileWindow._WINDOW_NAME, title=RecentFileWindow._WINDOW_TITLE) cmds.frameLayout(label="RecentFiles", marginWidth=6, marginHeight=6, borderStyle="etchedIn") for file_path, file_type in get_recent_files().items(): cmds.button(label=file_path, c=partial(self._open_file, file_path, file_type)) cmds.showWindow(RecentFileWindow._WINDOW_NAME)
def _create_ui(self): safe_delete_window(self._WINDOW_NAME) win = cmds.window(self._WINDOW_NAME) form = cmds.formLayout() field_group = cmds.columnLayout(adj=True, cal="center", rs=self._MARGIN) cmds.text(u"????????focalLength?????Unity?FOV?????????????", al="left") self.text_scroll = cmds.textScrollList(append=self._get_cameras(), ams=False, dcc=self._select) self.text_field = cmds.textFieldGrp(l=u"FOV", ad2=2, cl2=["left", "left"], cw=[1, 60]) self.result_field = cmds.textFieldGrp(l=u"Result", ad2=2, cl2=["left", "left"], cw=[1, 60]) cmds.setParent("..") button_group = cmds.columnLayout(adj=True, cal="center") cmds.button(l="Apply", c=self._apply) cmds.setParent("..") cmds.formLayout(form, e=True, attachForm=[(field_group, "top", self._MARGIN), (field_group, "left", self._MARGIN), (field_group, "right", self._MARGIN), (button_group, "bottom", self._MARGIN), (button_group, "left", self._MARGIN), (button_group, "right", self._MARGIN)], attachControl=[(button_group, "top", self._MARGIN, field_group)]) cmds.setParent("..") cmds.showWindow(win)
def curveJntRigUI(*args): if cmds.window("crvRigJntWin", exists=True): cmds.deleteUI("crvRigJntWin") w, h= 400, 300 widgets["win"] = cmds.window("crvRigJntWin", t="zbw_curveJntRig", w=w,h=h) widgets["mainCLO"] = cmds.columnLayout() widgets["numCtrlIFG"] = cmds.intFieldGrp(l="Number of Ctrls:", cal=[(1,"left"), (2,"left")], cw=[(1,120), (2,50)], v1=5) widgets["nameTFG"] = cmds.textFieldGrp(l="Rig Name (i.e. lfEye):", cal=[(1,"left"), (2,"left"), (3,"left")], cw=[(1,120), (2,280), (3,30)], tx="eye") widgets["cntrPivTFBG"] = cmds.textFieldButtonGrp(l="Center pivot object:", bl="<<<", cal=[(1,"left"), (2,"left"), (3,"left")], cw=[(1,120), (2,280), (3,30)], bc=partial(populateCrvField, "cntrPivTFBG"), cc=partial(secondFill, "center"), tx="centerLoc") widgets["upLocTFBG"] = cmds.textFieldButtonGrp(l="Aim up object:", bl="<<<", cal=[(1,"left"), (2,"left"), (3,"left")], cw=[(1,120), (2,280), (3,30)], bc=partial(populateCrvField, "upLocTFBG"), cc=partial(secondFill, "up"), tx="upLoc") cmds.separator(h=10) widgets["upCrvTFBG"] = cmds.textFieldButtonGrp(l="First Curve", bl="<<<", cal=[(1,"left"), (2,"left"), (3,"left")], cw=[(1,120), (2,280), (3,30)], bc=partial(populateCrvField, "upCrvTFBG"),tx="topCrv") widgets["upNameTFG"] = cmds.textFieldGrp(l="1st Suffix (i.e.'Top')", cal=[(1,"left"), (2,"left")], cw=[(1,120), (2,280)], tx="Top") cmds.separator(h=10) widgets["secondCBG"] = cmds.checkBoxGrp(l="Create Second Curve?", ncb=1, v1=0, cal=[(1,"left"), (2,"left")], cc=toggleSecond, en=True) widgets["downCrvTFBG"] = cmds.textFieldButtonGrp(l="Second Curve", bl="<<<", cal=[(1,"left"), (2,"left"), (3,"left")], en=False, cw=[(1,120), (2,280), (3,30)], bc=partial(populateCrvField, "downCrvTFBG"), tx="downCrv") widgets["downNameTFG"] = cmds.textFieldGrp(l="2nd Suffix (i.e. 'Dwn')", cal=[(1,"left"), (2,"left")], cw=[(1,120), (2,280)], en=False, tx="Dwn") widgets["cntrPiv2TFBG"] = cmds.textFieldButtonGrp(l="Center pivot object:", bl="<<<", cal=[(1,"left"), (2,"left"), (3,"left")], cw=[(1,120), (2,280), (3,30)], bc=partial(populateCrvField, "cntrPivTFBG"), en=False, tx="centerLoc") widgets["upLoc2TFBG"] = cmds.textFieldButtonGrp(l="Aim up object:", bl="<<<", cal=[(1,"left"), (2,"left"), (3,"left")], cw=[(1,120), (2,280), (3,30)], bc=partial(populateCrvField, "upLoc2TFBG"), en=False, tx="upLoc") cmds.separator(h=10) widgets["execBut"] = cmds.button(l="create base rig!", w=w, c=passToExecute) widgets["cnctBut"] = cmds.button(l="connect ctrls to jnts", w=w, c=connectProxies) widgets["closeBut"] = cmds.button(l="setup smart close", w=w, c=smartClose) cmds.separator(h=10) # widgets["scCBG"] = cmds.checkBoxGrp(l="Set up smart close?", ncb=1, v1=0, cal=[(1,"left"), (2,"left")], en=True) cmds.window(widgets["win"], e=True, w=5, h=5, resizeToFitChildren=True, sizeable=True) cmds.showWindow(widgets["win"])
def setClipUI(*args): """ UI for the whole thing""" if cmds.window("SCPwin", exists=True): cmds.deleteUI("SCPwin") cmds.window("SCPwin", t="Set Clip Planes", w=200, h=100) cmds.columnLayout("colLO") cmds.radioButtonGrp("camRBG", l="Cameras:", nrb=2, l1="All", l2="Selected", sl=1, cal=[(1,"left"),(2,"left"),(3,"left")], cw=[(1,70),(2,50),(3,50)]) cmds.floatFieldGrp("nearFFG", l="nearClip", v1=1, cal=([1,"left"], [2,"left"]), cw=([1,50], [2,150])) cmds.floatFieldGrp("farFFG", l="farClip", v1=100000, cal=([1,"left"], [2,"left"]), cw=([1,50], [2,150])) cmds.separator(h=10,style="single") cmds.button("button", l="Set Clip Planes", h=50, w=200, bgc=(.8, .6,.6), c=setPlanes) cmds.showWindow("SCPwin") cmds.window("SCPwin", e=True, w=200, h=100)
def spaceMatchUI(): if (cmds.window("spaceMatchWin", exists=True)): cmds.deleteUI("spaceMatchWin", window=True) #create window widgets["window"] = cmds.window("spaceMatchWin", title="Space Matcher", w=250, h=300) #create top frame widgets["topFrame"] = cmds.frameLayout(l="Object/Attr Selection", w=250, li=70, bgc=(0,0,0)) widgets["objCLO"] = cmds.columnLayout() #create top controls widgets["objTFG"] = cmds.textFieldGrp(l="Selected Obj", cw=([1,70],[2,175]), cal=([1,"left"], [2,"left"]), cc=clearList) widgets["matchObjButton"] = cmds.button(l="Select Control Object", w=250, bgc=(.8,.8,.8), c = getObj) # #or we could assume the obj has a "follow" enum attr. . . . # widgets["attrTFG"] = cmds.textFieldGrp(l="Selected Attr", cw=([1,70],[2,175]), cal=([1,"left"], [2,"left"]), cc=clearList) # widgets["matchObjButton"] = cmds.button(l="Select Spaces Enum Attr", w=250, bgc=(.8,.8,.8), c = getAttr) #back to window cmds.setParent(widgets["window"]) #create bottom frmae widgets["bottomFrame"] = cmds.frameLayout(l="Spaces", li=100, w=250, bgc=(0,0,0)) widgets["bottomRCLO"] = cmds.rowColumnLayout(nc=2, w=250) #get obj and put it in sel = cmds.ls(sl=True) if (len(sel)) == 1: getObj() #show window cmds.showWindow(widgets["window"]) cmds.window(widgets["window"], e=True, w=250, h=300)
def huddleUI(*args): if cmds.window("hudWin", exists=True): cmds.deleteUI("hudWin") widgets["win"] = cmds.window("hudWin", t="zbw_huddle", w=350, h=100, rtf=True) widgets["CLO"] = cmds.columnLayout() widgets["slider"] = cmds.floatSliderGrp(min=0, max=2, f=True, label="Factor:", cal=([1, "left"], [2,"left"], [3, "left"]), cw=([1,50],[2,50],[3,225]), pre=3, v=1.0) cmds.separator(h=20) widgets["button"] = cmds.button(l="Move objects aroudnd first selected", w=350, h=30, bgc=(.6,.8, .6), c=huddleExec) cmds.window(widgets["win"], e=True, w=5, h=5, rtf=True) cmds.showWindow(widgets["win"])
def extendUI(*args): """UI for the script""" #UI if cmds.window("curbWin", exists=True): cmds.deleteUI("curbWin") cmds.window("curbWin", t="zbw_polyExtender", w=200, h=200) cmds.columnLayout("colLO") cmds.frameLayout("topFrame", l="Covert Edge", cll=True, bgc=(.2,.2,.2)) cmds.text("Select poly edge to convert") cmds.button("convertBut", l="Convert!", w=200, h=30, bgc=(.8, .8,.6), c=convertEdge) cmds.separator(h=5) cmds.setParent("colLO") cmds.frameLayout("midFrame", l="Create Poly", cll=True, bgc=(.2,.2,.2)) cmds.text("Select curve") cmds.separator(h=5) cmds.textFieldGrp("name", l="Name", w=200, cw=[(1,30), (2,170)], tx="newPoly") cmds.checkBox("curbCB", l="Positive Direction", v=True) # cmds.checkBox("bumpCB", l="Add vertical hump?", v=True) cmds.floatFieldGrp("curbFFG", l="Curb Width", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=10) cmds.intFieldGrp("UDivIFG", l="Width Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1) cmds.intFieldGrp("VDivIFG", l="Length Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1) cmds.checkBox("polyHistory", l="Keep history on final poly?", v=False) cmds.checkBox("history", l="Keep history objects?", v=True, cc=enableHistory) cmds.separator(h=5) cmds.button("curbBut", l="Create Curb", h=40, w=200, bgc=(.6, .8, .6), c=extendPoly) cmds.showWindow("curbWin") cmds.window("curbWin", e=True, h=150, w=200)
def zbw_offsetAnim(*args): """creates offset from first obj sel to last based on the entered offset value""" def zbw_runOffsetAnim(*args): #get frame range!!!!!! #get selection, check that they are tranforms sel = cmds.ls(sl=True,type="transform") selSize = int(len(sel)) #for each selection mult the index by the offset value for i in range(0,selSize): obj = sel[i] offsetRaw = cmds.intFieldGrp('zbw_offsetValue', q=True, v=True) offset = offsetRaw[0] multFactor = i * offset #shift the entire anim curve by the offset mult value cmds.keyframe(obj, edit=True,relative=True,timeChange=multFactor,time=(1,24)) #create UI, get offset value, frame range or all anim if (cmds.window('zbw_offsetAnimUI', exists=True)): cmds.deleteUI('zbw_offsetAnimUI', window=True) cmds.windowPref('zbw_offsetAnimUI', remove=True) window=cmds.window('zbw_offsetAnimUI', widthHeight=(350,200), title='zbw_offsetAnim') cmds.columnLayout(cal='center') cmds.intFieldGrp('zbw_offsetValue', cal=(1,'left'), label='frequency(frames)', value1=5) #CREATE FRAME RANGE AREA (WHICH FRAMES ARE WE DOING?) #WHEN THAT HAPPENS, WHAT DO WE DO WITH THE FRAMES AFTER THAT? (PROBABLY NOTHING. . . LET USER WORRY ABOUT IT) #checkbox for random freq (to give a random amount to offset each object) #cmds.checkBoxGrp('zbw_animNoiseRandom', cal=(1,'left'), cw=(1, 175),label='random frequency on', value1=0, cc=zbw_animNoiseRandom) cmds.button('zbw_offsetAnimGo', label='offset!', width=75, command=zbw_runOffsetAnim) cmds.showWindow(window) #clean up keys
def import_anim_UI(): width = 400 if cmds.window("impAnimWin", exists=True): cmds.deleteUI("impAnimWin") widgets["win"] = cmds.window("impAnimWin", t="Import anim files", w=width, h=400, rtf=True) # widgets["clo"] = cmds.columnLayout() widgets["mainTLO"] = cmds.tabLayout() widgets["impCLO"] = cmds.columnLayout("Import Anim") cmds.text("1. choose the folder where your anim clips live,\n2. select the objs in scene to apply to\n3. 'random' will start anim in frame range\n4. select anim clips from list to randomly apply to objs\n5. press button to apply",al="left") cmds.separator(h=10) widgets["impPathTFG"] = cmds.textFieldButtonGrp(l="Anim Path:", bl="<<<", cal = ([1, "left"], [2, "left"], [3, "right"]), cw=([1, 75], [2, 275], [3, 40]), bc=partial(get_path, "import", "impPathTFG"), cc=populate_tsl) widgets["randRBG"] = cmds.radioButtonGrp(l="Insert Placement:", nrb=2, l1="Random Start", l2="At current Frame", sl=1, cal=([1, "left"], [2,"left"], [3,"left"]), cw=([1,100], [2, 100], [3, 100]), cc=partial(toggle_enable, "randRBG", "rangeIFG")) widgets["rangeIFG"] = cmds.intFieldGrp(l="Random Start Range:", nf=2, v1=0, v2=100, cw=([1, 120], [2, 50], [3, 50]), cal=([1, "left"], [2, "left"], [3, "left"])) widgets["delCBG"] = cmds.checkBoxGrp(l="Delete subsequent keys?", v1=True, cal=([1, "left"], [2, "left"]), cw=([1, 130], [2, 20])) cmds.separator(h=10) widgets["animTSL"] = cmds.textScrollList(w=400, h=150, allowMultiSelection=True) cmds.separator(h=10) widgets["importBut"] = cmds.button(l="Import random anim from selection", h=40, w=width, bgc=(.5, .8, .5), c=import_animation) cmds.setParent(widgets["mainTLO"]) widgets["expCLO"] = cmds.columnLayout("Export Anim") cmds.text("1. Select the obj 2. choose a path and name the anim\n3. choose range and hierarchy 4. press button!", al="left") cmds.separator(h=10) widgets["expPathTFG"] = cmds.textFieldButtonGrp(l="Export Path:", bl="<<<", cal = ([1, "left"], [2, "left"], [3, "right"]), cw=([1, 75], [2, 275], [3, 40]), bc=partial(get_path, "export", "expPathTFG")) widgets["nameTFG"] = cmds.textFieldGrp(l="Animation Name:", cw=([1, 100], [2, 250]), cal=([1, "left"], [2, "left"])) widgets["selRBG"] = cmds.radioButtonGrp(l="Hierarchy:", nrb=2, l1="Selection Only", l2="Below", sl=2, cal=([1, "left"], [2,"left"], [3,"left"]), cw=([1,75], [2, 100], [3, 100])) widgets["expRngRBG"] = cmds.radioButtonGrp(l="Time Range:", nrb=2, l1="Start_End", l2="All", sl=2, cal=([1, "left"], [2,"left"], [3,"left"]), cw=([1,75], [2, 100], [3, 100]), cc=partial(toggle_enable, "expRngRBG", "expRngIFG")) widgets["expRngIFG"] = cmds.intFieldGrp(nf=2, en=False, l="Start_End", v1=1, v2=10, cal=([1, "left"], [2,"left"], [3,"left"]), cw=([1,75], [2, 100], [3, 100])) cmds.separator(h=10) widgets["exportBut"] = cmds.button(l="Export anim from selection", h=40, w=width, bgc=(.5, .8, .5), c=export_animation) cmds.window(widgets["win"], e=True, w=5, h=5, rtf=True) cmds.showWindow(widgets["win"])
def wireRigUI (*args): if cmds.window("wireRigWin", exists = True): cmds.deleteUI("wireRigWin") widgets["win"] = cmds.window("wireRigWin", t="zbw_wireRig", w=300, h=250) widgets["mainCLO"] = cmds.columnLayout() widgets["topFLO"] = cmds.frameLayout(l="Convert Poly Edges",cll=True, cl=True) widgets["topCLO"] = cmds.columnLayout() widgets["convertBut"] = cmds.button(l="convert selected poly edge to curve", w=300, bgc = (.8,.8,0), c=convertEdge) cmds.separator(h=20, style="single") widgets["reverseBut"] = cmds.button(l="reverse direction of selected curve", w=300, bgc = (.8,.5,0), c=reverseCrv) cmds.setParent(widgets["mainCLO"]) widgets["botFLO"] = cmds.frameLayout(l="Create Wire Rig", cll=True) widgets["botCLO"] = cmds.columnLayout() widgets["numCtrlIFG"] = cmds.intFieldGrp(l="Number of Ctrls:", v1=5, cal=[(1, "left"), (2, "left")], cw=[(1, 150),(3, 75)]) widgets["hierCBG"] = cmds.checkBoxGrp(ncb=1, l1 = "Put Ctrls in hierarchy?", v1=True, en=True) widgets["nameTFG"] = cmds.textFieldGrp(l="Wire Rig Name:", w=300, tx="wireCtrl1", cal=[(1, "left")]) widgets["scaleFFG"] = cmds.floatFieldGrp(l="Control scale:", v1=1.0, cal=[(1, "left"), (2, "left")], cw=[(1, 150),(3, 75)]) cmds.separator(h=30, style="single") widgets["textText"] = cmds.text("Select geo, then curve, then button below", al="center") widgets["rigBut"] = cmds.button(l="Create Wire Rig", w= 300, h=40, bgc= (0, .5, 0), c=createWireDef) cmds.showWindow(widgets["win"]) #option to pull curve from edges
def transformBufferUI(*args): if cmds.window("tbWin", exists=True): cmds.deleteUI("tbWin") widgets["win"] = cmds.window("tbWin", t="zbw_tranformBuffer", s=False, w=200) widgets["mainCLO"] = cmds.columnLayout(w=200) ######## ------ checkbox to enable/disable these. . . . widgets["trnFFG"] = cmds.floatFieldGrp(l="Trns: ", nf=3, cw=[(1, 40), (2, 50), (3, 50), (4,50)], cal = [(1, "left"), (2, "left"), (3, "left"), (4,"left")]) widgets["rotFFG"] = cmds.floatFieldGrp(l="Rot: ", nf=3, cw=[(1, 40), (2, 50), (3, 50), (4,50)], cal = [(1, "left"), (2, "left"), (3, "left"), (4,"left")]) widgets["sclFFG"] = cmds.floatFieldGrp(l="Scl: ", nf=3, cw=[(1,40), (2, 50), (3, 50), (4,50)],cal = [(1, "left"), (2, "left"), (3, "left"), (4,"left")]) cmds.separator(h=10) widgets["transCBG"] = cmds.checkBoxGrp(ncb=3, la3 = ("Trns", "Rot", "Scl"), va3=(1, 1, 1), cal=[(1, "left"), (2, "left"), (3, "left")], cw = [(1, 50), (2, 50), (3, 50)]) cmds.separator(h=10) widgets["butFLO"] = cmds.formLayout(w=200, h=50) widgets["getBut"] = cmds.button(l="Catch\nValues", bgc = (.8, .5, .5), h=50, w=100, c=getValues) widgets["setBut"] = cmds.button(l="Set\nValues", bgc = (.5, .8,.5), h=50, w=100, c=setValues) cmds.formLayout(widgets["butFLO"], e=True, af = [ (widgets["getBut"], "top", 0), (widgets["getBut"], "left", 0), (widgets["setBut"], "top", 0), (widgets["setBut"], "left", 100) ]) cmds.window(widgets["win"], e=True, w=200, h=100) cmds.showWindow(widgets["win"])
def transfer_connections_UI(*args): if cmds.window("xferConWin", exists=True): cmds.deleteUI("xferConWin") widgets["win"] = cmds.window("xferConWin", w=200, rtf=True) widgets["clo"] = cmds.columnLayout() cmds.separator(h=10) widgets["shapeCBG"] = cmds.checkBoxGrp(ncb=2, labelArray2=("transforms?", "shapes?"), cw=[(1, 100),(2, 100)], valueArray2=(1, 1), cal=[(1,"left"), (2,"left")]) cmds.separator(h=10) widgets["inOutCBG"] = cmds.checkBoxGrp(ncb=2, labelArray2=("inputs?", "outputs?"), cw=[(1, 100),(2, 100)], valueArray2=(0, 1), cal=[(1,"left"), (2,"left")]) cmds.separator(h=10) widgets["xferBut"] = cmds.button(l="Transfer Connections", w=200, h=40, bgc=(.7, .5, .5), c=options_pass) cmds.window(widgets["win"], e=True, w=5, h=5, rtf=True) cmds.showWindow(widgets["win"])
def deformerWeightUI(*args): if cmds.window("defWgtsWin", exists=True): cmds.deleteUI("defWgtsWin") w, h = 300, 200 widgets["win"] = cmds.window("defWgtsWin", w=w, h=h, t="zbw_deformerWeights") widgets["mainFLO"] = cmds.formLayout(w=w, h=h) widgets["defTSL"] = cmds.textScrollList(w=w, h=100, allowMultiSelection=True) widgets["weightFFG"] = cmds.floatFieldGrp(w=w, l="Weight Mult (soft)selection value x this", v1=1.0, cw=[(1, 215), (2, 50)], cal=[(1, "left"), (2, "left")], cc=limitMinMax) widgets["objTFG"] = cmds.textFieldGrp(w=w, l="Deforming Object", cw=[(1, 100), (2, 200)], cal=[(1, "left"), (2, "left")], en=False) widgets["doBut"] = cmds.button(l="set selected weights (based on softSel)", w=w, h=40, bgc = (.5, .7, .5), c=partial(setWeights, "selection")) widgets["zeroBut"] = cmds.button(l="zero all weights on selected deformer", w=w, h=20, bgc = (.7, .7, .5), c=partial(setWeights,"zero")) widgets["resetBut"] = cmds.button(l="reset deformer list based on selection obj", w=w, h=20, bgc = (.7, .5, .5), c=populateList) cmds.formLayout(widgets["mainFLO"], e=True, af=[ (widgets["defTSL"], "left", 0), (widgets["defTSL"], "top", 0), (widgets["objTFG"], "left", 0), (widgets["objTFG"], "top", 105), (widgets["zeroBut"], "left", 0), (widgets["zeroBut"], "top", 135), (widgets["weightFFG"], "left", 0), (widgets["weightFFG"], "top", 165), (widgets["doBut"], "left", 0), (widgets["doBut"], "top", 195), (widgets["resetBut"], "left", 0), (widgets["resetBut"], "top", 245), ]) cmds.window(widgets["win"], e=True, w=5, h=5, rtf=True) cmds.showWindow(widgets["win"]) populateList()
def setupRLUI(): if cmds.window("RLWin", exists=True): cmds.deleteUI("RLWin") widgets["win"] = cmds.window("RLWin", t="zbw_setupRL", w=200, h=400) widgets["mainCL"] = cmds.columnLayout(w=200) widgets["mainFrame"] = cmds.frameLayout(l="Create Render Layers", w=200, cll=True, bgc=(.2,.2,.2)) widgets["CarKey"] = cmds.checkBox(l="Car_Env", v=True) widgets["CarEnv"] = cmds.checkBox(l="Car_Key", v=True) widgets["BGKey"] = cmds.checkBox(l="BG_Env", v=True) widgets["BGEnv"] = cmds.checkBox(l="BG_Key", v=True) widgets["AO"] = cmds.checkBox(l="All_AO", v=True) widgets["MatteA"] = cmds.checkBox(l="All_MatteA", v=True) widgets["MatteB"] = cmds.checkBox(l="All_MatteB", v=True) widgets["MoVec"] = cmds.checkBox(l="All_MoVec", v=True) widgets["Shadow"] = cmds.checkBox(l="All_Shadow", v=True) widgets["createBut"] = cmds.button(l="Create Layers", w=200, h=40, bgc=(.6,.8,.6), c=createRL) cmds.text("NOTE: this is setting the overrides for \nthe moVec layer RG's and materials \n(if you have them in scene\n for the AO and Movec layers but \n NO passes are set up") cmds.separator(h=20, style = "double") #widgets["copyBut"] = cmds.button(l="Copy Selected Layer", w=200, h=40, bgc=(.8,.8,.6), c=copyRL) #cmds.separator(h=20, style = "double") widgets["importBut"] = cmds.button(l="Import RL Shaders File", w=200, h=40, bgc=(.8,.6,.6), c=importRL) cmds.showWindow(widgets["win"]) cmds.window(widgets["win"], e=True, w=200, h=400) #create render layers
def channelbox_command_freezeUI(): with sysCmd.Undo(0): if cmds.window("freezeWindowBox", q=1, exists=1): cmds.deleteUI("freezeWindowBox") frz_window = cmds.window("freezeWindowBox", title="Freeze", rtf=1, s=0, tbm=1, tlb=1) layout = cmds.columnLayout(p=frz_window) layout_top = cmds.rowLayout(nc=4, p=layout) width = 25 cmds.button(l="T", w=width, ann="Freeze Translate", c=sysCmd.rpartial(channelbox_command_freezeTranslate, "", "", "Freeze Translate"), p=layout_top) cmds.button(l="R", w=width, ann="Freeze Rotate", c=sysCmd.rpartial(channelbox_command_freezeRotate, "", "", "Freeze Rotate"), p=layout_top) cmds.button(l="S", w=width, ann="Freeze Scale", c=sysCmd.rpartial(channelbox_command_freezeScale, "", "", "Freeze Scale"), p=layout_top) cmds.button(l="A", w=width, ann="Freeze All", c=sysCmd.rpartial(channelbox_command_freezeAll, "", "", "Freeze All"), p=layout_top) layout_bot = cmds.rowLayout(nc=4, p=layout) cmds.button(l="TS", w=width, ann="Freeze Translate / Scale", c=sysCmd.rpartial(channelbox_command_freezeTranslateScale, "", "", "Freeze Translate / Scale"), p=layout_bot) cmds.button(l="TR", w=width, ann="Freeze Translate / Rotate", c=sysCmd.rpartial(channelbox_command_freezeTranslateRotate, "", "", "Freeze Translate / Rotate"), p=layout_bot) cmds.button(l="RS", w=width, ann="Freeze Rotate / Scale", c=sysCmd.rpartial(channelbox_command_freezeRotateScale, "", "", "Freeze Rotate / Scale"), p=layout_bot) cmds.button(l="JO", w=width, ann="Freeze Joint Orient", c=sysCmd.rpartial(channelbox_command_freezeJointOrient, "", "", "Freeze Joint Orient"), p=layout_bot) cmds.window(frz_window, e=1, wh=(1, 1), rtf=1) cmds.showWindow(frz_window) # --
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)
def __init__(self): window = cmds.window( title="Chain Maker", iconName='ChnMk', widthHeight=(300, 100) ) cmds.columnLayout( adjustableColumn=True ) cmds.separator( style='single' ) self.curve_sel_name = cmds.textFieldGrp( label = 'Curve Selection' ) cmds.separator( style='single' ) cmds.button( label='Run', command=partial(self.run_command, 1) ) cmds.separator( style='single' ) cmds.button( label='Exit', command=('cmds.deleteUI(\"' + window + '\", window=True)') ) cmds.setParent( '..' ) cmds.showWindow( window )
def __init__(self): name = 'cmt_orientjoints' if cmds.window(name, exists=True): cmds.deleteUI(name, window=True) if cmds.windowPref(name, exists=True): cmds.windowPref(name, remove=True) self.window = cmds.window(name, title='CMT Orient Joints', widthHeight=(358, 330)) cmds.columnLayout(adjustableColumn=True) margin_width = 4 cmds.frameLayout(bv=False, label='Quick Actions', collapsable=True, mw=margin_width) cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65)) cmds.button(label='Make Planar Orientation', command=self.make_planar) cmds.button(label='Project to Planar Position', command=partial(make_position_planar)) cmds.button(label='Align Up With Child', command=self.align_with_child) cmds.button(label='Zero Orient', command=self.zero_orient) cmds.button(label='Orient to World', command=self.orient_to_world) cmds.rowColumnLayout(numberOfColumns=4) height = 20 label_width = 60 icon_left = 'nudgeLeft.png' icon_right = 'nudgeRight.png' cmds.text(label='Offset X', align='right', width=label_width) cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_x, direction=-1)) self.offset_x = cmds.floatField(value=90.0) cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_x, direction=1)) cmds.text(label='Offset Y', align='right', width=label_width) cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_y, direction=-1)) self.offset_y = cmds.floatField(value=90.0) cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_y, direction=1)) cmds.text(label='Offset Z', align='right', width=label_width) cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_z, direction=-1)) self.offset_z = cmds.floatField(value=90.0) cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_z, direction=1)) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.frameLayout(bv=False, label='Manual Orient', collapsable=True, mw=margin_width) cmds.columnLayout(adj=True) cmds.rowLayout(numberOfColumns=2, cw2=(150, 150)) self.reorient_children = cmds.checkBox(label='Reorient children', value=True, align='left') self.reset_orientation = cmds.checkBox(label='Reset orientation', value=True, align='left') cmds.setParent('..') cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65)) cmds.button(label='Template Joints', command=partial(self.template_joints)) cmds.button(label='Rebuild Joints', command=partial(rebuild_joints)) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.showWindow(self.window)
def createUI(self): """creates the UI """ self.widgets = {} width = self.windowSize[0] height = self.windowSize[1] if (cmds.window("zbw_win", exists=True)): cmds.deleteUI("zbw_win") self.widgets["window"] = cmds.window("zbw_win", title=self.windowName, w=width, h=height, s=self.sizeable) #menus for future self.menus() cmds.setParent(self.widgets["window"]) self.widgets['formLO'] = cmds.formLayout(nd=100, w=width) # self.widgets["topColumnLO"] = cmds.columnLayout(w=width) self.widgets["scrollLO"] = cmds.scrollLayout(vst=10) self.widgets["lowColumnLO"] = cmds.columnLayout(w=width) cmds.formLayout(self.widgets["formLO"], e=True, attachForm = [(self.widgets["scrollLO"], "top", 0), (self.widgets["scrollLO"], "left", 0), (self.widgets["scrollLO"], 'right', 0), (self.widgets["scrollLO"], 'bottom', 35)]) self.commonUI() self.customUI() #get to buttons bit cmds.setParent(self.widgets["formLO"]) butWidth = width/3 - 10 #add buttons self.widgets["applyCloseButton"] = cmds.button(w=butWidth, h=30, l='Apply and Close', c=partial(self.action, 1)) self.widgets["applyButton"] = cmds.button(w=butWidth, h= 30, l='Apply', c=partial(self.action, 0)) self.widgets['closeButton'] = cmds.button(w=butWidth, h=30, l="close window", c=self.closeWindow) cmds.formLayout(self.widgets["formLO"], e=True, attachForm=[(self.widgets["applyCloseButton"], 'bottom', 5), (self.widgets["applyCloseButton"], 'left', 5)]) cmds.formLayout(self.widgets["formLO"], e=True, attachForm=[(self.widgets["closeButton"], 'bottom', 5), (self.widgets["closeButton"], 'right', 5)]) cmds.formLayout(self.widgets["formLO"], e=True, attachForm=[(self.widgets["applyButton"], 'bottom', 5)]) cmds.formLayout(self.widgets["formLO"], e=True, attachControl=[(self.widgets["applyButton"], 'left', 5, self.widgets["applyCloseButton"]),(self.widgets["applyButton"], 'right', 5, self.widgets["closeButton"])]) cmds.showWindow(self.widgets["window"]) cmds.window(self.widgets["window"], e=True, w=width, h=height)
def isrUI(*args): if cmds.window("irnWin", exists=True): cmds.deleteUI("irnWin") widgets["win"] = cmds.window("irnWin", t="zbw_insertRandomNoise", w=225, h=100) widgets["CLO"] = cmds.columnLayout() cmds.text( "select the controls you want to add random\n motion to. This will add a group above \nand some attrs on the controls", al="left") cmds.separator(h=10) widgets["offsetCBG"] = cmds.checkBoxGrp(l="Offset randomize?", v1=True, cw=[(1, 125), (2, 50)], cal=[(1, "left"), (2, "left")], cc=partial(toggleOnOff, "offsetCBG", "offsetIFG")) widgets["offsetIFG"] = cmds.intFieldGrp(l="Offset Min/Max:", numberOfFields=2, cw=[(1, 125), (2, 50), (3, 50)], cal=[(1, "left"), (2, "left"), (3, "left")], v1=-200, v2=200) widgets["speedCBG"] = cmds.checkBoxGrp(l="Speed randomize?", v1=True, cw=[(1, 125), (2, 50)], cal=[(1, "left"), (2, "left")], cc=partial(toggleOnOff, "speedCBG", "speedFFG")) widgets["speedFFG"] = cmds.floatFieldGrp(l="Speed Min/Max:", numberOfFields=2, cw=[(1, 125), (2, 50), (3, 50)], cal=[(1, "left"), (2, "left"), (3, "left")], v1=-2, v2=2, pre=2, cc=partial(limitFloatField, "speedFFG", -10, 10)) widgets["ampCBG"] = cmds.checkBoxGrp(l="Amplitude randomize?:", v1=True, cw=[(1, 125), (2, 50)], cal=[(1, "left"), (2, "left")], cc=partial(toggleOnOff, "ampCBG", "ampFFG")) widgets["ampFFG"] = cmds.floatFieldGrp(l="Amplitude Min/Max", numberOfFields=2, cw=[(1, 125), (2, 50), (3, 50)], cal=[(1, "left"), (2, "left"), (3, "left")], v1=.5, v2=1.5, pre=2, cc=partial(limitFloatField, "ampFFG", -10, 10)) widgets["noiseCBG"] = cmds.checkBoxGrp(l="Noise randomize?:", v1=True, cw=[(1, 125), (2, 50)], cal=[(1, "left"), (2, "left")], cc=partial(toggleOnOff, "noiseCBG", "noiseFFG")) widgets["noiseFFG"] = cmds.floatFieldGrp(l="Noise Min/Max", numberOfFields=2, cw=[(1, 125), (2, 50), (3, 50)], cal=[(1, "left"), (2, "left"), (3, "left")], v1=.1, v2=.3, pre=2, cc=partial(limitFloatField, "noiseFFG", 0, 1)) widgets["freqCBG"] = cmds.checkBoxGrp(l="Noise Freq randomize?:", v1=True, cw=[(1, 125), (2, 50)], cal=[(1, "left"), (2, "left")], cc=partial(toggleOnOff, "freqCBG", "freqFFG")) widgets["freqFFG"] = cmds.floatFieldGrp(l="Noise Freq Min/Max", numberOfFields=2, cw=[(1, 125), (2, 50), (3, 50)], cal=[(1, "left"), (2, "left"), (3, "left")], v1=0, v2=.25, pre=2, cc=partial(limitFloatField, "freqFFG", 0, 1)) cmds.separator(h=5) cmds.separator(h=10) widgets["but"] = cmds.button(l="add to selected control", w=225, h=40, bgc=(.5, .7, .5), c=irnDo) cmds.window(widgets["win"], e=True, wh=(5, 5), rtf=True) cmds.showWindow(widgets["win"])
def animTools(): #create simple button based GUI for now if (cmds.window('zbw_animToolsUI', exists=True)): cmds.deleteUI('zbw_animToolsUI', window=True) cmds.windowPref('zbw_animToolsUI', remove=True) window=cmds.window('zbw_animToolsUI', widthHeight=(350,200), title='zbw_animTools') cmds.columnLayout(cal='center') #cmds.intFieldGrp('zbw_offsetValue', cal=(1,'left'), label='frequency(frames)', value1=5) #CREATE FRAME RANGE AREA (WHICH FRAMES ARE WE DOING?) #WHEN THAT HAPPENS, WHAT DO WE DO WITH THE FRAMES AFTER THAT? (PROBABLY NOTHING. . . LET USER WORRY ABOUT IT) #checkbox for random freq #cmds.checkBoxGrp('zbw_animNoiseRandom', cal=(1,'left'), cw=(1, 175),label='random frequency on', value1=0, cc=zbw_animNoiseRandom) cmds.text('zbw_offsetAnim') cmds.button('zbw_offsetAnimButton', label='offsetAnim', width=75, command=zbw_offsetAnim) cmds.text('zbw_pullDownAnimButton') cmds.button('zbw_pullDownAnim', label='pullDownAnim', width=75, command=zbw_pullDownAnim) cmds.text('zbw_pullUpAnimButton') cmds.button('zbw_pullUpAnimButton', label='pullUpAnim', width=75, command=zbw_pullUpAnim) cmds.text('zbw_randomizeKeys') cmds.button('zbw_randomizeKeysButton', label='randomizeKeys', width=75, command=zbw_randomizeKeys) cmds.text('zbw_animNoise') cmds.button('zbw_animNoiseButton', label='animNoise', width=75, command=zbw_animNoise) cmds.text('zbw_playblast') cmds.button('zbw_playblastButton', label='playblast', width=75, command=zbw_playblast) cmds.text('zbw_stepAll') cmds.button('zbw_stepAllButton', label='stepAll', width=75, command=zbw_stepAll) cmds.text('zbw_cleanKeys') cmds.button('zbw_cleanKeysButton', label='cleanKeys', width=75, command=zbw_stepAll) cmds.text('zbw_changeFrameRate') cmds.button('zbw_changeFrameRate', label='frameRate', width=75, command=zbw_changeFrameRate) cmds.showWindow(window) #XXX_selection_XXX #character selection list? #select nodes with animation? #XXX_workflow_XXX #pull down anim from Master #randomize keys #random noise #anim offsetting #zbw_playblast #zbw_copyAnimRange #animRetiming #XXX_3rdParty_XXX #tween machine #abx picker? #abx smartkeys? #poselibrary #XXX_blocking/polishing tools_XXX #blocking step keys #clean up dead keys #XXX_miscellaneous_XXX #pull up anim from obj under #fkIK matching script #zbw_changeFrameRate #zbw_bakeCleanCam
def softDeformerUI(): """UI for the whole thing""" # TODO - add some kind of help text to each tab if cmds.window("softModWin", exists=True): cmds.deleteUI("softModWin") widgets["window"] = cmds.window("softModWin", t="zbw_softDeformer", w=300, h=130) widgets["tabLO"] = cmds.tabLayout() widgets["smCLO"] = cmds.columnLayout("SoftMod", w=300) cmds.separator(h=10) widgets["smdTFG"] = cmds.textFieldGrp(l="Deformer Name", w=300, cw=[(1, 100), (2, 190)], cal=[(1, "left"), (2, "left")], tx="softMod_DEF") widgets["checkCBG"] = cmds.checkBoxGrp(l="AutoCheck if there are deformers?", v1=1, cw=[(1, 200)], cal=[(1, "left"), (2, "left")]) widgets["frontCBG"] = cmds.checkBoxGrp(l="Auto move to front of chain", v1=1, cw=[(1, 200)], cal=[(1, "left"), (2, "left")]) widgets["scaleFFG"] = cmds.floatFieldGrp(l="Control Scale", v1=1, pre=2, cw=[(1, 150), (2, 50)], cal=[(1, "left"), (2, "left")]) widgets["autoscaleCBG"] = cmds.checkBoxGrp(l="autoscale control?", v1=1, cw=[(1, 200)], cal=[(1, "left"), (2, "left")]) widgets["bpFrameIFG"] = cmds.intFieldGrp(l="BindPose/origin Frame", cw=[(1, 150), (2, 50)], cal=[(1, "left"), (2, "left")]) widgets["mainCtrlTFBG"] = cmds.textFieldButtonGrp(l="Parent Object:", cw=[(1, 75), (2, 175), (3, 75)], cal=[(1, "left"), (2, "left"), (3, "left")], bl="<<<", bc=partial(set_parent_object, "mainCtrlTFBG")) cmds.separator(h=10, style="single") widgets["smbutton"] = cmds.button(l="Create Deformer", w=300, h=40, bgc=(.6, .8, .6), c=partial(create_soft_mod_deformer, False)) cmds.separator(h=5) widgets["wavebutton"] = cmds.button(l="Soft Wave (use falloff to scale wave)", w=300, h=30, bgc=(.8, .8, .6), c=partial(create_soft_mod_deformer, True)) # third tab to do softselect to joint cmds.setParent(widgets["tabLO"]) widgets["jointCLO"] = cmds.columnLayout("softJoint", w=300) widgets["jntNameTFG"] = cmds.textFieldGrp(l="Joint Name", w=300, cw=[(1, 100), (2, 190)], cal=[(1, "left"), (2, "left")], tx="softSelect_JNT") widgets["jntCPOMCBG"] = cmds.checkBoxGrp(l="Joint to closest point on mesh?", v1=1, cw=[(1, 200)], cal=[(1, "left"), (2, "left")]) widgets["jntRotCBG"] = cmds.checkBoxGrp(l="Joint orient to surface?", v1=1, cw=[(1, 200)], cal=[(1, "left"), (2, "left")]) widgets["jntAutoCBG"] = cmds.checkBoxGrp(l="Create initial jnt if not bound?", v1=1, cw=[(1, 200)], cal=[(1, "left"), (2, "left")]) cmds.separator(h=10) widgets["jntbutton"] = cmds.button(l="Create Joint", w=300, h=40, bgc=(.6, .8, .6), c=soft_selection_to_joint) cmds.window(widgets["window"], e=True, w=5, h=5, rtf=True) cmds.showWindow(widgets["window"]) # -------------------------- # softMod deformer # -------------------------- # TODO - Add 'wave' to name . . .
def zbw_mmUI(): """the UI for the script""" if (cmds.window('`UI', exists=True)): cmds.deleteUI('zbw_messageMapperUI', window=True) cmds.windowPref('zbw_messageMapperUI', remove=True) window=cmds.window('zbw_messageMapperUI', widthHeight=(600,400), title='zbw_messageMapper') cmds.tabLayout(h=400) cmds.columnLayout("mmAddNewConnections", h=400) #2nd small column for the persistant UI cmds.columnLayout(w=400, h=100) cmds.textFieldButtonGrp('zbw_tfbg_baseObj', cal=(1, "left"), cw3=(75, 200, 75), label="base object", w=400, bl="choose object", bc=partial(zbw_mmAddBase, "zbw_tfbg_baseObj", "clear")) #button to create new message/obj field groups cmds.separator(h=20, st="single") cmds.button(w=150, l="add new message attr/obj", c=zbw_mmAddMObjs) cmds.separator(h=20, st="single") cmds.setParent(u=True) cmds.rowColumnLayout("mmRCLayout", nc=2, co=(2, "left", 30)) #back up to the 2nd columnLayout cmds.setParent(u=True) cmds.separator(h=20, st="single") #create button to delete last pair of text fields cmds.button("deleteLastButton", w=150, bgc=(.5,0,0), l="delete last attr/obj pair", c=zbw_mmDeleteLast) cmds.separator(h=20, st="double") #button to do connect all the attr/messages cmds.button("createMessageButton", w=150, bgc=(0,.5,0), l="create messages", c=zbw_mmConnectM) #back up to the main column cmds.setParent(u=True) #back up to the tab cmds.setParent(u=True) #new tab cmds.columnLayout("existingMessages", w=600, h=400) #Here we add stuff to the second tab cmds.textFieldButtonGrp("mmListMessages", cal=(1, "left"), cw3=(75,200,75), label="baseObject", w=400, bl="choose object", bc=partial(zbw_mmAddBase,"mmListMessages", "noClear")) cmds.separator(h=20, st="double") #button to create list of message attrs cmds.button(w=200, l="list all message attr for base", bgc = (0,.5,0), c=partial(zbw_mmListCurrentMessages, "mmListMessages")) cmds.separator(h=20, st="double") cmds.text("rt-click on the attr or object to change the connection") cmds.separator(h=20, st="double") cmds.rowColumnLayout("mmRCTextLayout", w=600, nc=3, cw=[(1, 200),(2,290),(3,100)]) cmds.text("ATTR") cmds.text("OBJECT") cmds.text("DELETE") cmds.showWindow(window)
def typeFinderUI(*args): if cmds.window("typeFinderWin", exists=True): cmds.deleteUI("typeFinderWin") widgets["win"] = cmds.window("typeFinderWin", w=400, h=400, t="zbw_typeFinder") widgets["mainCLO"] = cmds.columnLayout(w=400, h=400, bgc=(.2, .2,.2)) #---------------- right click on an item and get option to replace with parent or go down to shape cmds.text(l="Note: Rt-click on the below field to get suggestions from your sub-string") cmds.separator(h=10) widgets["typeTFBG"] = cmds.textFieldButtonGrp(l="Node Type", bl="Find", cal=[(1,"left"),(2,"left"),(3,"left")], cw=[(1, 75), (2,250), (3, 50)], bc=getObjectList) widgets["searchPUM"] = cmds.popupMenu(postMenuCommand=populateMenuItems) widgets["searchSelCB"] = cmds.checkBox(l="Only search current selection?", v=0) widgets["shpsToXformCB"] = cmds.checkBox(l="List transforms of found shapes (mesh, etc)?", v=1) widgets["stringMatchCB"] = cmds.checkBox(l="Additional name/string search?", v=0, changeCommand=toggleStringSearchEnable) widgets["stringSearchTFG"] = cmds.textFieldGrp(l="String:", en=False, cal=[(1,"left"),(2,"left")], cw=[(1, 75), (2,250)], changeCommand=getObjectList) cmds.separator(h=10) widgets["resultsTSL"] = cmds.textScrollList(w=400, h=200, bgc=(0,0,0), allowMultiSelection=True) #---------------- checkbox here to expand selection? for sets (true-select objects in set, false - just seletc the set) widgets["selectAllBut"] = cmds.button(l="Select All in List", h= 30) widgets["selectSelBut"] = cmds.button(l="Select Selected in List", h= 30) widgets["selectParOfSelBut"] = cmds.button(l="Select Parent/Transform of Selected in List", h= 30) widgets["deleteAllBut"] = cmds.button(l="Delete All in List", h= 30) widgets["deleteSelBut"] = cmds.button(l="Delete Selected in List", h= 30) widgets["clearListBut"] = cmds.button(l="Clear List", h= 30, c=clearScrollList) #widgets["connectDecompBut"] = cmds.button(l="Clear List", h= 30, c=clearList) #---------------- button to promote all shape to transforms? #---------------- button to select shapes of all in list cmds.showWindow(widgets["win"]) #---------------- FUNCTIONS: #---------------- get current selection (to filter our list) #---------------- filter our list based on another list #---------------- promote shapes: given an obj, is it a shape node? if it is, return it's parent #---------------- stop the process if the list count is more than 100? or 1000? #---------------- create a confirm dialog func (in zbw_rig?), args = message, buttons? #---------------- populate the buttons and related functions
def spaceMatchUI(): if (cmds.window("spaceMatchWin", exists=True)): cmds.deleteUI("spaceMatchWin", window=True) widgets["window"] = cmds.window("spaceMatchWin", title="Space Matcher", w=250, h=300) widgets["mainLO"] = cmds.columnLayout() widgets["tabLO"] = cmds.tabLayout() widgets["getObjCLO"] = cmds.columnLayout() widgets["instruct"] = cmds.text("get obj, then attr, then space then do it") cmds.separator(h=10) #----------fill with selection automatically? widgets["objTFG"] = cmds.textFieldGrp(l="select obj", cw=([1,50],[2,150],[3,50]), cal=([1,"left"], [2,"left"],[3,"left"]), cc=clearList) widgets["matchObjButton"] = cmds.button(l="select object", c=partial(getObj, widgets["objTFG"])) cmds.separator(h=10) #-----------maybe here have it catch the selected obj by default #-----------and/or have a field for the attribute (default to "follow") widgets["getAttrButton"] = cmds.button(w=250, al="center", h=20, l="select enum space attr from obj", bgc= (.5, .5, 0), c=getAttr) #-----------when the attr is selected list the attrs automagically, widgets["spacesTSL"] = cmds.textScrollList(w=250, h=200, nr=8, ams=False, bgc=(.2, .2, .2)) widgets["matchButton"] = cmds.button(w=250, al="center", h=40, bgc= (0,.5,0), l="space switch/match", c= doSpaceMatch) #tab for creation/setup of matching cmds.setParent(widgets["tabLO"]) #----------in this tab, create frames. One (closable) to create constraint and fill items, check boxes for orient, position (with user selecting objects), one frame (maybe already filled out) (always open) for setting up attrs (message, strings) widgets["setupCLO"] = cmds.columnLayout() #frame layout for creating the constraints widgets["createFrameLO"] = cmds.frameLayout(l="create Constrants", collapsable=True, w=250) cmds.text("have em select for constraint") widgets["posRotCBG"] = cmds.checkBoxGrp(ncb=2, l1="translation", v1=True, l2="rotation", v2=True) #----------this button should just create the constraints on the objects in question, but then fill in what parts of the lower half it can widgets["createSetupButton"] = cmds.button(l="create constraints") cmds.setParent(widgets["setupCLO"]) #frameLayout for setting up the attrs widgets["setupFrameLO"] = cmds.frameLayout(l="setup matching", collapsable=False, w=250, h=250) widgets["setupObjTFG"] = cmds.textFieldGrp(l="select ctrl obj", cw=([1,100],[2,150]), cal=([1,"left"], [2,"left"])) widgets["setupObjButton"] = cmds.button(l="get ctrl object", h=40, c= partial(getObj, widgets["setupObjTFG"])) widgets["setupConstrTFG"] = cmds.textFieldGrp(l="constraint", cw=([1,100],[2,150]), cal=([1,"left"], [2,"left"])) widgets["setupConstrButton"] = cmds.button(l="get constraint", h=40, c= partial(getObj, widgets["setupConstrTFG"])) #create list of attrs on constraint #attr = cmds.listAttr(sel,ud=True ) #create list of spaces on obj attr cmds.tabLayout(widgets["tabLO"], e=True, tabLabel = ((widgets["getObjCLO"], "change spaces"),(widgets["setupCLO"], "setup matching"))) cmds.showWindow(widgets["window"]) cmds.window(widgets["window"], e=True, w=250, h=300)
def ipMoverUI(): if (cmds.window('zbw_ipMoverUI', exists=True)): cmds.deleteUI('zbw_ipMoverUI', window=True) cmds.windowPref('zbw_ipMoverUI', remove=True) window=cmds.window('zbw_ipMoverUI', widthHeight=(400,200), title='zbw_imagePlane') cmds.columnLayout('zbw_ipmMainColumn') cam = cmds.ls(sl=True,dag=True,s=True, type="camera") if cam: ip = cmds.listConnections(cam[0], type="imagePlane") if ip: imagePlane = ip[0] ipText = imagePlane else: cmds.warning("there's no image plane on this camera") ipText = "no image plane" else: cmds.warning("select a camera") ipText = "no image plane" cmds.text(ipText) cmds.separator(h=20, style="double") if cam and ip: #---------------store original values somewhere . . . cmds.floatSliderGrp("alphaFSG", label='alpha',cal = [1,"left"], cw3=[50, 50, 300],width=400, field=True, minValue=0, maxValue=1, fieldMinValue=0, fieldMaxValue=1, value=1, pre=3, dc=partial(changeValue, (imagePlane + ".alphaGain"), "alphaFSG")) cmds.separator(h=20, style = "double") cmds.floatSliderGrp("centerXFSG", label='centerX',cal = [1,"left"], cw3=[50, 50, 300],width=400, field=True, minValue=-20.0, maxValue=20.0, fieldMinValue=-100.0, fieldMaxValue=100.0, value=0, pre=3, dc=partial(changeValue, (imagePlane + ".centerX"), "centerXFSG")) cmds.floatSliderGrp("centerYFSG", label='centerY',cal = [1,"left"], cw3=[50, 50, 300],width=400, field=True, minValue=-20.0, maxValue=20.0, fieldMinValue=-100.0, fieldMaxValue=100.0, value=0, pre=3, dc=partial(changeValue, (imagePlane + ".centerY"), "centerYFSG")) cmds.floatSliderGrp("centerZFSG", label='centerZ',cal = [1,"left"], cw3=[50, 50, 300],width=400, field=True, minValue=-20.0, maxValue=20.0, fieldMinValue=-100.0, fieldMaxValue=100.0, value=0, pre=3, dc=partial(changeValue, (imagePlane + ".centerZ"), "centerZFSG")) cmds.floatSliderGrp("widthFSG", label='width',cal = [1,"left"], cw3=[50, 50, 300],width=400, field=True, minValue=0, maxValue=20.0, fieldMinValue=0, fieldMaxValue=100.0, pre=3, dc=partial(changeValue, (imagePlane + ".width"), "widthFSG")) cmds.floatSliderGrp("heightFSG", label='height',cal = [1,"left"], cw3=[50, 50, 300],width=400, field=True, minValue=0, maxValue=20.0, fieldMinValue=0, fieldMaxValue=100.0, pre=3, dc=partial(changeValue, (imagePlane + ".height"), "heightFSG")) cmds.showWindow(window) cmds.window('zbw_ipMoverUI', e=True, w=400, h=200)
def appendUI(): """UI for appendPath script""" #create window with 3 text fields, buttons call up proc to add path if cmds.window("appendPath", exists=True): cmds.deleteUI("appendPath") widgets["win"] = cmds.window("appendPath", t="zbw_appendPath", w=500, h=5, s=False, rtf=True) #create some menus for saving and loading cmds.setParent(widgets["win"]) widgets["menu"] = cmds.menuBarLayout() widgets["menuFile"] = cmds.menu(label="file") cmds.menuItem(l='Clear Values', c=clearValues) cmds.menuItem(l="Save Add Paths", c=saveValues) cmds.menuItem(l="Load Add Paths", c=loadValues) widgets["tabLO"] = cmds.tabLayout(h=190) widgets["columnLO"] = cmds.columnLayout("Add Paths", w=500) widgets["path1"] = cmds.textFieldButtonGrp(l="path1", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 1)) widgets["path2"] = cmds.textFieldButtonGrp(l="path2", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 2)) widgets["path3"] = cmds.textFieldButtonGrp(l="path3", cal=[(1, "left"), (2,"left"),(3,"left")], cw3=(40, 410, 50), bl="<<<", bc=partial(addToField, 3)) cmds.separator(h=10, st="single") widgets["buttonRCL"] = cmds.rowColumnLayout(nc=3, w=500, cw=[(1,123),(2,247 ),(3,123)]) widgets["addCloseBut"] = cmds.button(l="Add and Close", w=120, h=30, bgc=(.6, .8, .6), c=applyClose) widgets["addBut"] = cmds.button(l="Add Paths!", w=245, h=30, bgc=(.8, .8, .6), c=apply) widgets["closeBut"] = cmds.button(l="Close", w=120, h=30, bgc=(.8,.6,.6), c=close) cmds.setParent(widgets["columnLO"]) cmds.separator(h=5, style="single") cmds.text("Click the '<<<' buttons to browse for paths to add. Click the 'Add' button to add those \npaths to the 'sys.path' list. Use the 'ViewPath' tab to view current list of paths.", al="center") cmds.text("Use 'file->save' to save the selected paths. Use 'file->load' to load previously saved paths") #back to window cmds.setParent(widgets["tabLO"]) widgets["columnLO2"] = cmds.columnLayout("View Paths", w=500) cmds.text("Double-click to display full path in script editor") widgets["listTSL"] = cmds.textScrollList(w=500, h=100, fn="smallPlainLabelFont", append=["click button below", "to refresh this list!"], dcc=printMe) refresh() cmds.separator(h=5, style="single") widgets["columnLO3"] = cmds.columnLayout(w=500) widgets["refreshBut"] = cmds.button(l="Refresh Paths", w=500, h=20, bgc=(.5, .5, .6), c=refresh) cmds.rowColumnLayout(nc=3, cw=[(1,200),(2,150 ),(3,150)]) widgets["removeBut"] = cmds.button(l="Remove Selected", w=180, h=20, bgc=(.7, .5, .5), c=removePath) widgets["topBut"] = cmds.button(l="Selected To Top", w=130, h=20, bgc=(.7, .5, .5), c=topPath) widgets["bottomBut"] = cmds.button(l="Selected To Bottom", w=130, h=20, bgc=(.7, .5, .5), c=bottomPath) #load (and check) previous saves cmds.showWindow(widgets["win"]) cmds.window(widgets["win"], e=True, w=5, h=5, rtf=True)
def cleanUI(*args): """the UI for the clean/tangent functions""" if cmds.window("cleanWin", exists=True): cmds.deleteUI("cleanWin") widgets["win"] = cmds.window("cleanWin", t="zbw_cleanKeys", w=300, h=220) widgets["mainCLO"] = cmds.columnLayout() # widgets["tabLO"] = cmds.tabLayout() widgets["cleanCLO"] = cmds.columnLayout("Clean Keys") # some explanation cmds.text("Options for which keys to clean/delete:") cmds.separator(h=10) # radio button group for all selected or for hierarchy under selected widgets["hierarchyRBG"] = cmds.radioButtonGrp(nrb=2, l1="Selected Objs Only", l2="Hierarchy Under Selected", sl=2, cw=[(1, 120), (2, 75), (3, 75)], cc=enableCurve) # radioButtons for time (timeslider, all anim, range) widgets["timeRBG"] = cmds.radioButtonGrp(nrb=3, l1="Timeslider", l2="All Anim", l3="Frame Range", sl=2, cw=[(1, 100), (2, 75), (3, 75)], cc=partial(enableFR, "timeRBG", "frameRangeIFG", "keepCBG")) # int field group for frame range widgets["frameRangeIFG"] = cmds.intFieldGrp(nf=2, l="Start/End", v1=1, v2=24, en=False, cal=[(1, "left"), (2, "left"), (3, "left")], cw=[(1, 75), (2, 75), (3, 75)]) # radio button group for nurbs curves only or for all transforms widgets["curvesRBG"] = cmds.radioButtonGrp(nrb=2, l1="Curves/Volume Primatives Only", l2="All DAG", sl=1, cw=[(1, 190), (2, 110)]) cmds.separator(h=10, style="single") # area to create/keep buffer curves widgets["bufCBG"] = cmds.checkBoxGrp(ncb=2, l1="Buffer Original Curve", l2="Overwrite Existing Buffer", v1=1, v2=0, cw=([1, 140], [2, 50], [3, 100], [4, 50]), cal=([1, "left"], [2, "left"], [3, "left"], [4, "left"])) cmds.separator(h=10, style="single") # check box for singlets and couplets cmds.text("Singletons have only one key. Couplets have only 2 keys") widgets["keepCBG"] = cmds.checkBoxGrp(ncb=2, l1="Keep Singletons", l2="Keep Identical Couplets", v1=0, v2=0) cmds.separator(h=10) widgets["buttonRCLO"] = cmds.rowColumnLayout(w=300, nc=2, cw=[(1, 200), (2, 100)]) widgets["cleanBut"] = cmds.button(l="Clean Animation Curves!", w=200, h=40, bgc=(.6, .8, .6), c=clean) widgets["selectBut"] = cmds.button(l="Select\nHierarchy!", w=100, h=40, bgc=(.8, .6, .6), c=selectHier) cmds.showWindow(widgets["win"]) cmds.window(widgets["win"], e=True, w=300, h=220)