我们从Python开源项目中,提取了以下48个代码示例,用于说明如何使用maya.cmds.columnLayout()。
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 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 jointRadiusUI(*args): if cmds.window("jntWin", exists=True): cmds.deleteUI("jntWin") widgets["win"] = cmds.window("jntWin", t="zbw_jointRadius", w=200, h=90, s=False) widgets["clo"] = cmds.columnLayout(rs=10) widgets["slider"] = cmds.floatSliderGrp(l="radius", min=0.05, max=2, field=True, fieldMinValue=0.01, fieldMaxValue=2, precision=2, sliderStep=0.1, value=0.5, cw=([1, 40], [2, 45], [3, 115]), cal=([1, "left"], [2, "left"], [3, "left"])) # radio button group, all or selected widgets["rbg"] = cmds.radioButtonGrp(nrb=2, l1="all", l2="selected", cw=([1, 50], [1, 50]), sl=1) widgets["but"] = cmds.button(l="Set Radius", w=205, h=50, bgc=(.5, .8, .5), c=adjustRadius) cmds.window(widgets["win"], e=True, w=200, h=90) 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 buildUI(self): # To start with we create a layout to hold our UI objects # A layout is a UI object that lays out its children, in this case in a column column = cmds.columnLayout() # Now we create a text label to tell a user how to use our UI cmds.text(label="Use this slider to set the tween amount") # We want to put our slider and a button side by side. This is not possible in a columnLayout, so we use a row row = cmds.rowLayout(numberOfColumns=2) # We create a slider, set its minimum, maximum and default value. # The changeCommand needs to be given a function to call, so we give it our tween function # We need to hold on to our slider's name so we can edit it later, so we hold it in a variable self.slider = cmds.floatSlider(min=0, max=100, value=50, step=1, changeCommand=tween) # Now we make a button to reset our UI, and it calls our reset method cmds.button(label="Reset", command=self.reset) # Finally we don't want to add anymore to our row layout but want to add it to our column again # So we must change the active parent layout cmds.setParent(column) # We add a button to close our UI cmds.button(label="Close", command=self.close) # *args will be a new concept for you # It basically means I do not know how many arguments I will get, so please put them all inside this one list (tuple) called args
def buildUI(self): column = cmds.columnLayout() cmds.text(label="Use this slider to set the tween amount") cmds.rowLayout(numberOfColumns=2) self.slider = cmds.floatSlider(min=0, max=100, value=50, step=1, changeCommand=tweener.tween) cmds.button(label="Reset", command=self.reset) cmds.setParent(column) cmds.button(label="Close", command=self.close) # And again, we just need to override the reset method # We don't need to define the close, or show methods because it gets those from BaseWindow
def buildUI(self): column = cmds.columnLayout() cmds.text(label="Use the slider to modify the number of teeth the gear will have") cmds.rowLayout(numberOfColumns=4) # This label will show the number of teeth we've set self.label = cmds.text(label="10") # Unlike the tweener, we use an integer slider and we set it to run the modifyGear method as it is dragged self.slider = cmds.intSlider(min=5, max=30, value=10, step=1, dragCommand=self.modifyGear) cmds.button(label="Make Gear", command=self.makeGear) cmds.button(label="Reset", command=self.reset) cmds.setParent(column) cmds.button(label="Close", command=self.close)
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 _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 _create_swatch_display_port_widget(file_node, parent): u"""swatchDisplayPort?QWidget???????????????""" # swatchDisplayPort??????????????????window????????? tmp = cmds.window() cmds.columnLayout() sw = cmds.swatchDisplayPort(h=64, w=64, sn=file_node) ptr = om.MQtUtil.findControl(sw) sw_widget = QtCompat.wrapInstance(long(ptr), QtWidgets.QWidget) sw_widget.setParent(parent) sw_widget.resize(64, 64) cmds.deleteUI(tmp) return sw_widget
def script_execute(code, source_type): ''' maya???????????? :param code: string :param source_type: 'mel' or 'python' :return: ''' window = cmds.window() cmds.columnLayout() cmds.cmdScrollFieldExecuter(t=code, opc=1, sln=1, exa=1, sourceType=source_type) cmds.deleteUI(window) # ??????????????????
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 spaceBufferUI(*args): if cmds.window("spaceBufferWin", exists=True): cmds.deleteUI("spaceBufferWin") widgets["win"] = cmds.window("spaceBufferWin", rtf=True, wh=(200, 20)) widgets["mainCLO"] = cmds.columnLayout(w=200) widgets["jntCreateBut"] = cmds.button(l="Create Joint/Grps at Selection!", w=200, h=30, bgc=(.6, .8,.6), c=createJointFromObj) widgets["makeBuffer"] = cmds.button(l="Create Space Buffer!", w=200, h=30, bgc=(.4, .6, .8), c=createSpaceBuffers) cmds.window(widgets["win"], e=True, wh=(5, 5), rtf=True) cmds.showWindow(widgets["win"])
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 extrudeUI(): if cmds.window("curveExtrudeWin", exists=True): cmds.deleteUI("curveExtrudeWin") w, h = 300, 220 widgets["win"] = cmds.window("curveExtrudeWin", w=w, h=h) widgets["CLO"] = cmds.columnLayout(w=w, h=h) widgets["text1"] = cmds.text(l="Name the rig to be created:") cmds.separator(h=5) widgets["nameTFG"] = cmds.textFieldGrp(l="Rig Name: ", cal=[(1, "left"),(2, "left")],cw=[(1, 50),(2, 245)]) cmds.separator(h=5) widgets["text2"] = cmds.text(l="Select the path curve.\nOptionally, " "then select profile crv and the cap rig in that order\n" "Note that cap rig and profile curve should be y up!", al="left") cmds.separator(h=5) widgets["extrBut"] = cmds.button(l="Create Extrusion Rig!", w=300, h=35, bgc = (.4, .5,.4), c=prepExtrude) cmds.separator(h=10) widgets["text3"] = cmds.text(l="Once you've attached a material :\nselect the control, then any place2DTexture nodes", al="left") cmds.separator(h=5) widgets["textureBut"] = cmds.button(l="Connect Ctrl to place2DTexture nodes!", w=300, h=35, bgc = (.25, .35, .5), c = connectTexture) cmds.window(widgets["win"], e=True, w=w, h=h) 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 audioUI(): """UI for the whole thing""" if (cmds.window("audioWin", exists=True)): cmds.deleteUI("audioWin") widgets["win"] = cmds.window("audioWin", t="zbw_audioManager", w=300, h=260) widgets["mainCLO"] = cmds.columnLayout() widgets["getAudioBut"] = cmds.button(l="Get All Audio In Scene", w=300, h=30, bgc=(.6, .6, .8), c=getAudio) cmds.text("Double-click item in list to enable sound and select it", al="left") widgets["audioTSL"] = cmds.textScrollList(h=100, w=300, dcc=selectAudio) widgets["buttonRCLO"] = cmds.rowColumnLayout(nc=2) widgets["deleteSelBut"] = cmds.button(l="Delete Selected", w=150, h=20, bgc=(.8,.6,.6), c=deleteSelected) widgets["deleteAllBut"] = cmds.button(l="Delete All Audio", w=150, h=20, bgc=(.8,.4,.4), c=deleteAll) cmds.setParent(widgets["mainCLO"]) cmds.separator(h=20) widgets["newAudioBut"] = cmds.button(l="Import New Audio File!", w=300, h=30, bgc=(.6,.8,.6), c=importAudio) cmds.separator(h=20) widgets["offsetRCLO"] = cmds.rowColumnLayout(nc=2, cw=([1,175], [2, 125]), cal=([1,"left"], [2,"left"])) widgets["offsetIFG"] = cmds.intFieldGrp(l="Offset Selected By ", v1=1, cal=([1,"left"], [2,"left"]), cw=([1,100],[2,50])) widgets["offsetBut"] = cmds.button(l="Offset!", w=100, h=30, bgc=(.6,.8,.8), c=offsetAudio) cmds.showWindow(widgets["win"]) cmds.window(widgets["win"], e=True, w=300, h=260)
def tanUI(*args): """the UI for the clean/tangent functions""" if cmds.window("tanWin", exists=True): cmds.deleteUI("tanWin") widgets["win"] = cmds.window("tanWin", t="zbw_tangents", w=300, h=160) widgets["mainCLO"] = cmds.columnLayout() # widgets["tabLO"] = cmds.tabLayout() #tab for changing all tangent types # cmds.setParent(widgets["tabLO"]) widgets["tangentCLO"] = cmds.columnLayout("Tangents") #radioButtons for tangent type (step, linear, auto, spline) widgets["tangentType"] = cmds.radioButtonGrp(nrb=4, l1="Step", l2="Linear", l3="Spline", l4="Auto", sl=1, cw=[(1,50),(2,50),(3,50),(4,50)]) #radio button group for all selected or for hierarchy under selected widgets["tanHierRBG"] = cmds.radioButtonGrp(nrb=2, l1="Selected Objs Only", l2="Hierarchy Under Selected", sl=2, cc=enableSelect) #radioButtons for time (timeslider, all anim, range) widgets["tanTimeRBG"] = cmds.radioButtonGrp(nrb=3,l1="Timeslider", l2="All Anim", l3="Frame Range", sl=2, cw=[(1,100),(2,75),(3,75)],cc=partial(enableFR,"tanTimeRBG","tanFrameRangeIFG")) #int field group for frame range widgets["tanFrameRangeIFG"] = 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)]) #radioButtons for curves only or for all DAG objects widgets["tanCurvesRBG"] = cmds.radioButtonGrp(nrb=2, l1="Curves/Volume Primatives Only", l2="All DAG", sl=1, cw=[(1, 190),(2, 110)]) cmds.separator(h=10) #Button for executing the change #button to SELECT those objects rather than change the tangents widgets["buttonRCLO"] = cmds.rowColumnLayout(w=300, nc=2, cw=[(1,200),(2,100)]) widgets["tanBut"] = cmds.button(l="Change Tangent Type!", w=200, h=40, bgc=(.6,.6,.8), c=changeTan) 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=160)
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 buildWindow(self): ''' Initialize the UI ''' if mc.window(self.name, exists=True): mc.deleteUI(self.name) mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu) if self.menu: self.createMenu() self.form = mc.formLayout() self.column = mc.columnLayout(adj=True) mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2, columnAlign2=('right','left'), columnAttach=[(1, 'both', 0), (2, 'both', 8)] ) #if we can find an icon, use that, otherwise do the text version if self.icon: mc.iconTextStaticLabel(style='iconOnly', image1=self.icon) else: mc.text(label=' _ _ |\n| | | |') if not self.menu: mc.popupMenu(button=1) mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name))) mc.text(label=self.info) mc.setParent('..') mc.separator(height=8, style='single', horizontal=True)
def buildMainLayout(self): '''Build the main part of the ui ''' tabs = mc.tabLayout() tab1 = mc.columnLayout(adj=True) mc.scrollLayout(cr=True) self.shelfLayout = mc.shelfLayout() self.refreshShelfLayout() mc.setParent(tabs) tab2 = mc.columnLayout(adj=True) mc.separator(height=8, style='none') mc.text('Select curve(s) to export. Multiple selected curves will be combined.') mc.text('Center and fit the curve in the viewport,') mc.text('and make sure nothing else is visible for best icon creation.') mc.separator(height=16, style='in') mc.button('Export Selected Curve', command=self.exportControl, annotation='Select a nurbsCurve to export.') mc.tabLayout( tabs, edit=True, tabLabel=((tab1, 'Import'), (tab2, 'Export') )) if not mc.shelfLayout(self.shelfLayout, query=True, numberOfChildren=True): mc.tabLayout( tabs, edit=True, selectTab=tab2)
def buildMainLayout(self): '''Build the main part of the ui ''' #tabs = mc.tabLayout() #tab1 = mc.columnLayout(adj=True) #self.swatch_selected = self.colorControlLayout() #mc.button(label='Color Selected', command=self.colorSelected) #mc.setParent('..') #tab2 = mc.columnLayout(adj=True) self.swatch_range1 = self.colorControlLayout(label='First Selected') self.swatch_range2 = self.colorControlLayout(label='Last Selected') mc.separator(horizontal=True, height=10) mc.button(label='Color Selected Nodes', command=self.colorSelectedRange) #mc.setParent('..') #tab3 = mc.columnLayout(adj=True) #self.positionWidgets = {} #for xyz in 'XYZ': #for m in ['Min','Max']: #self.positionWidgets[m+xyz] = self.colorControlLayout(label='{} {}'.format(m,xyz)) mc.setParent('..') #mc.tabLayout( tabs, edit=True, tabLabel=((tab1, 'Color Control'), (tab2, 'Color Range')) )
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 shapeScaleUI(): """ UI for the script """ if (cmds.window("ssWin", exists=True)): cmds.deleteUI("ssWin", window=True) # cmds.winPref("shapeScaleWin", remove=True) widgets["win"] = cmds.window("ssWin", t="zbw_shapeScale", w=400, h=75, s=False) widgets["colLo"] = cmds.columnLayout("mainCLO", w=400, h=75) widgets["formLO"] = cmds.formLayout(nd=100, w=400) cmds.separator(h=10) widgets["slider"] = cmds.floatSliderGrp("slider", f=False, l="Scale", min=0.01, max=2, pre=3, v=1, adj=3, cal=([1, "left"], [2, "left"], [3, "left"]), cw=([1, 50], [2, 220]), cc=shapeScaleExecute) cmds.separator(h=10) widgets["scaleFFG"] = cmds.floatFieldGrp(v1=100, pre=1, l="Scale %", en1=True, w=110, cw=([1, 50], [2, 50]), cal=([1, "left"], [2, "left"])) widgets["scaleDoBut"] = cmds.button(l="Scale", w=160, h=25, bgc=(.2, .4, .2), c=manualScale) widgets["trackerFFG"] = cmds.floatFieldGrp(l="Change", w=100, v1=100, pre=1, en1=False, cw=([1, 45], [2, 50]), cal=([1, "left"], [2, "right"]), bgc=(.2, .2, .2)) widgets["clearBut"] = cmds.button(l="RESET", w=45, bgc=(.2, .2, .2), c=resetScale) widgets["origBut"] = cmds.button(l="ORIG", w=45, bgc=(.2, .2, .2), c=origScale) # attach to form layout cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["slider"], 'top', 5), (widgets["slider"], 'left', 5)]) cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["scaleFFG"], 'top', 34), (widgets["scaleFFG"], 'left', 5)]) cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["scaleDoBut"], 'top', 34), (widgets["scaleDoBut"], 'left', 120)]) cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["clearBut"], 'top', 34), (widgets["clearBut"], 'left', 344)]) cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["trackerFFG"], 'top', 5), (widgets["trackerFFG"], 'left', 290)]) cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["origBut"], 'top', 34), (widgets["origBut"], 'left', 290)]) cmds.showWindow(widgets["win"]) cmds.window(widgets["win"], e=True, w=400, h=75)
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 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 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 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)
def ui(): ''' User interface for world bake ''' with utl.MlUi('ml_worldBake', 'World Bake', width=400, height=175, info='''Select objects, bake to locators in world, camera, or custom space. When you're ready to bake back, select locators and bake "from locators" to re-apply your animation.''') as win: mc.checkBoxGrp('ml_worldBake_bakeOnOnes_checkBox',label='Bake on Ones', annotation='Bake every frame. If deselected, the tool will preserve keytimes.') tabs = mc.tabLayout() tab1 = mc.columnLayout(adj=True) mc.radioButtonGrp('ml_worldBake_space_radioButton', label='Bake To Space', numberOfRadioButtons=3, labelArray3=('World','Camera','Last Selected'), select=1, annotation='The locators will be parented to world, the current camera, or the last selection.') mc.checkBoxGrp('ml_worldBake_constrain_checkBox',label='Maintain Constraints', annotation='Constrain source nodes to the created locators, after baking.') win.ButtonWithPopup(label='Bake Selection To Locators', command=toLocators, annotation='Bake selected object to locators specified space.', readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox', 'spaceInt':'ml_worldBake_space_radioButton', 'constrainSource':'ml_worldBake_constrain_checkBox'}, name=win.name)#this last arg is temp.. mc.setParent('..') tab2 = mc.columnLayout(adj=True) win.ButtonWithPopup(label='Bake Selected Locators Back To Objects', command=fromLocators, annotation='Bake from selected locators back to their source objects.', readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox'}, name=win.name)#this last arg is temp.. mc.setParent('..') tab3 = mc.columnLayout(adj=True) mc.checkBoxGrp('ml_worldBake_maintainOffset_checkBox',label='Maintain Offset', annotation='Maintain the offset between nodes, rather than snapping.') win.ButtonWithPopup(label='Bake Selected', command=utl.matchBake, annotation='Bake from the first selected object directly to the second.', readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox', 'maintainOffset':'ml_worldBake_maintainOffset_checkBox'}, name=win.name)#this last arg is temp.. mc.tabLayout( tabs, edit=True, tabLabel=((tab1, 'Bake To Locators'), (tab2, 'Bake From Locators'), (tab3, 'Bake Selection')) ) # win.ButtonWithPopup(label='Bake Selected With Offset', command=matchBake, annotation='Bake from the first selected object directly to the second, maintaining offset.', # readUI_toArgs={'bakeOnOnes':'ml_worldBake_bakeOnOnes_checkBox'}, name=win.name)#this last arg is temp..