def InitWindow( self ): self._window = cmds.window( self.windowID, title = 'FBX Exporter', sizeable=False, resizeToFitChildren=True ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1,self.Layout.CLWIDTH), (2,self.Layout.CLWIDTH), (3,self.Layout.CLWIDTH)], \ rowSpacing=[(1,self.Layout.SPACING), (2,self.Layout.SPACING), (3,self.Layout.SPACING)] ) cmds.text( label='Export current scene' ) cmds.separator(visible=False) cmds.separator(visible=False) cmds.button( 'Export All', width=self.Layout.BWIDTH, command=self.button_ExportAll_pressed ) cmds.button( 'Export Selected', width=self.Layout.BWIDTH, command=self.button_ExportSelected_pressed ) cmds.button( 'Open Current Scene', width=self.Layout.BWIDTH, command=self.button_OpenCurrentScene_pressed ) cmds.text( label='Batch export' ) cmds.separator(visible=False) cmds.separator(visible=False) cmds.button( 'Add Folder', width=self.Layout.BWIDTH, command=self.button_AddFolder_pressed ) cmds.button( 'Export All Files', width=self.Layout.BWIDTH, command=self.button_ExportAllFiles_pressed ) cmds.button( 'Delete Selected', width=self.Layout.BWIDTH, command=self.button_DeleteSelected_pressed ) cmds.separator() cmds.separator() cmds.separator() cmds.setParent( '..' ) cmds.rowColumnLayout( numberOfColumns=1, columnWidth=(1,3*self.Layout.CLWIDTH) ) cmds.progressBar('ProgressBar', width=3*self.Layout.BWIDTH ) cmds.textScrollList( 'scrollList', allowMultiSelection=False) cmds.setParent( '..' ) cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1,self.Layout.CLWIDTH), (2,self.Layout.CLWIDTH), (3,self.Layout.CLWIDTH)], \ rowSpacing=[(1,self.Layout.SPACING), (2,self.Layout.SPACING), (3,self.Layout.SPACING)] ) cmds.separator() cmds.separator() cmds.separator() cmds.separator(visible=False) cmds.separator(visible=False) cmds.button( 'Close', width=self.Layout.BWIDTH, command=self.button_Close_pressed )
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 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 j_MirrorBlendShape(): ''' UI ''' global text1 global text2 global text3 j_MainWindow = "" if (mc.window(j_MainWindow, exists = 1 )): mc.deleteUI(j_MainWindow) j_MainWindow = mc.window(title = u"镜像表情", wh = (300,160)) mc.columnLayout() mc.text(l = "") text1 = mc.textFieldButtonGrp( l = u"BaseObject:", buttonLabel = u" < < < < ", buttonCommand = 'xanthus.j_MirrorBlendShape.j_getObj(1)', cw3 = (90,120,100),h = 30) text2 = mc.textFieldButtonGrp(l = u"In-Between:", buttonLabel = u" < < < < ", buttonCommand = "xanthus.j_MirrorBlendShape.j_getObj(2)", cw3 = (90,120,100),h = 30,enable = 0) text3 = mc.textFieldButtonGrp(l = u"BlendShape:", buttonLabel = u" < < < < ", buttonCommand = "xanthus.j_MirrorBlendShape.j_getObj(3)", cw3 = (90,120,100),h = 30) mc.text(l = "",h = 10) mc.setParent('..') mc.rowLayout(nc = 2 ,cw2= (150,150),ct2 = ("left","left") ,co2 = (8,0) ) mc.button(l = u" 镜 像 ", w = 135, h= 30,c = "xanthus.j_MirrorBlendShape.j_MakeMirror()") mc.button(l = u" 重 置 ", w = 135, h= 30,c = "xanthus.j_MirrorBlendShape.j_Reset()") mc.setParent('..') mc.columnLayout mc.text(l = " copyright@ xanthus by Jiangjishi ", enable = 0) mc.showWindow(j_MainWindow)
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 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 doIt( self, arglist ): wnd = cmds.window( "kgmEngineWindow_" + str(time.time()), widthHeight = ( 200, 200 ) ) #cmds.columnLayout( adjustableColumn = True ) #cmds.button( label = 'Export Map', command = kgmEngine.exportMap ) #cmds.button( label = 'Export Mesh', command = kgmEngine.exportMesh ) #cmds.button( label = 'Export Skeleton', command = kgmEngine.exportSkeleton ) #cmds.button( label = 'Export Animation', command = kgmEngine.exportAnimation ) #cmds.button( label = 'Insert Node', command = kgmEngine.insertNode ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns = 2 ) cmds.checkBox( "Mesh", label="Mesh", value=False, onCommand=kgmEngine.enableMesh, offCommand=kgmEngine.enableMesh ) cmds.checkBox( "Material", label="Material", value=False, onCommand=kgmEngine.enableMaterial, offCommand=kgmEngine.enableMaterial ) cmds.checkBox( "Skeleton", label="Skeleton", value=False, onCommand=kgmEngine.enableSkeleton, offCommand=kgmEngine.enableSkeleton ) cmds.checkBox( "Animation", label="Animation", value=False, onCommand=kgmEngine.enableAnimation, offCommand=kgmEngine.enableAnimation ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns = 2 ) cmds.columnLayout( adjustableColumn=True ) cmds.button( label = 'Export', command = kgmEngine.export ) cmds.button( label = 'Insert Node', command = kgmEngine.insertNode ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns = 3 ) cmds.columnLayout( adjustableColumn=True ) cmds.radioCollection() cmds.radioButton( label='Bin', align='left', select=False ) cmds.radioButton( label='Xml', align='left', select=True ) #cmds.radioButtonGrp( label='Format', labelArray3=['Bin', 'Txt', 'Xml'], numberOfRadioButtons=3 ) #cmds.radioButton( 'Format', label='Bin', ) cmds.showWindow( wnd )
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 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 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 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 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 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 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 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 __init__(self) : # get the currently selected objects and make sure we have only one object selected = OM.MSelectionList() OM.MGlobal.getActiveSelectionList(selected) self.selectedObjects = [] selected.getSelectionStrings(self.selectedObjects) if len(self.selectedObjects) == 0 : cmds.confirmDialog( title='No objects Selected', message='Select a Mesh Object', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok' ) elif len(self.selectedObjects) > 1 : cmds.confirmDialog( title='Select One Object', message='Only One Mesh mat be exported at a time', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok' ) # now we have the correct criteria we can proceed with the export else : # get the start and end values for our UI sliders anim=OMA.MAnimControl() minTime=anim.minTime() maxTime=anim.maxTime() self.m_start=int(minTime.value()) self.m_end=int(maxTime.value()) # now we create a window ready to populate the components self.m_window = cmds.window( title='NCCA Pointbake Export' ) # create a layout cmds.columnLayout() # create two sliders for start and end we also attach methods to be called when the slider # changes self.m_startSlider=cmds.intSliderGrp( changeCommand=self.startChanged,field=True, label='Start Frame', minValue=self.m_start, maxValue=self.m_end, fieldMinValue=self.m_start, fieldMaxValue=self.m_end, value=self.m_start ) self.m_endSlider=cmds.intSliderGrp( changeCommand=self.endChanged ,field=True, label='End Frame', minValue=self.m_start, maxValue=self.m_end, fieldMinValue=self.m_end, fieldMaxValue=self.m_end, value=self.m_end ) # create a button and add the method called when pressed cmds.button( label='Export', command=self.export ) # finally show the window cmds.showWindow( self.m_window )
def snapOnClosestVertex_window(): """ Creates the 'Snap On Closest Vertex' vertex window. """ cmds.windowPref(enableAll=False) if (cmds.window("snapOnClosestVertex_window", exists=True)): cmds.deleteUI("snapOnClosestVertex_window") cmds.window("snapOnClosestVertex_window", title="Snap On Closest Vertex", width=320) spacing = 5 cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing) cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)]) cmds.text(label="Reference Object:") referenceObject_textField = cmds.textField("referenceObject_textField") cmds.button("getReferenceObject_button", label="Get Reference Object!", command=getReferenceObject_button_OnClicked) cmds.setParent(topLevel=True) cmds.separator(style="single") cmds.button("snapIt_button", label="Snap It!", al="center", command=snapIt_button_OnClicked) cmds.showWindow("snapOnClosestVertex_window") cmds.windowPref(enableAll=True)
def seqGUI(parent): frm = cmds.frameLayout( label="Sequence", cll=True, w=winWidth-5, collapseCommand=Callback(winExpand, -70), expandCommand=Callback(winExpand, 70)) frmCol = cmds.columnLayout(rs=3) cmds.checkBox( "mecRenSeqCB", label="On\Off", v=1) rowCol = cmds.rowColumnLayout("mecRenSeqRC", nc=2, cw=[[1,winWidth/2],[2,winWidth/2]], co=[[1,"right",5]]) ''' Older version. Used Callback instead with a function that will enable or disable any gui component. cmds.checkBox( "mecRenSeqCB", e=True, onc='%s.cmds.rowColumnLayout("mecRenSeqRC", e=True, en=True)' %scriptName) cmds.checkBox( "mecRenSeqCB", e=True, ofc='%s.cmds.rowColumnLayout("mecRenSeqRC", e=True, en=False)' %scriptName) ''' cmds.checkBox( "mecRenSeqCB", e=True, onc=Callback(enGUI,"rowColumnLayout", "mecRenSeqRC", 1 ) ) cmds.checkBox( "mecRenSeqCB", e=True, ofc=Callback(enGUI,"rowColumnLayout", "mecRenSeqRC", 0 )) cmds.textScrollList( "mecRenSeqTSL", h=40, ams=True ) cmds.setParent(rowCol) subCol = cmds.columnLayout() rowWidth = winWidth/2 cmds.rowColumnLayout(nc=2, w=rowWidth, cw=[[1,(rowWidth-70)], [2,60]]) cmds.textField("mecRenSeqName", w=rowWidth-70 ) cmds.button(label="Add", c=Callback(addTSL, "mecRenSeqTSL")) cmds.setParent(subCol) cmds.rowColumnLayout(nc=2, w=rowWidth, cw=[[1,rowWidth/2],[2,rowWidth/2-10]]) cmds.button(label="Rem All", c=Callback(remAllTSL, "mecRenSeqTSL")) cmds.button(label="Rem Sel", c=Callback(remSelTSL, "mecRenSeqTSL")) cmds.setParent(parent)
def main(): mc.python('from kmAnimImpExp import *') if mc.window( 'AnimImpExpUI', exists=True ): mc.deleteUI('AnimImpExpUI') WinName = mc.window( 'AnimImpExpUI', title='Anim Import/Export with select', iconName='AnimImpExpUI', width=100, height=200, menuBar=True ) mc.menu( label='Menu', tearOff=False ) mc.menuItem( label='Reload',command='from kmAnimImpExp import *;main()') mc.menuItem( divider=True ) mc.menuItem( label='Quit' ) mc.columnLayout(adj=True) mc.button(label='Import Anim',command='kmAnimImp()') mc.button(label='Export Anim',command='kmAnimExp()') mc.setParent('..') #columnLayout mc.showWindow(WinName)
def _showUI(self): if cmds.window(self.win, exists=True): cmds.deleteUI(self.win, window=True) cmds.window(self.win, title=self.win, widthHeight=(400, 220)) cmds.columnLayout('uicl_audioMain',adjustableColumn=True) cmds.separator(h=15, style='none') cmds.text(l='Select Audio to Offset') cmds.separator(h=15, style='in') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)]) cmds.button(label='<< Offset', ann='Nudge selected Audio Backwards', command=partial(self.offsetSelectedBy,'negative')) cmds.floatField('AudioOffsetBy', value=10) cmds.button(label='Offset >>', ann='Nudge selected Audio Forwards', command=partial(self.offsetSelectedBy,'positive')) cmds.setParent('..') cmds.separator(h=15, style='in') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)]) cmds.button(label='Offset Range to Start at:', ann='offset the selected range of audionodes such that they start at the given frame', command=self.offsetSelectedTo) cmds.floatField('AudioOffsetToo', value=10) cmds.setParent('..') cmds.separator(h=15, style='in') cmds.button(label='Ripple selected', ann="Ripple offset the selected audio nodes so they're timed one after another", command=self.offsetRipple) cmds.separator(h=15, style='none') cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp', c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200) cmds.showWindow(self.win) cmds.window(self.win, e=True, widthHeight=(290, 190))
def ZvParentMaster(posX=56, posY=180, width=_defaultSize[0], height=_defaultSize[1]): '''Main UI.''' winName = 'ZvParentMasterWin' if cmds.window(winName, exists=True): cmds.deleteUI(winName, window=True) cmds.window(winName, title='ZV', tlb=True) cmds.columnLayout(adj=True, rs=0, bgc=(0.3, 0.3, 0.3)) #### PULSANTI #### cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=_pmpath + 'pm_attach.xpm', c='%s.attach()' % __name__, ann='Attach objects') cmds.popupMenu(mm=True) cmds.menuItem(l='Create parent groups - translation', c='%s.createParentGroups(True, False)' % __name__, rp='NE') cmds.menuItem(l='Create parent groups - available attrs', c='%s.createParentGroups()' % __name__, rp='E') cmds.menuItem(l='Create parent groups - rotation', c='%s.createParentGroups(False, True)' % __name__, rp='SE') cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=_pmpath + 'pm_detach.xpm', c='%s.detach()' % __name__, ann='Detach objects') cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=_pmpath + 'pm_destroy.xpm', c='%s.destroy()' % __name__, ann='Destroy constraints') cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=_pmpath + 'pm_fixsnap.xpm', c='%s.fixSnap()' % __name__, ann='Fix snap') cmds.popupMenu(mm=True) cmds.menuItem(l='Fix snaps in the active range', c='%s.fixSnap(True)' % __name__, rp='E') cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=_pmpath + 'pm_select.xpm', c='%s.selectConstraintNodes()' % __name__, ann='Select constraints and snap groups') cmds.iconTextButton(style='iconOnly', h=34, bgc=(0.3, 0.3, 0.3), image=_pmpath + 'pm_timeline.xpm', c='%s.timeline()' % __name__, ann='Constraint timeline') cmds.popupMenu(mm=True) cmds.menuItem(l='<- Prev', c='%s.navigate(-1)' % __name__, rp='W') cmds.menuItem(l='Next ->', c='%s.navigate(1)' % __name__, rp='E') cmds.setParent('..') cmds.showWindow(winName) cmds.window(winName, edit=True, widthHeight=(width, height), topLeftCorner=(posY, posX)) sys.stdout.write('ZV Parent Master %s http://www.paolodominici.com [email protected]\n' % __version__)
def displayUI(self): windowName = 'LCMTUIWindow' if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) window = cmds.window(windowName, menuBar = True,t="LCMT v3.1.1") fileMenu = cmds.menu( label='Manage Light Types') cmds.menuItem( label='Add More Light Types',command=lambda *args:self.addLightTypes()) cmds.menuItem( label='See Current Light Types', command=lambda *args:self.displayLightTypes()) cmds.menuItem( label='Reset Light Types to Default Values', command=lambda *args:self.resetLightTypesToDefault()) cmds.paneLayout( configuration='vertical2' ) lightStageColumn = cmds.columnLayout(adjustableColumn=True) cmds.text('Lights in the SCENE') lights = cmds.ls(dag =True,visible=True,lights=True, type='mentalrayIblShape') lightList = cmds.iconTextScrollList(allowMultiSelection=True, append=lights) cmds.rowLayout(numberOfColumns = 2) useGroupLights = cmds.checkBox( label='Group Lights', onCommand = lambda *args: self.updateScollList(True, lightList), offCommand = lambda *args: self.updateScollList(False, lightList)) cmds.checkBox( label='Save Images?', cc = lambda *args: self.toggleSaveImages()) cmds.setParent('..') cmds.iconTextScrollList(lightList,edit=True,selectCommand=lambda *args: cmds.select(self.getElementsFromLightScrollList(lightList,useGroupLights),vis=True)) cmds.button(label='Render Lights!', command = lambda *args: self.renderAllLights(self.getElementsFromLightScrollList(lightList,useGroupLights),cmds.checkBox(useGroupLights, query=True, value=True))) cmds.setParent('..') renderLayersColumn = cmds.columnLayout(adjustableColumn=True) #new column cmds.text('Geometry in the SCENE') geometry = cmds.ls(geometry=True) #take out the ibl shapes from the geo selection geometry = list(set(geometry) - set(lights)) geoList = cmds.iconTextScrollList(allowMultiSelection=True, append=geometry,selectCommand=lambda *args: cmds.select(cmds.iconTextScrollList(geoList, query=True, si=True )) ) cmds.text('Create Render Layers from selected geometry and lights') cmds.button(label='Create Render Layers!', command = lambda *args: self.createLayersFromLights(cmds.iconTextScrollList(geoList, query=True, si=True ),self.getElementsFromLightScrollList(lightList,useGroupLights))) cmds.setParent('..') cmds.showWindow()
def __init__(self): if cmds.window('ms_info_window', query=True, exists=True): cmds.deleteUI('ms_info_window') window = cmds.window('ms_info_window', title='About Mayaseed', sizeable=False) cmds.columnLayout(rs=10, columnOffset=['both', 20], width=600) cmds.rowLayout(numberOfColumns=2) cmds.text('', width=30) cmds.image(image=os.path.join(ROOT_DIRECTORY, 'graphics', 'mayaseed.png')) cmds.setParent('..') cmds.text('Version ' + MAYASEED_VERSION) cmds.text('Mayaseed is a Maya plugin for exporting scenes to the appleseed renderer.') cmds.text('Written by Jonathan Topf.') cmds.rowLayout(numberOfColumns=4) cmds.button(label='Mayaseed website', command=('import webbrowser\nwebbrowser.open_new_tab("' + MAYASEED_URL + '")')) cmds.button(label='appleseed website', command=('import webbrowser\nwebbrowser.open_new_tab("' + APPLESEED_URL + '")')) cmds.text('', width=166) cmds.button(label='Close', command=('import maya.cmds as cmds\ncmds.deleteUI(\"' + window + '\", window=True)'), width=100) cmds.setParent('..') cmds.text('') cmds.setParent('..') cmds.showWindow(window)
def writeObj(self, file_name, progress = False, show_msg = True, scale = mcore.scene_scale()): all_parts = self.parts() part_num = len(all_parts) if progress: window = mc.window(t = 'Writing %s to obj' % self.set_name) mc.columnLayout() progressControl = mc.progressBar(maxValue = part_num, width = 300) mc.showWindow(window) f = open(file_name, 'w') vo = 1 vto = 1 vno = 1 for i in range(len(all_parts)): part = all_parts[i] # part.toObjStream(f, group = part.name(reformat = True), v_offset = vo, vt_offset = vto, vn_offset = vno, show_msg = not progress) part.toObjStream(f, group = part.partName(), v_offset = vo, vt_offset = vto, vn_offset = vno, show_msg = not progress, scale = scale) vo += part.numPoints() vto += part.numUVs() vno += part.numNormals() if progress: mc.progressBar(progressControl, edit=True, step=1) f.close() if progress: mc.deleteUI(window) if show_msg: print "Write %s to obj done." % self.set_name return True
def AverageUI(self): import maya.cmds as cmds import maya.mel as mel import sys if cmds.window('AverageTool',exists=True): cmds.deleteUI('AverageTool') cmds.window('AverageTool') grid=cmds.gridLayout( numberOfColumns=2, cellWidthHeight=(120, 150) ) column=cmds.columnLayout() cmds.button('Creat',c='creat()',h=100) cmds.button('Key',c='key()',h=50) cmds.columnLayout(column,edit=1,columnAttach=('both',0),adj=1,co=('both',50),columnWidth=120) cmds.setParent(column) cmds.setParent( '..' ) cmds.frameLayout( label='Average', borderStyle='in' ) cmds.columnLayout() cmds.rowLayout( numberOfColumns=3, columnWidth3=(35, 30, 35), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] ) cmds.intField('min',minValue=0,value=0) cmds.text('To') cmds.intField('max',minValue=0, value=0) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.frameLayout( label='Iterations', borderStyle='out' ) cmds.intField('iterations',minValue=0,maxValue=10,value=0) cmds.frameLayout( label='Key', borderStyle='out' ) cmds.button('Delect',c='Delect()') cmds.showWindow()
def show( self ) : oSrch = 'LFT' oRep = 'RGT' oMul = 0 if mc.window( self.win , exists=True ) : oSrch = mc.textField( '%sSrchTF'%self.ui , q=True , tx=True ) oRep = mc.textField( '%sRepTF'%self.ui , q=True , tx=True ) oMul = mc.floatField( '%sMultFF'%self.ui , q=True , v=True ) mc.deleteUI( self.win ) mc.window( self.win , t='pkWeightPuller' , rtf=True ) mc.columnLayout( '%sMainCL'%self.ui , adj=True ) mc.text( l='Search for' , align='center' ) mc.textField( '%sSrchTF'%self.ui , tx=oSrch ) mc.text( l='Replace with' , align='center' ) mc.textField( '%sRepTF'%self.ui , tx=oRep ) mc.button( '%sSwapBUT'%self.ui , l='Swap' , c=partial( self.swap ) ) mc.floatField( '%sMultFF'%self.ui , minValue=0 , maxValue=1 , v=oMul ) mc.button( '%sBUT'%self.ui , l='Pull' , c=partial( self.pull ) ) mc.showWindow( self.win ) mc.window( self.win , e=True , w=180 ) mc.window( self.win , e=True , h=180 )
def copyCrvShapeUI(): if cmds.window('copyCrvShapeWin', exists=True): cmds.deleteUI('copyCrvShapeWin') cmds.window('copyCrvShapeWin', t='CopyCurve', rtf=True) cmds.columnLayout('mainCL', adj=True) cmds.text(l='Search for', align='center') cmds.textField('searchTF') cmds.textField('searchTF', e=True, tx='_L_') cmds.separator() cmds.text(align='center', l='Replace with') cmds.textField('replaceTF') cmds.textField('replaceTF', e=True, tx='_R_') cmds.separator() cmds.button('copyBTN', l='copy', c=partial(copyCrvShape)) cmds.showWindow('copyCrvShapeWin') cmds.window('copyCrvShapeWin', e=True, w=220, h=98)
def Path(): path=mc.textField("PATH",q=True,fileName=True) return (mc.fileDialog2(fileMode=1,startingDirectory=path)) def materialName(): tagpath=Path() if tagpath is not None: mc.textField("PATH",e=True,fileName=os.path.dirname(tagpath[0]).replace(os.sep,"/")) mc.textField("material",e=True,fileName=os.path.basename(tagpath[0]).rsplit("_",1)[0]) if mc.window('SP2Maya',ex = 1): mc.deleteUI('SP2Maya') mc.window('SP2Maya',t = 'SP2Maya',w=200,h=40 ) mc.columnLayout() mc.rowLayout(numberOfColumns=5) mc.separator(w=60,h = 30,style='none') mc.text('Render:') mc.radioCollection("Render") mc.radioButton("vray",label="VRay") mc.radioButton("arnold",label="Arnold") mc.setParent('..') mc.rowLayout(numberOfColumns=2) #mc.separator(h = 50) #mc.separator(style = 'out') mc.separator(w=100,h = 30,style='none') mc.checkBox(l = 'udim textures',onc = UDIM_on,ofc = UDIM_off,align = 'right')
def UI(): #check to see if the window exists, if so delete it if cmds.window("je_shotReference_UI", exists=True): cmds.deleteUI("je_shotReference_UI") #create the window window = cmds.window("je_shotReference_UI", title="Shot Reference", w=400, h=200, sizeable=False, mxb=False, mnb=False) #create the mainLayout mainLayout = cmds.columnLayout(w=400, h=200) #create a row column layout rowColumnLayout = cmds.rowColumnLayout(nc=2, cw=[(1, 300), (2, 100)], columnOffset=[(1, "both", 5), (2, "both", 5)]) #Create fields for the text file cmds.separator(h=10, style="none") cmds.separator(h=10, style="none") cmds.text(label="Reference Quicktime Movie:", align="left") cmds.text(label="") cmds.textField("refQuickTimeMovieTextField", w=300) cmds.button(label="Browse", w=50, c=partial(shotReferenceTool_getTextFieldInfo, "*.mov", 1, "refQuickTimeMovieTextField")) cmds.separator(h=10, style="none") cmds.separator(h=10, style="none") #create a new row column layout for the frame offset values frameOffsetRowColumnLayout = cmds.rowColumnLayout(nc=4, cw=[(1, 100), (2, 100), (3, 100), (4, 100)], columnOffset=[ (1, "both", 5), (2, "both", 5), (3, "both", 5), (4, "both", 5) ], parent=mainLayout) #create the frame offset fields cmds.text(label="Frame Offset: ") cmds.textField("frameOffsetTextField", w=100) cmds.text(label="") cmds.text(label="") #create the process button cmds.separator(h=15, style="none", parent=mainLayout) cmds.button(label="Import Reference Video", parent=mainLayout, w=400, h=50, c=importReferenceVideo_Process) #show the window cmds.showWindow(window)
def listAllReferenceMovies_UI(): #check to see if the window exists, if so delete it if cmds.window("je_listAllReferenceMovies_UI", exists=True): cmds.deleteUI("je_listAllReferenceMovies_UI") #create the window window = cmds.window("je_listAllReferenceMovies_UI", title="Shot Reference Movies", w=400, h=200, sizeable=False, mxb=False, mnb=False) #create the mainLayout mainLayout = cmds.columnLayout(w=400, h=200) #create a dropdown menu of all the movies in the scene cmds.text(label="Movies In Scene: ", align='left') cmds.separator(h=10, style="none", parent=mainLayout) optionMenu = cmds.optionMenu("referenceMoviesOptionMenu", w=400) cmds.separator(h=20, style="none", parent=mainLayout) #find all the movies in the scene movieFiles = [] try: cmds.select("*ShotReferencePlane_M*") except ValueError: print "No Reference Videos in Scene" return movieShaders = cmds.ls(sl=True) for each in movieShaders: connections = cmds.listConnections(each, connections=True) for connection in connections: if connection.find("movie") == 0: movieNode = connection file = cmds.getAttr(movieNode + ".fileTextureName") movieFiles.append(file) if len(movieFiles) > 0: for file in movieFiles: cmds.menuItem(label=file, parent="referenceMoviesOptionMenu") else: cmds.warning("No Movies in Scene") return #create a new row column layout for the frame offset values frameOffsetRowColumnLayout = cmds.rowColumnLayout(nc=4, cw=[(1, 100), (2, 100), (3, 100), (4, 100)], columnOffset=[ (1, "both", 5), (2, "both", 5), (3, "both", 5), (4, "both", 5) ], parent=mainLayout) #create the frame offset fields cmds.text(label="Frame Offset: ", align='left') cmds.textField("movieFilesFrameOffsetTextField", w=100) cmds.text(label="") cmds.checkBox("hideVideoCheckBox", label="Toggle Video", v=0, cc=hideVideo) cmds.separator(h=20, style="none") cmds.separator(h=20, style="none") cmds.separator(h=20, style="none") cmds.separator(h=20, style="none") #create an optionMenu for attaching reference plane to another camera cmds.text(label="Attach to Camera: ", align='left') cameraOptionMenu = cmds.optionMenu("cameraOptionMenu", w=100) cmds.menuItem(label="None") #get all the cameras and populate the option menu cameras = cmds.ls(type='camera') for camera in cameras: cam = cmds.listRelatives(camera, parent=True)[0] cmds.menuItem(label=str(cam), parent=cameraOptionMenu) cmds.text(label="") cmds.text(label="") cmds.separator(h=20, style="none") cmds.separator(h=20, style="none") cmds.separator(h=20, style="none") cmds.separator(h=20, style="none") #create an optionMenu for PiP location cmds.text(label="PiP Location: ", align='left') pipOptionMenu = cmds.optionMenu("pipOptionMenu", w=100) cmds.menuItem(label="Bottom Left Corner") cmds.menuItem(label="Bottom Right Corner") cmds.menuItem(label="Top Left Corner") cmds.menuItem(label="Top Right Corner") cmds.text(label="") cmds.text(label="") #create the process button cmds.separator(h=15, style="none", parent=mainLayout) cmds.button(label="Apply Settings", parent=mainLayout, w=400, h=50, c=applyFrameOffsetToSelected) cmds.button(label="Delete Selected Video", parent=mainLayout, w=400, h=50, c=partial(deleteSelectedMovie, file)) #show the window cmds.showWindow(window)
def createUI(pWindowTitle, pApplyCallback): ''' Creating the UserInterface windowTitle : title of the window ApplyCallback : function called when button is pressed, therefore inclusion of functiontools.partial ''' windowID = 'myWindowID' if cmds.window(windowID, exists=True): cmds.deleteUI(windowID) cmds.window(windowID, title=pWindowTitle, sizeable=True, resizeToFitChildren=True) cmds.columnLayout(adjustableColumn=True) #create logo logopath = cmds.internalVar(upd=True) + "icons/43.png" cmds.image(w=443, h=222, image=logopath) cmds.separator(h=10, style='none') cmds.text(label="TREE GENERATOR") cmds.separator(h=10, style='none') #create options for materials type = cmds.checkBoxGrp(numberOfCheckBoxes=3, label='Type: ', labelArray3=['One', 'Two', 'Three'], value1=True) materials = cmds.checkBoxGrp(numberOfCheckBoxes=3, label='Materials For Branches: ', labelArray3=['Phong', 'Lambert', 'Blinn'], value1=True) materialsleaf = cmds.checkBoxGrp(numberOfCheckBoxes=3, label='Materials For Leafs: ', labelArray3=['Phong', 'Lambert', 'Blinn'], value1=True) cmds.separator(h=10, style='none') cmds.text(label="ADJUST TREE") cmds.separator(h=10, style='none') #create options for angle rotation, iterations and step length rotateAngle = cmds.intSliderGrp(label='RotateAngle: ', minValue=1, maxValue=50, value=25, field=True) iterations = cmds.intSliderGrp(label='Iterations: ', minValue=1, maxValue=5, value=4, field=True) stepLength = cmds.intSliderGrp(label='StepLength: ', minValue=0, maxValue=5, value=1, field=True) cmds.separator(h=10, style='none') #create options to colour branches and leafs colourTree = cmds.colorInputWidgetGrp(label='Tree Colour:', rgb=(0.109, 0.056, 0.023), columnAlign=(1, 'center')) colourLeaf = cmds.colorInputWidgetGrp(label='Leaf Colour:', rgb=(0.109, 0.382, 0.023), columnAlign=(1, 'center')) cmds.separator(h=10, style='none') #apply adujustment cmds.button(label="Apply", command=functools.partial(pApplyCallback, iterations, stepLength, rotateAngle, materials, colourTree, colourLeaf, materialsleaf, type)) cmds.separator(h=10, style='none') #cancel the window cmds.button(label="Cancel", command=cancelProc) cmds.showWindow() cmds.window(windowID, e=True, width=400)
def UI(): #establish the icon path icon = cmds.internalVar(upd=True) + 'icons/JR_icons/folder.jpg' #check for and create window if cmds.window('exampleBatchUI', exists=True): cmds.deleteUI('exampleBatchUI') # create the window cmds.window('exampleBatchUI', w=500, h=350, mnb=False, mxb=False, sizeable=False, title='Example Batch') # creat out main layout mainLayout = cmds.columnLayout(w=500, h=350) #create our row columb layout cmds.separator(h=15) cmds.rowColumnLayout( nc=2, cw=[(1, 460), (2, 40)], columnOffset=[(1, 'both', 5), (2, 'both', 5)] ) # first section relates to 1 and 2 columb widths, this creates rowColumnLayout #input field cmds.text(label='Input Directory:', align='left') cmds.text( label='') # this is to fill the next column with a blank for spacing cmds.textField('inputField', w=460) # create inputField cmds.symbolButton(w=20, h=20, image=icon, c=partial(browseFilePath, 3, None, 'inputField')) #seperator cmds.separator(h=5, style='none') cmds.separator(h=5, style='none') #text file field cmds.text(label='Text File:', align='left') cmds.text( label='') # this is to fill the next column with a blank for spacing cmds.textField('textInputField', w=460) # create text field cmds.symbolButton(w=20, h=20, image=icon, c=partial(browseFilePath, 1, '*.txt', 'textInputField')) #seperator cmds.separator(h=5, style='none') cmds.separator(h=5, style='none') #output field cmds.text(label='Output Directory:', align='left') cmds.text( label='') # this is to fill the next column with a blank for spacing cmds.textField('outputField', w=460) # create output field cmds.symbolButton(w=20, h=20, image=icon, c=partial(browseFilePath, 3, None, 'outputField')) #seperator cmds.separator(h=5, style='none') cmds.separator(h=5, style='none') # process buddon cmds.button(w=500, h=50, label='Process', parent=mainLayout, c=process) # show window cmds.showWindow('exampleBatchUI')
def build_gui_gt_check_for_updates(): ''' Build a GUI to show current and latest versions ''' window_name = "build_gui_gt_check_for_updates" if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True) cmds.window(window_name, title= 'GT Check for Updates - (v' + script_version + ')', mnb=False, mxb=False, s=True) cmds.window(window_name, e=True, s=True, wh=[1,1]) cmds.columnLayout("main_column", p= window_name) # Title Text title_bgc_color = (.4, .4, .4) cmds.separator(h=12, style='none') # Empty Space cmds.rowColumnLayout(nc=1, cw=[(1, 410)], cs=[(1, 10)], p="main_column") # Window Size Adjustment cmds.rowColumnLayout(nc=1, cw=[(1, 400)], cs=[(1, 10)], p="main_column") # Title Column cmds.text("GT Check for Updates", bgc=title_bgc_color, fn="boldLabelFont", align="center") cmds.separator(h=10, style='none', p="main_column") # Empty Space # Body ==================== checklist_spacing = 4 cmds.text(l='\ngithub.com/TrevisanGMW/gt-tools', align="center") cmds.separator(h=7, style='none') # Empty Space general_column_width = [(1, 210),(2, 110),(4, 37)] cmds.rowColumnLayout(nc=3, cw=general_column_width, cs=[(1, 18),(2, 0),(3, 0),(4, 0)], p="main_column") cmds.text(l='Status:', align="center", fn="boldLabelFont") update_status = cmds.text(l='...', align="center") cmds.separator(h=7, style='none') # Empty Space cmds.separator(h=7, style='none') # Empty Space cmds.rowColumnLayout(nc=3, cw=general_column_width, cs=[(1, 18),(2, 0),(3, 0),(4, 0)], p="main_column") cmds.text(l='Web Response:', align="center", fn="boldLabelFont") web_response_text = cmds.text(l='...', align="center", fn="tinyBoldLabelFont", bgc=(1, 1, 0)) cmds.separator(h=7, style='none') # Empty Space cmds.separator(h=7, style='none') # Empty Space cmds.rowColumnLayout(nc=3, cw=general_column_width, cs=[(1, 18),(2, 0),(3, 0),(4, 0)], p="main_column") cmds.text(l='Installed Version:', align="center", fn="boldLabelFont") installed_version_text = cmds.text(l='...', align="center") cmds.separator(h=7, style='none') # Empty Space cmds.separator(h=7, style='none') # Empty Space cmds.rowColumnLayout(nc=3, cw=general_column_width, cs=[(1, 18),(2, 0),(3, 0),(4, 0)], p="main_column") cmds.text(l='Latest Release:', align="center", fn="boldLabelFont") latest_version_text = cmds.text(l='...', align="center") cmds.separator(h=7, style='none') # Empty Space cmds.separator(h=15, style='none') # Empty Space # Changelog ============= cmds.rowColumnLayout(nc=1, cw=[(1, 400)], cs=[(1, 10)], p="main_column") cmds.text(l='Latest Release Changelog:', align="center", fn="boldLabelFont") cmds.text(l='Use the refresh button to check again:', align="center", fn="smallPlainLabelFont") cmds.separator(h=checklist_spacing, style='none') # Empty Space output_scroll_field = cmds.scrollField(editable=False, wordWrap=True, fn="obliqueLabelFont") cmds.separator(h=10, style='none') # Empty Space # Refresh Button cmds.rowColumnLayout(nc=2, cw=[(1, 280),(2, 115)], cs=[(1,10),(2,5)], p="main_column") auto_update_btn = cmds.button(l='Auto Check For Updates: Activated', h=30, c=lambda args: toggle_auto_updater()) auto_updater_interval_btn = cmds.button(l='Interval: 15 days', h=30, c=lambda args: change_auto_update_interval()) cmds.rowColumnLayout(nc=1, cw=[(1, 400)], cs=[(1,10)], p="main_column") cmds.separator(h=5, style='none') cmds.button(l='Refresh', h=30, c=lambda args: reroute_errors('check_for_updates')) cmds.separator(h=8, style='none') update_btn = cmds.button(l='Update', h=30, en=False, c=lambda args: reroute_errors('open_releases_page')) 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), QWidget) icon = QIcon(':/SP_FileDialogToParent_Disabled.png') widget.setWindowIcon(icon) def toggle_auto_updater(refresh_only=False): ''' Toggle the auto check for updates button while updating an optionVar that controls this behaviour Parameters: refresh_only (bool): Is it only refreshing or toggling? ''' persistent_auto_updater_exists = cmds.optionVar(exists=('gt_check_for_updates_auto_active')) if persistent_auto_updater_exists: current_status = bool(cmds.optionVar(q=("gt_check_for_updates_auto_active"))) else: current_status = gt_check_for_updates.get('def_auto_updater_status') if refresh_only: if current_status: cmds.button(auto_update_btn, e=True, label='Auto Check For Updates: Activated') cmds.button(auto_updater_interval_btn, e=True, en=True) else: cmds.button(auto_update_btn, e=True, label='Auto Check For Updates: Deactivated') cmds.button(auto_updater_interval_btn, e=True, en=False) if not refresh_only: if current_status: cmds.button(auto_update_btn, e=True, label='Auto Check For Updates: Deactivated') cmds.optionVar( iv=('gt_check_for_updates_auto_active', int(False))) cmds.button(auto_updater_interval_btn, e=True, en=False) else: cmds.button(auto_update_btn, e=True, label='Auto Check For Updates: Activated') cmds.optionVar( iv=('gt_check_for_updates_auto_active', int(True))) cmds.button(auto_updater_interval_btn, e=True, en=True) def change_auto_update_interval(refresh_only=False): ''' Toggle the auto check for updates button while updating an optionVar that controls this behaviour Parameters: refresh_only (bool): Is it only refreshing or toggling? ''' check_interval = gt_check_for_updates.get('def_auto_updater_interval') persistent_check_interval_exists = cmds.optionVar(exists=('gt_check_for_updates_interval_days')) if persistent_check_interval_exists: check_interval = int(cmds.optionVar(q=("gt_check_for_updates_interval_days"))) interval_list = {'five_days' : 5, 'half_month' : 15, 'one_month' : 30, 'three_months' : 91, 'six_months': 182, 'one_year': 365} if not refresh_only: if check_interval == interval_list.get('five_days'): check_interval = interval_list.get('half_month') cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval))) elif check_interval == interval_list.get('half_month'): check_interval = interval_list.get('one_month') cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval))) elif check_interval == interval_list.get('one_month'): check_interval = interval_list.get('three_months') cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval))) elif check_interval == interval_list.get('three_months'): check_interval = interval_list.get('six_months') cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval))) elif check_interval == interval_list.get('six_months'): check_interval = interval_list.get('one_year') cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval))) elif check_interval == interval_list.get('one_year'): check_interval = interval_list.get('five_days') # Restart cmds.optionVar( iv=('gt_check_for_updates_interval_days', int(check_interval))) new_interval = '' if check_interval == interval_list.get('half_month') or check_interval == interval_list.get('one_month') or check_interval == interval_list.get('five_days'): new_interval = str(check_interval) + ' days' elif check_interval == interval_list.get('three_months'): new_interval = '3 months' elif check_interval == interval_list.get('six_months'): new_interval = '6 months' elif check_interval == interval_list.get('one_year'): new_interval = '1 year' cmds.button(auto_updater_interval_btn, e=True, label='Interval: ' + new_interval) def reroute_errors(operation): ''' Wrap functions around a try and catch to avoid big crashes during runtime ''' try: if operation == 'open_releases_page': open_releases_page() else: check_for_updates() except Exception as exception: cmds.scrollField(output_scroll_field, e=True, clear=True) cmds.scrollField(output_scroll_field, e=True, ip=0, it=str(exception) + '\n') def open_releases_page(): ''' Opens a web browser with the latest release ''' cmds.showHelp ('https://github.com/TrevisanGMW/gt-tools/releases/latest', absolute=True) def check_for_updates(): ''' Compare versions and update text accordingly It uses "get_github_release" to check for updates ''' def execute_operation(): # Define Current Version stored_gt_tools_version_exists = cmds.optionVar(exists=("gt_tools_version")) if stored_gt_tools_version_exists: gt_check_for_updates['current_version'] = "v" + str(cmds.optionVar(q=("gt_tools_version"))) else: gt_check_for_updates['current_version'] = 'v0.0.0' # Retrive Latest Version response_list = get_github_release(gt_tools_latest_release_api) gt_check_for_updates['latest_version'] = response_list[0].get('tag_name') or "v0.0.0" success_codes = [200, 201, 202, 203, 204, 205, 206] web_response_color = (0, 1, 0) if response_list[1] not in success_codes: web_response_color = (1, .5, .5) cmds.text(web_response_text, e=True, l=response_list[2], bgc=web_response_color) cmds.text(installed_version_text, e=True, l=gt_check_for_updates.get('current_version')) cmds.text(latest_version_text, e=True, l=gt_check_for_updates.get('latest_version')) current_version_int = int(re.sub("[^0-9]", "", str(gt_check_for_updates.get('current_version')))) latest_version_int = int(re.sub("[^0-9]", "", str(gt_check_for_updates.get('latest_version')))) if current_version_int < latest_version_int: cmds.button(update_btn, e=True, en=True, bgc=(.6, .6, .6)) cmds.text(update_status, e=True, l="New Update Available!", fn="tinyBoldLabelFont", bgc=(1, .5, .5)) elif current_version_int > latest_version_int: cmds.text(update_status, e=True, l="Unreleased update!", fn="tinyBoldLabelFont", bgc=(.7, 0 , 1)) cmds.button(update_btn, e=True, en=False) else: cmds.text(update_status, e=True, l="You're up to date!", fn="tinyBoldLabelFont", bgc=(0, 1, 0)) cmds.button(update_btn, e=True, en=False) published_at = '' try: published_at = response_list[0].get('published_at').split('T')[0] except: pass cmds.scrollField(output_scroll_field, e=True, clear=True) cmds.scrollField(output_scroll_field, e=True, ip=0, it=(response_list[0].get('tag_name') + (' ' * 80) + '(' + published_at + ')\n')) cmds.scrollField(output_scroll_field, e=True, ip=0, it=response_list[0].get('body')) if latest_version_int != 0: try: previous_version = str(latest_version_int - 1) previous_version_tag = 'v' for c in previous_version: previous_version_tag += c + '.' previous_version_tag = previous_version_tag[:-1] before_previous_version = str(latest_version_int - 2) before_previous_version_tag = 'v' for c in before_previous_version: before_previous_version_tag += c + '.' before_previous_version_tag = before_previous_version_tag[:-1] previous_version_response = get_github_release(gt_tools_tag_release_api + previous_version_tag) before_previous_version_response = get_github_release(gt_tools_tag_release_api + before_previous_version_tag) if previous_version_response[1] in success_codes: published_at = '' try: published_at = previous_version_response[0].get('published_at').split('T')[0] except: pass cmds.scrollField(output_scroll_field, e=True, ip=0, it='\n\n' + (previous_version_response[0].get('tag_name') + (' ' * 80) + '(' + published_at + ')\n')) cmds.scrollField(output_scroll_field, e=True, ip=0, it=previous_version_response[0].get('body')) if before_previous_version_response[1] in success_codes: published_at = '' try: published_at = before_previous_version_response[0].get('published_at').split('T')[0] except: pass cmds.scrollField(output_scroll_field, e=True, ip=0, it='\n\n' + (before_previous_version_response[0].get('tag_name') + (' ' * 80) + '(' + published_at + ')\n')) cmds.scrollField(output_scroll_field, e=True, ip=0, it=before_previous_version_response[0].get('body')) except: pass if response_list[1] not in success_codes: cmds.text(update_status, e=True, l="Unknown", fn="tinyBoldLabelFont", bgc=(1, .5, .5)) cmds.scrollField(output_scroll_field, e=True, ip=1, it='') # Bring Back to the Top # Threaded Operation def threaded_operation(): try: utils.executeDeferred(execute_operation) except Exception as e: print(e) thread = threading.Thread(None, target = threaded_operation) thread.start() # Refresh When Opening reroute_errors('') # Refresh Buttons toggle_auto_updater(refresh_only=True) change_auto_update_interval(refresh_only=True)
def gui(): icon_path = os.path.join(os.path.split(__file__)[0], 'icons') win_width = 314 win = 'prm_face_win' if cmds.window(win, ex=True): cmds.deleteUI(win) cmds.window(win, sizeable=0, w=win_width, t='PRM Face System') main = cmds.columnLayout(bgc=[.78, .69, .6]) cmds.image(w=314, h=65, i=os.path.join(icon_path, 'rba_installer.png')) lorge_icon = False icon_width = 128 / 2 icon_height = 181 / 2 if lorge_icon: icon_width = 128 icon_height = 181 # Level 1 Mouth Shapes frame_heigth = icon_height + 65 if icon_width * 8 < win_width: frame_heigth = icon_height + 47 cmds.frameLayout(label="Mouth Shapes", w=314, h=frame_heigth, bgc=[.52, .47, .4]) cmds.scrollLayout() row = cmds.rowColumnLayout(nr=1) Face_Button(parent=row, label='Left Smile', image=os.path.join(icon_path, 'lt_mouth_smile.gif'), width=icon_width, height=icon_height) Face_Button(parent=row, label='Left Frown', image=os.path.join(icon_path, 'lt_mouth_frown.gif'), width=icon_width, height=icon_height) Face_Button(parent=row, label='Left Wide', image=os.path.join(icon_path, 'lt_mouth_wide.gif'), width=icon_width, height=icon_height) Face_Button(parent=row, label='Left OO', image=os.path.join(icon_path, 'lt_mouth_oo.gif'), width=icon_width, height=icon_height) Face_Button(parent=row, label='Rigth Smile', image=os.path.join(icon_path, 'rt_mouth_smile.gif'), width=icon_width, height=icon_height) Face_Button(parent=row, label='Right Frown', image=os.path.join(icon_path, 'rt_mouth_frown.gif'), width=icon_width, height=icon_height) Face_Button(parent=row, label='Right Wide', image=os.path.join(icon_path, 'rt_mouth_wide.gif'), width=icon_width, height=icon_height) Face_Button(parent=row, label='Right OO', image=os.path.join(icon_path, 'lt_mouth_oo.gif'), width=icon_width, height=icon_height) cmds.setParent(main) # Level 1 Eye # Lt and Rt Eye Close frame_heigth = icon_height + 65 if icon_width * 8 < win_width: frame_heigth = icon_heigth + 47 # Level 2 # Lt and Rt Upper lid and lower lid surprise and close. (4 Shapes each side) cmds.frameLayout(label="Eye Lid Shapes", w=314, h=frame_heigth, bgc=[.52, .47, .4]) cmds.scrollLayout() row2 = cmds.rowColumnLayout(nr=1) Face_Button(parent=row2, label='Left Up Wide', image=os.path.join(icon_path, 'lt_eye_wide.png'), width=icon_width, height=icon_height) Face_Button(parent=row2, label='Left Up Close', image=os.path.join(icon_path, 'lt_eye_closed.gif'), width=icon_width, height=icon_height) Face_Button(parent=row2, label='Left Low Wide', image=os.path.join(icon_path, 'lt_eye_wide.png'), width=icon_width, height=icon_height) Face_Button(parent=row2, label='Left Low Close', image=os.path.join(icon_path, 'lt_eye_closed.gif'), width=icon_width, height=icon_height) Face_Button(parent=row2, label='Right Up Close', image=os.path.join(icon_path, 'rt_eye_closed.gif'), width=icon_width, height=icon_height) Face_Button(parent=row2, label='Rigth Up Wide', image=os.path.join(icon_path, 'lt_eye_wide.png'), width=icon_width, height=icon_height) Face_Button(parent=row2, label='Right Low Close', image=os.path.join(icon_path, 'rt_eye_closed.gif'), width=icon_width, height=icon_height) Face_Button(parent=row2, label='Rigth Low Wide', image=os.path.join(icon_path, 'lt_eye_wide.png'), width=icon_width, height=icon_height) cmds.setParent(main) # Level 1 Brow # Eye Brow Up and Down frame_heigth = icon_height + 65 if icon_width * 4 < win_width: frame_heigth = icon_height + 47 cmds.frameLayout(label="Eye Brow Shapes", w=314, h=frame_heigth, bgc=[.52, .47, .4]) cmds.scrollLayout() row3 = cmds.rowColumnLayout(nr=1) Face_Button(parent=row3, label='Left Up', image=os.path.join(icon_path, 'lt_brow_up.gif'), width=icon_width, height=icon_height) Face_Button(parent=row3, label='Left Down', image=os.path.join(icon_path, 'rt_brow_down.gif'), width=icon_width, height=icon_height) Face_Button(parent=row3, label='Right Up', image=os.path.join(icon_path, 'rt_brow_up.gif'), width=icon_width, height=icon_height) Face_Button(parent=row3, label='Right Down', image=os.path.join(icon_path, 'rt_brow_down.gif'), width=icon_width, height=icon_height) cmds.setParent(main) # Level 2 Inside, Mid, Outside (Lt and Rt), Center # Binding System # Jaw System # Neck System cmds.button(w=win_width, l='Apply Face System', bgc=[1, 0.9, 0.4]) cmds.showWindow(win)
"マットの不透明度モード" def black(): for rend in mt: cmds.editRenderLayerAdjustment(rend + ".matteOpacityMode") cmds.setAttr(rend + ".matteOpacityMode", 0) "アンビエントカラーのオーバーライド" def ambi(): for rend in mt: cmds.editRenderLayerAdjustment(rend + ".ambientColor") cmds.setAttr(rend + ".ambientColor", 0, 0, 0, type="double3") "UI" cmds.window(title="松崎化", widthHeight=(253, 137)) cmds.columnLayout(columnAttach=('both', 5), rowSpacing=10, columnWidth=250) cmds.button(label='取得', command='mt = getgeo()') cmds.button(label='カラー黒', command='col()') cmds.button(label='アンビエント黒', command='ambi()') cmds.button(label='ブラックホール', command='black()') cmds.showWindow()
import maya.cmds as maya import maya.mel as mel import linecache import time import datetime ##########################Sub message windows################################################################## #Create a alarm message!# alarmWindow = maya.window(title="Message") maya.columnLayout(adjustableColumn=False) maya.text(label="Please select at least one camera!") successWindow = maya.window(title="Message") maya.columnLayout(adjustableColumn=False) maya.text(label="Success!") ##########################Main Panel to operate the animation################################################### #Create a Panel to show the funtion knob MainWindow = maya.window(title="Matchmove Tool(retime) v1.2") maya.columnLayout(adjustableColumn=False) maya.frameLayout(label='Preprocessing', borderStyle='in', marginHeight=8, backgroundColor=[0.35, 0.35, 0.35]) maya.columnLayout() maya.rowColumnLayout(numberOfColumns=3, columnAttach=[1, "right", 0], columnWidth=[[1, 80], [2, 200], [2, 150]]) maya.text(label="Bake Simulation", align='right') maya.button(label="Press", w=60, command="bake()") maya.text(label="")
def Edit_UI(): cmds.columnLayout(adj=True) cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1, 300), (2,23),(3, 100)] ) cmds.text('availableText',l='Available blendShape target: ') cmds.text(l='') cmds.text('InbetweenText',l='Inbetween weight:') cmds.columnLayout() cmds.popupMenu(mm=True) cmds.menuItem(l ="Append",rp= "N",c= lambda *args: CreativeBlendShape().AppendTarget() and freshTargetBlendShape("append")) cmds.menuItem(l= "Delete",rp ="S",c= lambda *args: CreativeBlendShape().RemoveTarget() and freshTargetBlendShape("remove")) cmds.menuItem(l= "Gian",rp ="W",c= lambda *args: CreativeBlendShape().GainTarget()) cmds.menuItem(l= "Rename",rp ="E",c= lambda *args: CreativeBlendShape().RenameTarget() and freshTargetBlendShape("append")) def cbTBS(): inbetweenWieght(),getBlendShapeIndex() cmds.textScrollList('targetBlendShapeText',height = 200,width = 300,sc = cbTBS) cmds.setParent('..') cmds.text(l=' => ') cmds.columnLayout() text2 = cmds.textScrollList('targetInbetweenText',allowMultiSelection=True, height = 150,width = 100,sc=lambda *args:setBlendShape()) cmds.floatField('InbetweenField',w=100,en=False) cmds.button( l='inputGeomTarget',c=lambda *args:CreativeBlendShape().inputGeomTarget()) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.text(l= '',h=5) b2=cmds.button('EditFinsihButton',label = 'Edit',c=lambda *args: EditFinishButton(),width = 60) cmds.setParent('..') cmds.columnLayout() cmds.frameLayout( w= 425,label='In-between', collapsable = True,labelAlign='top', borderStyle='etchedIn',marginHeight =2,marginWidth =2 ,collapse =True ) cmds.columnLayout(adj=1) cmds.checkBoxGrp('Inbetween',label='Add in-between target:',columnWidth=( 1, 160),of1=lambda *args:inbetweenBox(),on1=lambda *args:inbetweenBox()) cmds.floatSliderGrp('InbetweenSlider',label ='In-between weight:', field= True,min= -10.00, max =10.00 ,pre =2, enable =False ,adj= 3 ,cw3=( 140, 80,200)) cmds.button('EditAddbetweenButton',label = 'inbetweenEdit',c=lambda *args: inbetweenEditAddButton(), width = 50,enable=False) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.frameLayout( w= 425,label='Mirror Target', collapsable = True, labelAlign='top', borderStyle='etchedIn',marginHeight =2,marginWidth =2 ,collapse =True ) cmds.columnLayout() cmds.textFieldButtonGrp('MirrorTargetText',label=' >>',cw3= (150 ,150,120),bl=' Mirror ',bc= lambda *args: CreativeBlendShape().MirrorBlendShape(0) and freshTargetBlendShape("append")) cmds.setParent( '..' ) cmds.setParent( '..' ) ############################################# cmds.frameLayout( w= 425,label='Mirror>Target', collapsable = True, labelAlign='top', borderStyle='etchedIn',marginHeight =2,marginWidth =2 ,collapse =True ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1, 160), (2, 100), (3, 160)] ) cmds.textField("targetField",tx="Target",en=0) cmds.text(l=" ==>>==") cmds.textField("sourceField",tx="Source",en=0) cmds.button(l="Target",c=lambda *args:editField("targetField")) cmds.text(l="") cmds.button(l="Source",c=lambda *args:editField("sourceField")) cmds.setParent( '..' ) cmds.button(l="Apply",w=420,c=lambda *args: CreativeBlendShape().MirrorBlendShape(1)) cmds.setParent( '..' ) cmds.setParent( '..' ) ########################################## cmds.frameLayout( w= 425,label='BlendTwoAttr', collapsable = True, labelAlign='top', borderStyle='etchedIn',marginHeight =2,marginWidth =2 ,collapse =True ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1, 120), (2, 120), (3, 160)] ) cmds.textField("target_1Field",tx="Target1",en=0) cmds.textField("target_2Field",tx="Target2",en=0) cmds.text(l="") cmds.button(l="Target1",c=lambda *args:editField("target_1Field")) cmds.button(l="Target2",c=lambda *args:editField("target_2Field")) cmds.setParent( '..' ) cmds.button(l="create",w=420,c=lambda *args:CreativeBlendShape().blendTwoAttrCreate()) cmds.button(l="finish",w=420,c=lambda *args:CreativeBlendShape().blendTwoAttrConnect()) cmds.setParent( '..' ) cmds.setParent( '..' ) ################################################### cmds.setParent( '..' )
def applyShaders(rfrsh, only, scenesList): scenePath = cmds.textField(folderNameBox, q=True, tx=True) for sceneName in scenesList: if only == 0: try: cmds.delete(sceneName + ':*') cmds.namespace(rm=sceneName) except: pass print sceneName shaderNamespace = sceneName cmds.file(scenePath + '/' + sceneName + '.ma', i=True, ignoreVersion=True, mergeNamespacesOnClash=False, namespace=shaderNamespace, options="v=0;p=17;f=0", pr=True) if only == 1: shaderNamespace = sceneName + 'ImpOnly' cmds.file(scenePath + '/' + sceneName + '.ma', i=True, ignoreVersion=True, mergeNamespacesOnClash=False, namespace=shaderNamespace, options="v=0;p=17;f=0", pr=True) selection = cmds.select(shaderNamespace + '*:shadersAssignmentInfo', r=True) shaderNamespace = cmds.ls(sl=True)[0].split(':')[0] saInfoAttrs = cmds.listAttr(shaderNamespace + ':shadersAssignmentInfo') #getting the values from the assignmentInfo and operating them shaderInfoAttrList = [] missingObjects = [] missingObjShader = [] #we extract each attribut "shaderInfo" name from the assignmentInfo for attribut in saInfoAttrs: attributName = attribut.split('shaderInfo') if len(attributName) == 2: shaderInfoAttrList.append(attribut) #we get the info from each shading info attribut for attribut in shaderInfoAttrList: shaderInfo = cmds.getAttr(shaderNamespace + ':shadersAssignmentInfo.' + attribut).split(',')[0].split(' = ') if len(shaderInfo) == 2: vtxID = cmds.getAttr( shaderNamespace + ':shadersAssignmentInfo.' + attribut).split(',')[1].split(' = ')[1] #if the object has the lambert1 shader (initialShadingGroup), then select the existing initialShadingGroup if shaderInfo[1] == 'initialShadingGroup': cmds.select('initialShadingGroup', ne=True, r=True) else: cmds.select(shaderNamespace + ':' + shaderInfo[1], ne=True, r=True) shadingGroup = cmds.ls(sl=True) try: cmds.select(cmds.listRelatives('*:*' + shaderInfo[0], parent=True, fullPath=True), r=True) except: try: cmds.select(cmds.listRelatives(shaderInfo[0], parent=True, fullPath=True), r=True) except: missingObjects.append(shaderInfo[0]) missingObjShader.append(' shadered with : ' + shaderInfo[1]) if len(cmds.ls(sl=True)) > 1: multiple = 1 else: multiple = 0 objectToCheck = [] if multiple == 0: if only == 0: cmds.sets(e=True, forceElement=shadingGroup[0]) if multiple == 1: allNodes = cmds.ls(ap=True, type='mesh') for node in allNodes: if len(node.split(shaderInfo[0])) > 1: objectToCheck.append(node) for object in objectToCheck: numberOfVertices = cmds.polyEvaluate(object, v=True) if str(numberOfVertices) == str(vtxID): if only == 0: cmds.select(object, r=True) cmds.sets(e=True, forceElement=shadingGroup[0]) if cmds.checkBox(mustDeleteBox, q=True, v=True): cmds.delete(shaderNamespace + ':shadersAssignmentInfo') #if object are missing if len(missingObjects) > 0: objectListString = '\n'.join(missingObjects) shaderListString = '\n'.join(missingObjShader) if (cmds.window('warningWindow', exists=True)): cmds.deleteUI('warningWindow') cmds.window('warningWindow', title="Warning", titleBarMenu=True) cmds.columnLayout(cal='center', width=440, rowSpacing=10, columnAttach=('left', 40)) cmds.separator(height=15, style='none') cmds.text( label= 'Following objects were missing, or have a different name in the shader scene :', al='left') cmds.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 10), (2, 180), (3, 300), (4, 10)]) cmds.text(label='', al='left') cmds.text(label=objectListString, al='left') cmds.text(label=shaderListString, al='left', en=False) cmds.text(label='', al='left') cmds.separator(height=20, style='none') cmds.showWindow() #end of the "else apply" function cmds.select(cl=True) cmds.deleteUI('shaderImportWindow')
def addRenderSetupPreferences(): cmds.frameLayout(label=kRenderSetupTemplatesTitle) cmds.columnLayout(adjustableColumn=True) # Build the User Templates Location cmds.rowLayout(numberOfColumns=4, columnWidth=[(1,50), (2,130), (4,20)], adjustableColumn=3,\ columnAttach4=('left', 'both', 'both', 'right'), \ columnAlign4=('left', 'left', 'left', 'left')) cmds.text(label="") cmds.text(label=kUserTemplatesLocation) userTextField = cmds.textField(text=prefs.getUserTemplateDirectory()) cmd1 = 'maya.app.renderSetup.views.renderSetupPreferences._syncOptionVarWithTextField(\'%s\', \'%s\')' % (userTextField, prefs.kOptionVarUserTemplateDirectory) cmds.textField(userTextField, edit=True, changeCommand=cmd1) cmd2 = 'maya.app.renderSetup.views.renderSetupPreferences._selectPath(\'%s\', \'%s\', \'%s\')' % (userTextField, prefs.kOptionVarUserTemplateDirectory, kSelectUserTemplatesLocation) cmds.symbolButton(image='navButtonBrowse.png', command=cmd2) cmds.setParent('..') # Build the Global Template Location cmds.rowLayout(numberOfColumns=4, columnWidth=[(1,40), (2,140), (4,20)], adjustableColumn=3,\ columnAttach4=('left', 'both', 'both', 'right'), \ columnAlign4=('left', 'left', 'left', 'left')) cmds.text(label="") cmds.text(label=kGlobalTemplatesLocation) userTextField = cmds.textField(text=prefs.getGlobalTemplateDirectory()) cmd1 = 'maya.app.renderSetup.views.renderSetupPreferences._syncOptionVarWithTextField(\'%s\', \'%s\')' % (userTextField, prefs.kOptionVarGlobalTemplateDirectory) cmds.textField(userTextField, edit=True, changeCommand=cmd1) cmd2 = 'maya.app.renderSetup.views.renderSetupPreferences._selectPath(\'%s\', \'%s\', \'%s\')' % (userTextField, prefs.kOptionVarGlobalTemplateDirectory, kSelectUserTemplatesLocation) cmds.symbolButton(image='navButtonBrowse.png', command=cmd2) cmds.setParent('..') cmds.setParent('..') cmds.frameLayout(label=kRenderSettingsPresetsTitle) cmds.columnLayout(adjustableColumn=True) # Build the User Presets Location cmds.rowLayout(numberOfColumns=4, columnWidth=[(1,65), (2,115), (4,20)], adjustableColumn=3,\ columnAttach4=('left', 'both', 'both', 'right'), \ columnAlign4=('left', 'left', 'left', 'left')) cmds.text(label="") cmds.text(label=kUserPresetsLocation) userTextField = cmds.textField(text=prefs.getUserPresetsDirectory()) cmd1 = 'maya.app.renderSetup.views.renderSetupPreferences._syncOptionVarWithTextField(\'%s\', \'%s\')' % (userTextField, prefs.kOptionVarUserPresetsDirectory) cmds.textField(userTextField, edit=True, changeCommand=cmd1) cmd2 = 'maya.app.renderSetup.views.renderSetupPreferences._selectPath(\'%s\', \'%s\', \'%s\')' % (userTextField, prefs.kOptionVarUserPresetsDirectory, kSelectUserPresetsLocation) cmds.symbolButton(image='navButtonBrowse.png', command=cmd2) cmds.setParent('..') # Build the Global Presets Location cmds.rowLayout(numberOfColumns=4, columnWidth=[(1,54), (2,126), (4,20)], adjustableColumn=3,\ columnAttach4=('left', 'both', 'both', 'right'), \ columnAlign4=('left', 'left', 'left', 'left')) cmds.text(label="") cmds.text(label=kGlobalPresetsLocation) userTextField = cmds.textField(text=prefs.getGlobalPresetsDirectory()) cmd1 = 'maya.app.renderSetup.views.renderSetupPreferences._syncOptionVarWithTextField(\'%s\', \'%s\')' % (userTextField, prefs.kOptionVarGlobalPresetsDirectory) cmds.textField(userTextField, edit=True, changeCommand=cmd1) cmd2 = 'maya.app.renderSetup.views.renderSetupPreferences._selectPath(\'%s\', \'%s\', \'%s\')' % (userTextField, prefs.kOptionVarGlobalPresetsDirectory, kSelectUserPresetsLocation) cmds.symbolButton(image='navButtonBrowse.png', command=cmd2) cmds.setParent('..') cmds.setParent('..')
def positionUI(selectedRadioVal): """ Fenster dass zwischen Haendischer oder durch einen Algorightmus die Animation erstellt werden soll :param x: Die Reihe im Regal :param y: Die Spalte im Regal """ winID = "positionUI" if cmds.window(winID, exists=True): cmds.deleteUI(winID) # Fenster erstellen cmds.window("positionUI", title="Auswahl des Regals", h=150, w=223, sizeable=False) # Master Layout masterLayout = cmds.columnLayout() # Platzhalter + Strich cmds.separator(style='none', height=16) cmds.separator(style='in', width=224) cmds.separator(style='none', height=16) # Laying out the rowColumnLayout is simple as this table1 = cmds.rowColumnLayout(numberOfColumns=7, columnWidth=[(1, 32), (2, 32), (3, 32), (4, 32), (5, 32), (6, 32), (7, 32)]) cmds.separator(style='none', width=32) # Add first line of controls cmds.text(label="Reihe") x_txt = cmds.intField(minValue=1, maxValue=3, value=1) cmds.separator(style='none', width=32) # Adding more controls starts on the next row down. cmds.text(label="Spalte") y_txt = cmds.intField(minValue=1, maxValue=3, value=1) cmds.separator(style='none', width=32) # Wieder zurueck zum masterLayout cmds.setParent('..') cmds.separator(style='none', height=16) cmds.separator(style='in', width=224) cmds.separator(style='none', height=16) # Zweites TableLayout table3 = cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 35), (2, 160), (3, 35)]) cmds.separator(style='none', width=35) def importImage(*_): #Ist der Pfad des Files der ausgew?hlt wird filename = cmds.fileDialog2(fileMode=1, caption="Import Image") print(filename[0]) cmds.button(label='Barcode Einscannen', command=importImage) cmds.separator(style='none', width=35) cmds.setParent('..') cmds.separator(style='none', height=16) cmds.separator(style='in', width=224) cmds.separator(style='none', height=16) # Drittes TableLayout table3 = cmds.rowColumnLayout(numberOfColumns=5, columnWidth=[(1, 32), (2, 64), (3, 32), (4, 64), (5, 32)]) cmds.separator(style='none', width=32) def setPos(*_): """ Setzt die Anfangsposition des Roboterarms :param _: metadata des button Commands """ r.setIniPos(cmds.intField(x_txt, query=True, value=True), cmds.intField(y_txt, query=True, value=True)) cmds.button(label='Preview', command=setPos) cmds.separator(style='none', width=32) def weiter(*_): """ Hier wird man in die Animations GUI weitergefuehrt :param _: metadata des button Commands """ setPos(*_) r.attachPackage(cmds.intField(x_txt, query=True, value=True), cmds.intField(y_txt, query=True, value=True)) # Setz den ersten Keyframe r.setKeyframe(0) if selectedRadioVal == "Manuell": AnimationUI(cmds.intField(x_txt, query=True, value=True), cmds.intField(y_txt, query=True, value=True)) else: AlgorithmhUi(cmds.intField(x_txt, query=True, value=True), cmds.intField(y_txt, query=True, value=True)) # Schliesst die Init GUI cmds.deleteUI(winID) cmds.button(label='Weiter', command=weiter) cmds.separator(style='none', width=32) # Wieder zurueck zum masterLayout cmds.setParent('..') cmds.separator(style='none', height=16) # show window cmds.showWindow(winID)
def launch(): #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ # interface #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ if (cmds.window('shaderImportWindow', exists=True)): cmds.deleteUI('shaderImportWindow') cmds.window('shaderImportWindow', title="Import shaders", titleBarMenu=True) cmds.columnLayout() cmds.separator(height=13, style='none') cmds.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 10), (2, 140), (3, 380), (4, 35)]) cmds.text(label='', al='left') cmds.text(label='Shaders folder : ', al='left') folderNameBox = cmds.textField() cmds.symbolButton(image='folder-open.png', command='folderSelection()') cmds.setParent('..') cmds.separator(height=8, style='none') cmds.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 10), (2, 140), (3, 380), (4, 35)]) cmds.text(label='', al='left') cmds.text(label='Shaders to import : ', al='left') scenesListBox = cmds.textField() cmds.setParent('..') cmds.separator(height=5, style='none') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 150), (2, 350)]) cmds.text(label='', al='left') cmds.text( label= 'Names must be separate with a "," and whitespaces are not allowed.', al='left', en=False) cmds.setParent('..') cmds.separator(height=20, style='none') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 150), (2, 150), (3, 150)]) cmds.text(label='', al='left') cmds.radioCollection() importAssignBox = cmds.radioButton(label='Import and assign', sl=True) importOnlyBox = cmds.radioButton(label='Import shaders only') cmds.setParent('..') cmds.separator(height=13, style='none') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 150), (2, 280)]) cmds.text(label='', al='left') mustDeleteBox = cmds.checkBox( label='Delete Assignator info nodes after import', value=1) cmds.setParent('..') cmds.separator(height=20, style='none') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 188), (2, 188), (3, 191)]) cmds.text(label='', al='left') cmds.button(label='Import shaders', align='center', height=45, command='checking()') cmds.text(label='', al='left') cmds.separator(height=13, style='none') cmds.showWindow()
def exportPointDataUI(): ''' Main UI for the exportPointData module ''' # Get current frame range startFrame = mc.playbackOptions(q=True, min=True) endFrame = mc.playbackOptions(q=True, max=True) # Window window = 'exportPointDataUI' if mc.window(window, q=True, ex=True): mc.deleteUI(window) window = mc.window(window, t='Export Point Data', s=False) # Layout CL = mc.columnLayout(adj=True) # UI Elements pathTBG = mc.textFieldButtonGrp('exportPoint_pathTBG', label='Path', buttonLabel='...') camTBG = mc.textFieldButtonGrp('exportPoint_camTBG', label='Camera (2D only)', buttonLabel='Select') rangeIFG = mc.intFieldGrp('exportPoint_rangeIFG', nf=2, label='Frame Range', v1=startFrame, v2=endFrame) resIFG = mc.intFieldGrp('exportPoint_resIFG', nf=2, label='Resolution', v1=2348, v2=1152) refIFG = mc.intFieldGrp('exportPoint_refIFG', nf=1, label='Offset Base Frame', v1=startFrame) resOMG = mc.optionMenuGrp('exportPoint_resOMG', label='Resolution Preset') export2DB = mc.button('exportPoint_export2DB', label='Export 2D Point Data', c='glTools.ui.exportPointData.export2DFromUI()') export2DOffsetB = mc.button( 'exportPoint_export2DOffsetB', label='Export 2D Offset Data', c='glTools.ui.exportPointData.export2DOffsetFromUI()') export3DB = mc.button('exportPoint_export3DB', label='Export 3D Point Data', c='glTools.ui.exportPointData.export3DFromUI()') export3DRotB = mc.button( 'exportPoint_export3DRotB', label='Export 3D Rotate Data', c='glTools.ui.exportPointData.export3DRotationFromUI()') closeB = mc.button('exportPoint_closeB', label='Close', c='mc.deleteUI("' + window + '")') # Resolution presets mc.setParent(resOMG) mc.menuItem(label='WIDE(full)') mc.menuItem(label='WIDE(half)') mc.menuItem(label='WIDE(quarter)') # UI Callbacks mc.textFieldButtonGrp(pathTBG, e=True, bc='glTools.ui.utils.exportFolderBrowser("' + pathTBG + '")') mc.textFieldButtonGrp(camTBG, e=True, bc='glTools.ui.utils.loadTypeSel("' + camTBG + '",selType="transform")') mc.optionMenuGrp(resOMG, e=True, cc='glTools.tools.exportPointData.setResolution()') # Popup menu mc.popupMenu(parent=camTBG) for cam in mc.ls(type='camera'): if mc.camera(cam, q=True, orthographic=True): continue camXform = mc.listRelatives(cam, p=True, pa=True)[0] mc.menuItem( l=camXform, c='mc.textFieldButtonGrp("exportPoint_camTBG",e=True,text="' + camXform + '")') # Show Window mc.window(window, e=True, w=435, h=275) mc.showWindow(window)
def AnimationUI(x, y): """ Die GUI fuer die Animation des Roboterarms :param x: Die Reihe im Regal :param y: Die Spalte im Regal """ # Loescht Fenster, wenn das Fenster davor schon offen war winID = "Animation" if cmds.window(winID, exists=True): cmds.deleteUI(winID) # Erzeugt ein leeres Fenster animationWindow = cmds.window("Animation", title="Animation erzeugen", h=375, w=400, sizeable=False) # Layout erstellen mainLayout = cmds.columnLayout(w=400, h=375) cmds.separator(style='none', height=25) # Rows fuer die einzelnen Motoren row1mot = cmds.rowColumnLayout(numberOfColumns=7, columnWidth=[(1, 25), (2, 100), (3, 10), (4, 50), (5, 10), (6, 25), (7, 180)]) cmds.separator(style='none', width=50, height=15) cmds.text(label="Motor 1") cmds.separator(style='none', width=10) def m1(*_): r.setAchse1(cmds.intField(motor1, query=True, value=True)) motor1 = cmds.intField(cc=m1, value=int(init_pos[x - 1][y - 1][0])) cmds.separator(style='none', width=10) cmds.text(label="Grad") cmds.separator(style='none') cmds.separator(style='none', height=25) cmds.setParent('..') row2mot = cmds.rowColumnLayout(numberOfColumns=7, columnWidth=[(1, 25), (2, 100), (3, 10), (4, 50), (5, 10), (6, 25), (7, 180)]) cmds.separator(style='none', width=50) cmds.text(label="Motor 2") cmds.separator(style='none', width=10) def m2(*_): r.setAchse2(cmds.intField(motor2, query=True, value=True)) motor2 = cmds.intField(minValue=-85, maxValue=50, cc=m2, value=int(init_pos[x - 1][y - 1][1])) cmds.separator(style='none', width=10) cmds.text(label="Grad") cmds.text(label="(-85 - 50 Grad)") cmds.separator(style='none', height=25) cmds.setParent('..') row3mot = cmds.rowColumnLayout(numberOfColumns=7, columnWidth=[(1, 25), (2, 100), (3, 10), (4, 50), (5, 10), (6, 25), (7, 180)]) cmds.separator(style='none', width=50) cmds.text(label="Motor 3") cmds.separator(style='none', width=10) def m3(*_): r.setAchse3(cmds.intField(motor3, query=True, value=True)) motor3 = cmds.intField(minValue=-65, maxValue=210, cc=m3, value=int(init_pos[x - 1][y - 1][2])) cmds.separator(style='none', width=10) cmds.text(label="Grad") cmds.text(label="(-65 - 210 Grad)") cmds.separator(style='none', height=25) cmds.setParent('..') row4mot = cmds.rowColumnLayout(numberOfColumns=7, columnWidth=[(1, 25), (2, 100), (3, 10), (4, 50), (5, 10), (6, 25), (7, 180)]) cmds.separator(style='none', width=50) cmds.text(label="Motor 4") cmds.separator(style='none', width=10) def m4(*_): r.setAchse4(cmds.intField(motor4, query=True, value=True)) motor4 = cmds.intField(cc=m4, value=int(init_pos[x - 1][y - 1][3])) cmds.separator(style='none', width=10) cmds.text(label="Grad") cmds.separator(style='none') cmds.separator(style='none', height=25) cmds.setParent('..') row5mot = cmds.rowColumnLayout(numberOfColumns=7, columnWidth=[(1, 25), (2, 100), (3, 10), (4, 50), (5, 10), (6, 25), (7, 180)]) cmds.separator(style='none', width=50) cmds.text(label="Motor 5") cmds.separator(style='none', width=10) def m5(*_): r.setAchse5(cmds.intField(motor5, query=True, value=True)) motor5 = cmds.intField(minValue=-120, maxValue=120, cc=m5, value=int(init_pos[x - 1][y - 1][4])) cmds.separator(style='none', width=10) cmds.text(label="Grad") cmds.text(label="(-120 - 120 Grad)") cmds.separator(style='none', height=25) cmds.setParent('..') cmds.setParent('..') # Ein Layout fuer die Angabe der Sekunden zwischen den Keyframes table2 = cmds.rowColumnLayout(numberOfColumns=7, columnWidth=[(1, 25), (2, 100), (3, 10), (4, 50), (5, 10), (6, 25), (7, 180)]) cmds.separator(style='none', width=50) cmds.text(label="Animationsabstand") cmds.separator(style='none', width=10) timedistance = cmds.intField(minValue=0, maxValue=25) cmds.separator(style='none', width=10) cmds.text(label="sek") cmds.text(label="(0 - 25 Sekunden)") cmds.separator(style='none', height=25) cmds.setParent('..') # Layout fuer den Button table3 = cmds.rowColumnLayout(numberOfColumns=5, columnWidth=[(1, 50), (2, 150), (3, 50), (4, 100), (5, 50)]) cmds.separator(style='none', width=50, height=25) def setKey(*_): """ Setzt den Keyframe :param _: metadata des Button Commands """ r.setKeyframe(cmds.intField(timedistance, query=True, value=True)) cmds.button(label='Animationspunkt setzen', command=setKey) cmds.separator(style='none', width=50) def export(*_): """ Exportiert die Animation :param _: metadata des Button Commands """ printManualAnimation() cmds.button(label='Drucken', command=export) cmds.separator(style='none', width=50) cmds.setParent('..') cmds.separator(style='none', height=25) # Zeigt das Fentser an cmds.showWindow(winID)
def uiCreation(): if cmds.window( "main", exists = True ): cmds.deleteUI( "main" ) overUI = cmds.window( "main", title=windowName, mxb=False, s=False ) cmds.window( "main", e=True, wh=( 10, 10 ) , rtf=True, cc='closeProgressBar()' ) cmds.columnLayout( 'layout1', rs=4, adj=True ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| cmds.frameLayout( 'testestes', l=posScriptLabel, cll=1, bgc=frameColor1, p="main", sbm="Translation script", cc=('cmds.window( "main", e=True, h=10, rtf=True )') ) cmds.floatSliderGrp( "s1", l='Smooth', f=True, min=0.0, max=s1Max, fmx=10, v=goalSmooth, cc=('goalSmooth=printSmoothV()'), pre=2, w=slWidth, ann=goalSmoothAnn, cal=(1, "left"), cw3=( 45, 50, 10 ) ) cmds.floatSliderGrp( "s2", l='Scale', f=True, min=0.0, max=s2Max, fmx=10, v=timeScale, cc=('timeScale=printScaleV()'), pre=2, w=slWidth, ann=timeScaleAnn, cal=(1, "left"), cw3=( 45, 50, 10 ) ) cmds.floatSliderGrp( "s3", l='Weight', f=True, min=0.0, max=s3Max, v=goalW, cc=('goalW=printWeightV()'), pre=2, w=slWidth, ann=goalWeightAnn, cal=(1, "left"), cw3=( 45, 50, 10 ) ) cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, rW1), (2, rW2), (3, rW3) ] ) cmds.button( label="RESET VALUES", command=( 'resetTranslation()' ), bgc=yellowButton , h=buttonHeight, ann='Reset all translation values' ) cmds.separator( h=buttonHeight/1.25 , style='none' ) cmds.button( label="RUN TRANSLATION BAKING", command=( 'translationStart()' ), bgc=greenButton , h=buttonHeight ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| cmds.frameLayout( "rotLayout", l=rotScriptLabel, cll=1, bgc=frameColor1, p="main", sbm="Rotation script", cc=('cmds.window( "main", e=True, h=10, rtf=True )') ) cmds.floatSliderGrp( "s4", l='Smooth', f=True, min=0.0, max=s4Max, fmx=10, v=goalSmoothRot, cc=('goalSmoothRot=printRotSmoothV()'), pre=2, w=slWidth, ann=goalSmoothAnn, cal=(1, "left"), cw3=( 45, 50, 10 ) ) cmds.floatSliderGrp( "s5", l='Scale', f=True, min=0.0, max=s5Max, fmx=10, v=timeScaleRot, cc=('timeScaleRot=printRotScaleV()'), pre=2, w=slWidth, ann=timeScaleAnn, cal=(1, "left"), cw3=( 45, 50, 10 ) ) cmds.floatSliderGrp( "s6", l='Weight', f=True, min=0.0, max=s6Max, v=goalWRot, cc=('goalWRot=printRotWeightV()'), pre=2, w=slWidth, ann=goalWeightAnn, cal=(1, "left"), cw3=( 45, 50, 10 ) ) cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, rW1), (2, rW2), (3, rW3) ] ) cmds.button( label="RESET VALUES", command=( 'resetRotation()' ), bgc=yellowButton , h=buttonHeight, ann='Reset all rotation values' ) cmds.separator( h=buttonHeight/1.25 , style='none' ) cmds.button( label="RUN ROTATION BAKING", command=( 'rotationStart()' ), bgc=greenButton , h=buttonHeight ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| cmds.frameLayout( "checkboxLayout", l='OPTIONS', cll=1, bgc=frameColor1, p="main", sbm="Options", cc=('cmds.window( "main", e=True, h=10, rtf=True )') ) cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, rW1), (2, rW2), (3, rW3) ] ) cmds.separator( h=buttonHeight/4 , style='none' ) cmds.separator( h=buttonHeight/4 , style='none' ) cmds.separator( h=buttonHeight/4 , style='none' ) # checkbox � cmds.checkBox( "checkCycle", label="Looping animation", v=cycle, cc=( 'cycle=FuncCheckCycle(); cycleInfinity = cycle;' ), bgc=(Bg1, Bg1, Bg1), ann= '''USE 60 FPS Strong recomended to use animation minimum with 1 phase before and after animation cycle. Simple way to do it just use pre and post infinity with "Cycle" option in graph editor. After baking loop animation on layer will be set cycle infinity''' ) cmds.separator( h=buttonHeight/1.25 , style='none' ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # checkbox � cmds.checkBox( "checkVectorReverse", label="Aim reverse", v=aimVectorReverse, cc=( 'aimVectorReverse=FuncCheckVector()' ), bgc=(Bg1, Bg1, Bg1), ann= '''For reorientation aim for rotation script. May be useful when rotation simulation bake animation with incorrect rotations.''' ) # checkbox � #cmds.checkBox( "checkInfinity", label="Switch to 60 fps", v=False, en=False, cc=( 'print "Work in progress"' ), bgc=(Bg2, Bg2, Bg2), ann="Work in progress" ) #cmds.separator( h=buttonHeight/1.25 , style='none' ) #cmds.checkBox( "test1", label="Merge layers after baking", v=False, en=False, bgc=(Bg2, Bg2, Bg2), ann="Work in progress" ) cmds.separator( style='none' ) cmds.separator( style='none' ) cmds.separator( h=4 , style='none' ) cmds.button( label="RESET OPTIONS", command=( 'resetCheckbox()' ), bgc=yellowButton , h=buttonHeight/1.3, ann='Reset options' ) cmds.separator( h=1 , style='none' ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| cmds.frameLayout( "buttonsLayout", l='BUTTONS PANEL', cll=1, bgc=frameColor1, p="main", sbm="Options", cc=('cmds.window( "main", e=True, h=10, rtf=True )') ) cmds.rowColumnLayout( numberOfColumns=5, columnWidth=[ (1, 70), (2, 70), (3, 50), (4, 70), (5, 70) ], p="buttonsLayout" ) cmds.button( label="RESET ALL", command=( 'resetAllButton()' ), bgc=yellowButton , h=buttonHeight, ann='Reset all values and options in script window' ) cmds.button( label="button", command=( 'print "button 2"' ), en=False, h=buttonHeight, ann='v0.0.7+' ) cmds.button( label="DELETE", command=( 'deleteMainLayer()' ), bgc=redButton , h=buttonHeight, ann='Delete main layer "OVERLAPPY" with all layers inside' ) cmds.button( label="button", command=( 'print "button 4"' ), en=False, h=buttonHeight, ann='v0.0.7+' ) cmds.button( label="MERGE", command=( 'print "button 5"' ), en=False, bgc=blueButton, h=buttonHeight, ann='v0.0.7+\nMerge OVERLAPPY layer with all layers inside into 1 layer' ) cmds.separator( h=4 , style='none' ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| cmds.columnLayout( 'endColumn', rs=4, adj=True, p="main", bgc=endColor1 ) cmds.frameLayout( "informLayout", l='ABOUT', cll=1, bgc=frameColor2, cl=1, p="endColumn", sbm="Options", cc=('cmds.window( "main", e=True, h=10, rtf=True )') ) cmds.text( "Report bugs and leave rewiew please", h=20 ) cmds.text( "vk.com/geneugene3d", hl=True, h=20, bgc=linkColor1 ) cmds.text( "www.artstation.com/geneugene", hl=True, h=20, bgc=linkColor1 ) cmds.text( "www.highend3d.com/users/geneugene", hl=True, h=20, bgc=linkColor2 ) cmds.text( "www.highend3d.com/maya/script/overlappy-for-maya-105076", hl=True, h=20, bgc=linkColor2 ) #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| cmds.showWindow( overUI )
def AnimationmodelUI(): """ Erstellung der GUI fuer die Auswahl der Startposition des Roboterarms auf ein Paket im Regal """ winID = "Animationsmodel" if cmds.window(winID, exists=True): cmds.deleteUI(winID) # Create the window cmds.window("Animationsmodel", title="Auswahl des Animationmodels", h=150, w=400, sizeable=False) # Layout erstellen mainLayout = cmds.columnLayout(w=400, h=150) # # Platzhalter + Strich cmds.separator(style='none', width=50, height=15) # Laying out the rowColumnLayout table1 = cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 10), (2, 380), (3, 10)]) cmds.separator(style='none', width=50) cmds.text( "Waehlen sie die Methode aus welcher die Animation herzustellen ist") cmds.separator(style='none', width=50) # Zurueck zum Hauptlayout cmds.setParent('..') cmds.separator(style='none', width=50, height=15) # Laying out secound rowColumnLayout table2 = cmds.rowColumnLayout(numberOfColumns=5, columnWidth=[(1, 80), (2, 100), (3, 40), (4, 100), (5, 80)]) cmds.separator(style='none', width=80) DirectionControl = cmds.radioCollection() Direction0 = cmds.radioButton(label='Manuell') cmds.separator(style='none', width=40) Direction1 = cmds.radioButton(label='Algorithmisch') cmds.separator(style='none', width=80) # Zurueck zum Hauptlayout cmds.setParent('..') cmds.separator(style='none', width=50, height=20) DirectionControl = cmds.radioCollection(DirectionControl, edit=True, select=Direction1) # Laying out the rowColumnLayout table1 = cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 10), (2, 380), (3, 10)]) def weiter(*_): """ Wird man in die AnimationsGUI weitergefuehrt die man ausgewaehlt hat :param _: metadata des button Commands """ radioCol = cmds.radioCollection(DirectionControl, query=True, sl=True) getSelectRadioVal = cmds.radioButton(radioCol, query=True, label=True) positionUI(getSelectRadioVal) # Schliesst die Init GUI cmds.deleteUI(winID) cmds.separator(style='none', width=50) cmds.button(label='Weiter', command=weiter) cmds.separator(style='none', width=50) # Zurueck zum Hauptlayout cmds.setParent('..') cmds.showWindow(winID)
x_slider = "" y_slider = "" z_slider = "" def createPolySphere(*args): mc.polySphere(r=1, sx=20, ax=(0, 1, 0), cuv=2, ch=1) x_value = mc.floatSliderGrp(x_slider_name, q=True, value=True) y_value = mc.floatSliderGrp(y_slider_name, q=True, value=True) z_value = mc.floatSliderGrp(z_slider_name, q=True, value=True) mc.move(x_value, y_value, z_value, r=True) window = mc.window(title="Polygon Sphere GUI", widthHeight=(200, 55)) mc.columnLayout(adjustableColumn=True) x_slider_name = mc.floatSliderGrp(label="Move X", field=True, minValue=-10.0, maxValue=10.0, value=0.0) y_slider_name = mc.floatSliderGrp(label="Move Y", field=True, minValue=-10.0, maxValue=10.0, value=0.0) z_slider_name = mc.floatSliderGrp(label="Move Z", field=True, minValue=-10.0, maxValue=10.0,
print jointList cmds.select(jointList) cmds.select('L_Palm', 'R_Palm', add = True) cmds.sets (n= 'BindThisToHands') cmds.select (cl = True) imagePath = cmds.internalVar(usd = True) Path = imagePath + 'RdMTools/' Icons = Path + 'icons/' #Window cmds.window( "AutoHandV2", width=250, title="AutoHands", toolbox = True ) cmds.columnLayout( adjustableColumn=True ) cmds.separator (h = 15) cmds.frameLayout( label='Fingers' ) cmds.rowLayout(nc = 5) ThumbCheck=cmds.checkBox (l = 'Thumb', v = 1, hlc = (1,0,0)) IndexCheck=cmds.checkBox (l = 'Index', v = 1, hlc = (1,0,0)) MiddleCheck=cmds.checkBox (l = 'Middle', v = 1, hlc = (1,0,0)) RingCheck=cmds.checkBox (l = 'Ring', v = 1, hlc = (1,0,0)) PinkyCheck=cmds.checkBox (l = 'Pinky', v = 1, hlc = (1,0,0)) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.columnLayout (adj = True) cmds.separator (h = 15)
def openGui(self, *args): winName = "commandsWindow" height = 26 commands = [] names = [] hotkeysDict = [[]] allHotkeys = hotkeys.getHotkeys() totalItems = sum(len(x) for x in allHotkeys) itemsCount = 0 aB = 0 totalColums = 2 for n, loopHotkey in enumerate(allHotkeys): if itemsCount > (totalItems / totalColums) * (aB + 1): aB += 1 hotkeysDict.append([]) itemsCount += len(loopHotkey) for loopItem in loopHotkey: hotkeysDict[aB].append(loopItem) hotkeysDict[aB][-1]["colorValue"] = self.colorValues[ self.allColors[n]] if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName) window = cmds.window(winName, title="Commands and Hotkeys") mainLayout = cmds.columnLayout(adjustableColumn=True) columnsLayout = cmds.rowColumnLayout(numberOfColumns=totalColums) for loopColumn in xrange(totalColums): parent = cmds.rowColumnLayout(numberOfColumns=7, columnSpacing=([2, 5], [3, 3], [4, 3], [5, 1], [6, 5], [7, 5]), parent=columnsLayout) cmds.text(label='Command', h=height) cmds.text(label='Ctl', h=height) cmds.text(label='Alt', h=height) cmds.text(label='Key', h=height) cmds.text(label='', h=height) cmds.text(label='Set Hotkey', h=height) cmds.text(label='Assigned to', align="left", h=height) for loopIndex, loopCommand in enumerate(hotkeysDict[loopColumn]): command = loopCommand["command"] name = loopCommand["name"] key = loopCommand["hotkey"] alt = loopCommand["alt"] ctl = loopCommand["ctl"] toolTip = loopCommand["toolTip"] color = loopCommand["colorValue"] hotkeyData = aToolsMod.loadInfoWithUser("hotkeys", name) if hotkeyData != None: key = hotkeyData[0] alt = hotkeyData[1] ctl = hotkeyData[2] cmds.button("command%s" % name, label=utilMod.toTitle(name), command=command, annotation=toolTip, h=height, bgc=color, parent=parent) cmds.checkBox('ctl%s' % name, label='', value=ctl, changeCommand=lambda x, name=name, *args: self. updateHotkeyCheck(name), h=height, parent=parent) cmds.checkBox('alt%s' % name, label='', value=alt, changeCommand=lambda x, name=name, *args: self. updateHotkeyCheck(name), h=height, parent=parent) cmds.scrollField('key%s' % name, w=80, text=key, keyPressCommand=lambda x, name=name, *args: self.updateHotkeyCheck(name), h=height, parent=parent) cmds.button(label=" ", h=height, parent=parent) self.popSpecialHotkeys(name) cmds.button( label='>', command=lambda x, name=name, command=command, *args: self. setHotkey(self.getHotkeyDict([name], [command])), h=height, parent=parent) cmds.text("query%s" % name, align="left", label=self.hotkeyCheck(key, ctl, alt), font="plainLabelFont", h=height, parent=parent) commands.append(command) names.append(name) #cmds.button(label="Set Hotkey", command=lambda *args: getHotkeyDict([name], [command], [key], [alt], [ctl], [cmd])) self.updateHotkeyCheck(name) #cmds.rowLayout(numberOfColumns=2, columnAttach=([1, 'left', 0],[2, 'right', 0]), adjustableColumn=2) cmds.button(label="Load Defaults", command=lambda *args: self.loadHotkeys(True), parent=mainLayout) cmds.button(label="Set All Hotkeys", command=lambda *args: self.setHotkey( self.getHotkeyDict(names, commands)), parent=mainLayout) cmds.showWindow(window)
def main(self): cmds.columnLayout(adj=1, cal='center', rs=3) cmds.separator(h=1, st=SEPARATOR_STYLE) cmds.text(l=u'Add', bgc=BG_COLOR) cmds.setParent('..') cmds.rowColumnLayout(nc=2) cmds.radioCollection('addNumberType') cmds.radioButton('add_string', l=u'Add string') cmds.textField('addString', tx=u'', ann=u'enter additional string', rfc=partial(selRadioButton, 'add_string')) cmds.radioButton('add_serial_number', l=u'Serial number:(01,02..)') cmds.radioButton('add_sereal_alphabet', l=u'Serial number:(AA,AB..)') cmds.setParent('..') cmds.rowColumnLayout(nr=1) cmds.text(l=u' Serial number padding ') cmds.textField('add_paddingNumber', tx=2, ann=u'enter padding number(integer)') cmds.setParent('..') cmds.columnLayout(adj=1, cal='center', rs=3) cmds.separator(h=SEPARATOR_HIGH, st=SEPARATOR_STYLE) cmds.setParent('..') cmds.rowColumnLayout(nc=2) cmds.radioCollection('addType') cmds.radioButton('top', l=u'Add to lead ') cmds.radioButton('bottom', l=u'Add to end') cmds.setParent('..') cmds.rowColumnLayout(nc=3) cmds.radioButton('topFrom', l=u'From lead to') cmds.textField('topFromPoint', tx=u'', rfc=partial(selRadioButton, 'topFrom'), ann=u'enter number') cmds.text(l=u'th ') cmds.radioButton('bottomFrom', l=u'From end to') cmds.textField('bottomFromPoint', tx=u'', rfc=partial(selRadioButton, 'bottomFrom'), ann=u'enter number') cmds.text(l=u'th ') cmds.setParent('..') cmds.columnLayout(adj=1, cal='center', rs=3) cmds.button(l=u'Execute addition', c=partial(addString)) cmds.separator(h=SEPARATOR_HIGH, st=SEPARATOR_STYLE) cmds.text(l=u'Delete', bgc=BG_COLOR) cmds.rowColumnLayout(nc=3) cmds.radioCollection('removeType') cmds.radioButton('removeSpecific', l=u'String') cmds.textField('removeString', tx=u'', rfc=partial(selRadioButton, 'removeSpecific'), ann=u'enter string to delete e.g.:pSphere') cmds.text(l=u'') cmds.radioButton('removeTopFrom', l=u'From lead to') cmds.textField('removeTopFromPoint', tx=u'', rfc=partial(selRadioButton, 'removeTopFrom'), ann=u'number') cmds.text(l=u'th ') cmds.radioButton('removeBottomFrom', l=u'From end to') cmds.textField('removeBottomFromPoint', tx=u'', rfc=partial(selRadioButton, 'removeBottomFrom'), ann=u'number') cmds.text(l=u'th ') cmds.setParent('..') cmds.button(l=u'Execute deletion', c=partial(removeString)) cmds.separator(h=SEPARATOR_HIGH, st=SEPARATOR_STYLE) cmds.button(l=u'Delete name space', c=partial(deleteNamespaece)) cmds.separator(h=SEPARATOR_HIGH, st=SEPARATOR_STYLE) cmds.text(l=u'Replace', bgc=BG_COLOR) cmds.setParent('..') cmds.rowColumnLayout(nr=1) cmds.textField('targetString', tx=u'') cmds.text(l=u' is replaced by ') cmds.textField('replaceString', tx=u'') cmds.text(l=u' ') cmds.setParent('..') cmds.columnLayout(adj=1, cal='center', rs=3) cmds.button(l=u'Execute replacement', c=partial(replaceString)) cmds.separator(h=SEPARATOR_HIGH, st=SEPARATOR_STYLE) cmds.text(l=u'New', bgc=BG_COLOR) cmds.setParent('..') cmds.rowColumnLayout(nr=1) cmds.text(l=u' New name ') cmds.textField('newNameString', tx=u'', ann=u'enter new name you want') cmds.setParent('..') cmds.rowColumnLayout(nr=1) cmds.radioCollection('numberType') cmds.radioButton('serial_number', l=u'Serial number:(01,02..)') cmds.radioButton('sereal_alphabet', l=u'Serial number:(AA,AB..)') cmds.setParent('..') cmds.rowColumnLayout(nr=1) cmds.text(l=u' Serial number padding ') cmds.textField('paddingNumber', tx=2, ann=u'enter padding number(integer)') cmds.setParent('..') cmds.columnLayout(adj=1, cal='center', rs=3) cmds.button(l=u'Execute new name', ann=u'', c=partial(setNewName)) cmds.separator(h=SEPARATOR_HIGH, st=SEPARATOR_STYLE) cmds.text(l=u'') cmds.text( l=u'**Notice** Only selected objects are subject to processing') cmds.setParent('..')
def ipMoverUI(): if (cmds.window('zbw_ipMoverUI', exists=True)): cmds.deleteUI('zbw_ipMoverUI', window=True) cmds.windowPref('zbw_ipMoverUI', remove=True) window = cmds.window('zbw_ipMoverUI', widthHeight=(400, 200), title='zbw_imagePlane') cmds.columnLayout('zbw_ipmMainColumn') cam = cmds.ls(sl=True, dag=True, s=True, type="camera") if cam: ip = cmds.listConnections(cam[0], type="imagePlane") if ip: imagePlane = ip[0] ipText = imagePlane else: cmds.warning("there's no image plane on this camera") ipText = "no image plane" else: cmds.warning("select a camera") ipText = "no image plane" cmds.text(ipText) cmds.separator(h=20, style="double") if cam and ip: #---------------store original values somewhere . . . cmds.floatSliderGrp("alphaFSG", label='alpha', cal=[1, "left"], cw3=[50, 50, 300], width=400, field=True, minValue=0, maxValue=1, fieldMinValue=0, fieldMaxValue=1, value=1, pre=3, dc=partial(changeValue, (imagePlane + ".alphaGain"), "alphaFSG")) cmds.separator(h=20, style="double") cmds.floatSliderGrp("centerXFSG", label='centerX', cal=[1, "left"], cw3=[50, 50, 300], width=400, field=True, minValue=-20.0, maxValue=20.0, fieldMinValue=-100.0, fieldMaxValue=100.0, value=0, pre=3, dc=partial(changeValue, (imagePlane + ".centerX"), "centerXFSG")) cmds.floatSliderGrp("centerYFSG", label='centerY', cal=[1, "left"], cw3=[50, 50, 300], width=400, field=True, minValue=-20.0, maxValue=20.0, fieldMinValue=-100.0, fieldMaxValue=100.0, value=0, pre=3, dc=partial(changeValue, (imagePlane + ".centerY"), "centerYFSG")) cmds.floatSliderGrp("centerZFSG", label='centerZ', cal=[1, "left"], cw3=[50, 50, 300], width=400, field=True, minValue=-20.0, maxValue=20.0, fieldMinValue=-100.0, fieldMaxValue=100.0, value=0, pre=3, dc=partial(changeValue, (imagePlane + ".centerZ"), "centerZFSG")) cmds.floatSliderGrp("widthFSG", label='width', cal=[1, "left"], cw3=[50, 50, 300], width=400, field=True, minValue=0, maxValue=20.0, fieldMinValue=0, fieldMaxValue=100.0, pre=3, dc=partial(changeValue, (imagePlane + ".width"), "widthFSG")) cmds.floatSliderGrp("heightFSG", label='height', cal=[1, "left"], cw3=[50, 50, 300], width=400, field=True, minValue=0, maxValue=20.0, fieldMinValue=0, fieldMaxValue=100.0, pre=3, dc=partial(changeValue, (imagePlane + ".height"), "heightFSG")) cmds.showWindow(window) cmds.window('zbw_ipMoverUI', e=True, w=400, h=200)
def call_ui(): # def reassignMat_MainWindow(): if mc.window("reassignMatWin", exists=True): mc.deleteUI("reassignMatWin") main_win = mc.window('reassignMatWin', title="Reassing materials") main_fl = mc.formLayout('mainFL') # main_clm = mc.columnLayout('main_CLM',w=600,adjustableColumn=True) main_rly = mc.rowLayout('mainRL', numberOfColumns=3, w=880, p=main_fl, rowAttach=[(3, 'top', 0)]) # ======= list corect objes shaders========== src_clm = mc.columnLayout('src_CLM', columnAttach=('both', 5), rowSpacing=10, p=main_rly, adjustableColumn=True) mc.textScrollList('srcShdTSL', parent=src_clm, sc='ins_rs.sel_item_cmd()') listSrcSdCmdStr = 'import OCT_Pipeline.scripts.Minor.Ppl_ReassignMaterial_Ben as prmat\nins_rs = prmat.PPC_ReassignMatUI()\nins_rs.lfbt_cmd()' mc.button('addSource', label='List From Object shaders', p=src_clm, c=listSrcSdCmdStr) # ======== list selected dst objectes==================== trg_clm = mc.columnLayout('trg_CLM', columnAttach=('both', 5), rowSpacing=10, p=main_rly, adjustableColumn=True) mc.textScrollList('trgObjsTSL', parent=trg_clm, sc='ins_rs.sel_dst_itme_cmd()') mc.button('adddst', label='To objects', p=trg_clm, c='ins_rs.update_dstList()') mc.textFieldButtonGrp('filterTFB', label='filter key word', buttonLabel='filter/Back', p=trg_clm, bc='ins_rs.filterBTCMD()', cw3=[80, 100, 120]) # mc.setParent('..') # ==================list dst object's shaders===================== trg_lst_clm = mc.columnLayout('trg_lst_CLM', columnAttach=('both', 5), rowSpacing=10, p=main_rly, adjustableColumn=True, w=350) mc.text('lstTX', label='old shaders list', p=trg_lst_clm, al='left') mc.textScrollList('trgShdTSL', parent=trg_lst_clm, w=300, sc='ins_rs.sel_item_cmd(\'dst\')') mc.textFieldGrp('keywordTFG', label='keyword', text='', columnAlign=[1, 'left'], columnWidth2=[75, 250], w=250, p=trg_lst_clm) bt_grps = mc.rowLayout('bt_GRPS', numberOfColumns=3, columnWidth3=[400, 300, 300], columnOffset3=[15, 120, 60], p=main_fl) mc.button('atbt', label='AutoReassign[Model Match 100]', p=bt_grps, w=250, c='ins_rs.auto_reassign()') runbt = mc.button('runButon', label='reassign', p=bt_grps, w=250, c='ins_rs.Reassing_btcmd()') all_cb = mc.checkBox( 'allcb', label='other objects do the same ', p=bt_grps, w=150, ) # adjust layout elements mc.formLayout(main_fl, edit=True, attachForm=[(main_rly, 'top', 5)], attachControl=[(bt_grps, 'top', 15, main_rly)]) mc.window(main_win, e=True, wh=(850, 300), rtf=True, sizeable=False) mc.showWindow(main_win)
cycle = False # Проверка цикла pRad = 0.253 # Размер меша частицы pShape = 4 # Тип отображения частицы asT = cmds.playbackOptions(query=True, min=True) # Левая граница анимации aeT = cmds.playbackOptions(query=True, max=True) # Правая граница анимации #################################################################################################################### #"https://vk.com/geneugene3d" if cmds.window("main", exists=True): cmds.deleteUI("main") overUI = cmds.window("main", title='PosOverlapper v0.07', mxb=False, s=False) cmds.columnLayout(rs=5) cmds.text(l=" Just run this script", h=30, hl=True, ann="This is my first script") cmds.floatSliderGrp("s1", l='Smooth', f=True, min=0.0, max=6.0, fmx=10, v=goalSmooth, cc=('goalSmooth=printSmoothV()'), pre=1,
import maya.cmds as cmds
def build_gui_auto_fk(): ''' Builds the UI for the script GT Auto FK ''' window_name = "build_gui_auto_fk" if cmds.window(window_name, exists=True): cmds.deleteUI(window_name) # Main GUI Start Here ================================================================================= build_gui_auto_fk = cmds.window(window_name, title=script_name + " (v" + script_version + ')',\ titleBar=True, mnb=False, mxb=False, sizeable =True) cmds.window(window_name, e=True, s=True, wh=[1, 1]) content_main = cmds.columnLayout() # Title Text title_bgc_color = (.4, .4, .4) cmds.separator(h=10, style='none') # Empty Space cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 10)], p=content_main) # Window Size Adjustment cmds.rowColumnLayout(nc=3, cw=[(1, 10), (2, 200), (3, 50)], cs=[(1, 10), (2, 0), (3, 0)], p=content_main) # Title Column cmds.text(" ", bgc=title_bgc_color) # Tiny Empty Green Space cmds.text(script_name, bgc=title_bgc_color, fn="boldLabelFont", align="left") cmds.button(l="Help", bgc=title_bgc_color, c=lambda x: build_gui_help_auto_FK()) cmds.separator(h=10, style='none', p=content_main) # Empty Space # Body ==================== body_column = cmds.rowColumnLayout(nc=1, cw=[(1, 260)], cs=[(1, 10)], p=content_main) cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 13)], p=body_column) check_boxes_one = cmds.checkBoxGrp(columnWidth2=[120, 1], numberOfCheckBoxes=2, \ label1 = 'Mimic Hierarchy', label2 = 'Constraint Joint ', \ v1 = gt_auto_fk_settings.get('mimic_hierarchy'), \ v2 = gt_auto_fk_settings.get('constraint_joint'),\ cc1=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_mimic_hierarchy', cmds.checkBoxGrp(check_boxes_one, q=True, value1=True)),\ cc2=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_constraint_joint', cmds.checkBoxGrp(check_boxes_one, q=True, value2=True))) cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 13)], p=body_column) check_boxes_two = cmds.checkBoxGrp(columnWidth2=[120, 1], numberOfCheckBoxes=2, \ label1 = 'Colorize Controls', label2 = "Select Hierarchy ", \ v1 = gt_auto_fk_settings.get("auto_color_ctrls"), \ v2 = gt_auto_fk_settings.get("select_hierarchy"),\ cc1=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_auto_color_ctrls', cmds.checkBoxGrp(check_boxes_two, q=True, value1=True)),\ cc2=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_select_hierarchy', cmds.checkBoxGrp(check_boxes_two, q=True, value2=True))) cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 0)], p=body_column) cmds.separator(h=10) cmds.separator(h=5, style='none') # Empty Space # Customize Control cmds.rowColumnLayout(nc=1, cw=[(1, 230)], cs=[(1, 0)], p=body_column) ctrl_curve_radius_slider_grp = cmds.floatSliderGrp( cw=[(1, 100),(2, 50),(3, 10)], label='Curve Radius: ', field=True, value=float(gt_auto_fk_settings.get('curve_radius')), \ cc=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_curve_radius', str(cmds.floatSliderGrp(ctrl_curve_radius_slider_grp, q=True, value=True))),\ en=not gt_auto_fk_settings.get('using_custom_curve')) cmds.separator(h=7, style='none') # Empty Space cmds.rowColumnLayout(nc=1, cw=[(1, 230)], cs=[(1, 13)], p=body_column) cmds.button('gt_auto_fk_custom_curve_btn', l="(Advanced) Custom Curve", c=lambda x: define_custom_curve()) if gt_auto_fk_settings.get( 'using_custom_curve') == True and gt_auto_fk_settings.get( 'failed_to_build_curve') == False: cmds.button('gt_auto_fk_custom_curve_btn', e=True, l='ACTIVE - Custom Curve', bgc=[0, .1, 0]) cmds.rowColumnLayout(nc=1, cw=[(1, 270)], cs=[(1, 0)], p=body_column) cmds.separator(h=5, style='none') # Empty Space cmds.separator(h=10) # Text Fields cmds.rowColumnLayout(nc=3, cw=[(1, 70), (2, 75), (3, 100)], cs=[(1, 5), (2, 0)], p=body_column) cmds.text("Joint Tag:") cmds.text("Control Tag:") cmds.text("Control Grp Tag:") joint_tag_text_field = cmds.textField(text = gt_auto_fk_settings.get('string_joint_suffix'), \ enterCommand=lambda x:generate_fk_controls(),\ cc=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_string_joint_suffix', cmds.textField(joint_tag_text_field, q=True, text=True))) ctrl_tag_text_field = cmds.textField(text = gt_auto_fk_settings.get('string_ctrl_suffix'), enterCommand=lambda x:generate_fk_controls(),\ cc=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_string_ctrl_suffix', cmds.textField(ctrl_tag_text_field, q=True, text=True))) ctrl_grp_tag_text_field = cmds.textField(text = gt_auto_fk_settings.get('string_ctrl_grp_suffix'), enterCommand=lambda x:generate_fk_controls(),\ cc=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_string_ctrl_grp_suffix', cmds.textField(ctrl_grp_tag_text_field, q=True, text=True))) cmds.rowColumnLayout(nc=1, cw=[(1, 260)], cs=[(1, 0)], p=body_column) cmds.separator(h=10) cmds.separator(h=5, style='none') # Empty Space cmds.text(label='Ignore Joints Containing These Strings:') cmds.rowColumnLayout(nc=1, cw=[(1, 245)], cs=[(1, 5)], p=body_column) undesired_strings_text_field = cmds.textField(text=gt_auto_fk_settings.get('undesired_strings'), enterCommand=lambda x:generate_fk_controls(),\ cc=lambda x:set_persistent_settings_auto_fk('gt_auto_fk_undesired_strings', cmds.textField(undesired_strings_text_field, q=True, text=True))) cmds.rowColumnLayout(nc=1, cw=[(1, 260)], cs=[(1, 0)], p=body_column) cmds.text(label='(Use Commas to Separate Strings)') cmds.separator(h=5, style='none') # Empty Space cmds.separator(h=10) cmds.separator(h=10, style='none') # Empty Space cmds.button(l="Generate", bgc=(.6, .6, .6), c=lambda x: generate_fk_controls()) cmds.separator(h=10, style='none') # Empty Space # Generate FK Main Function Starts -------------------------------------------- def generate_fk_controls(): ''' Generate FK Controls. This is the main function of this script. It will create a curve, and according to the settings use it as a control for the selected joint. ''' cmds.undoInfo(openChunk=True, chunkName='Auto Generate FK Ctrls') try: errors = '' ctrl_curve_radius = cmds.floatSliderGrp( ctrl_curve_radius_slider_grp, q=True, value=True) selected_joints = cmds.ls(selection=True, type='joint', long=True) if cmds.checkBoxGrp(check_boxes_two, q=True, value2=True): cmds.select(hierarchy=True) selected_joints = cmds.ls(selection=True, type='joint', long=True) ctrl_tag = parse_text_field( cmds.textField(ctrl_tag_text_field, q=True, text=True))[0] ctrl_grp_tag = parse_text_field( cmds.textField(ctrl_grp_tag_text_field, q=True, text=True))[0] joint_tag = parse_text_field( cmds.textField(joint_tag_text_field, q=True, text=True))[0] undesired_jnt_strings = parse_text_field( cmds.textField(undesired_strings_text_field, q=True, text=True)) undesired_joints = [] # Find undesired joints and make a list of them for jnt in selected_joints: for string in undesired_jnt_strings: if string in get_short_name(jnt): undesired_joints.append(jnt) # Remove undesired joints from selection list for jnt in undesired_joints: if jnt in undesired_joints: selected_joints.remove(jnt) for jnt in selected_joints: if len(joint_tag) != 0: joint_name = get_short_name(jnt).replace(joint_tag, '') else: joint_name = get_short_name(jnt) ctrl_name = joint_name + ctrl_tag ctrlgrp_name = joint_name + ctrl_grp_tag if gt_auto_fk_settings.get("using_custom_curve"): ctrl = create_custom_curve( gt_auto_fk_settings.get("custom_curve")) try: ctrl = [cmds.rename(ctrl, ctrl_name)] except: ctrl = cmds.circle(name=ctrl_name, normal=[1, 0, 0], radius=ctrl_curve_radius, ch=False) # Default Circle Curve if gt_auto_fk_settings.get("failed_to_build_curve"): ctrl = cmds.circle(name=ctrl_name, normal=[1, 0, 0], radius=ctrl_curve_radius, ch=False) # Default Circle Curve else: ctrl = cmds.circle(name=ctrl_name, normal=[1, 0, 0], radius=ctrl_curve_radius, ch=False) # Default Circle Curve grp = cmds.group(name=ctrlgrp_name, empty=True) try: cmds.parent(ctrl, grp) constraint = cmds.parentConstraint(jnt, grp) cmds.delete(constraint) except Exception as e: errors = errors + str(e) # Colorize Control Start ------------------ if cmds.checkBoxGrp(check_boxes_two, q=True, value1=True): try: cmds.setAttr(ctrl[0] + ".overrideEnabled", 1) if ctrl[0].lower().startswith( 'right_') or ctrl[0].lower().startswith('r_'): cmds.setAttr(ctrl[0] + ".overrideColor", 13) #Red elif ctrl[0].lower().startswith( 'left_') or ctrl[0].lower().startswith('l_'): cmds.setAttr(ctrl[0] + ".overrideColor", 6) #Blue else: cmds.setAttr(ctrl[0] + ".overrideColor", 17) #Yellow except Exception as e: errors = errors + str(e) # Colorize Control End --------------------- # Constraint Joint if cmds.checkBoxGrp(check_boxes_one, q=True, value2=True): try: cmds.parentConstraint(ctrl_name, jnt) except Exception as e: errors = errors + str(e) + '\n' # Mimic Hierarchy if cmds.checkBoxGrp(check_boxes_one, q=True, value1=True): try: #Auto parents new controls # "or []" Accounts for root joint that doesn't have a parent, it forces it to be a list jnt_parent = cmds.listRelatives(jnt, allParents=True) or [] if len(jnt_parent) == 0: pass else: if len(joint_tag) != 0: parent_ctrl = ( jnt_parent[0].replace(joint_tag, "") + ctrl_tag) else: parent_ctrl = (jnt_parent[0] + ctrl_tag) if cmds.objExists(parent_ctrl): cmds.parent(grp, parent_ctrl) except Exception as e: errors = errors + str(e) + '\n' # Print Errors if necessary if errors != '': print('#' * 80) print(errors) print('#' * 80) cmds.warning(gt_auto_fk_settings.get('error_message')) except Exception as e: cmds.warning(str(e)) finally: cmds.undoInfo(closeChunk=True, chunkName='Auto Generate FK Ctrls') # Generate FK Main Function Ends -------------------------------------------- # Define Custom Curve def define_custom_curve(): '''Asks the user for input. Uses this input as a custom curve (by storing it in the settings dictionary)''' if gt_auto_fk_settings.get( 'custom_curve') == gt_auto_fk_settings_default_values.get( 'custom_curve'): textfield_data = '' else: textfield_data = str(gt_auto_fk_settings.get('custom_curve')) result = cmds.promptDialog( scrollableField=True, title='Py Curve', message= 'Paste Python Curve Below: \n(Use \"GT Generate Python Curve \" to extract it from an existing curve)', button=['OK', 'Use Default'], defaultButton='OK', cancelButton='Use Default', dismissString='Use Default', text=textfield_data) if result == 'OK': if cmds.promptDialog(query=True, text=True) != '': gt_auto_fk_settings["custom_curve"] = cmds.promptDialog( query=True, text=True) gt_auto_fk_settings["using_custom_curve"] = True gt_auto_fk_settings["failed_to_build_curve"] = False cmds.floatSliderGrp(ctrl_curve_radius_slider_grp, e=True, en=False) # Update Persistent Settings set_persistent_settings_auto_fk( 'gt_auto_fk_custom_curve', str(cmds.promptDialog(query=True, text=True))) set_persistent_settings_auto_fk( 'gt_auto_fk_using_custom_curve', True) set_persistent_settings_auto_fk( 'gt_auto_fk_failed_to_build_curve', False) cmds.button('gt_auto_fk_custom_curve_btn', e=True, l='ACTIVE - Custom Curve', bgc=[0, .1, 0]) else: gt_auto_fk_settings["using_custom_curve"] = False cmds.floatSliderGrp(ctrl_curve_radius_slider_grp, e=True, en=True) gt_auto_fk_settings[ 'custom_curve'] = gt_auto_fk_settings_default_values.get( 'custom_curve') cmds.button('gt_auto_fk_custom_curve_btn', e=True, l="(Advanced) Custom Curve", nbg=False) # Update Persistent Settings set_persistent_settings_auto_fk('gt_auto_fk_using_custom_curve', False) # Show and Lock Window cmds.showWindow(build_gui_auto_fk) cmds.window(window_name, e=True, s=False) # Set Window Icon qw = omui.MQtUtil.findWindow(window_name) if python_version == 3: widget = wrapInstance(int(qw), QWidget) else: widget = wrapInstance(long(qw), QWidget) icon = QIcon(':/kinInsert.png') widget.setWindowIcon(icon)
def populateWindow(): """This function add the UI elements to the window""" # Main layout for UI mainLayout = cmds.columnLayout() # ----------------------------------- Locator Creation ----------------------------------------- # Frame layout for locators cmds.frameLayout(label="Locators") cmds.text(align="left", font="boldLabelFont", label="Create locators to define tread's radius.") cmds.text(align="left", label="Select objects to adjust the locators to their bounding box automatically.") # Setting the columns to 3 so the buttons can be centered # - separator - button - separator cmds.rowLayout(numberOfColumns=3, columnWidth3=(150,200,150)) cmds.separator(width=150, style="none") cmds.button(label="Initialize", command=initFunc, width=200, annotation="Click to create locators to define Tread's radius", statusBarMessage="Click to create locators to define Tread's radius") cmds.separator(width=150, style="none") # Get out of rowLayout cmds.setParent("..") # Add separator at the end of frame layout cmds.separator(h=5) # Get out of Locator's frame layout cmds.setParent('..') # ----------------------------------- Circle Creation ----------------------------------------- # Frame layout for Curve creation cmds.frameLayout(label="Curve") cmds.text(align="left", font="boldLabelFont", label="Create circle using locators.") cmds.intSliderGrp("curveQuality", label="Curve quality", field=True, value=6, minValue=6, maxValue=20, annotation="This is the number of points the curve will have to modify its shape.", statusBarMessage="This is the number of points the curve will have to modify its shape.") # Setting the columns to 3 so the buttons can be centered # - separator - button - separator cmds.rowLayout(numberOfColumns=3, columnWidth3=(150,200,150)) cmds.separator(width=150, style="none") cmds.button(label="Make Curve", c=makeTread, width=200, annotation="Click to create a nurbs cirlce between the locators.", statusBarMessage="Click to create a nurbs cirlce between the locators.") cmds.separator(width=150, style="none") # Get out of rowLayout cmds.setParent("..") # Add separator at the end of frame layout cmds.separator(h=5) # Get out of curve's frame layout cmds.setParent('..') # ----------------------------------- Tread Creation ----------------------------------------- # Frame layout for tread mesh creation cmds.frameLayout(label="Making Tread") cmds.text(align="left", font="boldLabelFont", label="Tread mesh creation") def updateUI(value): """Nested function that updates the UI depending on the creation method""" # Update elements cmds.checkBox("useProxy",e=True, en=not value) cmds.checkBox("bboxCheck",e=True, en=not value) cmds.intSliderGrp("treadAmount",e=True, en=not value) # Make sure the text Field is enable when using the premade geo method if not value: proxyGeo = cmds.checkBox("useProxy", query=True, value=True) cmds.textFieldButtonGrp("treadName",e=True, en=not proxyGeo) usebbox = cmds.checkBox("bboxCheck", query=True, value=True) cmds.intSliderGrp("treadAmount",e=True, en=not usebbox) else: cmds.textFieldButtonGrp("treadName",e=True, en=value) # Radio Buttons for choosing between piece or whole mesh cmds.gridLayout(numberOfColumns=2, cellWidth=250) cmds.radioCollection() cmds.radioButton("premadeGeo", label="Previously created geometry", cc= lambda value: updateUI(value), enable=False, annotation="Use already created mesh tread. (WIP)", statusBarMessage="Use already created mesh tread. (WIP)") cmds.radioButton(label="Make tread from a piece", select=True, annotation="Use a geometry to duplicate around the circle.", statusBarMessage="Use a geometry to duplicate around the circle.") cmds.setParent('..') # Layout for creation methods cmds.gridLayout("treadGridLO", numberOfColumns=1, cellWidth=500) # Checkbox to decide if using a Proxy (default) geometry cmds.checkBox("useProxy", label="Create Proxy Geo", cc= lambda value: cmds.textFieldButtonGrp("treadName",e=True, en=not value), annotation="Use a default tread piece.", statusBarMessage="Use a default tread piece.") # This textField saves the name of the piece that the user wants to duplicate around the circle cmds.textFieldButtonGrp("treadName", buttonLabel="Pick Selected", bc=pickingObj, placeholderText="Selected Mesh", annotation="Use a default tread piece.", statusBarMessage="Use a default tread piece.") # Checkbox to decide if using the piece's bounding box to calculate the amount of duplicates cmds.checkBox("bboxCheck", label="Use piece's bounding box", cc= lambda value: cmds.intSliderGrp("treadAmount",e=True, en=not value), annotation="Use piece's measures to calculate the amount of pieces around the circle", statusBarMessage="Use piece's measures to calculate the amount of pieces around the circle") # Amount of pieces around the circle cmds.intSliderGrp("treadAmount", l="Amount of treads", f=True, v=20, minValue=1, maxValue=500, cc=RemakeTread, annotation="Define how many pieces to create around the circle", statusBarMessage="Define how many pieces to create around the circle") # Setting the columns to 3 so the buttons can be centered # - separator - button - separator cmds.rowLayout(numberOfColumns=3, columnWidth3=(150,200,150)) cmds.separator(width=150, style="none") cmds.button(label="Make Tread Mesh", c=makeTreadObj, width=200, annotation="Create tread's mesh aroung circle using chose parameters.", statusBarMessage="Create tread's mesh aroung circle using chose parameters.") cmds.separator(width=150, style="none") cmds.setParent('..') cmds.setParent('..') cmds.separator(h=5) cmds.text(align="left", font="boldLabelFont", label="Finalize before modifying the curve points") cmds.text(align="left", label="Create main controller and curvePoints controllers") # Setting the columns to 3 so the buttons can be centered # - separator - button - separator cmds.rowLayout(numberOfColumns=3, columnWidth3=(150,200,150)) cmds.separator(width=150, style="none") cmds.button(l="Finalize", c=finalizeTread, width=200, annotation="Finalize by creating controllers on the curve.", statusBarMessage="Finalize by creating controllers on the curve.") cmds.separator(width=150, style="none") cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') return mainLayout
def __init__(self): #get access to our maya tools toolsPath = cmds.internalVar(usd=True) + "mayaTools.txt" if os.path.exists(toolsPath): f = open(toolsPath, 'r') self.mayaToolsDir = f.readline() f.close() #create a dictionary for our UI widgets self.widgets = {} #create window if cmds.window("addCharacter_UI", exists=True): cmds.deleteUI("addCharacter_UI") self.widgets["window"] = cmds.window("addCharacter_UI", title="Add Character", w=430, h=260, sizeable=True, mxb=False, mnb=False) #create the main layout main = cmds.columnLayout(w=430) #banner image cmds.image(w=430, h=50, image=self.mayaToolsDir + "/General/Icons/ART/artBanner430px.bmp", parent=main) self.widgets["formLayout"] = cmds.formLayout(w=430, h=260, parent=main) #create the widgets self.widgets["project"] = cmds.optionMenu(label="Project:", w=200, cc=self.findCharacterRigs) self.widgets["search"] = cmds.textFieldGrp(label="Search:", cl2=["left", "left"], ct2=["left", "left"], cw2=[40, 160], text="coming soon", enable=False) self.widgets["characterList"] = cmds.textScrollList( allowMultiSelection=False, w=200, h=180, selectCommand=self.findCharacterThumbnail) self.widgets["thumbnailBorder"] = cmds.image(w=210, h=210, image="", ebg=True, bgc=[0, 0, 0]) self.widgets["thumbnail"] = cmds.image(w=200, h=200, image="") self.widgets["addButton"] = cmds.button(label="Add", w=60, c=partial( self.addCharacter, False)) self.widgets["addButton2"] = cmds.button(label="Add and Close", w=80, c=partial( self.addCharacter, True)) self.widgets["cancelButton"] = cmds.button(label="Cancel", w=60, c=self.cancel) #attach widgets cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["project"], 'top', 10), (self.widgets["project"], 'left', 10)]) cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["search"], 'top', 40), (self.widgets["search"], 'left', 10)]) cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["characterList"], 'top', 70), (self.widgets["characterList"], 'left', 10)]) cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["thumbnailBorder"], 'top', 5), (self.widgets["thumbnailBorder"], 'right', 5)]) cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["thumbnail"], 'top', 10), (self.widgets["thumbnail"], 'right', 10)]) cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["addButton"], 'bottom', 10), (self.widgets["addButton"], 'left', 215)]) cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["addButton2"], 'bottom', 10), (self.widgets["addButton2"], 'left', 280)]) cmds.formLayout(self.widgets["formLayout"], edit=True, af=[(self.widgets["cancelButton"], 'bottom', 10), (self.widgets["cancelButton"], 'right', 5)]) #show the window cmds.showWindow(self.widgets["window"]) self.findProjects() #set favorite project if it exists settingsLocation = self.mayaToolsDir + "/General/Scripts/projectSettings.txt" if os.path.exists(settingsLocation): f = open(settingsLocation, 'r') settings = cPickle.load(f) favoriteProject = settings.get("FavoriteProject") try: cmds.optionMenu(self.widgets["project"], edit=True, v=favoriteProject) except: pass self.findCharacterRigs()
def build_gui_help_auto_FK(): '''Builds the help window. You can reset persistent settings in here.''' window_name = "build_gui_help_auto_FK" 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]) cmds.columnLayout("main_column", 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='This script generates FK controls for joints while storing', align="left") cmds.text(l='their transforms in groups.', align="left") cmds.text(l='Select desired joints and run script.', align="left") cmds.separator(h=15, style='none') # Empty Space cmds.text(l='Colorize Controls:', align="left", fn="boldLabelFont") cmds.text(l='Automatically colorize controls according to their', align="left") cmds.text(l='names (prefix). It ignores uppercase/lowercase. ', align="left") cmds.text(l='No Prefix = Yellow', align="left") cmds.text(l='"l_" or "left_" = Blue', align="left") cmds.text(l='"r_" or "right_" = Red', align="left") cmds.separator(h=15, style='none') # Empty Space cmds.text(l='Select Hierarchy: ', align="left", fn="boldLabelFont") cmds.text(l='Automatically selects the rest of the hierarchy of the', align="left") cmds.text(l='selected object, thus allowing you to only select the', align="left") cmds.text(l='root joint before creating controls.', align="left") cmds.separator(h=15, style='none') # Empty Space cmds.text(l='(Advanced) Custom Curve:', align="left", fn="boldLabelFont") cmds.text(l='You can change the curve used for the creation of the', align="left") cmds.text(l='controls. Use the script "GT Generate Python Curve"', align="left") cmds.text(l='to generate the code you need to enter here.', align="left") cmds.separator(h=15, style='none') # Empty Space cmds.text(l='Joint, Control, and Control Group Tag:', align="left", fn="boldLabelFont") cmds.text(l='Used to determine the suffix of the elements.', align="left") cmds.text(l='Joint Tag is removed from the joint name for the control.', align="left") cmds.text(l='Control Tag is added to the generated control.', align="left") cmds.text(l='Control Group Tag is added to the control group.', align="left") cmds.text( l='(This is the transform carrying the transforms of the joint).', align="left") cmds.separator(h=15, style='none') # Empty Space cmds.text(l='Ignore Joints Containing These Strings: ', align="left", fn="boldLabelFont") cmds.text(l='The script will ignore joints containing these strings.', align="left") cmds.text(l='To add multiple strings use commas - ",".', align="left") 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=15, 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=10, style='none') cmds.button(l='Reset Persistent Settings', h=30, c=lambda args: reset_persistent_settings_auto_fk()) 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) if python_version == 3: widget = wrapInstance(int(qw), QWidget) else: widget = wrapInstance(long(qw), QWidget) icon = QIcon(':/question.png') widget.setWindowIcon(icon) def close_help_gui(): '''Function to close the help UI, created for the "OK" Button''' if cmds.window(window_name, exists=True): cmds.deleteUI(window_name, window=True)