def create(self): if cmds.window(self.window, exists=True): cmds.deleteUI(self.window); self.window = cmds.window(self.window, widthHeight=(800, 600), title="Light Manager") self.refreshList() self.createUI() cmds.setParent(menu=True) cmds.showWindow(self.window) try: initPos = cmds.windowPref( self.window, query=True, topLeftCorner=True ) if initPos[0] < 0: initPos[0] = 0 if initPos[1] < 0: initPos[1] = 0 cmds.windowPref( self.window, edit=True, topLeftCorner=initPos ) except : pass self.refreshList()
def gui(): if (cmds.window('dk_pipe_gui_001', ex=True)): cmds.deleteUI('dk_pipe_gui_001') # This clears any window preferences on our GUI if (cmds.windowPref('dk_pipe_gui_001', ex=True)): cmds.windowPref('dk_pipe_gui_001', r=True) cmds.window('dk_pipe_gui_001', t="Build Pipes") cmds.columnLayout('MAIN') cmds.rowColumnLayout(nc=2) cmds.iconTextStaticLabel(st='textOnly', l='No. Pipes') cmds.intField('n_pipes_int', w=150, min=1, max=20, v=8) cmds.iconTextStaticLabel(st='textOnly', l='Min Pipe Size') cmds.floatSlider('min_pipe_size_int', min=1, max=4, value=1, step=1) cmds.iconTextStaticLabel(st='textOnly', l='Max Pipe Size') cmds.floatSlider('max_pipe_size_int', min=1, max=4, value=1, step=1) cmds.iconTextStaticLabel(st='textOnly', l='Art Radius') cmds.intField('main_radius_int', value=3) cmds.button(w=150, l='Create Pipes', c=handle_input) cmds.setParent('MAIN') cmds.columnLayout('SECOND') cmds.button(w=300, l='Delete History (All)', c=handle_delete_button) cmds.showWindow('dk_pipe_gui_001')
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)
def init(self): window = c.window(title='WeatherViz',widthHeight=(400,600)); #form = c.formLayout(numberOfDivisions=100); c.rowColumnLayout(numberOfColumns=1); c.checkBoxGrp('weatherPanel', label='Weather'); c.checkBox('snowCheck', label='Snow', onc=self.snow.init, ofc=self.snow.remove, p='weatherPanel'); c.checkBox('rainCheck', label='Rain', onc=self.rain.init, ofc=self.rain.remove, p='weatherPanel'); c.checkBox('windCheck', label='Wind', onc=self.wind.init, ofc=self.wind.remove, p='weatherPanel'); c.button('collButton', label='Add collision', c=self.addCollision); #s1 = c.floatSliderGrp('snowTurb',label='Snow turbulence', field=True, value=5, dc=self.slider_drag_callback, min=0, max=10); c.floatSliderGrp('snowIntens',label='Snow Intencity', field=True, value=200, dc=self.slider_drag_callback, min=0, max=1000, en=False); c.floatSliderGrp('rainIntens',label='Rain Intencity', field=True, value=200, dc=self.slider_drag_callback, min=0, max=1000, en=False); c.floatSliderGrp('snowTurbSlider',label='Turbulence', field=True, value=1, dc=self.slider_drag_callback, min=0, max=100, en=False); c.floatSliderGrp('airMSlider',label='Wind Magnitude', field=True, value=30, dc=self.slider_drag_callback, min=0, max=100, en=False); c.floatSliderGrp('airMxdSlider',label='Wind Distance', field=True, value=20, dc=self.slider_drag_callback, min=0, max=100, en=False); #c.formLayout(form, edit=True, attachPosition=[(s1, 'top', 20, 1)]); #c.formLayout(form, edit=True, attachPosition=[(s2, 'top', 20, 1)]); c.textField("WeatherViz_HDR_Path_textField", cc=_WeatherViz_HDR_Path_textField__changeCommand) c.button("WeatherViz_HDR_Path_button", label="...", al="center", command=_WeatherViz_HDR_Path_button__command) WeatherViz_HDR_Path = c.optionVar(q="WeatherViz_HDR_Path") if WeatherViz_HDR_Path: c.textField("WeatherViz_HDR_Path_textField", edit=True, text=WeatherViz_HDR_Path) c.showWindow(window); c.windowPref(enableAll=True)
def nu(self): if(cmds.window(self.win, q = 1, ex = 1)): cmds.deleteUI(self.win) if(cmds.windowPref(self.win, ex = True)): cmds.windowPref(self.win, r = True) cmds.window(self.win, t = "Export as FBX", h = 170, w = 250,rtf=1,s=0) mainCol = cmds.columnLayout() cmds.columnLayout() cmds.image( image="//10.10.35.93/data/_3dAppDomain/_images/maya_export_fbx.png",w=250,h=45 ) cmds.text(label="") uRow = cmds.columnLayout() #zRow = cmds.rowLayout(numberOfColumns=1,cl1="left",cw1=170,ct1="left") cmds.button(label='click to set preset file') #cmds.setParent(zRow) tRow = cmds.rowLayout(numberOfColumns=2,cl2=("right","left"),cw2=(170,70),ct2=("right","left")) self.expPath = cmds.textField() cmds.textField( self.expPath , edit=True, width = 140, enterCommand=('cmds.setFocus(\"' + self.expPath + '\")') ) cmds.button(label='Browse',command='obj.abc()') cmds.setParent(tRow) cmds.setParent(uRow) cmds.text(label = " ") sRow = cmds.rowLayout(numberOfColumns=2,cl2=("center","center"),cw2=(120,130),ct2=("both","both"),co2=(10,05)) butExp = cmds.button( label='Push Export', command='obj.sortAndExport()') cmds.button( label=" Close ", command=("obj.close()")) cmds.setParent(sRow) cmds.setParent(mainCol) # cmds.text(label="") cmds.showWindow(self.win)
def gui (): try: cmds.deleteUI ("Stabilizer") except: pass try: cmds.windowPref("Stabilizer", remove = True) except: pass cmds.window( 'Stabilizer', sizeable = True, resizeToFitChildren = True, retain = False, topLeftCorner = (10, 700) ) cmds.columnLayout ('cl') cmds.button( 'button_stabilizer', label = "stabilize", width = 120, backgroundColor = (0, 0.5, 0), command = 'fstab.stabilizer("start")' ) cmds.button( 'add_eye_btn', enable = False, label = "add eye", width = 120, backgroundColor = (0.3, 0.3, 0.3), command = 'fstab.add_eye()' ) cmds.showWindow( 'Stabilizer' )
def transfertSelectionToTarget_window(): """ This definition creates the 'Transfert Selection To Target' main window. """ cmds.windowPref(enableAll=False) if (cmds.window("transfertSelectionToTarget_window", exists=True)): cmds.deleteUI("transfertSelectionToTarget_window") cmds.window("transfertSelectionToTarget_window", title="Transfert Selection To Target", width=320) spacing = 5 cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing) cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)]) cmds.text(label="Target:") sources_textField = cmds.textField("target_textField") cmds.button("pickTarget_button", label="Pick Target!", command=pickTarget_button_OnClicked) cmds.setParent(topLevel=True) cmds.separator(style="single") cmds.button("transfertSelection_button", label="Transfert Selection!", command=transfertSelection_button_OnClicked) setUnsetContextHotkeys() scriptJob = cmds.scriptJob(uiDeleted=("transfertSelectionToTarget_window", setUnsetContextHotkeys), runOnce=True) cmds.showWindow("transfertSelectionToTarget_window") cmds.windowPref(enableAll=True)
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)
def showUI(): win = 'lsWireOffset_window' # if window exists, delete if mc.window(win, ex=True): mc.deleteUI(win, wnd=True) # delete window prefs... if you want... mc.windowPref(win, remove=True) # create window mc.window(win, t='lsWireOffset v0.1', wh=(200,335), mxb=False) # main column mainCol = mc.columnLayout(columnAttach=('both', 5), rowSpacing=10, columnWidth=200) # creation frame createFrm = mc.frameLayout(p=mainCol, cl=False, l='Create New Module') createCol = mc.columnLayout(columnAttach=('both', 5), rowSpacing=5, columnWidth=188) nameTxtFld = mc.textFieldGrp( label='Name: ', text='', cw2=(40,125), p=createCol) mc.text(l='Select edge loop OR \n vertices and...') creationBtn = mc.button(l='Create', c="lsWireOffset.ui.createNew('%s')"%nameTxtFld) # edit frame editFrm = mc.frameLayout(p=mainCol, cl=False, l='Edit Existing Modules') editCol = mc.columnLayout(columnAttach=('both', 5), rowSpacing=5, columnWidth=188) scrollList = mc.textScrollList(win+'_wTSL') refreshTSL(scrollList) # popop menu for right click mc.popupMenu(win+'_wTSL_MM', p=scrollList, mm=True, button=3, pmc=buildMM) mc.showWindow(win)
def build(self): if mc.window( self.win, ex=1 ): mc.deleteUI( self.win ) if mc.windowPref( self.win, ex=1 ): mc.windowPref( self.win, remove=1 ) mc.window(self.win, title=self.title, wh=(410,378)) mc.columnLayout( 'mainColumn', adj=True ) mc.separator( h=10 ) mc.rowLayout( numberOfColumns=2, columnWidth2=(200, 200), columnAttach=[(1, "both", 5),(2 ,"both", 5)] ) mc.columnLayout( adj=True, columnAlign="center" ) mc.text( l=self.textsk ) self.skcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True ) mc.setParent('..') mc.columnLayout( adj=True, columnAlign="center" ) mc.text( l=self.textqp ) self.qpcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True ) mc.setParent( '..' ) mc.setParent('..') mc.separator ( h=10 ) mc.rowLayout( numberOfColumns=4, columnWidth4=(100, 100, 100, 100), columnAttach=[(1, "both", 1),(2 ,"both", 1), (3 ,"both", 1), (4 ,"both", 1)] ) mc.button( l=self.buttonsk, c=self.selSKItem ) mc.button( l=self.buttonAllSk, c=self.mainSK ) mc.button( l=self.buttonqp, c=self.selQPItem ) mc.button( l=self.buttonAllQp, c=self.mainQP ) mc.setParent('..') mc.columnLayout( adj=True, columnAlign="center" ) mc.separator ( h=10 ) mc.setParent('..') self.addSKList()
def createWindow(self): self.log.debug("creating window "+self.windowName) if self.windowExists(self.windowName): raise Exception("window %s already opened" % self.windowName) if not self.useUserPrefSize: try: cmds.windowPref(self.windowName,remove=True) cmds.windowPref(self.windowName,width=self.defaultWidth,height=self.defaultHeight) except: pass cmds.window(self.windowName, title=self.windowTitle, maximizeButton=False, minimizeButton=False, width=self.defaultWidth, height=self.defaultHeight, sizeable=self.sizeable, menuBar=self.menuBar) cmds.scriptJob(uiDeleted=[self.windowName,self.onWindowDeleted]) HeadlessDataHost.HANDLE.addReference(self)
def windowChooseCam(self): if cmds.window("ChooseRenderCam", exists=True): cmds.deleteUI("ChooseRenderCam", window=True) try: cmds.windowPref("ChooseRenderCam", r=True) except: pass chooseCamWin = cmds.window("ChooseRenderCam", h=220, w=300, te=300, le=900, s=1, title="Choose Camera") AllrowColumnLayout = cmds.columnLayout(w=200) CamtexTScrollList = cmds.textScrollList( "CamtexTScrollList", allowMultiSelection=False, showIndexedItem=4, dcc=self.lockTroughtCamera, sc=self.lockTroughtCamera, ) renderButton = cmds.button("Render", c=self.submitRender) self.addIntoTextScrollList() cmds.setParent("..") cmds.showWindow(chooseCamWin)
def unfoldBand_window(): """ This definition creates the 'Unfold Band' main window. """ cmds.windowPref(enableAll=False) if (cmds.window("unfoldBand_window", exists=True)): cmds.deleteUI("unfoldBand_window") cmds.window("unfoldBand_window", title="Unfold Band", width=384) spacing = 5 cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing) cmds.separator(height=10, style="singleDash") cmds.intSliderGrp("divisions_intSliderGrp", label="Divisions", field=True, minValue=0, maxValue=10, fieldMinValue=0, fieldMaxValue=65535, value=2) cmds.separator(style="single") cmds.columnLayout(columnOffset=("left", 140)) cmds.checkBox("keepConstructionHistory_checkBox", label="Keep Construction History", v=True) cmds.setParent(topLevel=True) cmds.separator(height=10, style="singleDash") cmds.button("unfoldBand_button", label="Unfold Band!", command=unfoldBand_button_OnClicked) cmds.showWindow("unfoldBand_window") cmds.windowPref(enableAll=True)
def cameraZoomControls_window(): """ Creates the 'Camera Zoom Controls' main window. """ cmds.windowPref(enableAll=False) if (cmds.window("cameraZoomControls_window", exists=True)): cmds.deleteUI("cameraZoomControls_window") cmds.window("cameraZoomControls_window", title="Camera Zoom Controls", sizeable=True, width=320) spacing = 5 cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing) cmds.floatSliderGrp("overscan_floatSliderGrp", label="Overscan", field=True, min=0.01, max=2.5, value=1, sliderStep=0.001, dragCommand=overscan_floatSliderGrp_OnValueChanged) cmds.floatSliderGrp("horizontalOffset_floatSliderGrp", label="Horizontal Offset", field=True, min=-2.5, max=2.5, value=0, sliderStep=0.001, dragCommand=horizontalOffset_floatSliderGrp_OnValueChanged) cmds.floatSliderGrp("verticalOffset_floatSliderGrp", label="Vertical Offset", field=True, min=-2.5, max=2.5, value=0, sliderStep=0.001, dragCommand=verticalOffset_floatSliderGrp_OnValueChanged) cmds.button("resetZoomCtrls_button", label="Reset Zoom Controls", command=resetZoomControls_button_OnClicked) cmds.showWindow("cameraZoomControls_window") cmds.windowPref(enableAll=True);
def gui(): ''' Generates the interface for the file sequencer. ''' if( cmds.window(win, ex=True) ): cmds.deleteUI(win) if( cmds.windowPref(win, ex=True) ): cmds.windowPref(win, r=True) cmds.window(win, h=500, w=400) mainCol = cmds.columnLayout() cmds.rowColumnLayout(nc=2, cw=[[1,200],[2,200]]) global targField, destField, tslTarget, tslDestin targField = cmds.scrollField( w=200, h=50, editable=False, wordWrap=True, text='Non editable with word wrap' ) destField = cmds.scrollField( w=200, h=50, editable=False, wordWrap=True, text='Non editable with word wrap' ) cmds.button(label="Load Target", c=Callback(getTarget)) cmds.button(label="Load Destination", c=Callback(getDestin)) cmds.text(label = "Target Files") cmds.text(label = "Destination Files") tslTarget = TextScrollList(200, 200) tslDestin = TextScrollList(200, 200) cmds.setParent(mainCol) # Inputs fieldsGUI(mainCol) cmds.showWindow(win) print("Interface executed.")
def gui(): """ # creates the gui """ win = "fsa_uvtransfertool" if cmds.window(win, ex=True): cmds.deleteUI(win) if cmds.windowPref(win, ex=True): cmds.windowPref(win, remove=True) global source_field # global textFieldButtonGrp for source mesh my_win = cmds.window(win, title="transfer_uvs", sizeable=False, mnb=True, width=200, height=200) cmds.columnLayout(adjustableColumn=True, width=200) source_field = cmds.textFieldButtonGrp( text="Source Mesh", buttonLabel="<<SOURCE<<", columnWidth=([1, 115], [2, 85]), annotation="add source", buttonCommand=add_source_mesh, ) cmds.button( width=200, height=100, label="Transfer To Selected Meshes", command=button_cmd, annotation="select target meshes after " + "source has been added", ) cmds.showWindow(my_win)
def gui(): ''' Generates the gui for the script. ''' if( cmds.window(win, q=True, ex=True)): cmds.deleteUI(win) if( cmds.windowPref(win, q=True, ex=True) ): # cmds.windowPref(win, r=True, wh=[winWidth, winHeight]) cmds.windowPref(win, r=True) cmds.window(win, title="Photoshop Tool", w=winWidth, h=winHeight) cmds.columnLayout() cmds.textScrollList("mecPhTSL", w=winWidth-15, h=150) cmds.button(label="Refresh", w=winWidth-15, c="mecPh.phAddTSL()") cmds.rowColumnLayout( nc=2, cw=[[1,80],[2,105]]) cmds.button(label="Close All", c="mecPh.phCloseAll()") cmds.button(label="Close Selected", c="mecPh.phCloseSel()") cmds.showWindow(win)
def create(self, *args ): top, left = cmds.window( WindowInfo._window, q=1, topLeftCorner=1 ) top += 70 left +=19 itemIndex = cmds.textScrollList( FolderUIInfo._scrollListUI, q=1, sii=1 ) if not itemIndex: return None selItem = cmds.textScrollList( FolderUIInfo._scrollListUI, q=1, si=1 )[0].split('.')[0] top += itemIndex[0]*13 if cmds.window( FolderSubRenameUiInfo._winName, ex=1 ): cmds.deleteUI( FolderSubRenameUiInfo._winName ) cmds.window( FolderSubRenameUiInfo._winName, titleBar=0 ) cmds.columnLayout() cmds.rowColumnLayout( nc=3, cw=[(1,120),(2,52),(3,25)] ) textField = cmds.textField( tx=selItem ) cmds.button( l='Rename', c=FolderSubRenameUiInfo.cmdRename ) cmds.button( l='X' , c=self.cmdDeleteWindow, bgc=[0.9,0.35,0.35] ) cmds.windowPref( FolderSubRenameUiInfo._winName, e=1, widthHeight = [ FolderSubRenameUiInfo._width, FolderSubRenameUiInfo._height ], topLeftCorner = [ top, left ] ) cmds.showWindow( FolderSubRenameUiInfo._winName ) FolderSubRenameUiInfo._renameTextField = textField
def deleteCustomOptions(): variablePrefix = "ngSkinTools" for varName in cmds.optionVar(list=True): if varName.startswith(variablePrefix): cmds.optionVar(remove=varName) cmds.windowPref('MirrorWeightsWindow',ra=True)
def create(self, *args ): top, left = cmds.window( WindowInfo._window, q=1, topLeftCorner=1 ) top +=70 left +=19 itemIndex = cmds.textScrollList( FolderUIInfo._scrollListUI, q=1, sii=1 ) if not itemIndex: return None top += itemIndex[0]*13 if cmds.window( FolderSubDeleteUiInfo._winName, ex=1 ): cmds.deleteUI( FolderSubDeleteUiInfo._winName ) cmds.window( FolderSubDeleteUiInfo._winName, titleBar=0 ) cmds.columnLayout() cmds.rowColumnLayout( nc=1, cw=[(1,200)] ) cmds.text( l='Are You Sure?', al='center', h=22 ) cmds.setParent( '..' ) cmds.rowColumnLayout( nc=2, cw=[(1,100),(2,100)]) cmds.button( l='Delete', c=FolderSubDeleteUiInfo.cmdDelete, h=22 ) cmds.button( l='Cancel', c=self.cmdDeleteWindow, h=22 ) cmds.setParent( '..' ) cmds.windowPref( FolderSubDeleteUiInfo._winName, e=1, widthHeight = [ FolderSubDeleteUiInfo._width, FolderSubDeleteUiInfo._height ], topLeftCorner = [ top, left ] ) cmds.showWindow( FolderSubDeleteUiInfo._winName )
def process(): ''' Brings up the Dome Light Rig UI. ''' dlWin = "domeLightWin" if cmds.window(dlWin, exists=True): cmds.deleteUI(dlWin) if cmds.windowPref(dlWin, exists=True): cmds.windowPref(dlWin, remove=True) winWidth = 425 winHeight = 485 cmds.window(dlWin, width=winWidth, height=winHeight, sizeable=False, menuBar=True, title="Dome Light Rig") cmds.menu(label="Help") cmds.menuItem(label="About...", command="from project import domeLight; domeLight.aboutWin()") cmds.frameLayout(borderVisible=1, borderStyle="etchedIn", labelVisible=0) mainForm = cmds.formLayout("mainForm") _buildControls( dlWin ) _positionControls( dlWin, mainForm ) cmds.window(dlWin, edit=True, width=winWidth, height=winHeight) cmds.showWindow(dlWin)
def alignComponents_window(): """ Creates the 'Align Components' main window. """ cmds.windowPref(enableAll=False) if (cmds.window("alignComponents_window", exists=True)): cmds.deleteUI("alignComponents_window") cmds.window("alignComponents_window", title="Align Components", width=320) spacing = 5 cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing) cmds.button("selectAnchors_button", label="Select Anchors!", command=selectAnchors_button_OnClicked) cmds.separator(height=10, style="singleDash") cmds.button("alignSelection_button", label="Align Selection!", command=alignSelection_button_OnClicked) cmds.separator(height=10, style="singleDash") cmds.button("alignSelectionOnXAxis_button", label="Align Selection On X!", command=alignSelectionOnXAxis_button_OnClicked) cmds.button("alignSelectionOnYAxis_button", label="Align Selection On Y!", command=alignSelectionOnYAxis_button_OnClicked) cmds.button("alignSelectionOnZAxis_button", label="Align Selection On Z!", command=alignSelectionOnZAxis_button_OnClicked) cmds.showWindow("alignComponents_window") cmds.windowPref(enableAll=True)
def create(self): if cmds.window(self.window, exists=True): cmds.deleteUI(self.window); self.window = cmds.loadUI(uiFile=self.uiFile, verbose=False) cmds.showWindow(self.window); try: initPos = cmds.windowPref( self.window, query=True, topLeftCorner=True ) if initPos[0] < 0: initPos[0] = 0 if initPos[1] < 0: initPos[1] = 0 cmds.windowPref( self.window, edit=True, topLeftCorner=initPos ) except : pass ctrlPath = '|'.join([self.window, 'radioButton']); cmds.radioButton(ctrlPath, edit=True, select=True); ctrlPath = '|'.join([self.window, 'groupBox_4']); cmds.control(ctrlPath, edit=True, enable=False); ctrlPath = '|'.join([self.window, 'groupBox_2', 'pushButton_7']); cmds.button(ctrlPath, edit=True, enable=False); ctrlPath = '|'.join([self.window, 'groupBox_2', 'lineEdit']); cmds.textField(ctrlPath, edit=True, text="-u --oiio");
def snapOnClosestVertex_window(): """ Creates the 'Snap On Closest Vertex' vertex window. """ cmds.windowPref(enableAll=False) if (cmds.window("snapOnClosestVertex_window", exists=True)): cmds.deleteUI("snapOnClosestVertex_window") cmds.window("snapOnClosestVertex_window", title="Snap On Closest Vertex", width=320) spacing = 5 cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing) cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)]) cmds.text(label="Reference Object:") referenceObject_textField = cmds.textField("referenceObject_textField") cmds.button("getReferenceObject_button", label="Get Reference Object!", command=getReferenceObject_button_OnClicked) cmds.setParent(topLevel=True) cmds.separator(style="single") cmds.button("snapIt_button", label="Snap It!", al="center", command=snapIt_button_OnClicked) cmds.showWindow("snapOnClosestVertex_window") cmds.windowPref(enableAll=True)
def postInstallDialog(): ''' Displays a dialog window to confirm the installation for MRT. ''' dialogWin = cmds.window(title='MRT Start Up', resizeToFitChildren=True, maximizeButton=False, minimizeButton=False, sizeable=False) mainCol = cmds.columnLayout(width=500, rowSpacing=15) cmds.separator(style='none') cmds.text(label='Modular rigging tools has been installed.', align='center', width=400) cmds.text(label='Please restart maya.', font='boldLabelFont', align='center', width=400) cmds.rowLayout(numberOfColumns=2, columnWidth=[(1, 150), (2, 100)]) cmds.separator(style='none') cmds.button(label='OK', command=('import maya.cmds; maya.cmds.deleteUI(\"'+dialogWin+'\")'), width=100, align='center') cmds.setParent(mainCol) cmds.separator(style='none') cmds.showWindow(dialogWin) try: cmds.windowPref(dialogWin, remove=True) except: pass
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 activateBlendshapes_window(): """ This definition creates the 'Activate Blendshapes' main window. """ cmds.windowPref(enableAll=False) if (cmds.window("activateBlendshapes_window", exists=True)): cmds.deleteUI("activateBlendshapes_window") cmds.window("activateBlendshapes_window", title="Activate Blendshapes", width=320) spacing = 5 cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing) cmds.separator(height=10, style="singleDash") cmds.floatSliderGrp("weight_floatSliderGrp", label="Weight", field=True, minValue=0, maxValue=1, fieldMinValue=0, fieldMaxValue=1, sliderStep=0.01, value=0, changeCommand=weight_floatSliderGrp_OnValueChanged, dragCommand=weight_floatSliderGrp_OnValueChanged) cmds.separator(height=10, style="singleDash") cmds.showWindow("activateBlendshapes_window") cmds.windowPref(enableAll=True)
def build(self): if mc.windowPref(self.win, exists=1): mc.windowPref(self.win, remove=1) if mc.window(self.win,exists=1): mc.deleteUI(self.win) mc.window( self.win, title=self.title, widthHeight=(500, 210) ) cl1 = mc.columnLayout( columnAttach=('both', 2), rowSpacing=3, columnWidth=500, adjustableColumn = True) mc.radioCollection() self.mouth = mc.radioButton( l='user import', select=1, p=cl1 ) self.autoR = mc.radioButton( l='auto import', p=cl1 ) mc.separator() mc.frameLayout('selected') mc.rowLayout(numberOfColumns=3, columnWidth3=(80, 75, 150), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] ) mc.text(l='Mode') mc.columnLayout() mc.radioCollection() self.prop = mc.radioButton( l='Prop', select=1 ) self.character = mc.radioButton( l='Character' ) mc.setParent( '..' ) mc.setParent( '..' ) self.numText = mc.floatFieldGrp( l='Num' ) self.txtProp = mc.textFieldButtonGrp( label='File Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath ) #mc.separator() #self.txtCharacter = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath ) #mc.separator() mc.separator(p=cl1) mc.button( 'importR', l='Import Reference File', p=cl1 ) mc.setParent( '..' )
def build(self): if mc.windowPref(self.win, exists=1): mc.windowPref(self.win, remove=1) if mc.window(self.win,exists=1): mc.deleteUI(self.win) mc.window(self.win, t=self.title, widthHeight=(280, 30)) mc.columnLayout(adj=1) mc.button( 'remove', l='Remove Reference', c=self.core.do )
def replaceCam(): main_win = 'replaceCamWin' if mc.window (main_win, exists = 1): mc.deleteUI (main_win) if mc.windowPref (main_win, exists = 1): mc.windowPref (main_win, remove = 1) win = mc.loadUI(f = '//192.168.3.250/scripts$/toonzPipe/mayaPipe/replaceCamWin.ui') mc.window(win, e = 1, tlc = [350,350]) mc.showWindow(win) mc.button('btn_importCam', e = 1, c = lambda event: importCam())
def _start_ui(self): # Remove size preference to force the window calculate its size windowName = 'VirtuCameraMayaConfigWindow' if cmds.windowPref(windowName, exists=True): cmds.windowPref(windowName, remove=True) self._ui_window = cmds.window(windowName, width=self._WINDOW_SIZE[0], height=self._WINDOW_SIZE[1], menuBarVisible=False, titleBar=True, visible=True, sizeable=True, closeCommand=self._close_ui, title='VirtuCamera Configuration') form_lay = cmds.formLayout(width=505, height=300) col_lay = cmds.columnLayout(adjustableColumn=True, columnAttach=('both', 0), width=465) cmds.text(label='Custom Scripts', align='left') cmds.separator(height=15, style='none') cmds.rowLayout(numberOfColumns=3, columnWidth3=(600, 80, 80), adjustableColumn=1, columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)]) self._script_num_ui = cmds.intSliderGrp( field=True, label='Script Number', minValue=0, maxValue=1, fieldMinValue=0, fieldMaxValue=1, value=0, dragCommand=self._script_number_changed_ui, enable=False) self._new_bt_ui = cmds.button(label='New', command=self._new_script_ui) self._rem_bt_ut = cmds.button(label='Remove', command=self._remove_script_ui, enable=False) cmds.setParent('..') self._label_ui = cmds.textFieldGrp( label='Button Label', textChangedCommand=self._label_changed_ui, enable=False) self._lang_ui = cmds.radioButtonGrp( label='Language', labelArray2=['Python', 'MEL'], numberOfRadioButtons=2, select=self._LANG_PY, changeCommand=self._languaje_changed_ui, enable=False) self._code_lb_ui = cmds.text(label='Script Code', align='left', enable=False) cmds.setParent('..') self._ui_sfield = cmds.scrollField( editable=True, wordWrap=False, keyPressCommand=self._code_changed_ui, enable=False) col_lay2 = cmds.columnLayout(adjustableColumn=True, columnAttach=('both', 0), width=465) cmds.rowLayout(numberOfColumns=2, columnWidth2=(680, 80), adjustableColumn=1, columnAttach=[(1, 'both', 0), (2, 'both', 0)]) cmds.separator(style='none') self._ui_save = cmds.button(label='Save', width=80, command=self._save_ui, enable=False) cmds.setParent('..') cmds.setParent('..') cmds.formLayout(form_lay, edit=True, attachForm=[(col_lay, 'top', 20), (col_lay, 'left', 20), (col_lay, 'right', 20), (self._ui_sfield, 'left', 20), (self._ui_sfield, 'right', 20), (col_lay2, 'bottom', 20), (col_lay2, 'left', 20), (col_lay2, 'right', 20)], attachControl=[(self._ui_sfield, 'top', 0, col_lay), (self._ui_sfield, 'bottom', 15, col_lay2)]) cmds.setParent('..') cmds.showWindow(self._ui_window)
def createExtraPanel(panel_width=0, panel_height=0, gap=[0, 0], margin=0, panel_height_percent=27.0 / 50, gap_percent=1.0 / 20, titleBar_height=30, pos="top"): cmds.windowPref(enableAll=0) # NOTE 获取当前角色摄像机 camera = None for cam in cmds.ls(type="camera"): cam = cmds.listRelatives(cam, p=1)[0] if "camera_001" in cam.lower(): camera = cam break desktop = QtWidgets.QApplication.desktop() # NOTE 获取任意副屏幕 for i in range(desktop.screenCount()): if desktop.primaryScreen() != i: screen = desktop.screenGeometry(i) break if panel_height <= 0: panel_height = screen.height() * panel_height_percent gap_LR, gap_TD = gap if gap_LR < 0: gap_LR = screen.width() * gap_percent if gap_TD < 0: gap_TD = gap_LR if panel_width <= 0: panel_width = (screen.width() - gap_LR) / 2 # NOTE 计算面板显示的位置 w, h = getWindowPos(screen, panel_width, panel_height, gap_LR, pos, margin) h += titleBar_height main_pos = [w, h, panel_width, panel_height] shadow_pos = [w + panel_width + gap_LR, h, panel_width, panel_height] # NOTE 创建主视角视图 main_panel_win = "main_panel_win" if cmds.window(main_panel_win, q=1, ex=1): cmds.deleteUI(main_panel_win) window = cmds.window(main_panel_win, t=u"主视角视图") cmds.paneLayout() main_panel = cmds.modelPanel() cmds.showWindow(window) mayaToQT(window).setGeometry(*main_pos) cmds.modelEditor(main_panel, e=1, allObjects=0) cmds.modelEditor(main_panel, e=1, polymeshes=1, locators=1, da="smoothShaded", hud=0, grid=0, displayTextures=1) if camera: cmds.lookThru(camera, main_panel) # NOTE 创建剪影视图 shadow_panel_win = "shadow_panel_win" if cmds.window(shadow_panel_win, q=1, ex=1): cmds.deleteUI(shadow_panel_win) window = cmds.window(shadow_panel_win, t=u"剪影视图") cmds.paneLayout() shadow_panel = cmds.modelPanel() cmds.showWindow(window) mayaToQT(window).setGeometry(*shadow_pos) cmds.modelEditor(shadow_panel, e=1, allObjects=0) cmds.modelEditor(shadow_panel, e=1, polymeshes=1, locators=1, da="smoothShaded", dl="none", hud=0, grid=0, viewTransformName="Raw", displayTextures=0) if camera: cmds.lookThru(camera, shadow_panel) cmds.windowPref(enableAll=0) graph_win = mel.eval( 'tearOffRestorePanel "Graph Editor" "graphEditor" true') graph_win = mayaToQT(graph_win).window() width = screen.width() height = screen.height() * ( 1 - panel_height_percent) - gap_TD - titleBar_height * 2 h += panel_height + titleBar_height + gap_TD graph_win.setGeometry(w, h, width, height)
bgcai= [0.314,0.677,0.717] bgcgrey= [0.2,0.2,0.2] bgcgreyl= [0.25,0.25,0.25] bgcgreenM= [0,0.96,0.54] bgcwhite= [0.95,0.95,0.95] bgcgreyd= [0.18,0.18,0.18] bgcblackl = [0.05,0.05,0.05] ##UI CHECKUP ###DELETE UI if mc.window('%s' %WINDN, query=True, exists=True): mc.deleteUI('%s' %WINDN, window=True) if mc.windowPref('%s' %WINDN, query=True, exists=True): mc.windowPref('%s' %WINDN, remove=True ) ##DELETE INFO UI if mc.windowPref('infoAiAssWind', query=True, exists=True): mc.windowPref('infoAiAssWind', remove=True ) if mc.window('infoAiAssWind', query=True, exists=True): mc.deleteUI('infoAiAssWind', window=True) class AiFuncClass: def __init__(self): print 'init' self.projectPath = self.def_projectPath() self.export_sf =5
def gui(): ''' Creats the gui ''' bw = 500 sw = 200 win = 'win3DFGrade' if (cmds.window(win, ex=True)): cmds.deleteUI(win) if (cmds.windowPref(win, ex=True)): cmds.windowPref(win, r=1) cmds.window(win, w=bw, h=400) ''' Main section of tool Displays scene name with button for opening new scene files ''' top_main = cmds.columnLayout(w=500) cmds.rowColumnLayout(w=500, nc=3) cmds.text(l='Scene Name', w=133) cmds.textField(w=133, tx=(cmds.file(q=True, sn=True))) cmds.button(l='Open Scene', w=133, c=open_scene) cmds.setParent(top_main) ''' Dislays grading options such as professionalism and late turnin decutions ''' cmds.rowColumnLayout(w=500, nc=6) cmds.text('Professional', w=66) cmds.floatField(v=0.00, w=66) cmds.text('Late Turnin', w=66) cmds.floatField(v=0.00, w=66) cmds.text('Total Grade', w=66) cmds.floatField(v=0.00, w=66) cmds.setParent(top_main) ''' Creats Export button ''' cmds.columnLayout(w=bw, cat=['left', 200]) cmds.button(l='Export', w=100, c=excel_export) cmds.setParent(top_main) ''' Subsection of tool ''' cmds.columnLayout(w=500) cmds.scrollLayout(w=500) bottom_main = cmds.columnLayout(w=bw) ''' Creates the 'Joint' grading sections ''' joint_frame = cmds.frameLayout('Joints', cll=True, w=bw - 10) joint_col = cmds.columnLayout() main_widget1 = Main_Widget('Joint Naming - Invalid', check_joint_naming(cmds.ls(typ='joint')), joint_naming, pf=0) cmds.setParent(joint_col) main_widget2 = Main_Widget('Joint Rotations - Invalid', check_joint_rotates(cmds.ls(typ='joint')), joint_rotates, pf=1) cmds.setParent(joint_col) main_widget3 = Main_Widget('Joint Translates - Warning', check_joint_translates(cmds.ls(typ='joint')), joint_naming, pf=0) cmds.setParent(joint_col) #main_widget4 = Main_Widget('Joint Orientaiton - Invalid', check_joint_orient(cmds.ls(typ='joint')), joint_naming, pf=0) cmds.setParent(bottom_main) ''' Creates the 'Curve' grading sections ''' cmds.frameLayout(l='Curves', cll=True, w=bw - 10) curve_col = cmds.columnLayout() main_widget5 = Main_Widget('Curve Naming - Invalid', check_curve_naming(cmds.ls(typ='nurbsCurve')), joint_naming, pf=1) cmds.setParent(curve_col) main_widget6 = Main_Widget('Curve Transforms - Invalid', check_transforms(cmds.ls(typ='nurbsCurve')), joint_rotates, pf=1) cmds.setParent(curve_col) main_widget7 = Main_Widget('Curve History - Invalid', check_curve_hist(cmds.ls(typ='nurbsCurve')), joint_rotates, pf=1) cmds.setParent(bottom_main) ''' Creates the 'Geometry' grading sections ''' cmds.frameLayout(l='Geometry', cll=True, w=bw - 10) geo_col = cmds.columnLayout() main_widget8 = Main_Widget('Geo Naming - Invalid', check_geo_naming(cmds.ls(typ='mesh')), joint_naming, pf=0) cmds.setParent(geo_col) main_widget9 = Main_Widget('Geo Transforms - Invalid', check_transforms(cmds.ls(typ='mesh')), joint_naming, pf=0) cmds.setParent(geo_col) main_widget10 = Main_Widget('Geo History - Invalid', check_geo_hist(cmds.ls(typ='mesh')), joint_naming, pf=0) cmds.setParent(bottom_main) cmds.showWindow(win)
def animPullDownUI(): """the ui for the module""" if cmds.window("apdWin", exists=True): cmds.deleteUI("apdWin", window=True) cmds.windowPref("apdWin", remove=True) widgets["win"] = cmds.window("apdWin", t="zbw_pullDownAnim", w=400, h=550) widgets["tabLO"] = cmds.tabLayout() widgets["mainCLO"] = cmds.columnLayout("SetupControls") # master controls layout widgets["zeroFLO"] = cmds.frameLayout("zeroFrameLO", l="Master Controls", w=400, bgc=(0, 0, 0), h=180) widgets["zeroCLO"] = cmds.columnLayout("zeroColumnLO", w=400) cmds.text("Select Master Control Items To Zero Out") widgets["zeroBut"] = cmds.button("zeroButton", l="Add Selected Master CTRLs", bgc=(.8, .8, .6), w=400, h=30, c=partial(getControl, "masterTSL")) widgets["zeroRCLO"] = cmds.rowColumnLayout("zeroRCLO", nc=2, w=400) widgets["zeroClearBut"] = cmds.button("clearZeroButton", l="Clear Selected", w=200, h=20, bgc=(.8, .6, .6), c=partial(clearList, "masterTSL")) widgets["zeroClearBut"] = cmds.button("clearAllZeroButton", l="Clear All", w=200, h=20, bgc=(.8, .5, .5), c=partial(clearAll, "masterTSL")) widgets["zeroSelObjBut"] = cmds.button("selObjZeroButton", l="Grab All Items From List", w=200, h=20, bgc=(.5, .6, .8), c=partial(selectObj, "masterTSL")) widgets["zeroKeysCB"] = cmds.checkBox("zeroKeysCB", l="Delete Master Keys?", v=1, en=True) cmds.setParent(widgets["zeroCLO"]) cmds.separator(h=10) widgets["masterTSL"] = cmds.textScrollList("masterTSL", nr=4, w=400, h=60, ams=True, dcc=partial( showName, "masterTSL"), bgc=(.2, .2, .2)) # ik items layout cmds.setParent(widgets["mainCLO"]) widgets["IKFLO"] = cmds.frameLayout( "IKFrameLO", l="World Space Controls (Translation and Rotation)", w=400, bgc=(0, 0, 0)) widgets["IKCLO"] = cmds.columnLayout("IKColumnLO", w=400) cmds.text("Select World Space Controls (translate and rotate)") widgets["IKBut"] = cmds.button("IKButton", l="Add World Space CTRLs", w=400, h=30, bgc=(.8, .8, .6), c=partial(getControl, "IKTSL")) widgets["IKRCLO"] = cmds.rowColumnLayout("IKRCLO", nc=2, w=400) widgets["IKClearSelBut"] = cmds.button("clearIKButton", l="Clear Selected", bgc=(.8, .6, .6), w=200, h=20, c=partial(clearList, "IKTSL")) widgets["IKClearAllBut"] = cmds.button("moveIKButton", l="Clear All", w=200, h=20, bgc=(.8, .5, .5), c=partial(clearAll, "IKTSL")) widgets["IKStoredBut"] = cmds.button("storedIKButton", l="Add Stored From Selected Master", bgc=(.6, .6, .8), w=200, h=20, c=partial(addStoredSolo, "storeTSL", "IKTSL")) widgets["IKSelObjBut"] = cmds.button("selObjIKButton", l="Grab All Items From List", bgc=(.5, .6, .8), w=200, h=20, c=partial(selectObj, "IKTSL")) cmds.setParent("IKColumnLO") cmds.separator(h=10) widgets["IKTSL"] = cmds.textScrollList("IKTSL", nr=10, w=400, h=90, ams=True, dcc=partial(showName, "IKTSL"), bgc=(.2, .2, .2)) cmds.separator(h=10) # ik items layout cmds.setParent(widgets["mainCLO"]) widgets["rotFLO"] = cmds.frameLayout( "rotFrameLO", l="World Rotation Controls (Rotation Only) -optional-", w=400, bgc=(0, 0, 0), cll=True, cl=True) widgets["rotCLO"] = cmds.columnLayout("rotColumnLO", w=400) cmds.text("Select World Rotation Controls (rotation only!)") widgets["rotBut"] = cmds.button("rotButton", l="Add World Rotation CTRLs", w=400, h=30, bgc=(.8, .8, .6), c=partial(getControl, "rotTSL")) widgets["rotRCLO"] = cmds.rowColumnLayout("rotRCLO", nc=2, w=400) widgets["rotClearSelBut"] = cmds.button("clearrotButton", l="Clear Selected", bgc=(.8, .6, .6), w=200, h=20, c=partial(clearList, "rotTSL")) widgets["rotClearAllBut"] = cmds.button("moveRotButton", l="Clear All", w=200, h=20, bgc=(.8, .5, .5), c=partial(clearAll, "rotTSL")) widgets["rotStoredBut"] = cmds.button("storedRotButton", l="Add Stored From Selected Master", bgc=(.6, .6, .8), w=200, h=20, c=partial(addStoredSolo, "storeRotTSL", "rotTSL")) widgets["rotSelObjBut"] = cmds.button("selObjRotButton", l="Grab All Items From List", bgc=(.5, .6, .8), w=200, h=20, c=partial(selectObj, "rotTSL")) cmds.setParent("rotColumnLO") cmds.separator(h=10) widgets["rotTSL"] = cmds.textScrollList("rotTSL", nr=10, w=400, h=70, ams=True, dcc=partial(showName, "rotTSL"), bgc=(.2, .2, .2)) cmds.separator(h=10) cmds.setParent(widgets["mainCLO"]) # create key type rbuttons widgets["keyRBG"] = cmds.radioButtonGrp(nrb=3, l="Key Type:", l1="Step", l2="Auto", l3="linear", sl=3, cw=[(1, 75), (2, 60), (3, 60), (4, 60)], cal=[(1, "left"), (2, "left"), (3, "left"), (4, "left")]) # doIt button layout cmds.setParent(widgets["mainCLO"]) # TO-DO----------------clear all button! widgets["doItRCLO"] = cmds.rowColumnLayout("doItLayout", nc=3, cw=[(1, 220), (2, 100), (3, 80)]) widgets["doItBut"] = cmds.button("doItButton", l="Pull Animation Down from Master!", w=220, h=50, bgc=(.4, .8, .4), c=pullDownAnim) widgets["pullBut"] = cmds.button("pullButton", l="Store \nWS Controls", w=100, h=50, bgc=(.4, .4, .8), c=storeControls) widgets["clearBut"] = cmds.button("clearButton", l="Clear All\nFields", w=80, h=50, bgc=(.8, .4, .4), c=clearAllLists) # create second tab cmds.setParent(widgets["tabLO"]) widgets["storeCLO"] = cmds.columnLayout("Stored Control Names", w=400) widgets["storeFL"] = cmds.frameLayout( l="Stored World Space Control Names (Translate and Rotate)", w=400, bgc=(0, 0, 0)) widgets["storeRCL"] = cmds.rowColumnLayout(nc=2) widgets["storeClearSelBut"] = cmds.button(l="Clear Selected", bgc=(.8, .6, .6), w=200, h=20, c=partial(clearList, "storeTSL")) widgets["storeClearAllBut"] = cmds.button(l="Clear All", bgc=(.9, .6, .6), w=200, h=20, c=partial(clearAll, "storeTSL")) cmds.setParent(widgets["storeCLO"]) widgets["storeTSL"] = cmds.textScrollList("storeTSL", nr=8, h=100, w=400, ams=True, bgc=(.2, .2, .2)) cmds.separator(h=5, style="none") # storing rotation only objects widgets["storeRotFL"] = cmds.frameLayout( l="Stored World Rotation Control Names (Rotation Only!)", w=400, bgc=(0, 0, 0)) widgets["storeRotRCL"] = cmds.rowColumnLayout(nc=2) widgets["storeRotClearSelBut"] = cmds.button(l="Clear Selected", bgc=(.8, .6, .6), w=200, h=20, c=partial( clearList, "storeRotTSL")) widgets["storeRotClearAllBut"] = cmds.button(l="Clear All", bgc=(.9, .6, .6), w=200, h=20, c=partial( clearAll, "storeRotTSL")) cmds.setParent(widgets["storeRotFL"]) widgets["storeRotTSL"] = cmds.textScrollList("storeRotTSL", nr=8, h=100, w=400, ams=True, bgc=(.2, .2, .2)) cmds.setParent(widgets["storeCLO"]) cmds.separator(h=10, style="single") widgets["storeRotPullBut"] = cmds.button( l="Pull Controls To Store Lists from Previous Tab!", bgc=(.8, .8, .4), w=400, h=40, c=storeControls) widgets["storeRotPushBut"] = cmds.button( l="Push These To Lists from Selected Master Ctrl!", bgc=(.4, .8, .4), w=400, h=40, c=partial(addStored, "yup")) cmds.text( "WARNING!\nThis 'push' button clears all fields on prev tab and add the stored controls \n to their respective lists AND put the selected master control into \nthe 'Master List'", al="center", w=400) # showWindow cmds.showWindow(widgets["win"])
def OCT_Associate_attribute_zwz_UI(): if mc.windowPref('Associate_attribute_zwz', exists=True): mc.windowPref('Associate_attribute_zwz', remove=True) if mc.window('Associate_attribute_zwz', exists=True): mc.deleteUI('Associate_attribute_zwz', window=True) mc.window("Associate_attribute_zwz", title=u"属性关联", menuBar=True, widthHeight=(300, 358), resizeToFitChildren=True, sizeable=True) mc.columnLayout('mainmenu', adjustableColumn=True) mc.frameLayout('oneFL', label=u'模糊查找', labelAlign='top', borderStyle='etchedOut') mc.columnLayout('Xml_Type', adjustableColumn=True) mc.rowLayout('txRow', numberOfColumns=3, columnAttach3=['left', 'left', 'left'], columnWidth3=[40, 180, 50], columnOffset3=[2, 2, 2]) mc.text(label='Name:') mc.textField('typeCmdText', text='name_aa_bb_cc', width=160, alwaysInvokeEnterCommandOnReturn=True) mc.button(label='Select', width=60, command='OCT_generel.OCT_Associate_attribute_zwz.selectN_zwz()', backgroundColor=(0.9, 0.5, 0), annotation=u'请输入需要选择物体的名字') mc.setParent('mainmenu') mc.frameLayout('twoFL', label=u'选择关联物体和被关联的Locator', labelAlign='top', borderStyle='etchedOut', height=247) mc.columnLayout(rowSpacing=2, adjustableColumn=True, columnAlign='left') mc.radioButtonGrp('Object_Type_zwz', numberOfRadioButtons=2, columnAlign2=("left", "left"), columnWidth=(1, 50), label="Type:", labelArray2=("Shape", "Transform"), columnAttach2=('left', 'left'), columnAttach=(1, 'left', 5), select=1) mc.rowLayout(numberOfColumns=2, columnWidth2=(150, 150), columnAlign2=('center', 'center'), columnAttach2=('both', 'both'), height=20, adjustableColumn2=True) mc.text(label='Objects(Multiple)') mc.text(label='Locator(One)') mc.setParent('..') mc.rowLayout(numberOfColumns=2, columnWidth2=(150, 150), columnAlign2=('center', 'center'), columnAttach2=('both', 'both'), height=150, adjustableColumn2=True) mc.textScrollList('selectObject', allowMultiSelection=1, height=150) mc.textScrollList('selectLoctor', allowMultiSelection=0, height=150) mc.setParent('..') mc.rowLayout(numberOfColumns=4, columnWidth4=(70, 100, 70, 70), columnAlign4=('center', 'center', 'center', 'center'), height=30, adjustableColumn=True) mc.button( 'loadobject', label='Load', width=70, command='OCT_generel.OCT_Associate_attribute_zwz.Control_Alist_zwz(1)') mc.button( 'clearobject', label='Clear', width=70, command='OCT_generel.OCT_Associate_attribute_zwz.Control_Alist_zwz(2)') mc.button( 'loadlocator', label='Load', width=70, command='OCT_generel.OCT_Associate_attribute_zwz.Control_Alist_zwz(3)') mc.button( 'clearlocator', label='Clear', width=70, command='OCT_generel.OCT_Associate_attribute_zwz.Control_Alist_zwz(4)') mc.setParent('mainmenu') mc.frameLayout('threeoFL', label='Associate_attribute', labelAlign='top', borderStyle='etchedOut') mc.rowLayout( numberOfColumns=3, columnAttach3=['left', 'left', 'left'], columnOffset3=[2, 5, 20], columnWidth3=(50, 150, 10), ) mc.text(label='Attribute:') mc.textField('AddAttr', text=u'别写错,不带点的!', alwaysInvokeEnterCommandOnReturn=True, w=150) mc.button(label='Create', width=60, command='OCT_generel.OCT_Associate_attribute_zwz.Add_Attr_zwz()', backgroundColor=(0.9, 0.5, 0.5), annotation=u"没写错的话,你就爽歪歪了!") mc.showWindow('Associate_attribute_zwz')
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)
# -*- coding: utf-8 -*- import maya.cmds as mc import maya.mel as mm import os if mc.windowPref('ReplaceOriginalObject_zwz', exists=True): mc.windowPref('ReplaceOriginalObject_zwz', remove=True) if mc.window('ReplaceOriginalObject_zwz', exists=True): mc.deleteUI('ReplaceOriginalObject_zwz', window=True) allCameras = mc.listCameras(p=True) myStartFrameV = mc.getAttr("defaultRenderGlobals.startFrame") myEndFrameV = mc.getAttr("defaultRenderGlobals.endFrame") myRenderwidth = mc.getAttr("defaultResolution.width") myRenderheight = mc.getAttr("defaultResolution.height") mc.window("ReplaceOriginalObject_zwz", title=u"OCT_ReplaceOriginalObject_zwz", menuBar=True, widthHeight=(350, 340), resizeToFitChildren=True, sizeable=True) mc.formLayout('formLyt', numberOfDivisions=100) one = mc.radioButtonGrp('modelOption_Radio', label=u'模式:', labelArray2=[u'创建', u'修复'], numberOfRadioButtons=2, columnAlign=[1, 'left'], columnAlign2=['left', 'left'], cw3=[45, 75, 90],
def show(self): Window = 'SaveAsTool' if cmds.window(Window,exists = True) == True: cmds.deleteUI(Window,window = True) if cmds.windowPref(Window,exists = True) == True: cmds.windowPref(Window,remove = True) cmds.window(Window,sizeable = False,title = 'Playblast Tool', closeCommand = self.hideHUD) ColumnLayout = cmds.columnLayout(parent = Window,adjustableColumn = True) cmds.text(label='Playbast Tools',height=30, backgroundColor=[0.5, 0.5, 0.6]) cmds.separator(style='out') cmds.frameLayout(label='Description :', collapsable=True, collapse=True,width=410) cmds.columnLayout(adjustableColumn=True) cmds.scrollField('descriptionScrollField',height=100,wordWrap=True) cmds.separator(style='in') cmds.setParent('..') cmds.setParent('..') cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1, 50),(2,310),(3,50)]) ShotT = cmds.text(height = 24,label = 'Mov Path:') ShotTF = cmds.textField(height = 24) browseB = cmds.button(height = 24,label = 'Browse',command = lambda *args: self.ChooseFolder()) cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) qualitySlider = cmds.intSliderGrp( field=True, label='Quality', value=50 ) ScaleSlider = cmds.floatSliderGrp( label='Scale', field=True, minValue=0.10, maxValue=1.00, fieldMinValue=0.10, fieldMaxValue=1.00, value=0.50,precision=2 ) cmds.columnLayout(adjustableColumn=True) cmds.rowColumnLayout( numberOfColumns = 4, columnWidth = [(1, 100), (2,100), (3, 100), (4,100)]) file_name_text = cmds.text(height = 24,label = u'屏显文件名:') file_name_textField = cmds.textField(height = 24) version_text = cmds.text(height = 24,label = u' 版本号:') version_textField = cmds.textField(height = 24) cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.rowColumnLayout( numberOfColumns = 4, columnWidth = [(1, 20),(2,100),(3, 100),(2,100)]) cmds.text(height = 24,label = ' ') approved_checkBox = cmds.checkBox(height = 24,label = u'已经通过', changeCommand = self.showHUD) approved_text = cmds.text(height = 24,label = u' 通过人:') approver_optionMenu = optionMenu(changeCommand = self.showHUD) #for _approver in APPROVER_LIST: # menuItem(label = _approver, parent = approver_optionMenu) cmds.setParent('..') playB = cmds.button(height = 32,label = u'拍屏 最终版需要把界面缩放设置成125%',command = lambda *args: self.check_interface()) #openB = cmds.button(height = 32,label = 'Open Mov',command = lambda *args: self.openMov()) #uploadB = cmds.button(height = 32,label = 'Upload Mov',command = lambda *args: self.uploadTheFile()) cmds.setParent('..') cmds.separator(style='in') cmds.text(label=' ') self.ShotTF = ShotTF self.qualitySlider = qualitySlider self.ScaleSlider = ScaleSlider self.file_name_textField = file_name_textField self.version_textField = version_textField self.approved_checkBox = approved_checkBox self.approver_optionMenu = approver_optionMenu self.playB = playB #self.uploadB = uploadB #self.openB = openB cmds.showWindow(Window) self.SetDefaultFolder() #self.setOpenB() #self.setUploadB(False) # print ph.HUD._get_namewithversion() _name = self._get_file_name() playblast_setup_path = '{}/setup/'.format(_get_project_path()) + 'MAYA_PLAYBLAST.json' playblast_setup_dict = read_json_file(playblast_setup_path) qualitySlider_value = playblast_setup_dict['quality'] ScaleSlider_value = playblast_setup_dict['scale'] cmds.intSliderGrp(self.qualitySlider, edit = True, value = qualitySlider_value) cmds.floatSliderGrp(self.ScaleSlider, edit = True, value = ScaleSlider_value) approver_list = playblast_setup_dict['approver_list'] for _approver in approver_list: menuItem(label = _approver, parent = approver_optionMenu) cmds.textField(self.file_name_textField, edit = True, text = _name, textChangedCommand = self.showHUD) _version = load_version(_name) cmds.textField(self.version_textField, edit = True, text = _version, textChangedCommand = self.showHUD) self.showHUD()
def gui(): ''' Creats the gui ''' global summery_scroll file_name = '/Users/critnkitten/Desktop/file_submission.txt' bw=500 sw=200 win = 'win3DFGrade' if (cmds.window(win, ex=True)): cmds.deleteUI(win) if (cmds.windowPref(win, ex=True)): cmds.windowPref(win, r=1) cmds.window(win, w=bw, h=400) ''' Main section of tool Displays scene name with button for opening new scene files ''' top_main = cmds.columnLayout(w=500) cmds.rowColumnLayout(w=500, nc=3) cmds.text(l='Scene Name', w=133) cmds.textField(w=133, tx=(cmds.file(q=True, sn=True))) cmds.button(l='Open Scene', w=133, c=open_scene) cmds.setParent(top_main) ''' Dislays grading options such as professionalism and late turnin decutions ''' cmds.rowColumnLayout(w=500, nc=6) cmds.text('Professional', w=66) cmds.floatField(v=0.00, w=66) cmds.text('Late Turnin', w=66) cmds.floatField(v=0.00, w=66) cmds.text('Total Grade', w=66) cmds.floatField(v=0.00, w=66) cmds.setParent(top_main) ''' Creats Export button ''' cmds.columnLayout(w=bw, cat=['left', 200]) cmds.button(l='Export', w= 100, c=excel_export) cmds.setParent(top_main) ''' Subsection of tool ''' cmds.columnLayout(w=500) form = cmds.formLayout() tabs = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5) cmds.formLayout( form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0)) ) tab1 = cmds.columnLayout() cmds.text(l='Summary Section') summery_scroll = cmds.scrollField(ww=True) cmds.setParent('..') ''' Creates the 'Joint' grading sections ''' tab3 = cmds.columnLayout() cmds.scrollLayout() main = cmds.columnLayout() joint_frame = cmds.frameLayout('Joints', cll=True, w=bw-10) joint_col = cmds.columnLayout() main_widget1 = Main_Widget('Joint Naming - Invalid', check_joint_naming(cmds.ls(typ='joint')), joint_naming, pf=1) cmds.setParent(joint_col) main_widget2 = Main_Widget('Joint Rotations - Invalid', check_joint_rotates(cmds.ls(typ='joint')), joint_rotates, pf=1) cmds.setParent(joint_col) main_widget3 = Main_Widget('Joint Translates - Warning', check_joint_translates(cmds.ls(typ='joint')), joint_naming, pf=1) cmds.setParent(joint_col) #main_widget4 = Main_Widget('Joint Orientaiton - Invalid', check_joint_orient(cmds.ls(typ='joint')), joint_naming, pf=0) cmds.setParent(main) ''' Creates the 'Curve' grading sections ''' cmds.frameLayout(l='Curves', cll=True, w=bw-10) curve_col = cmds.columnLayout() main_widget5 = Main_Widget('Curve Naming - Invalid', check_curve_naming(cmds.ls(typ='nurbsCurve')), joint_naming, pf=1) cmds.setParent(curve_col) main_widget6 = Main_Widget('Curve Transforms - Invalid', check_transforms(cmds.ls(typ='nurbsCurve')), joint_rotates, pf=1) cmds.setParent(curve_col) main_widget7 = Main_Widget('Curve History - Invalid', check_curve_hist(cmds.ls(typ='nurbsCurve')), joint_rotates, pf=1) cmds.setParent(main) ''' Creates the 'Geometry' grading sections ''' cmds.frameLayout(l='Geometry', cll=True, w=bw-10) geo_col = cmds.columnLayout() main_widget8 = Main_Widget('Geo Naming - Invalid', check_geo_naming(cmds.ls(typ='mesh')), joint_naming, pf=1) cmds.setParent(geo_col) main_widget9 = Main_Widget('Geo Transforms - Invalid', check_transforms(cmds.ls(typ='mesh')), joint_naming, pf=1) cmds.setParent(geo_col) main_widget10 = Main_Widget('Geo History - Invalid', check_geo_hist(cmds.ls(typ='mesh')), joint_naming, pf=1) cmds.setParent(main) cmds.tabLayout(tabs, edit=True, tabLabel=[(tab1, 'Summary'), (tab3, 'Grading')]) cmds.showWindow(win)
def OCT_Export_Scene_with_Optimize_zwz(): #重命名动画、素材节点名字 AllmYRenameObjects = mc.ls(type=[ 'animCurveTA', 'animCurveTL', 'animCurveTU', 'place2dTexture', 'envBall', 'bump2d' ]) ALlShader = mc.ls(mat=True, tex=True) AllmYRenameObjects += ALlShader for each in AllmYRenameObjects: AllSplitNs = each.split('_') try: mc.rename(each, AllSplitNs[-1]) except: try: mc.rename(each, '_'.join(AllSplitNs[-2::])) except: pass #删除空层,删除被锁无连接的reference节点 useDLayers = [] emptyDLayers = [] allDLayers = mc.ls(type='displayLayer') for Layer in allDLayers: if mc.getAttr('%s.identification' % Layer): useDLayers.append(Layer) for each in useDLayers: if not mc.editDisplayLayerMembers(each, q=True, noRecurse=True): emptyDLayers.append(each) for tmp in emptyDLayers: allInfoNodes = mc.listConnections('%s.drawInfo' % tmp, c=True) if allInfoNodes: for InfoNode in allInfoNodes: if mc.nodeType(InfoNode) == 'reference': mc.lockNode(InfoNode, lock=False) mc.delete(InfoNode) mc.delete(tmp) #删除无子物体,无关联的空组 deleteList = [] allTransforms = mc.ls(type='transform') if allTransforms: for tran in allTransforms: if mc.nodeType(tran) == 'transform': children = mc.listRelatives(tran, c=True) connectNode = mc.listConnections(tran) if children is None and connectNode is None: #打印空组的名字 print '%s, has no childred or no connected' % (tran) deleteList.append(tran) if deleteList: try: mc.delete(deleteList) except: pass #if mc.ls(sl=True): if mc.windowPref('scriptEditorPanel1Window', exists=True): mc.windowPref('scriptEditorPanel1Window', remove=True) if mc.window('scriptEditorPanel1Window', exists=True): mc.deleteUI('scriptEditorPanel1Window', window=True) if mc.windowPref('outlinerPanel1Window', exists=True): mc.windowPref('outlinerPanel1Window', remove=True) if mc.window('outlinerPanel1Window', exists=True): mc.deleteUI('outlinerPanel1Window', window=True) #显示层 myDLayers = [] allDLayers = mc.ls(type='displayLayer') for Layer in allDLayers: if mc.getAttr('%s.identification' % Layer): myDLayers.append(Layer) #渲染节点 allPartitions = mc.ls(type='partition') #渲染层 allMyRLayers = mc.listConnections('renderLayerManager.renderLayerId') allMyRLayers.append('renderLayerManager') #时间滑条 if mc.objExists('sceneConfigurationScriptNode'): mc.select('sceneConfigurationScriptNode', add=True) #选择摄像机 AllCameras = mc.listCameras() #参考节点 myRfs = mc.ls(type='reference') if mc.objExists('defaultLayer'): mc.select('defaultLayer', add=True) #选择mentalray相关渲染信息 if mc.objExists('mentalrayGlobals'): mc.select('mentalrayGlobals', add=True) #选择vray渲染的相关信息 if mc.objExists('vraySettings'): mc.select('vraySettings', add=True) #选择Arnold的分层节点 if mc.pluginInfo('mtoa.mll', query=True, loaded=True): try: allMyArnoldAOV = mc.ls(type="aiAOV") except: pass else: if allMyArnoldAOV: mc.select(allMyArnoldAOV, add=True) try: ArnoldDisplayDriver = mc.ls(type="aiAOVDriver") except: pass else: if ArnoldDisplayDriver: mc.select(ArnoldDisplayDriver, add=True) try: defaultArnoldFilter = mc.ls(type="aiAOVFilter") except: pass else: if defaultArnoldFilter: mc.select(defaultArnoldFilter, add=True) try: defaultArnoldRenderOptions = mc.ls(type="aiOptions") except: pass else: if defaultArnoldRenderOptions: mc.select(defaultArnoldRenderOptions, add=True) #Vray渲染层 try: allVrayRLs = mc.ls(type='VRayRenderElement') except: pass else: if allVrayRLs: mc.select(allVrayRLs, add=True) if AllCameras: mc.select(AllCameras, add=True) if myRfs: mc.select(myRfs, add=True) if myDLayers: mc.select(myDLayers, add=True) if allPartitions: mc.select(allPartitions, add=True) if allMyRLayers: mc.select(allMyRLayers, add=True) mc.select(allDagObjects=True, add=True) mc.evalDeferred('mc.ExportSelection();mc.select(cl=True)')
def quick_connection(): if cmds.window('QuickConnction', exists=True): cmds.deleteUI('QuickConnction', window=True) if cmds.windowPref('QuickConnction', exists=True): cmds.windowPref('QuickConnction', r=True) cmds.window('QuickConnction', title='Quick Connection', iconName='Short Name', widthHeight=(336, 260), s=0) form = cmds.formLayout(numberOfDivisions=100, bgc=[(.284), (.284), (.284)], w=336, h=260) driver = cmds.textField('drivertxf', w=150, h=40) driven = cmds.textScrollList('asd', h=40, w=150) driverButton = cmds.button(l='Driver', w=150, h=35, bgc=[(.394), (.394), (.394)], c='createDriver()') drivenButton = cmds.button(l='Driven', w=150, h=35, bgc=[(.394), (.394), (.394)], c='createDriven()') connectRotate = cmds.button(l='Connect Rotate', w=310, bgc=[(.2), (.5), (.4)], h=25, c='create_rotate_connection()') connectTranslate = cmds.button(l='Connect Translate', w=310, bgc=[(.2), (.5), (.4)], h=25, c='create_translate_connection()') connectScale = cmds.button(l='Connect Scale', w=310, bgc=[(.2), (.5), (.4)], h=25, c='create_scale_connection()') author = cmds.symbolButton(i='UV_Freeze_Tool.png', c='author()') deleteButton = cmds.button(l='Delete Connections', w=310, h=25, bgc=[(0.4), (0.5), (2)], c='delete_connections()') cmds.formLayout(form, edit=True, attachForm=[(driver, 'top', 17), (driven, 'top', 17), (driverButton, 'top', 65), (drivenButton, 'top', 65), (author, 'bottom', 2), (driver, 'left', 12), (driven, 'left', 12), (driverButton, 'left', 12), (drivenButton, 'left', 12), (connectRotate, 'left', 12), (connectTranslate, 'left', 12), (connectScale, 'left', 12), (deleteButton, 'left', 12), (author, 'left', 151)], attachControl=[(driven, 'left', 10, driver), (driverButton, 'bottom', 20, driver), (drivenButton, 'left', 10, driverButton), (connectTranslate, 'top', 7, connectRotate), (connectScale, 'top', 7, connectTranslate), (connectRotate, 'top', 14, driverButton), (deleteButton, 'top', 7, connectScale)]) cmds.showWindow('QuickConnction')
def helpWin(): #Check if window is already open if mc.window('helpWin', exists=True): #delete if it is already open mc.deleteUI('helpWin', window=True) #create window helpWin = mc.window('helpWin', t="Help with the White Box Tool", rtf=True) #layout mc.columnLayout(columnAttach=('both', 5), rowSpacing=10, columnWidth=200, h=300) mc.windowPref('helpWin', w=50, exists=True) #Type in the Help Info here mc.text(label='How to use the White Box Tool', fn="boldLabelFont", ww=True) mc.text( label= 'First, select a singular mesh object in your scene that you want to use as the source object', ww=True, align='left') mc.text( label= 'Use the "Store Source Model" button to store the information of that model', ww=True, align='left') mc.text( label= 'Then select the target meshes that you would like to replace in your scene', ww=True, align='left') mc.text( label= 'You can then choose the options you would like to use while replacing the objects via the check boxes', ww=True, align='left') mc.text(label=' Match Targets Translation?', fn="boldLabelFont", ww=True, align='left') mc.text( label= ' -This will allow you to match the targets location when duplicating the source object', ww=True, align='left') mc.text(label=' Match Targets Scale?', fn="boldLabelFont", ww=True, align='left') mc.text( label= ' -This will allow you to match the targets scale when duplicating the source object', ww=True, align='left') mc.text(label=' Match Targets Rotation?', fn="boldLabelFont", ww=True, align='left') mc.text( label= ' -This will allow you to match the targets rotation when duplicating the source object', ww=True, align='left') mc.text( label= 'Now that you have chosen the options for the duplication process, you can now click the "Replace Targets" button', ww=True, align='left') mc.text(label='\n\n Tips for making white boxing go more smoothly', fn="boldLabelFont", ww=True, align='left') mc.text( label= ' -If you want to use multiple meshes as the source object, it is necessary to combine the objects into one mesh first', ww=True, align='left') mc.text( label= ' -The script will automaticall center the pivots of all objects in order to make sure the translation and scale work correctly', ww=True, align='left') #Close Help button mc.button(label='Close Help', command='OCT_mod.WhiteBoxTool.cancelHelp()') #Call window mc.showWindow(helpWin)
def closeWindow(self): cmds.windowPref(self.uiWindow, remove=True) cmds.deleteUI(self.uiWindow, window=True)
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, 380) ) cmds.columnLayout(adjustableColumn=True) margin_width = 4 cmds.frameLayout( bv=False, label="Operations", collapsable=True, mw=margin_width ) cmds.rowColumnLayout(numberOfColumns=2, adj=1) self.insert_joint_field = cmds.intField(minValue=1, value=1) cmds.button(label="Insert Joints", c=self.insert_joints) cmds.setParent("..") cmds.gridLayout(numberOfColumns=3, cellWidthHeight=(116, 30)) cmds.button(label="Left", c=self.set_left) cmds.button(label="Center", c=self.set_center) cmds.button(label="Right", c=self.set_right) cmds.setParent("..") cmds.setParent("..") 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 screen_shot(self, ): cmds.displayPref(displayGradient=1) Dir = os.path.dirname(self.__file) if not os.path.exists(Dir): os.makedirs(Dir) self.__file = self.__file.split('.')[0] WindowName = 'Snapshot' if cmds.window(WindowName, exists=True): cmds.deleteUI(WindowName, window=True) if cmds.windowPref(WindowName, exists=True): cmds.windowPref(WindowName, remove=True) cmds.window(WindowName, title='Snapshot') modelPanels = cmds.getPanel(typ="modelPanel") for currentPanel in modelPanels: cmds.modelEditor(currentPanel, e=True, displayAppearance='smoothShaded') PaneLayout = cmds.paneLayout(width=480, height=480) if self.__sceneSnap: ModelPanel = cmds.modelPanel( copy=cmds.getPanel(withLabel='Persp View'), menuBarVisible=False) cmds.camera('persp', e=1, displayFilmGate=False, displayResolution=False) cmds.setAttr('persp.rx', -45) cmds.setAttr('persp.ry', 45) else: ModelPanel = cmds.modelPanel( copy=cmds.getPanel(withLabel='Front View'), menuBarVisible=False) cmds.camera('front', e=1, displayFilmGate=False, displayResolution=False) cmds.showWindow(WindowName) cmds.modelEditor(ModelPanel, edit=True, useDefaultMaterial=False) mel.eval('setWireframeOnShadedOption false ' + ModelPanel) cmds.modelEditor(ModelPanel, edit=True, allObjects=False, displayTextures=True) cmds.modelEditor(ModelPanel, edit=True, polymeshes=True) cmds.modelEditor(ModelPanel, edit=True, pluginObjects=['gpuCacheDisplayFilter', True]) cmds.modelEditor(ModelPanel, edit=True, grid=False) mel.eval('SelectAllPolygonGeometry') mel.eval('LowQualityDisplay') cmds.viewFit(cmds.lookThru(ModelPanel, query=True), fitFactor=0.8, animate=True) cmds.select(clear=True) cmds.modelEditor(ModelPanel, edit=True, activeView=True) cmds.playblast(startTime=0, endTime=0, format='image', filename=self.__file, sequenceTime=False, clearCache=True, viewer=False, showOrnaments=False, offScreen=True, framePadding=4, percent=100, compression='png', quality=100, widthHeight=[480, 480]) if cmds.window(WindowName, exists=True): cmds.deleteUI(WindowName, window=True) if cmds.windowPref(WindowName, exists=True): cmds.windowPref(WindowName, remove=True) if os.path.exists(self.__file + '.png'): os.remove(self.__file + '.png') os.rename(self.__file + '.0000.png', self.__file + '.png')
def Show(self): Window = 'SaveAsTool' if cmds.window(Window, exists=True) == True: cmds.deleteUI(Window, window=True) if cmds.windowPref(Window, exists=True) == True: cmds.windowPref(Window, remove=True) cmds.window(Window, sizeable=False, title='Playblast Tool') ColumnLayout = cmds.columnLayout(parent=Window, adjustableColumn=True) cmds.text(label='Playbast Tools', height=30, backgroundColor=[0.5, 0.5, 0.6]) cmds.separator(style='out') cmds.frameLayout(label='Description :', collapsable=True, collapse=True, width=410, borderStyle='etchedIn') cmds.columnLayout(adjustableColumn=True) cmds.scrollField('descriptionScrollField', height=100, wordWrap=True) cmds.separator(style='in') cmds.setParent('..') cmds.setParent('..') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 50), (2, 310), (3, 50)]) ShotT = cmds.text(height=24, label='Mov Path:') ShotTF = cmds.textField(height=24) browseB = cmds.button(height=24, label='Browse', command=lambda *args: self.ChooseFolder()) cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) qualitySlider = cmds.intSliderGrp(field=True, label='Quality', value=50) ScaleSlider = cmds.floatSliderGrp(label='Scale', field=True, minValue=0.10, maxValue=1.00, fieldMinValue=0.10, fieldMaxValue=1.00, value=0.50, precision=2) playB = cmds.button(height=32, label='Playblast', command=lambda *args: self.Playblastfunction()) openB = cmds.button(height=32, label='Open Mov', command=lambda *args: self.openMov()) uploadB = cmds.button(height=32, label='Upload Mov', command=lambda *args: self.uploadTheFile()) cmds.setParent('..') cmds.separator(style='in') cmds.text(label=' ') self.ShotTF = ShotTF self.qualitySlider = qualitySlider self.ScaleSlider = ScaleSlider self.playB = playB self.uploadB = uploadB self.openB = openB cmds.showWindow(Window) self.SetDefaultFolder() self.setOpenB() self.setUploadB(False)
def closeWin(self, myWinName): if mc.window(myWinName, q=True, exists=True): mc.deleteUI(myWinName, window=True) if mc.windowPref(myWinName, q=True, exists=True): mc.windowPref(myWinName, remove=True)
def createUI(self, *args): #check if window and prefs exist. If yes, delete if mc.window(self.window, exists=True): mc.deleteUI(self.window, window=True) elif mc.windowPref(self.window, exists=True): mc.windowPref(self.window, remove=True) # error check if the numberOfTabs is equal to the name[] if (self.numberOfTabs != len(self.name)): mc.warning("# of tabs and names are not equal!") pass else: #create the main window UI self.window = mc.window(self.window, title=self.title, widthHeight=self.winSize, sizeable=False, menuBar=True, mnb=True, mxb=False) self.mainForm = mc.formLayout(numberOfDivisions=100) self.tagLine = mc.text(label="Tin Girl Tools") self.tabs["uiTabs"] = mc.tabLayout(innerMarginWidth=20, innerMarginHeight=20, parent=self.mainForm) #attach UI elements to mainForm layout mc.formLayout(self.mainForm, edit=True, attachForm=((self.tabs["uiTabs"], "top", 0), (self.tabs["uiTabs"], "left", 0), (self.tabs["uiTabs"], "right", 0), (self.tabs["uiTabs"], "bottom", 30), (self.tagLine, "left", 0), (self.tagLine, "right", 0)), attachControl=((self.tagLine, "top", 10, self.tabs["uiTabs"]))) #dynamically create number of tabs for x in range(self.numberOfTabs): self.tabForm = mc.formLayout(bgc=(0.21, 0.21, 0.21)) #rename tabs according to name array self.tabName = mc.tabLayout(self.tabs["uiTabs"], edit=True, tabLabel=(self.tabForm, self.name[x]), parent=self.mainForm) self.currentName = self.name[x] self.innerTabForm = mc.formLayout() mc.formLayout(self.tabForm, edit=True, attachForm=([self.innerTabForm, "top", 3], [self.innerTabForm, "left", 3], [self.innerTabForm, "right", 3], [self.innerTabForm, "bottom", 36])) #columnLayout for each tab self.tabColLayout = mc.columnLayout(rs=5, parent=self.innerTabForm) #create custom UI elements self.createCustom(self.currentName) mc.formLayout(self.innerTabForm, e=True, attachForm=((self.tabColLayout, "top", 3), (self.tabColLayout, "left", 3), (self.tabColLayout, "right", 3), (self.tabColLayout, "bottom", 3))) mc.setParent("..") #for self.tabColLayout mc.setParent("..") #for self.innerTabForm #create common UI elements self.createCommon(self.currentName) mc.setParent("..") #for self.tabName #show the window mc.showWindow(self.window)
def shapeBuilderUI(): if cmds.window('Win' ,exists=True): cmds.deleteUI('Win') if cmds.windowPref('Win', exists=True ): cmds.windowPref( 'Win', r=True ) cmds.window('Win',title='FK Setup',s=0,h=600,w=300) cmds.showWindow('Win') form = cmds.formLayout('form01',bgc =[(.179),(.179),(.189)],w=300,h=600) cmds.text('Text_Joints',l='<font size = 4>Number Of Joints') cmds.intField('intField_Jnts',w=240,h=25) cmds.separator('S01') cmds.button('Button_CreateJnts',l='Create Joints',w=150,h=25,bgc=[(.2),(.5),(.4)],c='createJoints()') ###################################################################################### cmds.text('txtOrient',l='ORIENT JOINTS') cmds.checkBox('bxyz',label='XYZ') cmds.checkBox('bzxy',label='ZXY') cmds.checkBox('byzx',label='YZX') cmds.button('Button_OrientJnts',l='Orient Joints',w=150,h=25,bgc=[(.2),(.5),(.4)],c='orientJoints()') ######################################################################## cmds.text('textCtrl',l='<font size = 3>CONTROLLER') cmds.optionMenu('OptMenu', h=20,ann=('It will create the controller'),bgc=[(.2),(.5),(.4)]) cmds.menuItem('CubeMenu',l='Cube') cmds.menuItem('CircleMenu',l='Sphere') cmds.menuItem('SquareMenu',l='Square') ####################################################################### cmds.text('txtSize',l='<font size = 3>CONTROLLER SIZE') cmds.intSliderGrp('sizeSlider',l='Size',min=1,f=True,w=365) ############################################################### cmds.text('txtColor',l='<font size = 3>CONTROLLER COLOR') cmds.colorIndexSliderGrp('colorSlider', label='Color', min=0, max=20, value=10 ) ################################################## cmds.text('Text_Suffix',l='<font size = 3>SUFFIX') cmds.textField('txtF',w=240,h=25) ######################################3 cmds.button('Button_FkChain',l=' Build FK_Chain',c='fkSetup()',bgc=[(.057),(.074),(.1)],h=38,w=75) cmds.button('Button_IkChain',l=' Build IK_Chain',c='IkSetup()',bgc=[(.057),(.074),(.1)],h=38,w=75) cmds.button('Button_Fk_IK_Chain',l=' Build FK_IkChain',c='fk_IkSetup()',bgc=[(.057),(.074),(.1)],h=38,w=75) cmds.formLayout('form01',edit=True,attachForm=[('Text_Joints','top', 13), ('Text_Joints','left',98), ('intField_Jnts','left',30), ('Button_CreateJnts','left',34), ('Button_CreateJnts','right',30), ('txtOrient','left',30), ('txtOrient','right',30), ('bxyz','left',32), ('Button_OrientJnts','left',30), ('Button_OrientJnts','right',30), ('textCtrl','right',30), ('textCtrl','left',30), ('OptMenu','right',30), ('OptMenu','left',30), ('txtSize','right',30), ('txtSize','left',30), ('sizeSlider','left',-87), ('colorSlider','left',-87), ('txtColor','left',30), ('txtColor','right',30), ('Text_Suffix','right',30), ('Text_Suffix','left',30), ('Button_FkChain','left',30), ('txtF','left',30), ], attachControl=[('intField_Jnts','top',8,'Text_Joints'), ('Button_CreateJnts','top',5,'intField_Jnts'), ('txtOrient','top',12,'Button_CreateJnts'), ('bxyz','top',11,'txtOrient'), ('bzxy','top',11,'txtOrient'), ('byzx','top',11,'txtOrient'), ('Button_OrientJnts','top',10,'bzxy'), ('textCtrl','top',5,'Button_OrientJnts'), ('OptMenu','top',10,'textCtrl'), ('txtSize','top',10,'OptMenu'), ('sizeSlider','top',10,'txtSize'), ('txtColor','top',10,'sizeSlider'), ('colorSlider','top',10,'txtColor'), ('Text_Suffix','top',10,'colorSlider'), ('txtF','top',10,'Text_Suffix'), ('Button_FkChain','top',14,'txtF'), ('Button_IkChain','top',14,'txtF'), ('Button_Fk_IK_Chain','top',14,'txtF'), ('bzxy','left',56,'bxyz'), ('byzx','left',56,'bzxy'), ('Button_IkChain','left',5,'Button_FkChain'), ('Button_Fk_IK_Chain','left',5,'Button_IkChain') ])
def EternalCodeUiDef(): if cmds.window('EternalCodeWin', exists=True): cmds.deleteUI('EternalCodeWin', window=True) if cmds.windowPref('EternalCodeWin', exists=True): cmds.windowPref('EternalCodeWin', r=True) cmds.window('EternalCodeWin', title=" ", iconName='Short Name', h=800, w=500, s=0) form = cmds.formLayout(numberOfDivisions=100, w=300) backG = cmds.image( i='B:/Eternal_Code_Directory/Backup/Default_Icons/Back.png') searchImg = cmds.image( i='B:/Eternal_Code_Directory/Backup/Default_Icons/searchResult.png') AddImg = cmds.image( i='B:/Eternal_Code_Directory/Backup/Default_Icons/Store.png') Heading = cmds.text(l=' ', align='center', fn='boldLabelFont', hl=True) search = cmds.textField('searchField', w=200, h=22) searchButton = cmds.symbolButton( i="B:/Eternal_Code_Directory/Backup/Default_Icons/Search box.png", c='Procs.searchScripts()') searchResult = cmds.textScrollList('searchResultList', h=350, w=210) AddToScript = cmds.symbolButton( ann='Add To Notepad', i="B:/Eternal_Code_Directory/Backup/Default_Icons/IDE.png", c='Procs.Notepad()') AuthorButton = cmds.symbolButton(i="UVTkBtnHead.png", ann='Author: "Siddarth Mehra"', c='Procs.Procs.Author() ') sepratorone = cmds.textField(height=2, w=280) name = cmds.textField('NameScriptTxF', w=180, h=25) Sendscript = cmds.scrollField('Codee', w=180, h=330) radiocoll = cmds.radioCollection() radioMel = cmds.radioButton('MelRadio', label='Mel', sl=True) radioPython = cmds.radioButton(label='Python') SendSButton = cmds.symbolButton( ann='Store in Database', i="B:/Eternal_Code_Directory/Backup/Default_Icons/add.png", c='Procs.StoreCode()') cmds.formLayout(form, edit=True, attachForm=[ (backG, 'top', 1), (searchImg, 'top', 220), (searchImg, 'left', 25), (AddImg, 'top', 270), (AddImg, 'left', 280), (search, 'top', 240), (search, 'left', 37), (searchButton, 'left', 218), (searchButton, 'top', 239), (Heading, 'left', 250), (Heading, 'top', 8), (searchResult, 'left', 37), (name, 'top', 305), (name, 'left', 290), (AddToScript, 'left', 50), (AuthorButton, 'bottom', 10), (AuthorButton, 'right', 10), (Sendscript, 'left', 290), (radioMel, 'top', 680), (radioMel, 'left', 300), (radioPython, 'top', 700), (radioPython, 'left', 300), (SendSButton, 'top', 685), (SendSButton, 'left', 360), ], attachControl=[ (searchResult, 'top', 7, search), (AddToScript, 'top', 15, searchResult), (Sendscript, 'top', 8, name), ]) cmds.showWindow('EternalCodeWin')
def __init__( self, winName= 'colorWin' ): ''' colorWinUI is all part of __init__ constructor.''' self.winName= winName self.winHeight = 290 self.winWidth = 420 self.fieldTexts=[ 'controlName',] self.checkBoxes=[ 'SingleController','SnapConnect' ] self.menuItems=[ 'None','Hierarchy','TweakHierarchy' ] self.connectBoxes=[ 'parent','point','rotate','scale' ] self.radioBoxes=[ 'parentCon','pointCon','rotateCon','scaleCon' ] self.locCheckBoxes=[ 'parentSelection', 'additionalGroups', 'selectionName' ] self.locTexts=[ 'locName' ] if cmds.windowPref( self.winName, query=True, exists=True, ): cmds.windowPref( self.winName, wh= ( self.winWidth, self.winHeight ), ) cmds.windowPref( self.winName, remove=True ) if cmds.window( self.winName, q=1, ex= 1 ) == True: cmds.deleteUI( self.winName ) cmds.window( self.winName, tlb=1, wh=( self.winWidth, self.winHeight ), t= "Curve Controller Utility" ) tabs = cmds.tabLayout() cmds.setParent( tabs ) child1 = cmds.rowColumnLayout( nr=3, rh= [(1, 100),( 2, 60 ),( 3, 20)]) # Tab1 cmds.frameLayout( label= 'Choose Colour :', width= 412, h=30, parent= child1 ) cmds.rowColumnLayout( nc=3, cw= [(1, 135),( 2, 135 ),( 3, 135 )] ) # Color buttons. cmds.button( 'purple', l= 'Purple ', w= 60, h=25, bgc=(0.846000000089406967,0.03,0.7839999794960022 ), aop=1, c= "cmds.color(ud=7 )" ) cmds.button( 'red', l= 'Red ', w= 60, h=25, bgc=(0.85699999332427979,0.14800000190734863,0.3190000057220459 ), aop=1,c= "cmds.color(ud=8 )" ) cmds.button( 'brown', l= 'Brown ', w= 60, h=25, bgc=(0.602,0.452,0.173 ), aop=1, c= "cmds.color(ud=1)" ) cmds.button( 'green', l= 'Green ', w= 60, h=25, bgc=(0.5311,0.662,0.1 ), aop=1,c= "cmds.color(ud=3)" ) cmds.button( 'beige', l= 'Beige ', w= 60, h=25, bgc=(0.225,0.415,0.1 ), aop=1,c= "cmds.color(ud=2)" ) cmds.button( 'lightGreen', l= 'LightGreen ', w= 60, h=25, bgc=(0.0,0.668,0.268 ), aop=1,c= "cmds.color(ud=4)" ) cmds.button( 'cyan', l= 'Cyan ', w= 60, h=25, bgc=(0.1, 0.4, 0.5 ), aop=1,c= "cmds.color(ud=5)" ) cmds.button( 'skyBlue', l= 'SkyBlue ', w= 60, h=25, bgc=(0.36,0.49,0.811 ), aop=1,c= "cmds.color(ud=6 )" ) # Create controllers. nameFrame= cmds.frameLayout( label= 'Name Controllers: ', width= 412, h=50, parent=child1 ) cmds.text( "Put down 'Name' and it will result in: Name#_ctl ", parent= nameFrame ) for i in self.fieldTexts: cmds.textField( i, text= 'defaultControlName', parent= nameFrame ) funcFrame= cmds.frameLayout( l= "Choose Function:", w=412, h= 100, parent= child1 ) funcLabel = cmds.rowColumnLayout( numberOfColumns=4, columnWidth=[(1, 120), (2, 100), (3, 100)] ) for i in self.checkBoxes: cmds.checkBox( i, parent= funcLabel ) self.featureOptions = cmds.optionMenu( label='Features:' ) for eachItem in self.menuItems: cmds.menuItem( label= eachItem ) cmds.button( label= "Create Controller(s)", bgc= ( 0.05, 0.4, 0.5 ), height=30, command= self.function, parent = funcFrame ) cmds.button( label= "Close", height=20, command= self.deleteUI, parent=funcFrame ) cmds.setParent( tabs ) # Tab2 child2= cmds.rowColumnLayout( numberOfColumns= 2, cw= [(1, 250),( 2, 100 )], parent=tabs ) # Constraint boxes. constraintBox= cmds.frameLayout( l= "Choice Connections:", w=206, h= 150, parent=child2 ) cmds.radioButtonGrp( self.connectBoxes[0], numberOfRadioButtons=2, labelArray2=['parentConstraint', 'parentConnect'], sl=1 ) cmds.radioButtonGrp( self.connectBoxes[1], numberOfRadioButtons=2, labelArray2=['pointConstraint', 'normallateConnect'], sl=1 ) cmds.radioButtonGrp( self.connectBoxes[2], numberOfRadioButtons=2, labelArray2=['rotateConstraint', 'rotateConnect'], sl=1 ) cmds.radioButtonGrp( self.connectBoxes[3], numberOfRadioButtons=2, labelArray2=['scaleConstraint', 'scaleConnect'], sl=1 ) # Connection boxes. connectBox= cmds.frameLayout( l= "ApplyConnections:", w=206, h= 150, parent=child2 ) for eachConnect in self.radioBoxes: cmds.checkBox( eachConnect,label=eachConnect, parent = connectBox ) cmds.checkBox( self.radioBoxes[0], e=1, value=1 ) cmds.checkBox( self.radioBoxes[3], e=1, value=1 ) # Tab3 child3= cmds.rowColumnLayout( numberOfColumns= 1, cw= [(1, 50)], parent=tabs ) locFuncFrame= cmds.frameLayout( l= "Choose Name :", w=412, h= 80, parent= child3 ) for i in self.locTexts: cmds.text( "Put down 'name' and you'll get 'name#_grp; " ) cmds.text( "With selectionName: 'geo_name_grp'; Text field will be void." ) cmds.textField( i, text='defaultGroupName', parent= locFuncFrame ) locFrame= cmds.frameLayout( l= "Create Locator(s) with function(s):", w=412, h= 120, parent= child3 ) locFuncLabel = cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1, 150), (2, 150), (2, 150) ] ) for i in self.locCheckBoxes: cmds.checkBox( i, parent= locFuncLabel ) cmds.text( "Choose normalforms or vertices, click button to create a locator.", parent=locFrame ) cmds.button( label= "Create Locator(s)", bgc= ( 0.5, 0.4, 0.5 ), height=40, command= self.locators, parent = locFrame ) cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'Controllers'), (child2, 'snapConnections'), (child3, 'Locators') ) ) cmds.tabLayout( tabs, edit=True, selectTabIndex=1 ) cmds.showWindow(self.winName) cmds.window(self.winName, edit= True, wh=[self.winWidth,self.winHeight])
def gui(): ''' GUI for creating scriptJobs ''' # Get XML Data parseXML() global mainCol, tsl, sfDisc, tslText, radioCol if (cmds.window(win, q=True, ex=True)): cmds.deleteUI(win) if (cmds.windowPref(win, ex=True)): cmds.windowPref(win, r=True) cmds.window(win, title="Script Job Creator", mb=True, w=winWidth2, h=winHeight) cmds.menu(label="System") cmds.menuItem(label="Script Job Monitor", c=Callback(mecScriptJob.gui)) mainCol = cmds.columnLayout(rs=4, co=["both", 5]) cmds.rowColumnLayout(nc=2, cw=[[1, winWidth * .4], [2, winWidth * .6]]) tslText = cmds.text(label="Event Types", w=200, al="center") cmds.text(label="Type Desciption", w=300, al="center") tsl = cmds.textScrollList(w=200, h=150, append="Select Mode", en=False, sc=Callback(loadDisc)) sfDisc = cmds.scrollField(w=300, h=150, editable=False, wordWrap=True, text='Select event for discription.') cmds.setParent(mainCol) # Create a radioButton collection cmds.frameLayout(label="Script Job Type", labelAlign="center", w=winWidth, labelIndent=winWidth / 2 - 50) frmType = cmds.formLayout(w=winWidth, h=25) # cmds.text( l="Choose Script Job Type", w=winWidth, al="center") rlType = cmds.rowColumnLayout(nc=4, w=500, cw=[[1, winWidth * .25 - 15], [2, winWidth * .25], [3, winWidth * .25 - 10], [4, winWidth * .25]], co=[1, "left", 5]) radioCol = cmds.radioCollection() cmds.radioButton("mecSJEvent", label='event', cl=radioCol, sl=True, onCommand=Callback(loadTSL)) cmds.radioButton("mecSJAttr", label='attributes', cl=radioCol, onCommand=Callback(loadTSL)) cmds.radioMenuItemCollection("mecSJAttrCol") cmds.popupMenu() cmds.menuItem("mecAttrCh", label="attributeChange", cl="mecSJAttrCol", rb=True) cmds.menuItem("mecAttrDel", label="attributeDeleted", rb=False, cl="mecSJAttrCol") cmds.menuItem("mecAttrAdd", label="attributeAdded", rb=False, cl="mecSJAttrCol") cmds.setParent("..", m=True) cmds.radioButton("mecSJCond", label='condition', cl=radioCol, onCommand=Callback(loadTSL)) cmds.radioMenuItemCollection("mecSJConCol") cmds.popupMenu() cmds.menuItem("mecCondTrue", label="conditionTrue", rb=True, cl="mecSJConCol") cmds.menuItem("mecCondFalse", label="conditionFalse", rb=False, cl="mecSJConCol") cmds.menuItem("mecCondChange", label="conditionChange", rb=False, cl="mecSJConCol") cmds.setParent("..", m=True) cmds.radioButton("mecSJNode", label='nodeNameChanged', cl=radioCol, onCommand=Callback(loadTSL)) cmds.setParent(frmType) rlType2 = cmds.rowColumnLayout(nc=3, w=500, cw=[[1, winWidth / 3], [2, winWidth / 3 - 20], [3, winWidth / 3]], co=[1, "right", 10]) cmds.radioButton("mecSJConn", label='connectionChange', cl=radioCol, onCommand=Callback(loadTSL)) cmds.radioButton("mecSJUI", label='uiDeleted', cl=radioCol, onCommand=Callback(loadTSL)) cmds.radioButton("mecSJTime", label='timeChange', cl=radioCol, onCommand=Callback(loadTSL)) cmds.setParent(frmType) row1 = cmds.rowColumnLayout(nc=2, cw=[[1, winWidth / 2 + 10], [2, winWidth / 2 - 20]]) # This text and ann will change depending when type of script job is chosen. # In the case time this text and field will not be used. # Certain scriptJob types will automaticly change the content of this field cmds.textFieldGrp("mecSJConLabel", label='Attribute', text='', w=winWidth / 2, cw=[[1, 90], [2, 200]], ann="") # This field will recieve which procedure will be exectued when the scriptJob is triggered. cmds.textFieldGrp("mecSJProcLabel", label='Procedure: ', text='', w=winWidth / 2, cw=[1, 75], ann="What function will the scriptJob call?") cmds.formLayout(frmType, edit=True, attachForm=[[rlType, "left", 0], [rlType2, "left", 40], [row1, "left", 0], [rlType, "top", 5]], attachControl=[[rlType2, "top", 5, rlType], [row1, "top", 5, rlType2]]) cmds.formLayout(frmType, e=1, af=[row1, "bottom", 5]) cmds.setParent(mainCol) frmMid = cmds.formLayout() jsLayout = jobSecurity(frmMid) jLayout = jobLifeSpan(frmMid) cmds.formLayout(frmMid, e=1, af=[[jsLayout, "top", 5], [jLayout, "top", 5]], ac=[jLayout, "left", 10, jsLayout]) cmds.setParent(mainCol) # Script Job UI Connection cmds.frameLayout(label="Script Job UI Connection", labelAlign="center", w=winWidth, labelIndent=winWidth / 2 - 60) frm3 = cmds.formLayout(w=winWidth, h=25) row3 = cmds.rowColumnLayout(nc=3, cw=[[1, 60], [2, 150], [3, 100]]) cmds.checkBox( "mecSJParent", label="parent", w=100, v=0, ann= "Attaches this job to a piece of maya UI. When the UI is destroyed, the job will be killed along with it." ) cmds.textField("mecSJParentText", text="UINameHere", w=100) cmds.checkBox( "mecSJReplace", label="replacePrevious", v=0, ann= "This flag can only be used with the -parent flag. Before the new scriptJob is created, any existing scriptJobs that have the same parent are first deleted." ) cmds.setParent("..") cmds.formLayout(frm3, edit=True, attachForm=[[row3, "left", winWidth / 2 - 140], [row3, "top", 5]]) cmds.setParent(mainCol) # Create the Script Job cmds.button(label="Generate Script Job", w=winWidth, c=Callback(sjCreateSJ)) cmds.textField("mecSJPreview", w=winWidth, text="Preview Area", editable=False) cmds.button( label="Execute Script Job! Warning this will activate the scriptJob!", w=winWidth, c=Callback(exeScriptJ)) # Preview Area (Extra) # This area will show what the script job is looking like. # Get radioButton event setup first # Attr # Condition # Add elements into textScrollList #appendElements( tsl ) loadTSL() cmds.showWindow(win)
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 OCT_QuantituRender_UI_zwz(): if mc.windowPref('OCT_QuantituRender_UI_zwz', exists=True): mc.windowPref('OCT_QuantituRender_UI_zwz', remove=True) if mc.window('OCT_QuantituRender_UI_zwz', exists=True): mc.deleteUI('OCT_QuantituRender_UI_zwz', window=True) mc.window("OCT_QuantituRender_UI_zwz", title=u"OCT_QuantituRender_zwz", menuBar=True, widthHeight=(350, 340), resizeToFitChildren=True, sizeable=True) mc.formLayout('formLyt', numberOfDivisions=100) one = mc.columnLayout('First_Set', parent='formLyt') mc.rowLayout('oneRow', numberOfColumns=2, columnAttach2=['left', 'left'], columnWidth2=[5, 300], columnOffset2=[2, 2], adjustableColumn2=True, parent='First_Set') mc.text(label=u'详细文件名:', w=68, parent='oneRow') mc.textField('myAddress', text='D:\work\Test\scenes\Test.mb', width=300, alwaysInvokeEnterCommandOnReturn=True, parent='oneRow') mc.radioButtonGrp('Playoption', label=u'Playblast:', labelArray2=[u'1 (是)', u'2 (否)'], numberOfRadioButtons=2, columnAlign=[1, 'left'], columnAlign2=['left', 'left'], cw3=[85, 130, 90], sl=1, parent='First_Set') mc.radioButtonGrp('showoption', label=u'物体是否显示:', labelArray2=[u'1 (不显示)', u'2 (文件默认)'], numberOfRadioButtons=2, columnAlign=[1, 'left'], columnAlign2=['left', 'left'], cw3=[85, 130, 90], sl=1, parent='First_Set') mc.button(label=u'加 载', width=320, command='OCT_render.OCT_QuantityRender_zwz.Addaddress_zwz()', backgroundColor=(0.9, 0.5, 0), annotation=u"确认名字和选项", parent='First_Set') two = mc.text('Cameras_Set', label=u'渲染文件清单(面板可拉伸)', parent='formLyt', fn="boldLabelFont", al='left', w=200) two_one = mc.textScrollList( 'allMyAddress', append=u'文件地址:', allowMultiSelection=True, sc="OCT_render.OCT_QuantityRender_zwz.lsRenderlist_zwz('allMyAddress')", h=100, width=100, parent='formLyt') two_two = mc.textScrollList( 'myplayoptions', append='Playblast:', allowMultiSelection=True, sc= "OCT_render.OCT_QuantityRender_zwz.lsRenderlist_zwz('myplayoptions')", h=100, width=60, parent='formLyt') two_three = mc.textScrollList( 'myshowoptions', append=u'物体显示性:', allowMultiSelection=True, sc= "OCT_render.OCT_QuantityRender_zwz.lsRenderlist_zwz('myshowoptions')", h=100, width=65, parent='formLyt') three = mc.columnLayout('Second_Set', parent='formLyt') mc.button('clearlist', label=u'删除选中的清单', width=320, command='OCT_render.OCT_QuantityRender_zwz.clearLslist_zwz()', backgroundColor=(0.9, 0.3, 0.3), parent='Second_Set') mc.button( 'doRender', label=u'开始渲染', width=320, command='OCT_render.OCT_QuantityRender_zwz.Do_QuantituRender_zwz()', backgroundColor=(0.3, 0.7, 0.3), parent='Second_Set') mc.formLayout('formLyt', e=True, \ attachForm=[(one, 'top', 5),(one, 'left', 5),(two, 'left', 5),(two, 'top', 90),(two_one, 'top', 110),(two_two, 'top', 110),(two_three, 'top', 110),(two_one, 'left', 5),(two_three, 'right', 5),(three, 'left', 5),(three, 'bottom', 5)], \ attachControl=[(two_one, 'bottom', 1, three),(two_two, 'bottom', 1, three),(two_three, 'bottom', 1, three),(two_one, 'right', 1, two_two),(two_two, 'right', 1, two_three)], \ attachNone=[(three, 'top')], \ attachPosition=[(one, 'left',0, 0),(one, 'top',0, 0),] \ ) mc.showWindow('OCT_QuantituRender_UI_zwz')
def _start_ui(self): # Remove size preference to force the window calculate its size windowName = 'VirtuCameraMayaConfigWindow' if cmds.windowPref(windowName, exists=True): cmds.windowPref(windowName, remove=True) self._ui_window = cmds.window(windowName, width=self._WINDOW_SIZE[0], height=self._WINDOW_SIZE[1], menuBarVisible=False, titleBar=True, visible=True, sizeable=True, closeCommand=self._close_ui, title='VirtuCamera Configuration') form_lay = cmds.formLayout(width=550, height=400) col_lay = cmds.columnLayout(adjustableColumn=True, columnAttach=('both', 0), width=465) cmds.text(label='General Settings', align='left') cmds.separator(height=15, style='none') cmds.rowLayout(numberOfColumns=3, columnWidth3=(59, 80, 45), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)]) cmds.separator(style='none') cmds.text(label='Server Port', align='right') self._port_num_ui = cmds.intField( width=45, value=self.DEFAULT_SRVPORT, minValue=0, maxValue=65535, changeCommand=self._port_num_changed_ui) cmds.setParent('..') cmds.separator(height=5, style='none') self._cap_mode_ui = cmds.optionMenuGrp( label='Capture Mode', changeCommand=self._cap_mode_changed_ui) cmds.menuItem(label=self.CAPMODE_BUFFER) cmds.menuItem(label=self.CAPMODE_SCREENSHOT) cmds.text( label= " 'Viewport Buffer' is faster. 'Screenshot' is experimental, only use it\n if you are having problems visualizing the viewport on the App.", align='left') cmds.separator(height=25, style='none') cmds.separator() cmds.separator(height=15, style='none') cmds.text(label='Custom Scripts', align='left') cmds.separator(height=15, style='none') cmds.rowLayout(numberOfColumns=3, columnWidth3=(600, 80, 80), adjustableColumn=1, columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)]) self._script_num_ui = cmds.intSliderGrp( field=True, label='Script Number', minValue=0, maxValue=1, fieldMinValue=0, fieldMaxValue=1, value=0, dragCommand=self._script_number_changed_ui, enable=False) self._new_bt_ui = cmds.button(label='New', command=self._new_script_ui) self._rem_bt_ut = cmds.button(label='Remove', command=self._remove_script_ui, enable=False) cmds.setParent('..') self._label_ui = cmds.textFieldGrp( label='Button Label', textChangedCommand=self._label_changed_ui, enable=False) self._lang_ui = cmds.radioButtonGrp( label='Language', labelArray2=['Python', 'MEL'], numberOfRadioButtons=2, select=self.LANG_PY, changeCommand=self._languaje_changed_ui, enable=False) self._code_lb_ui = cmds.text(label='Script Code', align='left', enable=False) cmds.setParent('..') self._ui_sfield = cmds.scrollField( editable=True, wordWrap=False, keyPressCommand=self._code_changed_ui, enable=False) col_lay2 = cmds.columnLayout(adjustableColumn=True, columnAttach=('both', 0), width=465) cmds.rowLayout(numberOfColumns=2, columnWidth2=(680, 80), adjustableColumn=1, columnAttach=[(1, 'both', 0), (2, 'both', 0)]) cmds.separator(style='none') self._ui_save = cmds.button(label='Save', width=80, command=self._save_ui, enable=False) cmds.setParent('..') cmds.setParent('..') cmds.formLayout(form_lay, edit=True, attachForm=[(col_lay, 'top', 20), (col_lay, 'left', 20), (col_lay, 'right', 20), (self._ui_sfield, 'left', 20), (self._ui_sfield, 'right', 20), (col_lay2, 'bottom', 20), (col_lay2, 'left', 20), (col_lay2, 'right', 20)], attachControl=[(self._ui_sfield, 'top', 0, col_lay), (self._ui_sfield, 'bottom', 15, col_lay2)]) cmds.setParent('..') cmds.showWindow(self._ui_window)
def toolBoxUi(self): # gather info for layout self.getToolsOnScreen() self.resizeAndAjust() self.savePref() # delete if (self.firstLaunch == 1): uiToDelete = [ self.win, self.win + 'Bis', self.dockWin, self.dockWin + 'Bis' ] for uiName in uiToDelete: try: mc.deleteUI(uiName) except: pass else: mc.evalDeferred('import maya.cmds as mc') mc.evalDeferred( 'if(mc.window( "{0}" , ex = True )): mc.deleteUI( "{0}" )'. format(self.win)) mc.evalDeferred( 'if(mc.dockControl( "{0}" , ex = True )): mc.deleteUI( "{0}" )' .format(self.dockWin)) if (self.win[-3:-1] == 'Bi'): self.win = self.win.split('Bis')[0] self.dockWin = self.dockWin.split('Bis')[0] else: self.win = self.win + 'Bis' self.dockWin = self.dockWin + 'Bis' # build if (self.firstLaunch == 0): self.winTitle = self.categories[self.categorieIndex] mc.window(self.win, wh=self.whMainWin, s=True, t=self.winTitle, topLeftCorner=self.positionWin) mc.windowPref(self.win, e=True, wh=self.whMainWin, topLeftCorner=self.positionWin) mc.formLayout(self.mainColumName, numberOfDivisions=100, bgc=[0.27, 0.27, 0.27]) #0.27 self.canvasPopupMenu() mc.textField( self.searchFieldName, bgc=[0.35, 0.35, 0.35], h=self.hSearchBar, tx=self.searchFilter, cc= 'import maya.cmds as mc; toolBoxWindow.searchFilter = mc.textField( toolBoxWindow.searchFieldName , q = True , tx = True );toolBoxWindow.toolBoxUi()' ) mc.scrollLayout(self.scrollName, horizontalScrollBarThickness=self.scrollBarThickness, verticalScrollBarThickness=self.scrollBarThickness, p=self.mainColumName) self.scrollToolsPopupMenu() self.gridListTools() mc.formLayout( self.mainColumName, e=True, af=[(self.searchFieldName, 'top', self.whSideSpaceMainWin[1]), (self.searchFieldName, 'right', self.whSideSpaceMainWin[0]), (self.searchFieldName, 'left', self.whSideSpaceMainWin[0])], ac=[]) mc.formLayout( self.mainColumName, e=True, af=[(self.scrollName, 'bottom', self.whSideSpaceMainWin[1]), (self.scrollName, 'right', self.whSideSpaceMainWin[0]), (self.scrollName, 'left', self.whSideSpaceMainWin[0])], ac=[(self.scrollName, 'top', 0, self.searchFieldName)]) if not (self.dockingMode[self.dockingModeIndex] == 'none'): mc.dockControl(self.dockWin, l=self.winTitle, content=self.win, area=self.dockingMode[self.dockingModeIndex]) else: mc.showWindow(self.win) self.firstLaunch = 0
def close(self): if mc.window(self._windowName, q=True, exists=True): mc.deleteUI(self._windowName, window=True) if mc.windowPref(self._windowName, q=True, exists=True): mc.windowPref(self._windowName, remove=True)
def gui(): if(cmds.window('tjmToolSetMain',ex=True)): cmds.deleteUI('tjmToolSetMain', window=True) if(cmds.windowPref('tjmToolSetMain', ex=True, )): cmds.windowPref('tjmToolSetMain', r=True) cmds.window('tjmToolSetMain', t="RBA ToolSet", w=305, h=600, s=True, tlc=[107,58]) cmds.scrollLayout(w=305) main = cmds.columnLayout(adjustableColumn=1) #Modeling global normalSize, borderEdgeSize cmds.frameLayout('Modeling',l='Modeling', cl=True, cll=True, width=275) cmds.columnLayout(adj=1) cmds.button(l='Normals',c=normals) normalSize=cmds.floatSliderGrp(min=0.0, max=1.0, s=0.01, f=True,dc=normalResize) cmds.button(l='Border Edges', c=borderEdge) borderEdgeSize=cmds.floatSliderGrp(min=1.0, max=10, s=0.5, f=True, dc=borderEdgeResize) cmds.separator( h=5, st='singleDash') cmds.text(l='Normals') cmds.button(l='Conform', c=conformNormals) cmds.button(l='Reverse',c=reverseNormals) cmds.button(l='Soften', c=softenNormals) cmds.button(l='Harden', c=hardenNormals) cmds.setParent(main) #Control Icons cmds.frameLayout('ControlIcons',l='Control Icons', cl=True, cll=True, width=275) cmds.columnLayout(adj=1) cmds.button(l='Circle', c=createCircle) cmds.button(l='Square', c=createSquare) cmds.button(l='Cube',c=createCube) cmds.button(l='Pointer', c=createPointer) cmds.button(l='COG', c=createCOG) cmds.rowColumnLayout(numberOfColumns=2, width=275) global colorIndexValue cmds.button(bgc=[1,0,0], c=colorRed, l='') cmds.button(bgc=[0,0,1], c=colorBlue, l='') cmds.button(bgc=[1,1,0], c=colorYellow, l='') cmds.button(bgc=[1,0,1], c=colorPurple, l='') cmds.setParent('..') cmds.rowColumnLayout(nc=1) colorIndexValue=cmds.colorIndexSliderGrp(l=' ', min=0, max=20, value=10,dc=applyColor) #cmds.button(l='Apply', c=applyColor) cmds.setParent(main) #Rigging global pointCheckBox, orientCheckBox, parentCheckBox cmds.frameLayout('Rigging',l='Rigging', cl=True, cll=True, width=275) cmds.columnLayout(adj=1) cmds.text(l='Constraints') pointCheckBox=cmds.checkBox( l='Offset') cmds.button(l='Point', c=constraintPoint) orientCheckBox=cmds.checkBox( l='Offset') cmds.button(l='Orient', c=constraintOrient) parentCheckBox=cmds.checkBox( l='Offset') cmds.button(l='Parent',c=constraintParent) cmds.button(l='Pole Vector', c=constraintPoleVector) cmds.separator( height=5, style='singleDash') cmds.setParent(main) #Attribute Creator global separatorText, intText, floatText cmds.frameLayout('AttributeCreator',l='Attribute Creator',cl=True,cll=True,width=275,) cmds.columnLayout(adj=1) cmds.rowColumnLayout(nc=2) cmds.button(l='Separator',c=createSeparator) separatorText=cmds.textField(ed=True) cmds.button(l='Int',c=createInt) intText=cmds.textField(ed=True) cmds.button(l='Float',c=createFloat) floatText=cmds.textField(ed=True) cmds.setParent('..') #Intermediate Attribute Creator WIP cmds.text(l='Custom Attribute', al='center') global attributeLongName, radioSelection, minValue, maxValue cmds.columnLayout('radioMenu',cal='left', w=275) attributeLongName=cmds.textFieldGrp(l='LongName',ed=True, w=250) radioSelection=cmds.radioButtonGrp(la2=['Integer', 'Float'], nrb=2,sl=1) minValue=cmds.floatFieldGrp(nf=1,l='Min',v1=0) maxValue=cmds.floatFieldGrp(nf=1,l='Max',v1=1) cmds.setParent('..') cmds.button(l='Create Attribute',c=createAttribute) cmds.setParent(main) #Clean-Up cmds.frameLayout('CleanUp',l='Clean Up', cl=True, cll=True, width=275) cmds.columnLayout(adj=1) cmds.text(l='Geo') cmds.separator( h=5, st='singleDash') cmds.button(l='Delete History', c=deleteHistory) cmds.button(l='Freeze Transforms', c=freezeTransforms) cmds.button(l='Center Pivot', c=centerPivot) cmds.showWindow('tjmToolSetMain')
def __init__(self): windowName = "behaviour_UI_Ribbon" windowWidth = 400 windowHeight = 160 if mc.window(windowName, ex=True): mc.deleteUI(windowName) mc.windowPref(windowName, remove=True) mainWindow = mc.window(windowName, t="behaviour_UI_Ribbon", s=False, mnb=False, mxb=False) mc.window(windowName, e=True, wh=(windowWidth, windowHeight)) mainFormL = mc.formLayout() prefixText = mc.text(l="prefix:") self.prefixField = mc.textField("prefix", pht="nombra me") numCtrlsText = mc.text(l="num_of_ctrls:") self.numCtrlsField = mc.intField("num_of_ctrls", min=1, v=5, step=1) numJntsText = mc.text(l="num_of_jnts:") self.numJntsField = mc.intField("num_of_jnts", min=1, v=29, step=1) self.equalCheckbox = mc.checkBox("equal", l="equal_dist", v=True) self.constrCheckbox = mc.checkBox("constrain", l="constrain", v=True) self.wireCheckbox = mc.checkBox("wire", l="wire", v=False) self.fkCheckbox = mc.checkBox("add_fk", l="add_fk", v=False) self.ribbonizeBtn = mc.button(l="Ribbon_ps", c=self.launch) mc.formLayout(mainFormL, e=True, attachForm=[ (prefixText, "left", 20), (numCtrlsText, "left", 20), (numJntsText, "left", 20), (prefixText, "top", 19), (self.prefixField, "top", 15), (self.equalCheckbox, "left", 20), (self.wireCheckbox, "left", 20), (self.constrCheckbox, "left", 110), (self.fkCheckbox, "left", 110), (self.prefixField, "left", 110), (self.numCtrlsField, "left", 110), (self.numJntsField, "left", 110), (self.ribbonizeBtn, "left", 200), (self.ribbonizeBtn, "right", 15), (self.ribbonizeBtn, "top", 15), (self.ribbonizeBtn, "bottom", 15), ], attachControl=[ (numCtrlsText, "top", 11, prefixText), (numJntsText, "top", 11, numCtrlsText), (self.numCtrlsField, "top", 5, self.prefixField), (self.numJntsField, "top", 5, self.numCtrlsField), (self.equalCheckbox, "top", 20, self.numJntsField), (self.wireCheckbox, "top", 5, self.equalCheckbox), (self.constrCheckbox, "top", 20, self.numJntsField), (self.fkCheckbox, "top", 5, self.constrCheckbox), (self.prefixField, "right", 15, self.ribbonizeBtn), (self.numCtrlsField, "right", 15, self.ribbonizeBtn), (self.numJntsField, "right", 15, self.ribbonizeBtn), ]) mc.showWindow(mainWindow)