def evenEdgeSpacingUI(): """ Even Edge Spacing UI """ # Window window = 'evenEdgeSpacingUI' if cmds.window(window, q=True, ex=1): cmds.deleteUI(window) window = cmds.window(window, t='Even Edge Spacing', s=True) # Layout CL = cmds.columnLayout() # UI Elements cmds.intSliderGrp('evenEdgeSpacing_smoothISG', label='Smooth', field=True, minValue=0, maxValue=20, fieldMinValue=0, fieldMaxValue=100, value=4) cmds.floatSliderGrp('evenEdgeSpacing_influenceFSG', label='Influence', field=True, minValue=0.0, maxValue=1.0, fieldMinValue=0.0, fieldMaxValue=1.0, value=1.0) cmds.checkBoxGrp('evenEdgeSpacing_snapToOrigCBG', label='Maintain Shape', numberOfCheckBoxes=1, v1=False) # columnWidth2=[100,165] cmds.checkBoxGrp('evenEdgeSpacing_deleteHistoryCBG', label='Delete History', numberOfCheckBoxes=1, v1=False) cmds.button('evenEdgeSpacingB', l='Even Edge Spacing', w=390, c='glTools.model.straightenVerts.evenEdgeSpacingFromUI()') # Show Window cmds.window(window, e=True, wh=[392, 99]) cmds.showWindow(window)
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 create(self): """ Draw the window """ # delete the window if its handle exists if cmds.window(self.window, exists=True): # deletes window. 'window' flag makes sure that deleted object is a window cmds.deleteUI(self.window, window=True) # initialize the window self.window = cmds.window(title=self.title, widthHeight=self.size, menuBar=True) # main form for the window self.mainForm = cmds.formLayout(numberOfDivisions=100) # create common menu items items and buttons self.commonMenu() self.commonButtons() # create a tabLayout self.optionsBorder = cmds.tabLayout(scrollable=True, tabsVisible=False, height=1) # Attach tabLayout to parent formLayout, and to control button cmds.formLayout(self.mainForm, edit=True, attachForm= ([self.optionsBorder, 'top', 0], [self.optionsBorder, 'left', 2], [self.optionsBorder, 'right', 2]), attachControl= ([self.optionsBorder, 'bottom', 5, self.applyBtn])) # new form to attach controls in displayOptions() self.optionForm = cmds.formLayout(numberOfDivisions=100) self.displayOptions() # Show the window cmds.showWindow(self.window)
def smoothEdgeLineUI(): """ Smooth Edge Line UI """ # Window window = 'smoothEdgesUI' if cmds.window(window, q=True, ex=1): cmds.deleteUI(window) window = cmds.window(window, t='Smooth Edge Line', s=True) # Layout CL = cmds.columnLayout() # UI Elements cmds.intSliderGrp('smoothEdges_smoothISG', label='Smooth', field=True, minValue=1, maxValue=20, fieldMinValue=1, fieldMaxValue=100, value=4) cmds.floatSliderGrp('smoothEdges_falloffFSG', label='Falloff Distance', field=True, precision=3, minValue=0.0, maxValue=10.0, fieldMinValue=0.0, fieldMaxValue=100.0, value=0.01) cmds.checkBoxGrp('smoothEdges_edgeSpacingCBG', label='Maintain Edge Spacing', numberOfCheckBoxes=1, v1=False) cmds.checkBoxGrp('smoothEdges_snapToOrigCBG', label='Maintain Shape', numberOfCheckBoxes=1, v1=False) # columnWidth2=[100,165] cmds.checkBoxGrp('smoothEdges_deleteHistoryCBG', label='Delete History', numberOfCheckBoxes=1, v1=False) cmds.button('smoothEdgesB', l='Smooth', w=390, c='glTools.model.straightenVerts.smoothEdgeLineFromUI()') # Show Window cmds.window(window, e=True, wh=[392, 115]) 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 particleLocatorsUI(): """ """ # Get current frame range start = cmds.playbackOptions(q=True, min=True) end = cmds.playbackOptions(q=True, max=True) # Define window particleLocatorsUI = 'particleLocatorsWindow' if cmds.window(particleLocatorsUI, q=True, ex=True): cmds.deleteUI(particleLocatorsUI) particleLocatorsUI = cmds.window(particleLocatorsUI, t='Generate Locators') # UI Layout cmds.columnLayout(adj=False, cal='left') partiTFG = cmds.textFieldGrp('partiLoc_particleTFG', label='Particle', text='', cw=[(1, 120)]) prefixTFG = cmds.textFieldGrp('partiLoc_prefixTFG', label='Prefix', text='', cw=[(1, 120)]) bakeAnicmdsBG = cmds.checkBoxGrp('partiLoc_bakeAnicmdsBG', label='Bake Animation', ncb=1, v1=0, cw=[(1, 120)]) startEndIFG = cmds.intFieldGrp('partiLoc_startEndISG', nf=2, label='Frame Range', v1=start, v2=end, cw=[(1, 120)]) rotateLocCBG = cmds.checkBoxGrp('partiLoc_rotateCBG', label='Rotate (rotatePP)', ncb=1, v1=0, cw=[(1, 120)]) scaleLocCBG = cmds.checkBoxGrp('partiLoc_scaleCBG', label='Scale (scalePP)', ncb=1, v1=0, cw=[(1, 120)]) cmds.button(l='Create Locators', c='glTools.tools.generateParticles.particleLocatorsFromUI()') # Popup menu cmds.popupMenu(parent=partiTFG) for p in cmds.ls(type=['particle', 'nParticle']): cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")') # Show Window cmds.showWindow(particleLocatorsUI)
def locatorParticlesUI(): """ """ # Define window locParticleUI = 'locatorParticleWindow' if cmds.window(locParticleUI, q=True, ex=True): cmds.deleteUI(locParticleUI) locParticleUI = cmds.window(locParticleUI, t='Generate Particles') # UI Layout cmds.columnLayout(adj=False, cal='left') partiTFG = cmds.textFieldGrp('locParticle_particleTFG', label='Particle', text='', cw=[(1, 100)]) radiusFFG = cmds.floatSliderGrp('locParticle_radiusFSG', label='radius', f=True, min=0.1, max=10.0, fmn=0.01, fmx=100.0, pre=2, v=1.0, cw=[(1, 100)]) rotateLocCBG = cmds.checkBoxGrp('locParticle_rotateCBG', label='Add rotatePP', ncb=1, v1=0, cw=[(1, 100)]) scaleLocCBG = cmds.checkBoxGrp('locParticle_scaleCBG', label='Add scalePP', ncb=1, v1=0, cw=[(1, 100)]) selfCollideCBG = cmds.checkBoxGrp('locParticle_selfCollideCBG', label='self collide', ncb=1, v1=0, cw=[(1, 100)]) cmds.button(l='Create Particles', c='glTools.tools.generateParticles.locatorParticlesFromUI()') # Popup menu cmds.popupMenu(parent=partiTFG) for p in cmds.ls(type=['particle', 'nParticle']): cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")') # Show Window cmds.showWindow(locParticleUI)
def __init__(s): with report.Report(): tracker = JointTracker() winName = "Orient_Joints" if cmds.window(winName, ex=True): cmds.deleteUI(winName) s.win = cmds.window(rtf=True, w=300, t="Orient Joints") cmds.columnLayout(adj=True) cmds.button( l="Attach Marker", h=50, c=Callback(tracker.addMarker), ann=""" Attach a Marker to the selected Joint. Rotate the marker into the desired joint rotation. """ ) cmds.button( l="Update Joints", h=50, c=Callback(tracker.orientJoints), ann=""" Rotate all joints that have markers to their respective rotations. """ ) cmds.showWindow(s.win) cmds.scriptJob(uid=[s.win, tracker.removeMarkers])
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 __init__(self): winName = "Size set" global typeMenu winTitle = winName if cmds.window(winName, exists=True): cmds.deleteUI(winName) # self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=150, h=100 ) window = cmds.window(winName, title=winTitle, tbm=1, w=250, h=100 ) cmds.menuBarLayout(h=30) cmds.rowColumnLayout (' selectArrayRow ', nr=1, w=250) cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow') cmds.rowLayout (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow') cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow') cmds.setParent ('selectArrayColumn') cmds.separator(h=10, p='selectArrayColumn') cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(100, 20)) typeMenu=cmds.optionMenu( label='ctrl size') cmds.menuItem( label="Large" ) cmds.menuItem( label="Med" ) cmds.menuItem( label="Small" ) cmds.button (label='Change Selection', p='listBuildButtonLayout', command = lambda *args:self.controllerSize()) cmds.showWindow(window)
def setAttributeVectorUI(): global tfXIn, tfXOut, tfYIn, tfYOut, tfZIn, tfZOut, tslVectorList, tfXAdd, tfYAdd, tfZAdd, vectorUI vectorUI = 'vectorUI' closeUI(vectorUI) cmds.window(vectorUI, title = 'vectorUI') cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 210) cmds.text('..: random range :..', backgroundColor = [0.15, 0.15, 0.0]) cmds.gridLayout(numberOfColumns = 6, cellWidthHeight = (33, 20)) tfXIn = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0]) tfXOut = cmds.textField(text = '1.0', backgroundColor = [0.15, 0.1, 0.0]) tfYIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1]) tfYOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.15, 0.1]) tfZIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15]) tfZOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.1, 0.15]) cmds.setParent('..') cmds.button('ok', command = 'setAttributeVectorRandom()') cmds.separator(style = 'out') cmds.text('..: vector list :..', backgroundColor = [0.0, 0.15, 0.15]) tslVectorList = cmds.textScrollList(allowMultiSelection = True) cmds.button('remove', command = 'removeScrollListVector()') cmds.gridLayout(numberOfColumns = 4, cellWidthHeight = (50, 20)) tfXAdd = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0]) tfYAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1]) tfZAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15]) cmds.button('add..', command = 'addScrollListVector()') cmds.setParent('..') cmds.button('random', command = 'setAttributeListVectorRandom()') cmds.button('increment %', command = 'setAttributeListVectorInc()') cmds.setParent('..') cmds.showWindow()
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 addMultiAttr(): #Create a variable for the window name winName = 'blend' winTitle = 'rh_addMultiAttr' #Delete the window if it exists if cmds.window(winName, exists=True): cmds.deleteUI(winName, window=True) #Build the main window cmds.window(winName, title=winTitle, sizeable=True) cmds.textFieldButtonGrp('Obj',label='Object :', text='', ed = False,buttonLabel='Load Sel',bc = 'sel()') cmds.columnLayout(adjustableColumn=True) cmds.textFieldGrp('Attr',l='Attribute:',text='') cmds.columnLayout(adjustableColumn=True) cmds.floatFieldGrp('minAttr', numberOfFields=1, label='Min Value', value1=0) cmds.columnLayout(adjustableColumn=True) cmds.floatFieldGrp('maxAttr', numberOfFields=1, label='Max Value', value1=0) cmds.columnLayout(adjustableColumn=True) cmds.button(label='Contact', command='Connect()') cmds.columnLayout(adjustableColumn=True) #Show the window cmds.showWindow(winName) cmds.window(winName, edit=True, width=300, height=120)
def create(self): if cmds.window( self.winName, ex=1 ): cmds.deleteUI( self.winName, wnd=1 ) cmds.window( self.winName, title= self.title ) form = cmds.formLayout() field_meshForm = self.field_mesh.create() field_uvForm = self.field_uv.create() checkForm = self.check.create() buttons_form = self.buttons.create() cmds.setParent( '..' ) cmds.formLayout( form, e=1, af=[(field_meshForm, 'top', 0 ), ( field_meshForm, 'left', 0 ), ( field_meshForm, 'right', 0 ), (field_uvForm, 'left', 0 ), ( field_uvForm, 'right', 0 ), (checkForm, 'left', 0 ), (checkForm, 'right', 0 ), (buttons_form, 'left', 0 ), ( buttons_form, 'right', 0 ) ], ac=[(field_uvForm, 'top', 0, field_meshForm ), (checkForm, 'top', 0, field_uvForm), (buttons_form, 'top', 0, checkForm )]) cmds.window( self.winName, e=1, w=self.width, h=self.height ) cmds.showWindow( self.winName ) self.setTextInfomation() self.popupSetting() self.buttonCommandSetting()
def create(self): if cmds.window('uvShellAlignWindow', exists = True): cmds.deleteUI('uvShellAlignWindow') self.window = cmds.window(self.window, title = self.title, widthHeight = self.size) self.frameForm = cmds.frameLayout(label = " 1. 基準とする UVShell を選択して登録", bgc = (0.5, 0.3, 0.2), cll = False) self.setUVSBtn1 = cmds.button(label = "基準 UVShell を登録" , command = self.registUVBndBox1, height = 30 ) cmds.rowLayout( numberOfColumns = 1, adj = True) cmds.setParent("..") self.frameForm = cmds.frameLayout(label = " 2. 位置を揃えたい UVShell を選択して実行", bgc = (0.2, 0.3, 0.5), cll = False) self.distDcheckBox = cmds.radioButtonGrp('radioBtn', label = "", numberOfRadioButtons = 4 , sl = 1, cl4 = ['left','left','left','left'] , la4 = [ 'Left', 'Right', 'Bottom', 'Top'], adj = True) self.backupPathText = cmds.text("※ 2016/1/5 現在、複数UVを選択した状態での位置揃えには対応していません", font = "smallBoldLabelFont", align = 'left'); self.setUVSBtn2 = cmds.button(label = "選択した UVShell を揃える" , command = self.registUVBndBox2, height = 30 ) cmds.setParent("..") cmds.separator(width = self.width, style = 'in') cmds.text("【問い合わせ先】 : TAセクション.村岡", bgc = (0.2, 0.2, 0.2), align = 'left', width = self.width); cmds.setParent("..") cmds.showWindow()
def create(self): if cmds.window( WinA_Global.winName, ex=1 ): cmds.deleteUI( WinA_Global.winName, wnd=1 ) cmds.window( WinA_Global.winName, title= WinA_Global.title, titleBarMenu = WinA_Global.titleBarMenu ) form = cmds.formLayout() importPathForm = self.uiImportPath.create() importByMatrixForm = self.importByMatrix.create() buttonForm = self.uiButton.create() cmds.setParent( '..' ) cmds.formLayout( form, e=1, af=[(importPathForm, 'top', 8), (importPathForm, 'left', 0), (importPathForm, 'right', 0), (importByMatrixForm, 'left', 120 ), (importByMatrixForm, 'right', 0 ), (buttonForm, 'left', 0 ), (buttonForm, 'right', 0 )], ac=[(importByMatrixForm, 'top', 8, importPathForm), (buttonForm, 'top', 8, importByMatrixForm)] ) cmds.window( WinA_Global.winName, e=1, w= WinA_Global.width, h= WinA_Global.height, rtf=1 ) cmds.showWindow( WinA_Global.winName ) WinA_uiCmd.setUiDefault() WinA_uiCmd.loadInfo() WinA_uiCmd.setUiCommand()
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 UI(): if cmds.window("TressFXExporterUI", exists = True): cmds.deleteUI("TressFXExporterUI") windowTitle = 'TressFX Exporter' + ' ' + 'v' + tressfx_exporter_version window = cmds.window("TressFXExporterUI", title = windowTitle, w=280, h = 260, mnb=False, sizeable=False) mainLayout = cmds.columnLayout(w=280, h=260) cmds.separator(h=8, style='in') cmds.text(label='Number of vertices per strand (4, 8, 16, 32 or 64):', align='left') cmds.intField("numVerticesPerStrand", w=30, minValue=4, maxValue=64, value=16 ) cmds.separator(h=8, style='in') cmds.checkBox("bothEndsImmovable", label='Both ends immovable') cmds.checkBox("InvertZ", label='Invert Z', value = True) cmds.checkBox("exportSkinCheckBox", label='Export skin data', value = False) cmds.checkBox("randomStrandCheckBox", label='Randomize strands for LOD', value = True) cmds.separator(h=15) cmds.button(label="Set the base mesh", w=170, h=30, command=SetBaseMesh) cmds.textField("MeshNameLabel", w=170, editable=False) cmds.separator(height=10, style='none') cmds.button(label="Export as binary (*.tfx)", w=170, h=30, command=ExportBinary) cmds.separator(h=15) version_text = 'v' + tressfx_exporter_version cmds.text(label=version_text, align='left') global selected_mesh_shape_name selected_mesh_shape_name = '' cmds.showWindow(window)
def enterTimecodeUI(self, buttonlabel='set', buttonfunc=None): ''' generic UI to enter timecode :param buttonlabel' = label to add to the button :param buttonfunc' = function to bind to the button on exit ''' self.win='Timecode_UI' if cmds.window(self.win, exists=True): cmds.deleteUI(self.win, window=True) cmds.window(self.win, title=self.win) cmds.columnLayout(adjustableColumn=True) cmds.text(label='Timecode Reference') cmds.separator(h=10, style='in') cmds.rowColumnLayout(nc=8) cmds.text(label=' smpte : ') cmds.textField('tchrs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tchrs')) cmds.text(label=' : ') cmds.textField('tcmins', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcmins')) cmds.text(label=' : ') cmds.textField('tcsecs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcsecs')) cmds.text(label=' : ') cmds.textField('tcfrms', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcfrms')) cmds.setParent('..') cmds.button(label=buttonlabel, command=lambda x:self.__uicb_gatherTimecode(buttonfunc)) cmds.showWindow(self.win)
def ruMainWindow(): ruWin = "riggUtils" if mc.window(ruWin,q=True,ex=True): mc.deleteUI(ruWin) mc.window(ruWin,title = "Rigging Utilities") mc.scrollLayout(horizontalScrollBarThickness=16) ruMainColumn = mc.columnLayout(columnAttach=("both",5),rowSpacing=10,columnWidth=320) mc.frameLayout(label="General",bs="etchedOut",w=300,mw=5,cll=1) mc.button(label='Show Axis',command='mc.toggle(state=True, localAxis=True)') mc.button(label='Hide Axis',command='mc.toggle(state=False, localAxis=True)') mc.frameLayout(label="Non T-Pose joint placer",bs="etchedOut",w=300,mw=5,cll=1,p=ruMainColumn) mc.columnLayout(rs=5,adj=1) mc.button(l="Create Helper Locator",c =ruCreateLocator) mc.button(l="Create Joint on Helper Locator",c =ruCreateJointLocator) mc.floatSliderGrp("ruJointRadius",en=1,label="Joint Radius",field=True,minValue=0,maxValue=5,fieldMinValue=0,fieldMaxValue=5,value=0.5,cw3=(70,30,10),dc=ruJointRadius) mc.frameLayout(label="Fingers Utils",bs="etchedOut",w=300,mw=5,cll=1,p=ruMainColumn) mc.columnLayout(rs=5,adj=1) mc.floatSliderGrp("ruJointOrientation",en=1,label="Finger Orient",field=True,minValue=0,maxValue=5,fieldMinValue=0,fieldMaxValue=5,value=0.5,cw3=(70,30,10),dc=ruOrientJoint) mc.frameLayout(label="Finger Renaming",bs="etchedOut",w=300,mw=5,cll=1) mc.optionMenu('ruFinger',l='Choose finger') mc.menuItem(l='Thumb') mc.menuItem(l='Index') mc.menuItem(l='Middle') mc.menuItem(l='Ring') mc.menuItem(l='Pinky') mc.textFieldButtonGrp( label='Template string', text='', buttonLabel='Rename', bc=ruRenameFinger, cw3=[120,70,70],ct3=['left','left','left'],co3=[2,2,2] ) mc.showWindow(ruWin)
def create(self): if cmds.window( Win_Global.winName, q=1, ex=1 ): cmds.deleteUI( Win_Global.winName ) cmds.window( Win_Global.winName, title= Win_Global.title ) formOuter = cmds.formLayout() stdForm = self.stdArea.create() rigForm = self.rigArea.create() followForm = self.followArea.create() addRigForm = self.addRigArea.create() cmds.setParent( '..' ) cmds.formLayout( formOuter, e=1, af = [ (stdForm, 'left', 5), (stdForm, 'right', 5), (stdForm, 'top', 5), (rigForm, 'left', 5), (rigForm, 'right', 5), (followForm, 'left', 5), (followForm, 'right', 5), (addRigForm, 'left', 5), (addRigForm, 'right', 5), (addRigForm, 'bottom', 5) ], ac = [ (rigForm, 'top', 5, stdForm ), (followForm, 'top', 5, rigForm ), (addRigForm, 'top', 5, followForm )] ) cmds.window( Win_Global.winName, e=1, width = Win_Global.width, height= Win_Global.height ) cmds.showWindow( Win_Global.winName ) Win_Global.loadInfo()
def windowSHM(*args): if cmds.window("shdrmnWin", exists = 1): cmds.deleteUI("shdrmnWin") win = cmds.window("shdrmnWin", title = "Shader manager", w = 500, sizeable = 0) mainLayout = cmds.columnLayout (w = 500) cmds.rowColumnLayout(w = 500, nc = 4, parent = mainLayout ) cmds.textFieldGrp( 'getAiAttrField', text = 'mColor') cmds.button(label = "GET TX", w= 83, h = 50, c = getTextureFromShader ) cmds.button(label = "SHOW TX", w= 83, h = 50, c = assignPREVShader) cmds.button(label = "TILE UV", w= 83, h = 50, c = setTileUV) cmds.rowColumnLayout(w = 500, nc = 1, parent = mainLayout ) cmds.button(label = "DELETE PREVIEW", w= 500, h = 50, c = deleteShaders, parent = mainLayout ) cmds.separator(height=10, parent = mainLayout) cmds.rowColumnLayout(w = 500, nc = 2, parent = mainLayout ) cmds.button(label = "GET MATERIALS", w= 250, h = 50, c = getMaterial ) cmds.button(label = "ASSIGN MATERIALS", w= 250, h = 50, c = asignMaterial ) cmds.showWindow(win)
def setupRLUI(): if cmds.window("RLWin", exists=True): cmds.deleteUI("RLWin") widgets["win"] = cmds.window("RLWin", t="zbw_setupRL", w=200, h=400) widgets["mainCL"] = cmds.columnLayout(w=200) widgets["mainFrame"] = cmds.frameLayout(l="Create Render Layers", w=200, cll=True, bgc=(.2,.2,.2)) widgets["CarKey"] = cmds.checkBox(l="Car_Env", v=True) widgets["CarEnv"] = cmds.checkBox(l="Car_Key", v=True) widgets["BGKey"] = cmds.checkBox(l="BG_Env", v=True) widgets["BGEnv"] = cmds.checkBox(l="BG_Key", v=True) widgets["AO"] = cmds.checkBox(l="All_AO", v=True) widgets["MatteA"] = cmds.checkBox(l="All_MatteA", v=True) widgets["MatteB"] = cmds.checkBox(l="All_MatteB", v=True) widgets["MoVec"] = cmds.checkBox(l="All_MoVec", v=True) widgets["Shadow"] = cmds.checkBox(l="All_Shadow", v=True) widgets["createBut"] = cmds.button(l="Create Layers", w=200, h=40, bgc=(.6,.8,.6), c=createRL) cmds.text("NOTE: this is setting the overrides for \nthe moVec layer RG's and materials \n(if you have them in scene\n for the AO and Movec layers but \n NO passes are set up") cmds.separator(h=20, style = "double") #widgets["copyBut"] = cmds.button(l="Copy Selected Layer", w=200, h=40, bgc=(.8,.8,.6), c=copyRL) #cmds.separator(h=20, style = "double") widgets["importBut"] = cmds.button(l="Import RL Shaders File", w=200, h=40, bgc=(.8,.6,.6), c=importRL) cmds.showWindow(widgets["win"]) cmds.window(widgets["win"], e=True, w=200, h=400)
def create( self, *args ): if cmds.window( self.winName, ex=1 ): cmds.deleteUI( self.winName, wnd=1 ) cmds.window( self.winName, title= self.title, titleBarMenu=0 ) cmds.columnLayout() cmds.rowColumnLayout( nc=1, cw=[( 1,self.width-2)] ) cmds.text( l='Register ID', h=30 ) idField = cmds.textField( h=25 ) helpField = cmds.textField( en=0 ) cmds.setParent( '..' ) firstWidth = (self.width-2)*0.5 secondWidth = (self.width-2)-firstWidth cmds.rowColumnLayout( nc=2, cw=[(1,firstWidth),(2,secondWidth)]) cmds.button( l='Create', h=25, c=self.cmdCreate ) cmds.button( l='Cancel', h=25, c=self.cmdCancel ) cmds.setParent( '..' ) cmds.window( self.winName, e=1, width = self.width, height = self.height ) cmds.showWindow( self.winName ) self.idField = idField self.helpField = helpField
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 SetTitle(self,title): """ Initialised the windows and define the windows titles @type title: string @param title: the window title """ self.title=title self.winName= title.replace(" ","_").replace(".","_")+"_gui" # print winName # print cmds.window(winName, q=1, exists=1) res = cmds.window(self.winName, q=1, exists=1) # print res if bool(res): # print self.winName, " exist" cmds.deleteUI(self.winName, window=True) # print self.winName, " deleted" #chec for the dock one res = cmds.dockControl(self.winName, q=1, exists=1) # print res if bool(res): # print self.winName+"dock", " exist" cmds.deleteUI(self.winName, control=True) # print self.winName, " deleted" winName = cmds.window(self.winName, menuBar=True,title=title, w=self.w*self.scale,h=self.h*self.scale) print ("settitle ",winName, self.winName, winName==self.winName) self.winName = winName # cmds.window(self.winName,e=1,vis=True) print self.winName, " created"
def create_comment(self, *args): cmds.window('comment_win') cmds.columnLayout() cmds.text(l='Enter in new comment') self.new_comment_field = cmds.scrollField() add = cmds.button(l='Add', c=self.add_comment) cmds.showWindow('comment_win')
def secondaryUI(): sec_UIname = 'secondary' if cmds.window(sec_UIname,exists = True): cmds.deleteUI(sec_UIname) cmds.window(sec_UIname,title = 'rosa_secondary') clmLot = cmds.columnLayout( adjustableColumn=True) cmds.textField('ctrl_name',text = 'ctrl_name') cmds.button('createctrl',label = 'create ctrl',h = 30,c = 'ctrl()') cmds.button('load_model',label = 'load "org" model',c = 'load_org()') cmds.textField('org_model',text = '"org" model') cmds.button('load_property_obj',label = 'loading property add object',c = 'load_vis()') cmds.textField('vis',text = 'Visibility') # flLot = cmds.flowLayout(columnSpacing = 6) cmds.text(label = 'ctrl axial:') cmds.radioCollection() cmds.radioButton('follic',label = 'follic',select = 0) cmds.radioButton('Custom',label = 'Custom',select = 1) # cmds.setParent( clmLot) cmds.button(label = 'Generate',c = 'secondary_add()') cmds.button('add_ctrl',label = 'add controller',c = 'add_controller()') cmds.button('Add_modelSec',label = 'Add_modelSec',c = 'Add_modelSec()') cmds.button(label = 'inverse_connect',c = 'inverse_connect01()') # cmds.frameLayout( label='modify ctrl:',borderStyle='etchedOut') cmds.setParent( clmLot) cmds.button(label = 'loding want to modify the controller',c = 'load_ctrl()') cmds.textField('sec_ctrl',text = 'secondary_ctrl') cmds.button(label = 'modify the controller position',c = 'ctrl_modify()') cmds.button(label = 'complete controller modifies',c = 'modify_complete()') cmds.showWindow()
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 show(self): """ Build and show the dialog """ windowTitle = self.getWindowTitle( ) wnd = cmds.window( resizeToFitChildren=True, title= windowTitle, minimizeButton=False, maximizeButton=False, retain=False ) # build widgets topFormLayout = cmds.formLayout() topColumnLayout = cmds.columnLayout( rowSpacing=10 ) self.imageNameField = cmds.textFieldButtonGrp( label= maya.stringTable['y_adjustBackgroundImageWin.kImageName' ], fileName= "", editable= True, buttonLabel= maya.stringTable['y_adjustBackgroundImageWin.kLoad2' ], buttonCommand= self.onLoadImage, changeCommand = self.onImageFieldChange) self.adjustImageHPositionSlider = cmds.floatSliderGrp( label= maya.stringTable['y_adjustBackgroundImageWin.kHorizontalPosition' ], field= True, min= 0, max= 1000.0, precision= 2, value= 0, dragCommand = self.onAdjustImagePositionHorizontal, changeCommand= self.onAdjustImagePositionHorizontal ) self.adjustImageVPositionSlider = cmds.floatSliderGrp( label= maya.stringTable['y_adjustBackgroundImageWin.kVerticalPosition' ], field= True, min= 0, max= 1000.0, precision= 2, value= 0, dragCommand = self.onAdjustImagePositionVertical, changeCommand =self.onAdjustImagePositionVertical ) self.adjustImageScaleSlider = cmds.floatSliderGrp( label= maya.stringTable['y_adjustBackgroundImageWin.kScale' ], field= True, min= 0.1, max= 10.0, fieldMaxValue= 1000.0, precision= 2, value=0, dragCommand = self.onAdjustImageScale, changeCommand = self.onAdjustImageScale ) cmds.setParent( upLevel=True ) adjustImageFitToWidthButton = cmds.button( label = maya.stringTable['y_adjustBackgroundImageWin.kFitToWidth' ], command = self.onFitToWidth ) adjustImageFitToHeightButton = cmds.button( label= maya.stringTable['y_adjustBackgroundImageWin.kFitToHeight' ], command= self.onFitToHeight ) cmds.formLayout( topFormLayout, edit=True, attachForm = [ (topColumnLayout, 'left', 5), (topColumnLayout, 'top', 5), (topColumnLayout, 'right',5), (adjustImageFitToWidthButton, 'left',5), (adjustImageFitToHeightButton, 'right',5)], attachNone = [ (adjustImageFitToHeightButton,'bottom'), (topColumnLayout, 'bottom'), (adjustImageFitToWidthButton,'bottom')], attachControl =[ (adjustImageFitToWidthButton, 'top', 10,topColumnLayout), (adjustImageFitToHeightButton,'left',5,adjustImageFitToWidthButton), (adjustImageFitToHeightButton,'top',10,topColumnLayout)], attachPosition = [(adjustImageFitToWidthButton,'right',5,50)] ) self.update() self.activate( wnd ) cmds.showWindow( wnd )
def displayUI(self): RigGUI = 'autoRigging' if rig.window(RigGUI, exists=True): rig.deleteUI(RigGUI) rig.window(RigGUI, title=' 2009 AutoRig', menuBar=True, wh=(400, 500), minimizeButton=True, maximizeButton=True) #=============================================================================== # 开始菜单 #=============================================================================== rig.menu(label='File', tearOff=True) rig.menuItem(label='New') rig.menuItem(label='Open') rig.menuItem(label='Save') rig.menuItem(divider=True) rig.menuItem(label='Quit') rig.menu(label='Help', helpMenu=True) rig.menuItem('Application..."', label=u'帮助文档', c='from RIG.Help.helpUI import *;SK_helptUI()') self.tabs = rig.tabLayout(innerMarginWidth=5, innerMarginHeight=5) #=============================================================================== # 开始"AutoRiggingLayout" #=============================================================================== self.AutoRiggingLayout = rig.columnLayout(w=100, h=600, columnAlign='center') rig.button(label=u' 导入模版 ', w=322, c='SK_BodyJointPosition()') rig.separator(w=322, h=15, style='in') rig.setParent(self.AutoRiggingLayout) rig.intSliderGrp('fingerNumsField', field=True, label=u'手指个数:', minValue=0, maxValue=5, fieldMinValue=0, fieldMaxValue=100, value=5, columnAttach=[(1, 'left', 0), (2, 'left', 0), (3, 'both', 0)], columnWidth3=(55, 50, 222)) rig.intSliderGrp('toesNumsField', field=True, label=u'脚趾个数:', minValue=0, maxValue=5, fieldMinValue=0, fieldMaxValue=100, value=5, columnAttach=[(1, 'left', 0), (2, 'left', 0), (3, 'both', 0)], columnWidth3=(55, 50, 222)) rig.intSliderGrp('neckSegsField', field=True, label=u'脖子段数:', minValue=2, maxValue=5, fieldMinValue=2, fieldMaxValue=100, value=2, columnAttach=[(1, 'left', 0), (2, 'left', 0), (3, 'both', 0)], columnWidth3=(55, 50, 222)) rig.intSliderGrp('waistSegsField', field=True, label=u'腰部段数:', minValue=3, maxValue=10, fieldMinValue=4, fieldMaxValue=100, value=0, columnAttach=[(1, 'left', 0), (2, 'left', 0), (3, 'both', 0)], columnWidth3=(55, 50, 222)) rig.setParent(self.AutoRiggingLayout) rig.separator(w=322, h=15, style='in') rig.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 161), (2, 161)], columnAttach=(2, 'both', 0)) rig.button(label=u' 刷新模版 ', w=130, c='SK_refreshTemp()') rig.button(label=u' 镜像骨骼 ', w=130, c='orientAndMirrorJoint ()') rig.setParent(self.AutoRiggingLayout) rig.separator(w=322, h=15, style='in') rig.text(l=u'选择项目') #选择项目 rig.radioCollection() rig.rowColumnLayout(nc=3, columnWidth=[(1, 100), (2, 100), (3, 100)]) self.OrigenRB = rig.radioButton(label=u'初始版本', sl=1) self.WoodliesRB = rig.radioButton(label='Woodlies') self.WinxTVRB = rig.radioButton(label='WinxTV', vis=False) rig.setParent(self.AutoRiggingLayout) rig.button(label=u' 生成身体设置 ', w=322, h=40, c=lambda x: self.buildSetup()) rig.separator(w=322, h=15, style='in') rig.columnLayout('MeshListLayout') rig.textScrollList('meshList', w=322, h=100, allowMultiSelection=True, deleteKeyCommand='SK_delMeshList() ') rig.setParent(self.AutoRiggingLayout) rig.separator(w=322, h=15, style='in') rig.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 161), (2, 161)], columnAttach=(2, 'both', 0)) rig.button(label=u' 添加绑定模型 ', w=130, c='SK_addMeshList()') rig.button(label=u' 对绑定模型蒙皮 ', w=130, c='SK_rigSkin()') rig.setParent(self.AutoRiggingLayout) rig.separator(w=322, h=15, style='in') rig.button(l=u'IK<-->FK', w=322, h=40, c='SK_IKFKSwitchCommand()') rig.separator(w=322, h=15, style='in') rig.button(l=u'恢复初始POSE', w=322, h=40, c='SK_creatConDefaultPos(0)') rig.setParent(self.tabs) #=============================================================================== # 开始"assemblageLayout" #=============================================================================== self.assemblageLayout = rig.columnLayout(w=300, h=355) rig.text(u'1:->选择你要复制的部件2:->在下面的输入复制的数量\n3:->完成复制4:->完成镜像') rig.rowColumnLayout('skinningLayout', numberOfColumns=3, columnWidth=[(1, 109), (2, 109), (3, 109)], columnAttach=(2, 'both', 0)) rig.intField('numOfduplicate', min=1, max=100, value=1, step=1) rig.button(label=u' 完成复制 ', c='SK_duplicateJnt()') rig.button(label=u' 完成镜像 ', c='SK_mirrorDupJoint ()') rig.setParent('..') rig.separator(w=332, h=15, style='in') rig.setParent(self.tabs) #=============================================================================== # 开始"RiggingToolsLayout" #=============================================================================== self.RiggingToolsLayout = rig.columnLayout(w=300, h=355) #------------------------------------------------------------------------------ modelFL = rig.frameLayout(w=327, label=u"模型工具", borderStyle='in', cll=True, cl=True) rig.frameLayout(modelFL, edit=True, expandCommand="rig.frameLayout(\"" + modelFL + "\" ,edit=True,h=200)") rig.frameLayout(modelFL, edit=True, collapseCommand="rig.frameLayout(\"" + modelFL + "\" ,edit=True,h=20)") rig.columnLayout() rig.separator(w=312, h=5, style='in') rig.button( label=u' 打开模型工具窗口 ', w=312, c='from RIG.tools.modelTools.modelUI import *; SK_modelUI()') rig.setParent(self.RiggingToolsLayout) #------------------------------------------------------------------------------ simulationFL = rig.frameLayout(w=327, label=u"解算设置工具", borderStyle='in', cll=True, cl=True) rig.frameLayout(simulationFL, edit=True, expandCommand="rig.frameLayout(\"" + simulationFL + "\" ,edit=True,h=200)") rig.frameLayout(simulationFL, edit=True, collapseCommand="rig.frameLayout(\"" + simulationFL + "\" ,edit=True,h=20)") rig.columnLayout() rig.separator(w=312, h=5, style='in') rig.text(u'增加布料设置') rig.button( label=u' 打开布料设置窗口 ', w=312, c='from RIG.simulation.simulationUI import *; SK_simulationUI()') rig.separator(w=312, h=5, style='in') rig.text(u'增加动力学IK设置') rig.button( label=u' 打开动力学IK设置设置窗口 ', w=312, c='from RIG.tools.dynamicCurve.DC_dynamicCurveUI import *; SK_dynamicIKUI()' ) rig.separator(w=312, h=5, style='in') rig.text(u'导入导出头发Cache工具') rig.button( label=u' 打开头发Cache窗口 ', w=312, c='from RIG.tools.ImportExportHairCache.hairCacheUI import *; SK_HairCacheUI()' ) rig.setParent(self.RiggingToolsLayout) #------------------------------------------------------------------------------ fingerFL = rig.frameLayout(w=327, label=u"手指工具", borderStyle='in', cll=True, cl=True) rig.frameLayout(fingerFL, edit=True, expandCommand="rig.frameLayout(\"" + fingerFL + "\" ,edit=True,h=200)") rig.frameLayout(fingerFL, edit=True, collapseCommand="rig.frameLayout(\"" + fingerFL + "\" ,edit=True,h=20)") rig.scrollLayout() fingerMoLayout = rig.columnLayout() rig.separator(w=312, h=5, style='in') rig.text(u' 增加手指工具') rig.button(label=u' 打开窗口 ', w=312, c='SK_fingerAnimUI()') rig.setParent(self.RiggingToolsLayout) #------------------------------------------------------------------------------ resetFL = rig.frameLayout(w=327, label=u"恢复工具", borderStyle='in', cll=True, cl=True) rig.frameLayout(resetFL, edit=True, expandCommand="rig.frameLayout(\"" + resetFL + "\" ,edit=True,h=200)") rig.frameLayout(resetFL, edit=True, collapseCommand="rig.frameLayout(\"" + resetFL + "\" ,edit=True,h=20)") rig.scrollLayout() resetMoLayout = rig.columnLayout() rig.text(u"重新恢复到模版文件") rig.button(label=u' 恢复 ', w=312, c='SK_restoreJoint(True)') rig.setParent(self.RiggingToolsLayout) #------------------------------------------------------------------------------ curveFL = rig.frameLayout(w=327, label=u"曲线工具", borderStyle='in', cll=True, cl=True) rig.frameLayout(curveFL, edit=True, expandCommand="rig.frameLayout(\"" + curveFL + "\" ,edit=True,h=200)") rig.frameLayout(curveFL, edit=True, collapseCommand="rig.frameLayout(\"" + curveFL + "\" ,edit=True,h=20)") curveMoScr = rig.scrollLayout() rig.columnLayout() rig.text(u" 导入-导出控制器形状 ") rig.button( label=u' 打开窗口', w=312, c='from RIG.tools.importExputCurveShape import *\nSK_ImportExportUI().displayUI()' ) rig.separator(w=312, h=15, style='in') rig.text(u"镜像控制器形状") rig.rowColumnLayout('curveMirrorLayout', numberOfColumns=2, columnWidth=[(1, 156), (2, 156)], columnAttach=(2, 'both', 0)) rig.button(l=u'左 ——>右', c='SK_MirrorCurveControlCmd(1)') rig.button(l=u'右 ——>左', c='SK_MirrorCurveControlCmd(0)') rig.separator(w=312, h=15, style='in') rig.setParent('..') rig.text(u" 增加控制器到bodySet ") rig.button( label=u' 增加', w=312, c='from RIG.tools.addSet import *\nSK_AddToSet("bodySet",rig.ls(sl = True),True)' ) rig.separator(w=312, h=15, style='in') rig.setParent(self.RiggingToolsLayout) #------------------------------------------------------------------------------ extraFL = rig.frameLayout('extraFrame', w=327, label=u"附加工具", borderStyle='in', cll=True, cl=True) rig.frameLayout(extraFL, edit=True, expandCommand="rig.frameLayout(\"" + extraFL + "\" ,edit=True,h=300)") rig.frameLayout(extraFL, edit=True, collapseCommand="rig.frameLayout(\"" + extraFL + "\" ,edit=True,h=20)") rig.columnLayout() # 选择骨骼增加控制器 rig.text(u'为选择的骨骼添加控制器:') rig.button(label=u'确定', w=312, c='buildSKTOCON()') rig.separator(w=312, h=15, style='in') # 将软选择变形器转为CLUSTER rig.text(u'将softMod转为cluster:') rig.button(label=u'确定', w=312, c='softModToCluster()') rig.separator(w=312, h=15, style='in') rig.text(u'重设簇的形节点位置:') rig.button(label=u'确定', w=312, c='resetClusterPos()') rig.separator(w=312, h=15, style='in') rig.text(u'关闭场景中局部旋转轴向显示:') rig.button(label=u'确定', w=312, c='TL_CloseDisplayLocalAxis()') rig.separator(w=312, h=15, style='in') rig.text(u'创建线性IK:') rig.button( label=u'打开窗口', w=312, c='from RIG.tools.IKsplineTool.ikSpline import * \nIKSplineUI()') rig.setParent(self.RiggingToolsLayout) #------------------------------------------------------------------------------ skinFL = rig.frameLayout('skinTools', w=327, label=u"权重工具", borderStyle='in', cll=True, cl=True) rig.frameLayout(skinFL, edit=True, expandCommand="rig.frameLayout(\"" + skinFL + "\" ,edit=True,h=200)") rig.frameLayout(skinFL, edit=True, collapseCommand="rig.frameLayout(\"" + skinFL + "\" ,edit=True,h=20)") rig.columnLayout() rig.separator(w=312, h=5, style='in') rig.text(u' 将一个物体的权重拷给多个物体') rig.button( label=u' 确定 ', w=312, c='from RIG.tools.copyWeigths import *\nSK_copyWeightToOtherObj()') rig.separator(w=312, h=5, style='in') rig.text(u'检测是否有影响物体重叠') rig.button( label=u' 确定 ', w=312, c='from RIG.tools.detectInfluence import *\ndetectInfluenceObj()') rig.separator(w=312, h=5, style='in') rig.text(u'导入导出权重') rig.button( label=u' 打开工具窗口 ', w=312, c='from RIG.tools.IOWeights.IOWeightsUI import *\nSK_IOWeightsUI()' ) rig.setParent(self.RiggingToolsLayout) rig.setParent(self.tabs) #=============================================================================== # 开始"faceRiggingLayout" #=============================================================================== self.faceRiggingLayout = rig.columnLayout(w=300, h=355) rig.button(l=u'打开面部设置窗口', c='from RIG.face.faceUI import *\nOpenFaceUI()', w=325) rig.separator(w=325, h=5, style='in') rig.button(l=u'打开最新面部设置窗口', c='import RIG.WDface.WD_FaceUI as face;face.WD_SelectUI()', w=325) rig.separator(w=325, h=5, style='in') rig.text(u' 增加下颚设置') rig.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 162), (2, 162)]) rig.button(label=u' 确定 ', c='from RIG.tools.AddJawSetup import *\nSK_AddJawSetup()') rig.button( l=u'移除设置', c='from RIG.tools.AddJawSetup import *\nSK_removeJawSetup()') rig.setParent('..') rig.separator(w=325, h=5, style='in') rig.text(u' 增加眼睛设置') rig.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 108), (2, 108), (3, 108)], columnAttach=(3, 'both', 0)) rig.button( l=u'导入控制器', c='from RIG.tools.AddEyeSetup import SK_AddEyeSetup\nSK_AddEyeSetup(True)' ) rig.button( l=u'完成设置', c='from RIG.tools.AddEyeSetup import SK_AddEyeSetup\nSK_AddEyeSetup(False)' ) rig.button( l=u'移除设置', c='from RIG.tools.AddEyeSetup import SK_removeEyeSetup\nSK_removeEyeSetup()' ) rig.setParent(self.tabs) rig.tabLayout( self.tabs,edit=True,tabLabel=((self.AutoRiggingLayout,'AutoRigging'), (self.assemblageLayout,'assemblage'), (self.RiggingToolsLayout,'RiggingTools'),(self.faceRiggingLayout,'faceRigging')),\ selectTabIndex = self.getOptionVar(),changeCommand = lambda x = 0:self.setOptionVar()) rig.showWindow(RigGUI) rig.window(RigGUI, e=True, wh=(344, 680))
def customMayaMenu(): gMainWindow = mel.eval('$temp1=$gMainWindow') menus = cmds.window(gMainWindow, q=True, menuArray=True) found = False for menu in menus: label = cmds.menu(menu, q=True, label=True) if label == "Epic Games": found = True if found == False: customMenu = cmds.menu(parent=gMainWindow, label='Epic Games') #tools path toolsPath = cmds.internalVar(usd=True) + "mayaTools.txt" if os.path.exists(toolsPath): f = open(toolsPath, 'r') mayaToolsDir = f.readline() f.close() #ART cmds.menuItem(parent=customMenu, label="Animation Rigging Toolset", bld=True, enable=False) cmds.menuItem(parent=customMenu, divider=True) cmds.menuItem(parent=customMenu, label="Character Rig Creator", c=launchSkeletonBuilder) cmds.menuItem(parent=customMenu, label="Edit Existing Character", c=editCharacter) cmds.menuItem(parent=customMenu, label="Add Character For Animation", c=launchAddCharacter) cmds.menuItem(parent=customMenu, label="Animation Interface", c=launchAnimUI) cmds.menuItem(parent=customMenu, label="Settings", c=launchARTSettings) artHelp = cmds.menuItem(parent=customMenu, label="Help", subMenu=True) cmds.menuItem(parent=artHelp, label="Learning Videos", c=launchLearningVideos) cmds.menuItem(parent=artHelp, label="Help Documentation", c=launchRigHelp) cmds.menuItem(parent=artHelp, label="About", c=aboutARTTools) cmds.menuItem(parent=customMenu, divider=True) cmds.menuItem(parent=customMenu, label="Misc. Tools", bld=True, enable=False) cmds.menuItem(parent=customMenu, divider=True) #PERFORCE p4Menu = cmds.menuItem(parent=customMenu, label="Perforce", subMenu=True, to=True) cmds.menuItem("perforceSubmitMenuItem", parent=p4Menu, label="Submit Current File", enable=False, c=p4Submit) cmds.menuItem("perforceAddAndSubmitMenuItem", parent=p4Menu, label="Add and Submit Current File", enable=False, c=p4AddSubmit) cmds.menuItem("perforceCheckOutMenuItem", parent=p4Menu, label="Check Out Current File", enable=False, c=p4CheckOut) cmds.menuItem("perforceFileHistoryMenuItem", parent=p4Menu, label="Current File History", enable=False, c=p4GetHistory) cmds.menuItem("perforceGetLatestMenuItem", parent=p4Menu, label="Get Latest Revision of Current File", enable=False, c=p4GetLatest) cmds.menuItem("perforceProjectList", parent=p4Menu, label="Set Project", enable=False, subMenu=True) cmds.menuItem("perforceProject_New", parent="perforceProjectList", label="New Project", c=createNewProj) cmds.radioMenuItemCollection("perforceProjectRadioMenuCollection", parent="perforceProjectList") cmds.menuItem(parent=customMenu, divider=True) #check settings to see if use source control is turned on toolsPath = cmds.internalVar(usd=True) + "mayaTools.txt" if os.path.exists(toolsPath): f = open(toolsPath, 'r') mayaToolsDir = f.readline() f.close() settingsLocation = mayaToolsDir + "/General/Scripts/projectSettings.txt" if os.path.exists(settingsLocation): f = open(settingsLocation, 'r') settings = cPickle.load(f) f.close() #find use source control value sourceControl = settings.get("UseSourceControl") if sourceControl: cmds.menuItem("perforceSubmitMenuItem", edit=True, enable=True) cmds.menuItem("perforceAddAndSubmitMenuItem", edit=True, enable=True) cmds.menuItem("perforceCheckOutMenuItem", edit=True, enable=True) cmds.menuItem("perforceFileHistoryMenuItem", edit=True, enable=True) cmds.menuItem("perforceGetLatestMenuItem", edit=True, enable=True) cmds.menuItem("perforceProjectList", edit=True, enable=True) #launch script job for checking Maya Tools cmds.scriptJob(event=["NewSceneOpened", autoUpdateTools])
def setupScene(*args): cmds.currentUnit(time='ntsc') cmds.playbackOptions(min=0, max=100, animationStartTime=0, animationEndTime=100) cmds.currentTime(0) #check for skeleton builder or animation UIs if cmds.dockControl("skeletonBuilder_dock", exists=True): print "Custom Maya Menu: SetupScene" channelBox = cmds.formLayout("SkelBuilder_channelBoxFormLayout", q=True, childArray=True) if channelBox != None: channelBox = channelBox[0] #reparent the channelBox Layout back to maya's window cmds.control(channelBox, e=True, p="MainChannelsLayersLayout") channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm') channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm') #edit the channel box pane's attachment to the formLayout cmds.formLayout(channelBoxLayout, edit=True, af=[(channelBox, "left", 0), (channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl=(channelBox, "top", 0, channelBoxForm)) #print "deleting dock and window and shit" cmds.deleteUI("skeletonBuilder_dock") if cmds.window("SkelBuilder_window", exists=True): cmds.deleteUI("SkelBuilder_window") if cmds.dockControl("artAnimUIDock", exists=True): channelBox = cmds.formLayout("ART_cbFormLayout", q=True, childArray=True) if channelBox != None: channelBox = channelBox[0] #reparent the channelBox Layout back to maya's window cmds.control(channelBox, e=True, p="MainChannelsLayersLayout") channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm') channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm') #edit the channel box pane's attachment to the formLayout cmds.formLayout(channelBoxLayout, edit=True, af=[(channelBox, "left", 0), (channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl=(channelBox, "top", 0, channelBoxForm)) #print "deleting dock and window and shit" cmds.deleteUI("artAnimUIDock") if cmds.window("artAnimUI", exists=True): cmds.deleteUI("artAnimUI")
def editCharacter(*args): if cmds.window("artEditCharacterUI", exists=True): cmds.deleteUI("artEditCharacterUI") window = cmds.window("artEditCharacterUI", w=300, h=400, title="Edit Character", mxb=False, mnb=False, sizeable=False) mainLayout = cmds.columnLayout(w=300, h=400, rs=5, co=["both", 5]) #banner image toolsPath = cmds.internalVar(usd=True) + "mayaTools.txt" if os.path.exists(toolsPath): f = open(toolsPath, 'r') mayaToolsDir = f.readline() f.close() cmds.image(w=300, h=50, image=mayaToolsDir + "/General/Icons/ART/artBanner300px.bmp", parent=mainLayout) cmds.text(label="", h=1, parent=mainLayout) optionMenu = cmds.optionMenu("artProjOptionMenu", label="Project:", w=290, h=40, cc=getProjCharacters, parent=mainLayout) textScrollList = cmds.textScrollList("artProjCharacterList", w=290, h=300, parent=mainLayout) button = cmds.button( w=290, h=40, label="Edit Export File", c=editSelectedCharacter, ann= "Edit the character's skeleton settings, joint positions, or skin weights.", parent=mainLayout) button2 = cmds.button( w=290, h=40, label="Edit Rig File", c=editSelectedCharacterRig, ann= "Edit the character's control rig that will be referenced in by animation.", parent=mainLayout) cmds.text(label="", h=1) cmds.showWindow(window) getProjects() getProjCharacters()
def FSrenamerUI(): ''' Create UI Window ''' # Size Parameters windowWidth = 540 windowHeight = 300 paddingFrameSize = 116 materialSize = 80 colorSize = 80 positionSize = 50 nameSize = 200 paddingSize = 50 extensionSize =50 spacingSize = 7 searchSize = 80 searchInputSize = 300 prefixSize = 80 prefixInputSize = 150 frameLayoutMargin = 10 namespaceButtonSize = 200 #Color frame_bgc = [0.18, 0.18, 0.18] # Parameters Lists materialList = ['concrete', 'stone','paint','metal','wood','plastic','rubber','cloth','glass','ceramic','skin','hair','nail','bone','liquid','polysterene','leather','default','paper','felt','light','plant'] materialList.sort() colorList = ['Grey','Black','White','Yellow','Red','Green','Blue','Orange','Purple','Brown','Pink','Colour','Clear','Mixed'] colorList.sort() positionList = ['C','R', 'L', 'F', 'B', 'FR','BR','FL','BL'] extensionList = ['GEP','GES','GED','GEV','PLY','NRB','CRV','GRP','LOC'] # Window Creation if (cmds.window("FSRenamer_window", exists=True)): cmds.deleteUI("FSRenamer_window") window = cmds.window("FSRenamer_window", title= __title__+ ' ' +__version__, iconName='FSRenamer', width=windowWidth, height=windowHeight, sizeable=False) cmds.columnLayout( adjustableColumn=True ) ''' Search and Replace ''' cmds.frameLayout(label="Search and Replace", collapsable=True, collapse=True, marginWidth=frameLayoutMargin, bgc=frame_bgc) cmds.separator( height=5, style='none' ) cmds.rowLayout(numberOfColumns=2) cmds.text(label='Search For :', width=searchSize, align='right') cmds.textField('searchFor_textField', width=searchInputSize) cmds.setParent(upLevel=True) cmds.rowLayout(numberOfColumns=2) cmds.text(label='Replace with :', width=searchSize, align='right') cmds.textField('replaceWith_textField', width=searchInputSize) cmds.setParent(upLevel=True) cmds.rowLayout(numberOfColumns=4) cmds.separator(width=searchSize, style=None) cmds.radioCollection('searchAndReplaceOptions_radioCollection') cmds.radioButton('hierarchy_radioButton' ,label='Hierarchy', sl=True) cmds.radioButton('selected_radioButton' ,label='Selected') cmds.radioButton('all_radioButton' ,label='All') cmds.setParent(upLevel=True) cmds.button('searchAndReplace_button', label='Replace', height=30, command=searchAndReplace) cmds.separator( height=10, style='none' ) cmds.setParent(upLevel=True) ''' Prefix and Suffix ''' cmds.frameLayout(label="Prefix and Suffix", collapsable=True, collapse=True, marginWidth=frameLayoutMargin, bgc=frame_bgc) cmds.separator( height=5, style='none' ) cmds.rowLayout(numberOfColumns=3) cmds.text(label='Prefix :', width=prefixSize, align='center') cmds.textField('addPrefix_textField', width=prefixInputSize) cmds.button('addPrefix_button', width=prefixSize, label='Add Prefix', command=partial(addPrefixSuffix, 'prefix')) cmds.setParent(upLevel=True) cmds.rowLayout(numberOfColumns=3) cmds.text(label='Suffix :', width=prefixSize, align='center') cmds.textField('addSuffix_textField', width=prefixInputSize) cmds.button('addSuffix_button', width=prefixSize, label='Add Suffix', command=partial(addPrefixSuffix, 'suffix')) cmds.setParent(upLevel=True) #cmds.checkBox('keepNamespacePrefix_checkbox', l='Keep Namespaces', v=0) cmds.separator( height=10, style='none' ) cmds.setParent(upLevel=True) ''' Namespaces Utilities ''' cmds.frameLayout(label="Namespace Utilities", collapsable=True, collapse=True, marginWidth=frameLayoutMargin, bgc=frame_bgc) cmds.separator( height=5, style='none' ) cmds.rowLayout(numberOfColumns=2) cmds.columnLayout(rowSpacing=5) cmds.textScrollList('namespaces_list',allowMultiSelection=True, height=150, width=360) displayNamespacesList() cmds.setParent(upLevel=True) cmds.columnLayout(rowSpacing=5) cmds.button('removeSelectedNamespaces_button', label='Remove Selected Namespaces', width=namespaceButtonSize, command=removeSelectedNamespaces) cmds.button('removeAllNamespaces_button', label='Remove All Namespaces', width=namespaceButtonSize, command=removeAllNamespaces) cmds.separator(height=20, style='none') cmds.button('refreshNamespaces_button', label="Refresh", width=namespaceButtonSize, command=refreshNamespacesListTrigger) cmds.setParent(upLevel=True) cmds.setParent(upLevel=True) cmds.separator( height=5, style='none' ) cmds.setParent(upLevel=True) ''' Lettering and numbering ''' cmds.frameLayout(label="Padding", collapsable=True, collapse=False, marginWidth=frameLayoutMargin, bgc=frame_bgc) cmds.separator( height=5, style='none' ) cmds.rowLayout(numberOfColumns=4) cmds.separator(width=paddingFrameSize*2, style='none' ) cmds.text(label='Number of Digits', width=paddingFrameSize, align='center') cmds.text(label='Start Value (Offset)', width=paddingFrameSize, align='center') cmds.setParent(upLevel=True) cmds.rowLayout(numberOfColumns=4) cmds.radioCollection('numbersOrLetters_radioCollection') cmds.radioButton('numbers_radioButton' ,label='Numbers', width=paddingFrameSize, sl=True , onc=toggleNumberOfDigits) cmds.radioButton('letters_radioButton', label='Letters' , width=paddingFrameSize, onc=toggleNumberOfDigits) cmds.intField('paddingField', minValue=1, maxValue=10, value=4 , step=1, width=paddingFrameSize) cmds.intField('paddingStartField', minValue=1, step=1, value=1, width=paddingFrameSize) cmds.setParent(upLevel=True) cmds.separator( height=5, style='none' ) cmds.setParent(upLevel=True) ''' Renaming input fields ''' cmds.frameLayout(label="Renaming Input Fields", collapsable=True, collapse=False, marginWidth=frameLayoutMargin, bgc=frame_bgc) cmds.separator( height=10, style='none' ) # Titles cmds.rowLayout(numberOfColumns=9) cmds.text(label="Material", align='center', width=materialSize) cmds.text(label="Color", align='center', width=colorSize) cmds.separator(style='none', width=spacingSize) cmds.text(label="Position", align='center', width=positionSize) cmds.separator(style='none', width=spacingSize) cmds.text(label="Name", align='center', width=nameSize) cmds.text(label="Padding", align='center', width=paddingSize) cmds.separator(style='none', width=spacingSize) cmds.text(label="Extension", align='center', width=extensionSize) cmds.setParent(upLevel=True) # Input fields cmds.rowLayout(numberOfColumns=9) cmds.optionMenu('materialMenu', width=materialSize) for m in materialList: cmds.menuItem( label=m ) cmds.optionMenu('colorMenu', width=colorSize) for c in colorList: cmds.menuItem( label=c ) cmds.text(label="_", align='center') cmds.optionMenu('positionMenu', width=positionSize) for p in positionList: cmds.menuItem( label=p ) cmds.text(label="_", align='center') cmds.textField('nameField', width=nameSize) cmds.text(label="# # # #", align='center', width=paddingSize) cmds.text(label="_", align='center') cmds.optionMenu('extensionMenu', width=extensionSize) for e in extensionList: cmds.menuItem( label=e ) cmds.setParent(upLevel=True) # Group Naming Template, Keep Namespace switch cmds.checkBox('keepNamespace_checkbox', l='Keep Namespaces', v=0) cmds.checkBox('groupNaming_checkbox', l='Group Naming Template', v=0, onc=enableGroupRename, ofc=disableGroupRename) cmds.checkBox('disablePadding_checkbox', l='Disable Padding For Single Group', v=1, en=0) cmds.separator( height=10, style='none' ) cmds.setParent(upLevel=True) ''' Buttons ''' cmds.separator( height=10, style='none' ) cmds.button( 'renameButton', label = 'Rename Selection', height=50, command=renameSelection ) cmds.separator( height=20, style='double' ) cmds.button( label='Close', height=30, command=('cmds.deleteUI(\"' + window + '\", window=True)') ) cmds.setParent(upLevel=True) cmds.window(window, e=True, width=windowWidth, height=windowHeight) cmds.showWindow( window )
def renameProgressBar(numberOfObj): progressBarWindow = cmds.window('progressBar_window', title='FS Renamer Progression') cmds.columnLayout() cmds.progressBar('renameProgress_progressBar',minValue=0, maxValue=numberOfObj, width=300, height=40) cmds.showWindow(progressBarWindow)
def close_progressbar(): if cmds.window(obj.progressBar_name, exists = True): cmds.deleteUI(obj.progressBar_name)
cmds.parent(grp_jnt, structure.GetJoint()) cmds.parent(sphere, structure.GetControl()) StickObjectToMesh(vtxObject, sphere[0]) cmds.connectAttr('%s.translate' % sphere[0], '%s.translate' % joint) cmds.connectAttr('%s.rotate' % sphere[0], '%s.rotate' % joint) cmds.connectAttr('%s.scale' % sphere[0], '%s.scale' % joint) #********************* Setup Window ************************************************ window = "" if cmds.window(window, exists=True): cmds.deleteUI(window) window = cmds.window(title="Setup stick Ctrls", iconName='Stick Ctrls', widthHeight=(300, 100), sizeable=False) cmds.columnLayout(adj=True) cmds.separator(h=10) cmds.text('Sticky Ctrls by Ronin Garay V1.') cmds.separator(h=10) radiusText = cmds.textFieldGrp(l='Ctrl Radius: ', ed=True) cmds.button(label='Create Ctrls', command='stickyCtrl()') cmds.button(label='Close', command=('cmds.deleteUI(\"' + window + '\", window=True)')) cmds.setParent('..')
def create_ui(): # NEED TO REFACTOR if cmds.window(obj.main_window_name, exists = True): cmds.deleteUI(obj.main_window_name) obj.close_progressbar() cmds.window(obj.main_window_name, title = obj.main_window_label, mxb = False, s = True) cmds.window(obj.main_window_name, e = True, rtf = True, wh = (10, 10), cc = "obj.close_progressbar()") cmds.columnLayout(obj.UI_layout, rs = 4, adj = True) # Translate layout cmds.frameLayout(obj.T_layout_name, l = obj.TL_label, cll = 1, bgc = obj.frame_color_1, parent = obj.UI_layout, cc = ('obj.resize_UI()')) cmds.floatSliderGrp(obj.T_sliderSmooth_name, l = obj.smooth_label, f = True, cc = ('obj.T_print_smooth()'), pre = obj.precision, w = obj.sl_Width, ann = obj.goal_smooth_ann, cal = (1, "left"), cw3 = (45, 50, 10) ) cmds.floatSliderGrp(obj.T_sliderScale_name, l = obj.scale_label, f = True, cc = ('obj.T_print_scale()'), pre = obj.precision, w = obj.sl_Width, ann = obj.time_scale_ann, cal = (1, "left"), cw3 = (45, 50, 10) ) cmds.floatSliderGrp(obj.T_sliderWeight_name, l = obj.weight_label, f = True, cc = ('obj.T_print_weight()'), pre = obj.precision, w = obj.sl_Width, ann = obj.goal_weight_annn, cal = (1, "left"), cw3 = (45, 50, 10) ) cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [(1, obj.rW1), (2, obj.rW2), (3, obj.rW3)]) cmds.button(label = obj.reset_button_label, command = ('obj.reset_translation_sliders()'), bgc = obj.yellow_button, h = obj.slider_height, ann = obj.T_reset_ann) cmds.separator(h = obj.slider_height / 1.25, style = 'none') #cmds.button(label = obj.TB_run_label, command = ('obj.translate_simulation()'), cmds.button(label = obj.TB_run_label, command = ('obj.run_simulation(obj.prefix_base_layer[1])'), bgc = obj.green_button, h = obj.slider_height) # Rotate layout cmds.frameLayout(obj.R_layout_name, l = obj.RL_label, cll = 1, bgc = obj.frame_color_1, parent = obj.UI_layout, cc = ('obj.resize_UI()')) cmds.floatSliderGrp(obj.R_sliderSmooth_name, l = obj.smooth_label, f = True, cc = ('obj.R_print_smooth()'), pre = obj.precision, w = obj.sl_Width, ann = obj.goal_smooth_ann, cal = (1, "left"), cw3 = (45, 50, 10) ) cmds.floatSliderGrp(obj.R_sliderScale_name, l = obj.scale_label, f = True, cc = ('obj.R_print_scale()'), pre = obj.precision, w = obj.sl_Width, ann = obj.time_scale_ann, cal = (1, "left"), cw3 = (45, 50, 10) ) cmds.floatSliderGrp(obj.R_sliderWeight_name, l = obj.weight_label, f = True, cc = ('obj.R_print_weight()'), pre = obj.precision, w = obj.sl_Width, ann = obj.goal_weight_annn, cal = (1, "left"), cw3 = (45, 50, 10) ) cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [(1, obj.rW1), (2, obj.rW2), (3, obj.rW3)]) cmds.button(label = obj.reset_button_label, command = ('obj.reset_rotation_sliders()'), bgc = obj.yellow_button, h = obj.slider_height, ann = obj.R_reset_ann) cmds.separator(h = obj.slider_height / 1.25, style = 'none') cmds.button(label = obj.RB_run_label, #command = ('obj.rotate_simulation()'), command = ('obj.run_simulation(obj.prefix_base_layer[2])'), bgc = obj.green_button, h = obj.slider_height) # Checkbox layout cmds.frameLayout(obj.CH1_layout_name, l = obj.CH1_label, cll = 1, bgc = obj.frame_color_1, p = obj.UI_layout, cc = ('obj.resize_UI()')) ## Надо решить columns_count1 = 3 cWraw1 = obj.window_width / columns_count1 cellOffset1 = 10 cHeight1 = obj.slider_height / 1.3 ## Надо решить cmds.rowColumnLayout(numberOfColumns = columns_count1, columnWidth = [ (1, cWraw1), (2, cWraw1 - cellOffset1), (3, cWraw1 + cellOffset1)]) cmds.separator(h = obj.slider_height / 4, style = 'none') cmds.separator(style = 'none') cmds.separator(style = 'none') ## Cell #1 ## ## Reset button ## cmds.button(label = obj.reset_button_label, command = ('obj.reset_checkboxes()'), bgc = obj.yellow_button, h = cHeight1, ann = obj.CH1_reset_ann) ## Cell #2 ## ## Aim reverse #1 ## cmds.checkBox(obj.aimReverse_checkbox_name, label = obj.Aim_reverse_label, cc = ('obj.print_check_vector()'), bgc = (obj.Bg1, obj.Bg1, obj.Bg1), ann = obj.aim_reverse_ann) ## Cell #3 ## ## Cycle #2 ## cmds.checkBox(obj.cycle_checkbox_name, label = obj.Cycle_checkbox_label, h = cHeight1, cc = ('obj.print_check_cycle()'), bgc = (obj.Bg1, obj.Bg1, obj.Bg1), ann = obj.cycle_checkbox_ann) ## Cell #4 ## ## Empty ## cmds.separator(style = 'none') ## Надо решить ## Cell #5 ## ## Checkbox #3 ## cmds.checkBox("test_checkbox_5", label = "", v = False, en = False, cc = ('print "Hello TEST!!!"'), h = cHeight1, bgc = (obj.Bg1, obj.Bg1, obj.Bg1), ann = "Work in progress") ## Надо решить ## Cell #6 ## ## Hierarchy mode #4 ## cmds.checkBox(obj.hierarchy_checkbox_name, label = "Hierarchy mode", h = cHeight1, cc = ('obj.print_hierarchy_mode()'), bgc = (obj.Bg1, obj.Bg1, obj.Bg1), ann = "Work in progress") ## Надо решить # Button layout cmds.frameLayout(obj.B1_layout_name, l = obj.B1_label, cll = 1, bgc = obj.frame_color_1, parent = obj.UI_layout, cc = ('obj.resize_UI()')) ## Надо решить columns_count2 = 5 cWraw2 = obj.window_width / columns_count2 ## Надо решить cmds.rowColumnLayout(numberOfColumns = columns_count2, columnWidth = [ (1, cWraw2), (2, cWraw2), (3, cWraw2), (4, cWraw2), (5, cWraw2)], p = obj.B1_layout_name) ## Cell #1 ## cmds.button(label = obj.resetAll_button_label, command = ('obj.reset_all()'), bgc = obj.yellow_button, h = obj.slider_height, ann = obj.resetAll_ann) ## Cell #2 ## cmds.button(label = "", command = ('print "button 2"'), en = False, h = obj.slider_height, ann = "") ## Cell #3 ## cmds.button(label = obj.delete_label, command = ('obj.delete_overlappy_layer()'), bgc = obj.red_button, h = obj.slider_height, ann = obj.delete_ann) ## Cell #4 ## cmds.button(label = "", command = ('print "some command"'), en = False, h = obj.slider_height, ann = "") ## Cell #5 ## cmds.button(label = obj.move_label, command = ('obj.move_layers_to_safe()'), en = True, bgc = obj.blue_button, h = obj.slider_height, ann = obj.move_ann) ## Cell #6 ## cmds.button(label = "", command = ('print "some command"'), en = False, h = obj.slider_height, ann = "") ## Cell #7 ## cmds.button(label = "", command = ('print "some command"'), en = False, h = obj.slider_height, ann = "") ## Cell #8 ## cmds.button(label = "", command = ('print "some command"'), en = False, h = obj.slider_height, ann = "") ## Cell #9 ## cmds.button(label = "", command = ('print "some command"'), en = False, h = obj.slider_height, ann = "") ## Cell #10 ## cmds.button(label = "HIERARCHY", command = ('obj.SelectTransformHierarchy()'), en = True, h = obj.slider_height, ann = "Select transform hierarchy (without shapes)") # About layout cmds.columnLayout(obj.about_layout_name, rs = 4, adj = True, parent = obj.UI_layout, bgc = obj.end_color_1) cmds.frameLayout(l = obj.about_label, cll = 1, bgc = obj.frame_color_2, cl = 1, p = obj.about_layout_name, cc = ('obj.resize_UI()')) cmds.text(obj.aboutText[0], h = 20) cmds.text(obj.aboutText[1], hl = True, h = 20, bgc = obj.link_color_1) cmds.text(obj.aboutText[2], hl = True, h = 20, bgc = obj.link_color_1) cmds.text(obj.aboutText[3], hl = True, h = 20, bgc = obj.link_color_2) cmds.text(obj.aboutText[4], hl = True, h = 20, bgc = obj.link_color_2) cmds.showWindow(obj.main_window_name)
def cancelCallback(*pArgs): if cmds.window(windowID,exists = True): cmds.deleteUI(windowID)
def resize_UI(): cmds.window(obj.main_window_name, e = True, wh = (10, 10), rtf = True)
def __init__(cls): if cmds.window(cls.winName, exists=True): cmds.deleteUI(cls.winName) cls.ui()
# cmds.ls(sl=True,type='joint') to prevent the case that joints and non joints are both selected sel=cmds.ls(sl=True) if len(sel)!=1: cmds.warning('Please select only 1 joint.') else: # 2. To check the selected joint has a parent joint if not cmds.listRelatives(sel[0],p=True): cmds.warning('The joint selected has no parent. Please select another one') else: # 3. Generate a UI that asks the name and number of twist joints if cmds.window('joint_twist_UI', exists = True): cmds.deleteUI('joint_twist_UI') else: cmds.window('joint_twist_UI') cmds.window('joint_twist_UI',e=True,w=350,h=100) cmds.showWindow('joint_twist_UI') cmds.columnLayout('main_cl') cmds.rowColumnLayout('text_rcl',nc=2) cmds.text(label='Name:') # This prints out a label cmds.textField('name_textField') # This is to create a typing field cmds.text(label='# of Joints') cmds.intField('joint_num_intField',value = 1,minValue=1) # When the Create Joints is pressed, the create_joints def will be called.
def build_gui_help_path_manager(self): ''' Creates the Help GUI for GT Path Manager ''' window_name = "build_gui_help_path_manager" if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True) cmds.window(window_name, title=script_name + " Help", mnb=False, mxb=False, s=True) cmds.window(window_name, e=True, s=True, wh=[1, 1]) main_column = cmds.columnLayout(p=window_name) # Title Text cmds.separator(h=12, style='none') # Empty Space cmds.rowColumnLayout(nc=1, cw=[(1, 310)], cs=[(1, 10)], p=main_column) # Window Size Adjustment cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column) # Title Column cmds.text(script_name + " Help", bgc=[.4, .4, .4], fn="boldLabelFont", align="center") cmds.separator(h=10, style='none', p=main_column) # Empty Space # Body ==================== cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column) # cmds.text(l='Script for managing paths', align="center") # cmds.separator(h=15, style='none') # Empty Space cmds.text( l= 'This script displays a list with the name, type and path\n of any common nodes found in Maya.', align="center") cmds.separator(h=10, style='none') # Empty Space cmds.text( l= 'You can select the node listed by clicking on it or \nchange its name or path by double clicking the cell.', align="center") cmds.separator(h=10, style='none') # Empty Space cmds.text( l= 'The icon on the left describes the validity of the path.\nIf the file or directory is found in the system it shows\n a green confirm icon otherwise it shows a red icon.', align="center") cmds.separator(h=10, style='none') # Empty Space cmds.text(l='Auto Path Repair', align="center", font='boldLabelFont') cmds.text( l= 'This function walks through the folders under the\nprovided directory looking for missing files. \nIf it finds a match, the path is updated.', align="center") cmds.separator(h=10, style='none') # Empty Space cmds.text(l='Search and Replace', align="center", font='boldLabelFont') cmds.text( l= 'This function allows you to search and replace strings\nin the listed paths.', align="center") cmds.separator(h=10, style='none') # Empty Space cmds.text(l='Refresh', align="center", font='boldLabelFont') cmds.text( l='Re-populates the list while re-checking for path validity.', align="center") cmds.separator(h=10, style='none') # Empty Space cmds.text(l='Search Path', align="center", font='boldLabelFont') cmds.text(l='A directory path used when looking for missing files.', align="center") cmds.separator(h=15, style='none') # Empty Space cmds.rowColumnLayout(nc=2, cw=[(1, 140), (2, 140)], cs=[(1, 10), (2, 0)], p=main_column) cmds.text('Guilherme Trevisan ') cmds.text( l= '<a href="mailto:[email protected]">[email protected]</a>', hl=True, highlightColor=[1, 1, 1]) cmds.rowColumnLayout(nc=2, cw=[(1, 140), (2, 140)], cs=[(1, 10), (2, 0)], p=main_column) cmds.separator(h=10, style='none') # Empty Space cmds.text(l='<a href="https://github.com/TrevisanGMW">Github</a>', hl=True, highlightColor=[1, 1, 1]) cmds.separator(h=7, style='none') # Empty Space # Close Button cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column) cmds.separator(h=5, style='none') cmds.button(l='OK', h=30, c=lambda args: close_help_gui()) cmds.separator(h=8, style='none') # Show and Lock Window cmds.showWindow(window_name) cmds.window(window_name, e=True, s=False) # Set Window Icon qw = omui.MQtUtil.findWindow(window_name) widget = wrapInstance(long(qw), QtWidgets.QWidget) icon = QtGui.QIcon(':/question.png') widget.setWindowIcon(icon) def close_help_gui(): ''' Closes Help UI in case it's opened. ''' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True)
def ui(cls): cmds.window(cls.winName, title='Correct Shape', menuBar=True) cls.widgets['createMenu'] = cmds.menu(label='Create', tearOff=True, p=cls.winName) cls.widgets['addBsMenuItem'] = cmds.menuItem( label='Add Blend Shape Node', c=Functions.addBsNode) cls.widgets['editMenu'] = cmds.menu(label='Edit', tearOff=True, p=cls.winName) cls.widgets['selBsMenuItem'] = cmds.menuItem( label='Select Blend Shape Node', c=Functions.selBsNode) cls.widgets['helpMenu'] = cmds.menu(label='Help', tearOff=True, p=cls.winName) cls.widgets['mainColLo'] = cmds.columnLayout(adj=True) cmds.separator(h=5, p=cls.widgets['mainColLo']) cls.widgets['geoRowColLo'] = cmds.rowColumnLayout(numberOfColumns=3) cmds.text(label='Geometry: ', p=cls.widgets['geoRowColLo']) cls.widgets['geoTxtFld'] = cmds.textField(p=cls.widgets['geoRowColLo']) cmds.button(label='<<', p=cls.widgets['geoRowColLo'], c=Functions.loadGeoBS) cls.widgets['bsNodeRowColLo'] = cmds.rowColumnLayout( numberOfColumns=2, p=cls.widgets['mainColLo']) cmds.text(label='Blend Shape Node: ', p=cls.widgets['bsNodeRowColLo']) cls.widgets['bsNodeOptMenu'] = cmds.optionMenu( cc=Functions.populateCorrectiveTrgList, p=cls.widgets['bsNodeRowColLo']) cmds.separator(h=10, style='in', p=cls.widgets['mainColLo']) cls.widgets['correctiveTrgNameRowColLo'] = cmds.rowColumnLayout( numberOfColumns=4, columnSpacing=[(3, 30)], p=cls.widgets['mainColLo']) cmds.text(label='New Corrective: ', p=cls.widgets['correctiveTrgNameRowColLo']) cls.widgets['correctiveTrgNameTxtFld'] = cmds.textField( p=cls.widgets['correctiveTrgNameRowColLo']) cls.widgets['scltBtnRowColLo'] = cmds.rowColumnLayout( numberOfColumns=2, columnWidth=[(1, 205), (2, 205)], columnSpacing=[(2, 5)], p=cls.widgets['mainColLo']) cls.widgets['sculptBtn'] = cmds.button( label='Sculpt', p=cls.widgets['scltBtnRowColLo'], c=Functions.sculptMode) cls.widgets['cancelBtn'] = cmds.button( label='Cancel', p=cls.widgets['scltBtnRowColLo'], c=Functions.cancelSculpt, enable=False) cls.widgets['createBtn'] = cmds.button( label='Create', h=40, p=cls.widgets['mainColLo'], c=Functions.createCorrectiveTarget, enable=False) cmds.separator(h=5, style='none', p=cls.widgets['mainColLo']) cls.widgets['correctiveTrgFrmLo'] = cmds.frameLayout( label='Corrective List', collapsable=True, p=cls.widgets['mainColLo']) cls.widgets['correctiveTrgColLo'] = cmds.columnLayout( adj=True, p=cls.widgets['correctiveTrgFrmLo']) cls.widgets['correctiveTrgTxtScrList'] = cmds.textScrollList( allowMultiSelection=True, sc=Functions.selBsNode, p=cls.widgets['correctiveTrgColLo']) cmds.popupMenu() cmds.menuItem(label='Refresh List', c=Functions.populateCorrectiveTrgList) cls.widgets['popMenuRename'] = cmds.menuItem(label='Rename', c=Functions.rename) cls.widgets['popMenuBreak'] = cmds.menuItem(label='Delete Key', c=Functions.delKey) cls.widgets['popMenuRmv'] = cmds.menuItem(label='Remove', c=Functions.removeTrg) cls.widgets['slderRowColLo'] = cmds.rowColumnLayout( numberOfColumns=2, columnWidth=[(1, 370)], p=cls.widgets['correctiveTrgColLo']) cls.widgets['trgFltSldrGrp'] = cmds.floatSliderGrp( field=True, columnWidth=[(1, 30)], min=0.00, max=1.00, step=0.01, dc=Functions.trgSldrDragCmd, cc=Functions.trgSldrDragCmd, enable=True, p=cls.widgets['slderRowColLo']) cmds.symbolButton(image='setKeyframe.png', c=Functions.setKey, p=cls.widgets['slderRowColLo']) cmds.window(cls.winName, e=True, w=400, h=300) cmds.showWindow(cls.winName)
def build_gui_search_replace_path_manager(self): ''' Creates the GUI for Searching and Replacing Paths ''' window_name = "build_gui_search_replace_path_manager" if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True) cmds.window(window_name, title='Search and Replace', mnb=False, mxb=False, s=True) cmds.window(window_name, e=True, s=True, wh=[1, 1]) main_column = cmds.columnLayout(p=window_name) # Body cmds.separator(h=12, style='none') # Empty Space cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column) cmds.text(l='This will search and replace strings in your paths', align="center") cmds.separator(h=12, style='none') # Empty Space cmds.rowColumnLayout(nc=1, cw=[(1, 310)], cs=[(1, 10)], p=main_column) # Window Size Adjustment cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column) # Title Column cmds.text('Search for:', bgc=[.4, .4, .4], fn="boldLabelFont", align="center") search_txtfield = cmds.textField(placeholderText='Type search here') cmds.separator(h=10, style='none') # Empty Space cmds.text('Replace with:', bgc=[.4, .4, .4], fn="boldLabelFont", align="center") replace_txtfield = cmds.textField(placeholderText='Type replace here') # Close Button cmds.separator(h=5, style='none') cmds.rowColumnLayout(nc=2, cw=[(1, 148), (2, 148)], cs=[(1, 10), (2, 4)], p=main_column) # Apply Button cmds.button(l='Search and Replace', h=30, c=lambda args: apply_search_replace()) #cmds.separator(h=10, style='none') cmds.button(l='Cancel', h=30, c=lambda args: close_snr_gui()) cmds.separator(h=8, style='none') # Show and Lock Window cmds.showWindow(window_name) cmds.window(window_name, e=True, s=False) # Set Window Icon qw = omui.MQtUtil.findWindow(window_name) widget = wrapInstance(long(qw), QtWidgets.QWidget) icon = QtGui.QIcon(':/search.png') widget.setWindowIcon(icon) def apply_search_replace(): ''' Runs Search and Replace Function ''' self.search_string = cmds.textField(search_txtfield, q=True, text=True) self.replace_string = cmds.textField(replace_txtfield, q=True, text=True) if self.search_string != '': try: gt_path_manager_dialog.show() except: pass self.refresh_table(is_search_replace=True) if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True) else: cmds.warning('"Search for" string can\'t be empty.') def close_snr_gui(): ''' Closes Search and Replace GUI in case it's opened. ''' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True)
''' 09/10/18 RdMAutoSpine v1.0 By Esteban Rodriguez www.renderdemartes.com [email protected] import RdMAutoSpine reload (RdMAutoSpine) ''' from maya import cmds if cmds.window("AutoSpine", exists=True): cmds.deleteUI("AutoSpine") ###JOINTS LOCATORS def LocatorsBtn(*args): jointsNum = cmds.intSliderGrp(locatorNum, q=True, value=5) for X in range(jointsNum): cmds.select(clear=True) cmds.CreateLocator() cmds.move(0, 2.5 * X, 0) cmds.select(clear=True)
def buildUi(self): self.wind = cmds.window( self.winName, title='Matrix collision setup | PaulWinex | v2.0', widthHeight=[390, 270]) cmds.columnLayout(adjustableColumn=True) cmds.frameLayout(label='Naming') self.elementName = cmds.textFieldGrp(label='Element Name') self.sideNameMenu = cmds.optionMenuGrp(label='Side', columnWidth=(2, 180)) for k in '', 'center', 'left', 'right', 'lower', 'upper': cmds.menuItem(label=k) cmds.setParent('..') cmds.frameLayout(label='Orient collision plane to') cmds.rowLayout(numberOfColumns=4) cmds.columnLayout() collection1 = cmds.radioCollection() self.rbMeshNormal = cmds.radioButton(label='Mesh Normal', sl=1) self.rbRigControl = cmds.radioButton(label='Rig Control') cmds.setParent('..') cmds.columnLayout() self.fromCamera = cmds.radioButton(label='From Camera') self.ontocamera = cmds.radioButton(label='Onto Camera') cmds.setParent('..') cmds.columnLayout() self.rbX = cmds.radioButton(label='X') self.rbY = cmds.radioButton(label='Y') self.rbZ = cmds.radioButton(label='Z') cmds.setParent('..') cmds.columnLayout() self.rbXn = cmds.radioButton(label='-X') self.rbYn = cmds.radioButton(label='-Y') self.rbZn = cmds.radioButton(label='-Z') cmds.setParent('..') cmds.setParent('..') cmds.frameLayout(label='Source Objects') cmds.rowLayout(numberOfColumns=3, columnWidth3=(90, 75, 40), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)]) cmds.text('Rig Control') self.text2 = cmds.textField(editable=0) self.set2 = cmds.button(label='set', c=partial(self.setObject, 2)) cmds.setParent('..') cmds.rowLayout(numberOfColumns=3, columnWidth3=(90, 75, 40), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)]) cmds.text('Collision Mesh') self.text3 = cmds.textField(editable=0) self.set3 = cmds.button(label='set', c=partial(self.setObject, 3)) cmds.setParent('..') cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) self.export = cmds.button(label='Do setup', c=self.doSetup)
def close_snr_gui(): ''' Closes Search and Replace GUI in case it's opened. ''' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True)
def TreeWindow(): if mc.window('TreeGeneratorUI', exists=True): mc.deleteUI('TreeGeneratorUI') window = mc.window("TreeGeneratorUI", title='L System Tree', widthHeight=(200, 400), sizeable=0, minimizeButton=0, maximizeButton=0) mc.columnLayout() mc.text(label="Number of branches (2-15): ") branchesText = mc.intField(minValue=2, value=9, maxValue=15) #branchNum = mc.intField(branchesText, query = True, value = True) mc.text(label="Branch Angle (0-90): ") angleText = mc.intField(minValue=0, value=35, maxValue=90) #angle = mc.intField(angleText, query = True, value = True) mc.text(label="Angle Variance (0-50)") angleVarianceText = mc.intField(minValue=0, value=6, maxValue=50) #angleVariance = mc.intField(angleVarianceText, query = True, value = True) mc.text(label="Length Decay (0-100): ") lengthFactorText = mc.intField(minValue=0, value=85, maxValue=100) #lengthFactor = mc.intField(lengthFactorText, query = True, value = True) mc.text(label="Length Variance (0-100): ") lengthVarianceText = mc.intField(minValue=0, value=15, maxValue=100) #lengthVariance = mc.intField(lengthVarianceText, query = True, value = True) mc.text(label="Radius Decay (0-100): ") radiusFactorText = mc.intField(minValue=0, value=90, maxValue=100) #radiusFactor = mc.intField(radiusFactorText, query = True, value = True) mc.text(label="Radius Variance(0-100): ") radiusVarianceText = mc.intField(minValue=0, value=10, maxValue=100) #radiusVariance = mc.intField(radiusVarianceText, query = True, value = True) mc.text(label="initial radius (0-2) ") initialRadiusText = mc.floatField(minValue=0, value=0.2, maxValue=2) #initialRadius = mc.floatField(initialRadiusText, query = True, value = True) mc.text(label="initial length (0-100): ") initialLengthText = mc.intField(minValue=0, value=20, maxValue=100) #initialLength = mc.intField(initialLengthText, query = True, value = True) mc.button(label="Draw Tree", command=lambda *args: drawTree( branchesText, angleText, angleVarianceText, lengthFactorText, lengthVarianceText, radiusFactorText, radiusVarianceText, initialRadiusText, initialLengthText), width=100, height=30) mc.button(label="Reset Parameter", command=lambda *args: Reset(branchesText, angleText, angleVarianceText, lengthFactorText, lengthVarianceText, radiusFactorText, radiusVarianceText, initialRadiusText, initialLengthText), width=100, height=30)
def close_help_gui(): ''' Closes Help UI in case it's opened. ''' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, 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, 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 __init__(self): self.winName = 'pw_matrixCollisonUI' if cmds.window(self.winName, q=1, ex=1): cmds.deleteUI(self.winName) self.buildUi() self.element = ''
def setUp(self): cmds.setParent(None, menu=1) self.win = cmds.window()
import maya.cmds as cmds import os import json import playblast reload(playblast) """ uasage from rigDoodle import ui reload(ui) x = ui.UI() x.loadInMaya() """ #- initialize window if cmds.window('playblastUI', ex=True): cmds.deleteUI('playblastUI') class UI: def __init__(self): """ initializing ui """ configJson = "config.json" basedir = os.path.dirname(os.path.realpath(__file__)) self.configFile = os.path.join(basedir, configJson) cmds.window('playblastUI', menuBar=True, width=500, title='Beaver House Playblast')
def __init__(cls): if cmds.window(cls.uiWdgDic['winName'], exists=True): cmds.deleteUI(cls.uiWdgDic['winName']) cls.ui()
for i in ctrl: ctrlShape = cmds.listRelatives(i, s=True) for shape in ctrlShape: conDispLayer = cmds.listConnections('{}.drawOverride'.format(shape)) shapeDrawOverride = '{}|{}.drawOverride'.format(longCtrl[0],shape) if cmds.connectionInfo(shapeDrawOverride, id=True): conDispLayerDrawInfo = '{}.drawInfo'.format(conDispLayer[0]) cmds.disconnectAttr(conDispLayerDrawInfo, shapeDrawOverride) cmds.setAttr('{}|{}'.format(longCtrl[0],shape) + ".overrideEnabled", 1) cmds.setAttr('{}|{}'.format(longCtrl[0],shape) + ".overrideColor", Color) wv = 25 winID = 'setNurbOverrideColorPanel' # Create Window with buttons for each color override if cmds.window(winID, exists=True): cmds.deleteUI(winID) cmds.window(winID, title='Override NURB Color') cmds.columnLayout(adjustableColumn=True, rowSpacing=5, width=200) cmds.frameLayout(label='NURBS Colours', labelAlign='top') cmds.rowColumnLayout(numberOfRows=1) cmds.button(label='', ann='black', width=wv, command=partial(setNurbOverrideColor, 1), bgc=(0, 0, 0)) cmds.button(label='', ann='dark grey', width=wv, command=partial(setNurbOverrideColor, 2), bgc=(.2, .2, .2)) cmds.button(label='', ann='light grey', width=wv, command=partial(setNurbOverrideColor, 3), bgc=(.6, .6, .6)) cmds.button(label='', ann='white', width=wv, command=partial(setNurbOverrideColor, 16), bgc=(.9, .9, .9)) cmds.button(label='', ann='dark green', width=wv, command=partial(setNurbOverrideColor, 7), bgc=(.3, .6, .3)) cmds.button(label='', ann='soft green', width=wv, command=partial(setNurbOverrideColor, 23), bgc=(.4, .7, .4)) cmds.button(label='', ann='lime green', width=wv, command=partial(setNurbOverrideColor, 26), bgc=(.6, .8, .4))
#Define function used to run maya commands with Python - mc import maya.cmds as mc ##OAT - Object Alignment Tool #Instructions: first select source, then target #This declares variable objAligner string = objAligner #This prevents the duplication of our window if mc.window(objAligner, ex=True): mc.deleteUI(objAligner, window=True) #Create a window for the object aligner that is not resizeable objAligner = mc.window(title="Object Alignment Tool", s=False, wh=(300, 100)) #Create an adjustable column layout mc.columnLayout(adj=True) #Instructions mc.text(l="Instructions: select source, then target") #Add a button to our window mc.button(l="Go Aligner Go!", w=300, h=100, c="aligner()") #Show the window mc.showWindow(objAligner) #This creates a function (named "aligner()") that runs a series of code def aligner(): #This creates a parent constraint with no offset prtCns = mc.parentConstraint() #This removes the parent constraint mc.delete(prtCns)
def initUI(self): # check for open Window first winName = windowTitle if cmds.window(winName, exists=1): cmds.deleteUI(winName, wnd=True) self.setObjectName(windowObject) self.setWindowTitle(windowTitle) self.setWindowFlags(QtCore.Qt.Tool) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setMinimumWidth(350) self.setMinimumHeight(100) # self.setGeometry(690, 335, 350, 150) self.setLayout(QtWidgets.QVBoxLayout()) self.layout().setContentsMargins(2, 2, 2, 2) self.layout().setSpacing(10) self.layout().setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignHCenter) labelLayout = QtWidgets.QVBoxLayout() labelLayout.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignHCenter) sliderLayout = QtWidgets.QHBoxLayout() sliderLayout.setContentsMargins(8, 5, 8, 5) sliderLayout.setSpacing(5) buttonsLayout = QtWidgets.QHBoxLayout() buttonsLayout.setContentsMargins(10, 10, 10, 10) buttonsLayout.setSpacing(10) self.layout().addLayout(labelLayout) verticalSpacer = QtWidgets.QSpacerItem(15, 15, QtWidgets.QSizePolicy.Minimum) verticalSpacer2 = QtWidgets.QSpacerItem(5, 5, QtWidgets.QSizePolicy.Maximum) self.layout().addItem(verticalSpacer) self.layout().addLayout(sliderLayout) self.layout().addItem(verticalSpacer2) self.layout().addLayout(buttonsLayout) self.topLabel = QtWidgets.QLabel( '< Use this slider to set the opacity amount >') self.topLabel.setContentsMargins(0, 10, 0, 0) self.zeroLabel = QtWidgets.QLabel('0 -') self.slider = QtWidgets.QSlider() self.slider.setOrientation(QtCore.Qt.Orientation.Horizontal) self.slider.setRange(0, 100) self.slider.setFixedHeight(22) self.hundredLabel = QtWidgets.QLabel('- 100') self.CloseBtn = QtWidgets.QPushButton('Close') self.ResetBtn = QtWidgets.QPushButton('Reset') labelLayout.addWidget(self.topLabel) sliderLayout.addWidget(self.zeroLabel) sliderLayout.addWidget(self.slider) sliderLayout.addWidget(self.hundredLabel) buttonsLayout.addWidget(self.CloseBtn) buttonsLayout.addWidget(self.ResetBtn) self.slider.setValue(100) #---------------------------------------------------------------------------------# self.CloseBtn.clicked.connect(self.closeNOW) self.ResetBtn.clicked.connect(lambda: self.slider.setValue(100)) self.slider.valueChanged.connect( lambda: self.windowOpacity(self.slider.value()))
def __enter__(self): ''' Initialize the UI ''' if mc.window(self.name, exists=True): mc.deleteUI(self.name) mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu) if self.menu: self.createMenu() self.form = mc.formLayout() self.column = mc.columnLayout(adj=True) mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2, columnAlign2=('right','left'), columnAttach=[(1, 'both', 0), (2, 'both', 8)] ) #if we can find an icon, use that, otherwise do the text version if self.icon: mc.iconTextStaticLabel(style='iconOnly', image1=self.icon) else: mc.text(label=' _ _ |\n| | | |') if not self.menu: mc.popupMenu(button=1) mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name))) mc.text(label=self.info) mc.setParent('..') mc.separator(height=8, style='single') return self