def csMainWindow(): csWin = "CreateSkeleton" if mc.window(csWin, q=True, ex=True): mc.deleteUI(csWin) mc.window(csWin, title="Create Skeleton") mc.scrollLayout(horizontalScrollBarThickness=16) csMainCL = mc.columnLayout(columnAttach=("both", 5), rowSpacing=10, columnWidth=320) # GUIDES CREATION csFL1 = mc.frameLayout(label="Create Guides", bs="etchedOut", w=300, mw=5, cll=1, p=csMainCL) csCL1 = mc.columnLayout(rs=5, adj=1, p=csFL1) # Character Name mc.textFieldGrp("csChName", l="Character Name", tx="") # Number of Fingers/Toes # mc.intSliderGrp("csFingersNumber",label="Number of Fingers",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=csSetFingersNumber) # mc.checkBoxGrp("csHasThumb",numberOfCheckBoxes=1, label='Thumb?') # mc.intSliderGrp("csToesNumber",label="Number of Toes",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=csSetToesNumber) mc.button(l="Create Guides", c=csCreateGuides) # Character Scale Slider mc.floatSliderGrp("csScaleSlider", en=0, label="Guide scale", field=True, minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=100, value=1, cw3=(70, 30, 10), dc=csScaleGuides) # Character Mirror mc.rowColumnLayout(nc=2, cw=[(1, 138), (2, 138)], p=csCL1) mc.button(l="Mirror left << ", al="right", c=functools.partial(csMirrorGuide, "left")) mc.button(l=">> Mirror right", al="left", c=functools.partial(csMirrorGuide, "right")) # END GUIDES CREATION # JOINTS CREATION csFL2 = mc.frameLayout(label="Create Joints", bs="etchedOut", w=300, mw=5, cll=1, p=csMainCL) csCL2 = mc.columnLayout(rs=5, adj=1, p=csFL2) mc.button(l="Create Joints", c=csCreateJoints) # floatSliderGrp -en 0 -label "THUMB Orient" -field true -minValue 0 -maxValue 180 -fieldMinValue 1 -fieldMaxValue 100 -value 0 -cw3 80 40 10 -dc csJointOrientX csJointXSlider; # END JOINTS CREATION mc.showWindow(csWin)
def moduleGUI( self ): col = cmds.columnLayout( adjustableColumn=True, columnAttach=('both', 5), parent=self.fillArea ) # Frame area. cmds.text( label='FRAMES', height=20, font='boldLabelFont', backgroundColor=[0.2,0.2,0.2] ) cmds.separator( style='none', height=5 ) # Frame template section. cmds.rowColumnLayout( numberOfColumns=2, columnWidth=[(1, 40), (2, self.winWidth-40)] ) # Left column. self.toggleColumn = cmds.rowColumnLayout( numberOfColumns=1 ) cmds.symbolCheckBox( image='icon_root.png', value=0, annotation='roots', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_spine.png', value=0, annotation='spines', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_arm.png', annotation='arms', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_leg.png', annotation='legs', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_hand.png', annotation='hands', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_foot.png', annotation='feet', changeCommand=self.moduleButtons ) cmds.symbolCheckBox( image='icon_head.png', annotation='heads', changeCommand=self.moduleButtons ) cmds.setParent( '..' )#toggleColumn # Right column. cmds.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16, height=100 ) self.frameGrid = cmds.gridLayout( numberOfColumns=4, cellWidthHeight=( 50, 50 ) ) self.moduleButtons() cmds.setParent( '..' )#frameGrid cmds.setParent( '..' )#scrollLayout cmds.setParent( '..' )#rowColumnLayout cmds.separator( style='none', height=10 ) cmds.setParent( '..' )#col
def downloadGui(self): if cmds.window('HugePropsDownload', q=1, exists=1): cmds.deleteUI('HugePropsDownload') MyDownLoadtool = cmds.window('HugePropsDownload',title='Huge Props Download',widthHeight=(550,500),sizeable=False) cmds.columnLayout(adjustableColumn=True) cmds.text(label='Huge Props Download',height=30, backgroundColor=[0.5, 0.5, 0.6]) cmds.separator(style='out') cmds.columnLayout(adjustableColumn=True) cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1,200),(2,350)]) cmds.columnLayout(adjustableColumn=True) cmds.text('Huge Props List',align='center',backgroundColor=[0.5, 0.6, 0.5]) cmds.scrollLayout('hugePropsScrollLayout', height=200) self.HugePropsList() cmds.setParent('..') cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.text('AR and Props List',align='center',backgroundColor=[0.5, 0.6, 0.5]) cmds.scrollLayout('mainScrollLayout', height=200) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.separator(style='out') cmds.button(label='Download',height=50,command=lambda *arg: self.Download()) cmds.separator(style='out') cmds.setParent('..') cmds.showWindow(MyDownLoadtool)
def create_main_window(self): main_window = cmds.window(title=".Burn the witch "+u"\u0028\u256F\u00B0\u25A1\u00B0\u0029\u256F\uFE35\u0020\u253B\u2501\u253B", widthHeight=(500, 560), tlc=(450, 1100)) cmds.scrollLayout() # witch_dock = cmds.dockControl(label=".Burn the witch", area='right', content=main_window, fl=True, width=510, # height=570) cmds.text(label='Pickle path is: ' + str(self.global_work_space['miscData']['picklePath'])) cmds.gridLayout(numberOfColumns=3, cellWidthHeight=(100, 25)) cmds.button(label='SaveData', height=25, backgroundColor=[0.3, 0.3, 0.3], command=partial(self.helper.heyWitch_stashDictionary, self.global_work_space)) cmds.button(label='Refresh', height=25, backgroundColor=[0.3, 0.3, 0.3], command=partial(self.refresh_main_window, main_window)) cmds.setParent('..') tab_layout = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5) toolkit_column_layout = self.main_tabs_manager.toolkit_tab_builder() mswPane = self.main_tabs_manager.msw_tab_builder() mapsPane = self.main_tabs_manager.magic_maps_tab_builder() bjcCol = self.main_tabs_manager.bjc_tab_builder() cmds.tabLayout(tab_layout, edit=True, tabLabel=( (toolkit_column_layout, 'Toolkit'), (mswPane, 'Mesh Skinning Workspace'), (mapsPane, 'Magic Maps'), (bjcCol, 'Bind Joint Clusters'))) # cmds.setParent('..') cmds.setParent('..') # end of scroll and row layouts for both cmds.showWindow(main_window) cmds.window(main_window, edit=True, visible=True)
def show(self): self.close() win = mc.window(self._windowName, wh=self._windowSize, t=u'材质质感库', sizeable=False) layout = mc.formLayout() control = mc.treeView('control', parent=layout, abr=False) tabs = mc.tabLayout("tabs") arnoldScroll = mc.scrollLayout('arnold', p=tabs) vrayScroll = mc.scrollLayout('vray', p=tabs) mc.formLayout(layout, e=True, attachForm=[(control, 'top', 2), (control, 'left', 2), (control, 'bottom', 2), (tabs, 'top', 2), (tabs, 'right', 2), (tabs, 'bottom', 2)], attachPosition=[(control, 'left', 0, 0), (control, 'right', 0, 25), (tabs, 'left', 0, 25), (tabs, 'right', 0, 99)]) for key in assertText.keys(): mc.treeView(control, e=True, addItem=(key, '')) for typeName in assertText[key]: mc.treeView(control, e=True, addItem=(typeName, key)) mc.treeView(control, e=True, selectCommand=self.selectTreeCallBack) mc.showWindow(win) if not mc.pluginInfo('mtoa.mll', q=True, l=True): mc.loadPlugin('mtoa.mll')
def UI(): bdWin = "FootballUtils" if cmds.window(bdWin,q=True,ex=True): cmds.deleteUI(bdWin) cmds.window(bdWin,title = "Football Utils") cmds.scrollLayout(horizontalScrollBarThickness=16) bdMainCL = cmds.columnLayout(columnAttach=("both",5),rowSpacing=10,columnWidth=320) #Bip List bdFL1 = cmds.frameLayout(label="Bips",bs="etchedOut",w=300,mw=5,cll=1,p=bdMainCL) bdRL= cmds.rowLayout(numberOfColumns=2, columnWidth2=(150, 150), p=bdFL1 ) bdBipList = cmds.textScrollList('bipList',numberOfRows = 10, allowMultiSelection=True,height = 100,sc=bdSelectBip,p=bdRL) bdGenericList = cmds.textScrollList('genericList',numberOfRows = 10, allowMultiSelection=True,height = 100,sc=bdSelectGeneric,p=bdRL) bdPopulateBipList() cmds.button(l="Rename Bips",c=bd_renameBips,p=bdFL1 ) bdFL2 = cmds.frameLayout(label="Generic",bs="etchedOut",w=300,mw=5,cll=1,p=bdMainCL) cmds.button(l="Import Generic Character",al="right",c = bdImportGeneric) cmds.button(l="Duplicate Generic Character",al="right",c = bdDuplicateGeneric) cmds.text(l='Note: Even if there is only one Generic, click Duplicate Generic\n Use the Global_Scale_Anim to scale the Generic chars') cmds.button(l="Copy Anim ",al="right",c = bd_mocapToCotrollers) cmds.button(l="Bake Anim",al="left",c = bd_bakeControllers); cmds.button(l="Remove Mocap data",c =bdRemoveMocapData) #END JOINTS CREATION cmds.showWindow(bdWin)
def windowGUI(): window = cmds.window( 'TSakson SAL Grading Script Project 07 - Compositing, Motion Blur & SSS' ) cmds.scrollLayout('Scroll Layout') cmds.columnLayout() cmds.showWindow(window)
def __init__(self, dictionaries): self.dictionaries = dictionaries self.check = [0] * len(self.dictionaries[0].keys()) win = mc.window(title="Attribute Comparison", resizeToFitChildren=True) columns = len(self.titles) mc.columnLayout(adj=True) mc.frameLayout(label="All values", collapsable=True, width=512) mc.scrollLayout(height=256) col = mc.rowLayout(numberOfColumns=columns) for i in range(columns): self.createColumn(i) mc.setParent("..") mc.setParent("..") mc.frameLayout(label="Only changed values", collapsable=True, width=512) mc.scrollLayout(height=128) col = mc.rowLayout(numberOfColumns=columns) for i in range(columns): self.createColumn(i, True) mc.setParent("..") mc.separator() mc.text(label="Note: Frame will be empty upon no changes found.", align="center") mc.showWindow(win)
def Char_ModelLibWin(): winWH = [500,420] winName = 'ModelLibraryWin' if cmds.window(winName,q = True,ex = True): cmds.deleteUI(winName) cmds.window(winName,wh = winWH,t = 'ModelLibrary',mb = True) cmds.menu(l = '文件') cmds.menuItem(l = '整理文件信息',c = 'fb.mod.charLibrary.propList()') cmds.menuItem(l = '添加角色',c = 'fb.mod.charLibrary.Char_AddPropWin()') cmds.menuItem('addSelmen',l = '叠加选择',cb = False) cmds.menu(l = '刷新') cmds.menuItem(l = '刷新窗口',c = 'fb.mod.charLibrary.Char_ModelLibWin()') cmds.formLayout('Char_MLformLayout',nd=100) coLayoutTop = cmds.columnLayout(adj = True,cat = ['both',0],rs = 10) cmds.text(l = '角色库') cmds.separator() cmds.setParent('..') treeList = cmds.treeLister('Char_TreeList') #cmds.popupMenu() #cmds.menuItem('Char_OpenScenesFolder',l = '打开场景文件夹') #cmds.menuItem('Char_OpenImageFolder',l = '打开图片文件夹') scLy = cmds.frameLayout('PicFrameLay',l = '图片',bs = 'etchedOut') cmds.scrollLayout('picScrolLY',cr = True,hst = 1000,vst = 1000,mcw = 1000,rc = 'fb.mod.charLibrary.Char_Rcmd()') cmds.gridLayout('Char_GridLY',cwh =(100,100)) cmds.setParent('..') cmds.showWindow(winName) cmds.formLayout('Char_MLformLayout',e = True, af = [(coLayoutTop,'top',5),(coLayoutTop,'left',5),(coLayoutTop,'right',5),(treeList,'left',5),(treeList,'bottom',5),(scLy,'right',5),(scLy,'bottom',0)], ac = [(treeList,'top',0,coLayoutTop),(scLy,'top',0,coLayoutTop),(scLy,'left',0,treeList)], ap = [(treeList,'right',5,40)]) if cmds.window('addPropWin',q = True,ex = True): cmds.deleteUI('addPropWin') Char_TreeList()
def csMainWindow(): csWin = "CreateSkeleton" if mc.window(csWin,q=True,ex=True): mc.deleteUI(csWin) mc.window(csWin,title = "Create Skeleton") mc.scrollLayout(horizontalScrollBarThickness=16) csMainCL = mc.columnLayout(columnAttach=("both",5),rowSpacing=10,columnWidth=320) #GUIDES CREATION csFL1 = mc.frameLayout(label="Create Guides",bs="etchedOut",w=300,mw=5,cll=1,p=csMainCL) csCL1= mc.columnLayout(rs=5,adj=1,p=csFL1) #Character Name mc.textFieldGrp("csChName",l="Character Name",tx="") #Number of Fingers/Toes #mc.intSliderGrp("csFingersNumber",label="Number of Fingers",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=csSetFingersNumber) #mc.checkBoxGrp("csHasThumb",numberOfCheckBoxes=1, label='Thumb?') #mc.intSliderGrp("csToesNumber",label="Number of Toes",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=csSetToesNumber) mc.button(l="Create Guides",c=csCreateGuides) #Character Scale Slider mc.floatSliderGrp("csScaleSlider",en=0,label="Guide scale",field=True,minValue=1,maxValue=100,fieldMinValue=1,fieldMaxValue=100,value=1,cw3=(70,30,10),dc=csScaleGuides) #Character Mirror mc.rowColumnLayout(nc=2,cw=[(1,138),(2,138)],p=csCL1); mc.button(l="Mirror left << ",al="right",c = functools.partial(csMirrorGuide,"left")) mc.button(l=">> Mirror right",al="left",c = functools.partial(csMirrorGuide,"right")); #END GUIDES CREATION #JOINTS CREATION csFL2 = mc.frameLayout(label="Create Joints",bs="etchedOut",w=300,mw=5,cll=1,p=csMainCL) csCL2 = mc.columnLayout(rs=5,adj=1,p=csFL2) mc.button(l="Create Joints",c =csCreateJoints) #floatSliderGrp -en 0 -label "THUMB Orient" -field true -minValue 0 -maxValue 180 -fieldMinValue 1 -fieldMaxValue 100 -value 0 -cw3 80 40 10 -dc csJointOrientX csJointXSlider; #END JOINTS CREATION mc.showWindow(csWin)
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 get_reference_list_UI(versionUp=True, origScene=None, *args): if cmds.window("getRefWin", exists=True): cmds.deleteUI("getRefWin") win = cmds.window("getRefWin", t=" References to Export", w=400, h=300, rtf=True) cmds.scrollLayout(w=400, h=300) column = cmds.columnLayout(w=380, h=600) for ref in cmds.file(q=True, reference=True): rfn = cmds.referenceQuery(ref, rfn=True) cmds.checkBoxGrp(l=rfn, v1=True, cal=[(1, "left"), (2, "left")], cw=[(1, 350), (2, 25)]) cmds.separator(h=20) but = cmds.button(l="Publish Files to MB and FBX!", w=380, h=30, c=partial(pull_refs_from_ui, column, versionUp, origScene)) cmds.showWindow(win)
def random_mover_UI(): #declare the UI randomMoverWin = 'lgRandomMover' #restart the UI if it all ready exists if cmds.window(randomMoverWin, exists = True): cmds.deleteUI(randomMoverWin) if cmds.windowPref(randomMoverWin, exists = True): cmds.windowPref(randomMoverWin, remove=True) cmds.window(randomMoverWin, title = "Random Mover Tool") cmds.scrollLayout('lgRandomMoverSL', childResizable=True) cmds.columnLayout() cmds.floatFieldGrp('XTranslateInput', numberOfFields=2, label='X Translate min and max', value1=0, value2=0) cmds.floatFieldGrp('YTranslateInput', numberOfFields=2, label='Y Translate min and max', value1=0, value2=0) cmds.floatFieldGrp('ZTranslateInput', numberOfFields=2, label='Z Translate min and max', value1=0, value2=0) cmds.floatFieldGrp('XRotateInput', numberOfFields=2, label='X Rotate min and max', value1=0, value2=0) cmds.floatFieldGrp('YRotateInput', numberOfFields=2, label='Y Rotate min and max', value1=0, value2=0) cmds.floatFieldGrp('ZRotateInput', numberOfFields=2, label='Z Rotate min and max', value1=0, value2=0) cmds.floatFieldGrp('XScaleInput', numberOfFields=2, label='X Rotate min and max', value1=0, value2=0) cmds.floatFieldGrp('YScaleInput', numberOfFields=2, label='Y Rotate min and max', value1=0, value2=0) cmds.floatFieldGrp('ZScaleInput', numberOfFields=2, label='Z Rotate min and max', value1=0, value2=0) cmds.button(label='Randomize!', command ="from random_mover import random_mover; random_mover.random_mover_backend({'t':{'x':{'min':cmds.floatFieldGrp('XTranslateInput',query=True,value1=True),'max': cmds.floatFieldGrp('XTranslateInput',query=True,value2=True)},'y':{'min':cmds.floatFieldGrp('YTranslateInput',query=True,value1=True),'max': cmds.floatFieldGrp('YTranslateInput',query=True,value2=True)},'z':{'min':cmds.floatFieldGrp('ZTranslateInput',query=True,value1=True),'max':cmds.floatFieldGrp('ZTranslateInput',query=True,value2=True)}},'r':{'x':{'min':cmds.floatFieldGrp('XRotateInput',query=True,value1=True),'max': cmds.floatFieldGrp('XRotateInput',query=True,value2=True)}, 'y':{'min':cmds.floatFieldGrp('YRotateInput',query=True,value1=True),'max': cmds.floatFieldGrp('YRotateInput',query=True,value2=True)}, 'z':{'min':cmds.floatFieldGrp('ZRotateInput',query=True,value1=True),'max': cmds.floatFieldGrp('ZRotateInput',query=True,value2=True)}},'s':{'x':{'min':cmds.floatFieldGrp('XScaleInput',query=True,value1=True),'max': cmds.floatFieldGrp('XScaleInput',query=True,value2=True)},'y':{'min':cmds.floatFieldGrp('YScaleInput',query=True,value1=True),'max': cmds.floatFieldGrp('YScaleInput',query=True,value2=True)},'z':{'min':cmds.floatFieldGrp('ZScaleInput',query=True,value1=True),'max': cmds.floatFieldGrp('ZScaleInput',query=True,value2=True)}}})") #run the window cmds.showWindow( randomMoverWin )
def modulesLayout(): moduleArm = moduleType('Arm') moduleLeg = moduleType('Leg') moduleSpine = moduleType('spine') cmds.frameLayout(label='Prefix :',mw =1 ,mh =3,bs="etchedOut",cl= 0,cll=0,w=442) cmds.rowColumnLayout (nc=4,cw=[(1,50),(2,90),(3,80),(4,100)]) cmds.text(l =" Name :",align="left" ) cmds.textField() cmds.text(l =" Side : ",align="center" ) cmds.optionMenu (l='Method:') cmds.menuItem(label ="l/r",c ="") cmds.menuItem(label ="lt/rt",c ="") cmds.menuItem(label= "left/right",c='') cmds.menuItem(label= "custom",c='') cmds.menuItem(label= "none",c='') cmds.separator(height= 7,style ="none") cmds.setParent('..') cmds.rowColumnLayout (nc=3,cw=[(1,137),(2,137),(3,137)]) cmds.text(l ="Left :",align="center" ) cmds.text(l ="Center :",align="center" ) cmds.text(l ="Right : ",align="center" ) cmds.colorIndexSliderGrp('leftColorGrp',min =1 ,max= 31 ,value= 14 ,columnWidth=[(1,37),(2,100)]) cmds.colorIndexSliderGrp('centerColorGrp',min =1 ,max= 31 ,value= 23 ,columnWidth=[(1,37),(2,100)]) cmds.colorIndexSliderGrp('rightColorGrp',min =1 ,max= 31 ,value= 7 ,columnWidth=[(1,37),(2,100)]) cmds.setParent('..') cmds.setParent('..') cmds.separator(height =7 ,style= "none" ) cmds.scrollLayout(horizontalScrollBarThickness=16,verticalScrollBarThickness=16,h=285) moduleArm.mainModule() moduleLeg.mainModule() moduleSpine.mainModule() cmds.setParent('..') cmds.button(l='Build Skeleton',h=50)
def OCT_DownloadProxyUI(): proxyType = [] proxyType = os.listdir(OCT_PROXYPATH) if mc.window("OCT_ProxySeed", q=True, exists=True): mc.deleteUI("OCT_ProxySeed") mc.window("OCT_ProxySeed", title=u"代理库工具", widthHeight=(490, 730), sizeable=False) form = mc.formLayout() tabs = mc.tabLayout("tabs") mc.formLayout(form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0))) if proxyType: for proxy in proxyType: mc.scrollLayout(proxy, p=tabs) mc.rowColumnLayout(proxy, numberOfColumns=3) PathType = OCT_PROXYPATH + "\\" + proxy path = os.listdir(PathType) if path: for j in range(len(path)): iconFile = PathType + "\\" + path[j] + "\\images\\" + path[ j] + ".bmp" mc.nodeIconButton( path[j], style='iconAndTextVertical', numberOfPopupMenus=True, image=iconFile, label=path[j], h=130, w=160, p=proxy, c='OCT_proxy.OCT_DownloadProxy.Opendir(%d)' % j) mc.popupMenu(path[j], parent=path[j], b=3) mc.menuItem(l=u"打开maya原文件", c='OCT_proxy.OCT_DownloadProxy.OpenMaya(%d)' % j, parent=path[j]) mc.menuItem( l=u"打开maya_Vray原文件", c='OCT_proxy.OCT_DownloadProxy.OpenMayaVray(%d)' % j, parent=path[j]) mc.menuItem( l=u"打开maya_Arnold原文件", c='OCT_proxy.OCT_DownloadProxy.OpenMayaArnold(%d)' % j, parent=path[j]) mc.menuItem( l=u"导入Vray代理文件", c='OCT_proxy.OCT_DownloadProxy.ImportVray(%d)' % j, parent=path[j]) mc.menuItem( l=u"导入Arnold代理文件", c='OCT_proxy.OCT_DownloadProxy.importArnold(%d)' % j, parent=path[j]) mc.setParent("..") mc.setParent("..") mc.showWindow("OCT_ProxySeed")
def SundayControllerToolUI(): global sundayControllerToolUI SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(sundayControllerToolUI, exists = True): cmds.deleteUI(sundayControllerToolUI) sundayControllerToolUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayControllerTool.ui') except: sundayControllerToolUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayControllerTool.ui') cmds.setParent(sundayControllerToolUI) cmds.setParent(cmds.button('SundayControllerToolChooseColorDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) cmds.iconTextRadioCollection('ltColorCollection') cmds.rowColumnLayout(numberOfColumns = 8) cmds.text(label = 'Color : ') cmds.iconTextRadioButton('DarkBlue_5', image1 = SundayImage + 'SundayColorDarkBlue.png', height = 20, width = 20, select = True) cmds.iconTextRadioButton('DarkRed_4', image1 = SundayImage + 'SundayColorDarkRed.png', height = 20, width = 20) cmds.iconTextRadioButton('Purple_9', image1 = SundayImage + 'SundayColorPurple.png', height = 20, width = 20) cmds.iconTextRadioButton('Red_13', image1 = SundayImage + 'SundayColorRed.png', height = 20, width = 20) cmds.iconTextRadioButton('Green_14', image1 = SundayImage + 'SundayColorGreen.png', height = 20, width = 20) cmds.iconTextRadioButton('LightBlue_18', image1 = SundayImage + 'SundayColorLightBlue.png', height = 20, width = 20) cmds.iconTextRadioButton('Yellow_17', image1 = SundayImage + 'SundayColorYellow.png', height = 20, width = 20) cmds.setParent(sundayControllerToolUI) cmds.setParent(cmds.button('SundayControllerToolDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) cmds.scrollLayout(childResizable = True) cmds.rowColumnLayout(numberOfColumns = 8) SundayLocatorToolPy.SundayLocatorToolMakeLocatorButtonsInWidget('SundayControllerToolPy\nreload(SundayControllerToolPy)\nSundayControllerToolPy.SundayControllerToolApply') cmds.showWindow(sundayControllerToolUI) if platform.system() == 'Windows': cmds.window(sundayControllerToolUI, edit = True, topLeftCorner = [ 100, 100])
def bdMainWindow(): bdWin = "CreateSkeleton" if cmds.window(bdWin, q=True, ex=True): cmds.deleteUI(bdWin) cmds.window(bdWin, title="Create Skeleton") cmds.scrollLayout(horizontalScrollBarThickness=16) bdMainCL = cmds.columnLayout(columnAttach=("both", 5), rowSpacing=10, columnWidth=320) #GUIDES CREATION bdFL1 = cmds.frameLayout(label="Template Guides", bs="etchedOut", w=300, mw=5, cll=1, p=bdMainCL) bdCL1 = cmds.columnLayout(rs=5, adj=1, p=bdFL1) #Character Name cmds.textFieldGrp("bdChName", l="Character Name", tx="") #Number of Fingers/Toes #cmds.intSliderGrp("bdFingersNumber",label="Number of Fingers",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=bdSetFingersNumber) #cmds.checkBoxGrp("bdHasThumb",numberOfCheckBoxes=1, label='Thumb?') #cmds.intSliderGrp("bdToesNumber",label="Number of Toes",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=bdSetToesNumber) cmds.button(l="Import Template", c=bdImportTemplate) #Character Scale Slider cmds.floatSliderGrp("bdScaleSlider", en=0, label="Guide scale", field=True, minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=100, value=1, cw3=(70, 30, 10), dc=bdScaleGuides) #Character Mirror cmds.rowColumnLayout(nc=2, cw=[(1, 138), (2, 138)], p=bdCL1) cmds.button(l="Mirror left << ", al="right", c=functools.partial(bdMirrorGuide, "left")) cmds.button(l=">> Mirror right", al="left", c=functools.partial(bdMirrorGuide, "right")) #END GUIDES CREATION #JOINTS CREATION bdFL2 = cmds.frameLayout(label="Create Joints", bs="etchedOut", w=300, mw=5, cll=1, p=bdMainCL) bdCL2 = cmds.columnLayout(rs=5, adj=1, p=bdFL2) cmds.button(l="Create Joints", c=bdCreateSkeleton) #floatSliderGrp -en 0 -label "THUMB Orient" -field true -minValue 0 -maxValue 180 -fieldMinValue 1 -fieldMaxValue 100 -value 0 -cw3 80 40 10 -dc bdJointOrientX bdJointXSlider; #END JOINTS CREATION cmds.showWindow(bdWin)
def bdMainWindow(): bdWin = "CreateSkeleton" if cmds.window(bdWin,q=True,ex=True): cmds.deleteUI(bdWin) cmds.window(bdWin,title = "Create Skeleton") cmds.scrollLayout(horizontalScrollBarThickness=16) bdMainCL = cmds.columnLayout(columnAttach=("both",5),rowSpacing=10,columnWidth=320) #GUIDES CREATION bdFL1 = cmds.frameLayout(label="Template Guides",bs="etchedOut",w=300,mw=5,cll=1,p=bdMainCL) bdCL1= cmds.columnLayout(rs=5,adj=1,p=bdFL1) #Character Name cmds.textFieldGrp("bdChName",l="Character Name",tx="") #Number of Fingers/Toes #cmds.intSliderGrp("bdFingersNumber",label="Number of Fingers",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=bdSetFingersNumber) #cmds.checkBoxGrp("bdHasThumb",numberOfCheckBoxes=1, label='Thumb?') #cmds.intSliderGrp("bdToesNumber",label="Number of Toes",field=True,minValue=1,maxValue=5,fieldMinValue=1,fieldMaxValue=5,value=4,cw3=(100,30,10),dc=bdSetToesNumber) cmds.button(l="Import Template",c=bdImportTemplate) #Character Scale Slider cmds.floatSliderGrp("bdScaleSlider",en=0,label="Guide scale",field=True,minValue=1,maxValue=100,fieldMinValue=1,fieldMaxValue=100,value=1,cw3=(70,30,10),dc=bdScaleGuides) #Character Mirror cmds.rowColumnLayout(nc=2,cw=[(1,138),(2,138)],p=bdCL1); cmds.button(l="Mirror left << ",al="right",c = functools.partial(bdMirrorGuide,"left")) cmds.button(l=">> Mirror right",al="left",c = functools.partial(bdMirrorGuide,"right")); #END GUIDES CREATION #JOINTS CREATION bdFL2 = cmds.frameLayout(label="Create Joints",bs="etchedOut",w=300,mw=5,cll=1,p=bdMainCL) bdCL2 = cmds.columnLayout(rs=5,adj=1,p=bdFL2) cmds.button(l="Create Joints",c =bdCreateSkeleton) #floatSliderGrp -en 0 -label "THUMB Orient" -field true -minValue 0 -maxValue 180 -fieldMinValue 1 -fieldMaxValue 100 -value 0 -cw3 80 40 10 -dc bdJointOrientX bdJointXSlider; #END JOINTS CREATION cmds.showWindow(bdWin)
def buildMainLayout(self): '''Build the main part of the ui ''' tabs = mc.tabLayout() tab1 = mc.columnLayout(adj=True) mc.scrollLayout(cr=True) self.shelfLayout = mc.shelfLayout() self.refreshShelfLayout() mc.setParent(tabs) tab2 = mc.columnLayout(adj=True) mc.separator(height=8, style='none') mc.text('Select curve(s) to export. Multiple selected curves will be combined.') mc.text('Center and fit the curve in the viewport,') mc.text('and make sure nothing else is visible for best icon creation.') mc.separator(height=16, style='in') mc.button('Export Selected Curve', command=self.exportControl, annotation='Select a nurbsCurve to export.') mc.tabLayout( tabs, edit=True, tabLabel=((tab1, 'Import'), (tab2, 'Export') )) if not mc.shelfLayout(self.shelfLayout, query=True, numberOfChildren=True): mc.tabLayout( tabs, edit=True, selectTab=tab2)
def get_reference_list_UI(versionUp=True, origScene=None, *args): """ make a little ui to select references to export """ if cmds.window("getRefWin", exists=True): cmds.deleteUI("getRefWin") h=200 win = cmds.window("getRefWin", t=" References to Export", w=400, h=h+50, rtf=True) mainCLO = cmds.columnLayout(w=400, h=300,) cmds.text("Current References in the scene. Check the ones you'd like to export", al="left") cmds.separator(h=10) cmds.frameLayout(w=400, h=h+20, cll=False, l="References to Export") floCLO = cmds.columnLayout(h=h) cmds.scrollLayout(w=400, h=h) column = cmds.columnLayout(w=395, bgc=(.3, .3, .3)) for ref in sorted(cmds.file(q=True, reference=True)): rfn = cmds.referenceQuery(ref, rfn=True) cmds.checkBoxGrp(l=rfn, v1=True, cal=[(1, "left"), (2, "left")], cw=[(1, 350),(2, 25)]) cmds.setParent(mainCLO) cmds.separator(h=20) cmds.rowColumnLayout(nc=2, w=400) selAllBut = cmds.button(l="Select All", w=200, h=20, bgc=(.5,.5,.5), c=partial(select_all_cbs, column, 1)) deselAllBut = cmds.button(l="Deselect All", w=200, h=20, bgc=(.5,.5,.5), c=partial(select_all_cbs, column, 0)) cmds.setParent(mainCLO) expBut = cmds.button(l="Publish Files to MB and FBX!", w=400, h=40, bgc=(.5,.7,.5), c=partial(pull_refs_from_ui, column, versionUp, origScene)) cmds.window(win, e=True, w=5, h=5, rtf=True) cmds.showWindow(win)
def refresh_asset_entries(*args): if not cmds.window(asset_store_window, exists=True): return cmds.setParent(asset_store_window) # Delete the existing layout if cmds.scrollLayout(asset_entries_scroll_layout, exists=True): cmds.deleteUI(asset_entries_scroll_layout) installed_assets = get_installed_assets() cmds.scrollLayout(asset_entries_scroll_layout, childResizable=True) if installed_assets \ and installed_assets["organization"]["entries"]: create_asset_entries(installed_assets["organization"]["entries"]) else: cmds.text( label="There are no Orbolt assets installed for this user.<br />" "Please visit the <a href=\"http://www.orbolt.com/maya\">Orbolt Store</a> for assets.", wordWrap=True, hyperlink=True, ) cmds.setParent(upLevel=True)
def build(self): # ( No need to change ) if cmds.window(self.win, exists=1): #self.update() return cmds.window(self.win, title=self.title, wh=(320, 250)) cmds.formLayout('MAINFORM', nd=100) r = cmds.button(h=32, l='Restart', c=self.update) c = cmds.button(h=32, l='Close', c=self.close) h = cmds.button(h=32, l='Help', c=self.help) p = cmds.paneLayout(configuration='horizontal2', ps=(1, 100, 70)) self.listScr = cmds.scrollLayout(vst=1, hst=0, cr=1) self.list = cmds.columnLayout(adj=1) cmds.setParent(p) cmds.scrollLayout(vst=1, hst=0, cr=1) self.info = cmds.columnLayout(adj=1) self.setInfoUI() self.updateList() # after setInfoUI self.updateListBGC() cmds.formLayout('MAINFORM', e=1, af=[(r, 'bottom', 5), (r, 'left', 5), (h, 'right', 5), (c, 'bottom', 5), (h, 'bottom', 5), (p, 'left', 2), (p, 'right', 2), (p, 'top', 2)], ac=[(p, 'bottom', 5, r), (c, 'left', 3, r), (c, 'right', 3, h)], ap=[(r, 'right', 0, 30), (h, 'left', 0, 70)]) #print window(self.win,q=1,wh=1) cmds.window(self.win, e=1, wh=[self.win_width, self.win_height]) # Set the size of the window
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.radioButtonGrp('ruBendAxis', numberOfRadioButtons=3, onc=ruSetBendAxis, label='Bend Around', labelArray3=['X', 'Y', 'Z'],cw4=[100,50,50,50],ct4=['left', 'left','left','left'],co4=[0,0,0,0]) 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('ruTemplateName', label='Template string', text='', buttonLabel='Rename', bc=ruRenameFingerChain, cw3=[120,70,70],ct3=['left','left','left'],co3=[2,2,2] ) mc.showWindow(ruWin)
def refresh(self): #delete old propsList layoutList = cmds.scrollLayout('mainScrollLayout', childArray=True, q=True) if layoutList == None: pass else: for item in layoutList: cmds.deleteUI(item) #delete old hugePropsList layoutList = cmds.scrollLayout('hugePropsScrollLayout', childArray=True, q=True) if layoutList == None: pass else: for item in layoutList: cmds.deleteUI(item) #bulid new hugePropsList = os.listdir(self.ServerRootPath) cmds.columnLayout(parent='hugePropsScrollLayout',adjustableColumn=True) cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection') self.id = -1 for i in range(len(hugePropsList)): self.id += 1 cmds.iconTextRadioButton('id%s_hugePropsIconTextRadioButton'%i,collection='hugePropsIconTextRadioCollection', style='iconAndTextHorizontal',l='%s'%hugePropsList[i], width=190, height=25, onCommand=lambda *arg:self.refreshPropsListPlus()) cmds.setParent('..')
def fix_defaultnames(objectswithdefaultnames): """Find objects with names that Maya uses when the user creates an object and fails to rename it. --- Naming (detect default names). Open list window with object names for review. fix_defaultobjectnames(list) create a UI for renaming objects with invalid (default) names. """ verbose = cmds.optionVar(query='checkmateVerbosity') if cmds.window('showObjectNamesWin', exists=True): cmds.deleteUI('showObjectNamesWin') win = cmds.window('showObjectNamesWin', width =340, height=400, title="Objects with default names") cmds.scrollLayout(childResizable=True) cmds.columnLayout(adjustableColumn=True) numitems = 0 for item in objectswithdefaultnames: if numitems < 500: numitems = numitems + 1 # cmds.button(label='select', command='cmds.select(\'%s\')' % item) cmds.nameField(object=item, receiveFocusCommand='cmds.select(\'%s\')' % item) else : break cmds.showWindow(win)
def backUpAllFileGui(self): projectList = self.jobList2[0] moduleList = self.jobList2[1] projectOption = cmds.optionMenu('optionProject2', q=True, select=True) moduleOption = cmds.optionMenu('optionModule2', q=True, select=True) project = projectList[int(projectOption) - 1] module = moduleList[int(moduleOption) - 1] ServerRoot = Path.Path().GetServerPath() ServerRootPath = '%s/%s/ProjectConfig/workNodeScripts/%s/backup/' % ( ServerRoot, project, module) if os.path.isdir(ServerRootPath): pass else: lsrunas.lsrunas().CreateDir_1(ServerRootPath) listAllDir = os.listdir(ServerRootPath) listAllDir.sort() if cmds.window('backUpAllFileWindow', q=1, exists=1): cmds.deleteUI('backUpAllFileWindow') backUpAllFileWindow = cmds.window('backUpAllFileWindow', title='Backup', widthHeight=(300, 300), sizeable=False) cmds.rowColumnLayout('backUpAllLayout', numberOfColumns=1, columnWidth=[(1, 300)]) cmds.text('History All Code Backuper', height=30, backgroundColor=[0.5, 0.6, 0.6]) cmds.separator(style='out') cmds.text(' ') cmds.text(' ') cmds.separator(style='out') cmds.text(label='All Code`s History:', align='left') cmds.text(' ') cmds.scrollLayout('historyAllScrollLayout', parent='backUpAllLayout', width=300, height=400) cmds.iconTextRadioCollection('historyAllCodeList') for i in range(len(listAllDir)): cmds.iconTextRadioButton(listAllDir[i], collection='historyAllCodeList', st='iconAndTextHorizontal', visible=True, l=listAllDir[i], width=270, height=25) cmds.separator(style='out') cmds.setParent('..') cmds.text(' ') cmds.button(label='BackUp', height=30, command=lambda *arg: self.backUpAllFunc()) cmds.text(' ') cmds.showWindow(backUpAllFileWindow)
def buildUI(self) : self.resetExternalContext() self.window = cmds.window("autorigging_ui", title="Auto-rigging (BB, EL, TP)", w=self.width, h=self.height) # Title cmds.columnLayout(w=self.width, h=self.height) cmds.separator(h=10) cmds.text(label="Autorigging", w=self.width,h=20, backgroundColor=[0.15,0.15,0.15]) cmds.separator(h=10) # Mesh selector self.meshSelector = cmds.optionMenu(w=self.width,h=30,label="Choisissez un Mesh :") for m in cmds.ls(type="transform"): cmds.menuItem(label=str(m)) cmds.separator(h=40) # Point buttons cmds.scrollLayout(w=self.width) self.definePointButtons() # Action buttons (enter mode) cmds.setParent("..") cmds.setParent("..") # Here to exit scrollLayout cmds.separator(h=10) cmds.rowLayout(numberOfColumns=3) self.activateButton = cmds.button("activetaBtn", label="Activer", w=self.width/3 - 10, h=self.pointButtonHeight, command=self.onActivateButtonClick ) self.generateButton = cmds.button("generateBtn", label="Generer", w=self.width/3 - 10, h=self.pointButtonHeight, command=self.onGenerateButtonClick ) self.autoGenerateButton = cmds.button("generateAutoRigBtn", label="AutoGenerer", w=self.width/3 - 10, h=self.pointButtonHeight, command=self.onAutoRigButtonClick ) # Console cmds.setParent("..") cmds.columnLayout() cmds.separator(h=10) self.consoleText = cmds.text(label="Auto-rigging non-actif", width=self.width, height=50, backgroundColor=[0.3,0.3,0.3]) cmds.showWindow(self.window) cmds.draggerContext("riggingContext", space="world", pressCommand=self.on3DSceneClick) # Registring context ? cmds.setToolTo("riggingContext")
def initializeModuleTab(self, tabHeight, tabWidth): moduleSpecific_scrollHeight = 160 #scrollHeight = tabHeight - moduleSpecific_scrollHeight -160 scrollHeight = 250 #tabHeight temp value #will contain all the controls and buttons self.UIElements["moduleColumn"] = cmds.columnLayout(adj=True, rs=3) self.UIElements["moduleFrameLayout"] = cmds.frameLayout(height=scrollHeight, collapsable=False, borderVisible=False, label="Framer_v0.1") self.UIElements["moduleList_Scroll"] = cmds.scrollLayout(hst=0) self.UIElements["moduleList_column"] = cmds.columnLayout(columnWidth = self.scrollWidth, adj=True, rs=2) # First separator cmds.separator() #search for all modules and list the names for module in utils.findAllModules("Modules/Blueprint"): self.createModuleInstallButton(module) cmds.setParent(self.UIElements["moduleList_column"]) cmds.separator() #create a separator cmds.setParent(self.UIElements["moduleColumn"]) cmds.separator() self.UIElements["moduleName_row"] = cmds.rowLayout(nc=2, columnAttach=(1, "right", 0), columnWidth=[(1, 80)], adjustableColumn=2) cmds.text(label="Module Name :") self.UIElements["moduleName"] = cmds.textField(enable=False, alwaysInvokeEnterCommandOnReturn=True, enterCommand=self.renameModule) cmds.setParent(self.UIElements["moduleColumn"]) #Make the width of the buttons to fit into 3 columnAlign columnWidth = tabWidth + 20 #(tabWidth - 20) / 3 self.UIElements["moduleButtons_rowColumn"] = cmds.rowColumnLayout(numberOfColumns=3, ro=[(1, "both", 2),(2, "both", 2), (3, "both", 2)], columnAttach=[ (1, "both", 3),(2,"both", 3),(3,"both",3)], columnWidth=[(1,columnWidth),(2, columnWidth),(3, columnWidth)] ) self.UIElements["rehookBtn"] = cmds.button(enable=False, label="Re-hook", c=self.rehookModule_setup ) self.UIElements["snapRootBtn"] = cmds.button(enable=False, label="Snap Root > Hook", c=self.snapRootToHook) self.UIElements["constrainRootBtn"] = cmds.button(enable=False, label="Constrain Root > Hook", c=self.constrainRootToHook) self.UIElements["groupSelectedBtn"] = cmds.button(label="Group Selected", c=self.groupSelected) self.UIElements["ungroupBtn"] = cmds.button(enable=False, label="Ungroup", c=self.ungroupSelected) self.UIElements["mirrorModuleBtn"] = cmds.button(enable=False, label="Mirror Module", c=self.mirrorSelection) self.UIElements["duplicateModuleBtn"] = cmds.button(enable=True, label="Duplicate", c=self.duplicateModule) self.UIElements["deleteModuleBtn"] = cmds.button(enable=False, label="Delete") self.UIElements["symmetryMoveCheckBox"] = cmds.checkBox(enable=True, label="Symmetry Move", onc=self.setupSymmetryMoveExpressions_Checkbox, ofc=self.deleteSymmetryMoveExpressions) cmds.setParent(self.UIElements["moduleColumn"]) cmds.separator() self.UIElements["moduleSpecificRowColumnLayout"] = cmds.rowColumnLayout(nr=1, rowAttach=[1, "both", 0], rowHeight=[1,moduleSpecific_scrollHeight] ) self.UIElements["moduleSpecific_Scroll"] = cmds.scrollLayout(hst=0) self.UIElements["moduleSpecific_column"] = cmds.columnLayout(columnWidth=400, columnAttach=["both", 5], rs=2) cmds.setParent(self.UIElements["moduleColumn"]) cmds.separator()
def resizeTextScrollers(self): width=cmds.scrollLayout('reviewScrollLayout',q=True,w=True)-20 height=cmds.scrollLayout('reviewScrollLayout',q=True,h=True) cmds.scrollField('comment',e=True,h=(height/2)-120) cmds.scrollField('comment',e=True,w=width) cmds.scrollField('history',e=True,h=(height/2)-120) cmds.scrollField('history',e=True,w=width) cmds.rowColumnLayout('SceneNodeActivatorRC', e=True, columnWidth=[(1,(width/2)-1), (2,(width/2)-1)])
def __init__(s, i18n, char, requestCharEdit, requestClipEdit, sendRunClip): s.i18n = i18n s.char = char s.requestClipEdit = requestClipEdit # We're asking to edit the clip s.sendRunClip = sendRunClip # User wants to place the clip s.clips = [] # Init clips! name = s.char.metadata.get("name", "CLips").title() if not char.data: # Does the character contain nothing? with warn: requestCharEdit(char, s.refresh) s.winName = "%sWin" % name if cmds.window(s.winName, ex=True): cmds.deleteUI(s.winName) s.window = cmds.window(s.winName, rtf=True, s=False, t="%s %s" % (name, i18n["clips.title"])) cmds.columnLayout(adj=True) cmds.rowLayout(nc=2, adj=2) # Open Row cmds.iconTextButton( ann=i18n["clips.editChar"], style="iconOnly", font="boldLabelFont", image="goToBindPose.png", h=50, w=50, bgc=[0.3,0.3,0.3], c=lambda: requestCharEdit(s.char, s.refresh) ) cmds.text( l="<h1>%s</h1>" % name, hl=True, h=50 ) cmds.setParent("..") # Close row cmds.columnLayout(adj=True) # Open Col cmds.button( l=i18n["clips.newClip"], h=50, c=lambda x: warn.run(requestClipEdit, s.char, s.refresh) ) cmds.setParent("..") # Close row cmds.floatSlider( min=50, max=200, v=100, dc=s.sizeClips, h=20 ) cmds.separator() cmds.frameLayout(l=i18n["clips.moreInfo"], font="tinyBoldLabelFont") cmds.scrollLayout(cr=True, bgc=[0.2,0.2,0.2], h=400) s.wrapper = cmds.gridLayout(w=400, cwh=[100, 120], cr=True, aec=False) cmds.setParent("..") # Close grid cmds.setParent("..") # Close Scroll cmds.separator() cmds.showWindow(s.window) cmds.scriptJob(uid=[s.window, s.cleanup], ro=True) s.refresh()
def _showUI(self): reportData=self.SceneReviewer.getReportData() allowEdit=False sceneName=None date=reportData['date'] if reportData.has_key('sceneName'): sceneName=reportData['sceneName'] author=None if not reportData['author']: #new sceneReport author=getpass.getuser() allowEdit=True elif reportData['author']==getpass.getuser(): #current author of comment == you author=getpass.getuser() allowEdit=True date=time.ctime() else: #current author != you author=reportData['author'] if not date: date=time.ctime() if not sceneName: sceneName=self.getSceneName() if cmds.window(self.win, exists=True): cmds.deleteUI(self.win, window=True) window = cmds.window(self.win, title=self.win, s=True, widthHeight=(260,300)) cmds.scrollLayout('reviewScrollLayout',rc=lambda *args:self.resizeTextScrollers()) cmds.columnLayout(adjustableColumn=True,columnAttach=('both',5)) cmds.textFieldGrp('author',label='Author', ed=False, text=author)#, tcc=partial(self.updateInternalDict)) cmds.textFieldGrp('date', label='Date', ed=False, text=date)#, tcc=partial(self.updateInternalDict)) cmds.textFieldGrp('sceneName', label='SceneName', ed=False, text=sceneName) cmds.separator(h=15,style='none') cmds.text(label='Comment') cmds.scrollField('comment', text=reportData['comment'], ed=allowEdit, h=200, wordWrap=False, kpc=partial(self.updateInternalDict), cc=partial(self.updateInternalDict)) cmds.button(label='New Comment',bgc=r9Setup.red9ButtonBGC(1),c=partial(self.addNewComment)) cmds.separator(h=15,style='none') cmds.text(label='History') cmds.scrollField('history', editable=False, en=True, wordWrap=False, h=200,text=reportData['history']) cmds.separator(h=15,style='none') cmds.rowColumnLayout('SceneNodeActivatorRC',numberOfColumns=2,columnWidth=[(1,200),(2,200)]) cmds.button('setReviewActive',label='Activate Live Review',bgc=r9Setup.red9ButtonBGC(1),c=lambda x:self._setReviewStatus('active')) cmds.button('setReviewInActive',label='Disable Live Review',bgc=r9Setup.red9ButtonBGC(1),c=lambda x:self._setReviewStatus('inactive')) cmds.setParent('..') 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(window) if self.SceneReviewer.exists(): self._setReviewStatus('active') else: self._setReviewStatus('inactive')
def blender(self,*args): """ Second window: User enters values per node here. """ self.numControls = mc.intField(self.intFieldName,q=True,v=True) self.source1 = [] #Used to store names. Assignment happens in step2. self.source2 = [] self.target = [] self.nodeName = [] if(mc.window("ms_blending",exists=True)): mc.deleteUI("ms_blending",window=True) mc.window("ms_blending",title="ms_colorBlender v1.0", rtf=True) mc.scrollLayout() mc.columnLayout() #Creates numControls frameLayouts by calling fieldsGrp class. count = 1 #frameLayout counter self.frames = [] while count < (self.numControls + 1): inst = fieldsGrp(count) #Construct instance of frameLayout group creation class and store it. self.frames.append( inst ) #Store created instance count = count + 1 #Main creation window buttons/options here mc.rowLayout(nc=4) mc.text(" Load selected as: ") mc.button(label="All Source1", c = self.loadAllSrc1) mc.button(label="All Source2", c = self.loadAllSrc2) mc.button(label="All Targets", c = self.loadAllTgt) mc.setParent("..") mc.separator(w=400) mc.text("\n Prefix for each blendColor node created.") self.prefixField = mc.textFieldGrp(label='Prefix:',text='Default') mc.text("\n Attributes to connect into blendColor node inputs/outputs. No point. ('.')") self.src1AttField = mc.textFieldGrp(label='Input 1:',text='rotate') self.src2AttField = mc.textFieldGrp(label='Input 2:',text='rotate') self.tgtAttField = mc.textFieldGrp(label='Output:',text='rotate') mc.text("\n") mc.text(' Source1 = 1, Source2 = 0') self.wieghtField = mc.floatFieldGrp(label='Weight On:') mc.rowLayout(nc=4) mc.text(" ") mc.text(" ") mc.button(label="Connect", c = self.createLinkNodes ) mc.text(" ") mc.setParent("..") mc.setParent("..") mc.setParent("..") mc.showWindow("ms_blending") mc.deleteUI('ms_colorBlender',window=True)
def chosen_win(fake_input=True): winName = "All Controls" versionNumber = 0.1 if cmds.window(winName, exists=True): cmds.deleteUI(winName) cmds.window(winName, sizeable=True, titleBar=True, resizeToFitChildren=False, menuBar=True, widthHeight=(600, 500), title=winName) cmds.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16) cmds.columnLayout(columnAttach=('left', 5), rowSpacing=10, columnWidth=250) meshTransList = getChosenTransFromScene() #print meshTransList for eachTuple in meshTransList: eachTran = eachTuple[0] eachShape = eachTuple[1] cmds.rowLayout(numberOfColumns=6, columnWidth6=(200, 75, 75, 75, 75, 75), columnAlign=(1, 'center')) cmds.text(label=eachTran) cmds.button(label="select", command=partial(selectLabeledTrans, eachTran)) cmds.text(label="color: ") cmds.button(label="swipe", command=partial(swipeColor, eachShape)) crt_colorText = cmds.textField(width=50) cmds.textField(crt_colorText, width=50, enterCommand=partial(pressEnter, crt_colorText, eachShape), alwaysInvokeEnterCommandOnReturn=True, edit=True) cmds.setParent("..") cmds.rowLayout(numberOfColumns=6, columnWidth6=(200, 75, 75, 75, 75, 75), columnAlign=(1, 'center')) cmds.text(label="Change All Colors") cmds.text(label="color: ") cmds.button(label="swipe", command=partial(swipeAllColor, meshTransList)) colorText = cmds.textField(width=50) cmds.textField(colorText, width=50, enterCommand=partial(enterAllColors, colorText, meshTransList), alwaysInvokeEnterCommandOnReturn=True, edit=True) cmds.setParent("..") cmds.showWindow()
def widget(self,widgetParent): hook = mc.columnLayout( adjustableColumn=True, rs=5 ,p=widgetParent) mc.separator() mc.rowLayout( numberOfColumns=3, columnWidth2=(80,(self.canvasSize[0]-80-20)), adjustableColumn=2,cl2=('left','both' ) ) mc.text(l=' Current Path :') self.pathTxFld = mc.textField( 'buildEditor_UI_data_dir_txFld',ed=False ) mc.setParent('..') mc.separator() self.swtTab = mc.tabLayout( innerMarginWidth=5, innerMarginHeight=5 ) self.ImportTab = mc.frameLayout( mw=5,labelVisible=False,mh=5 ,p=self.swtTab) self.EditTab = mc.frameLayout( mw=5,labelVisible=False,mh=5 ,p=self.swtTab) mc.columnLayout( adjustableColumn=True) mc.frameLayout( borderStyle='etchedIn',collapsable=False,labelVisible=False,mw= 3 ,mh=3) mc.rowLayout( h=26,numberOfColumns=3, columnWidth3=(80,(self.canvasSize[0]-80-20),20), adjustableColumn=2,cl3=('left','both','right')) mc.text(l=' Current Dish :') self.currentEditedDish = mc.textField( ) rRootBtnC = mc.button(l='<' ,c=self.expose_dish_root) self.IO_TAB = mc.tabLayout( innerMarginWidth=5, innerMarginHeight=5,p=self.EditTab ) mc.frameLayout( borderStyle='etchedIn',collapsable=False,labelVisible=False,mw= 5 ,mh=5,p=self.IO_TAB ) mc.scrollLayout( horizontalScrollBarThickness=0,verticalScrollBarThickness=8, h=200,childResizable=True ) self.dishInputsComponents = mc.columnLayout( adjustableColumn=True,rs=3) mc.frameLayout( borderStyle='etchedIn',collapsable=False,labelVisible=False,mw= 5 ,mh=5,p=self.IO_TAB ) mc.scrollLayout( horizontalScrollBarThickness=0,verticalScrollBarThickness=8, h=200,childResizable=True) self.dishOutputsComponents = mc.columnLayout( adjustableColumn=True,rs=3) mc.tabLayout(self.IO_TAB ,e=True,tabLabelIndex=[1,'Inputs']) mc.tabLayout(self.IO_TAB ,e=True,tabLabelIndex=[2,'Outputs']) self.FindTab = mc.frameLayout( mw=5,labelVisible=False,mh=5 ,p=self.swtTab) self.createGourmetTab() mc.textScrollList( self.bentoElements , e=True,ra=True) mc.tabLayout(self.swtTab ,e=True,tabLabelIndex=[1,'Import']) mc.tabLayout(self.swtTab ,e=True,tabLabelIndex=[2,'Edit']) mc.tabLayout(self.swtTab ,e=True,tabLabelIndex=[3,'Find']) mc.tabLayout(self.swtTab,e=True,changeCommand=self.refresh_dishTabs_contents) anchorDock = mc.rowLayout( numberOfColumns=2, columnWidth2=(self.canvasSize[0]/5*2+12, 75 ), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1,'both',0), (2,'both',0)] ,w=self.canvasSize[0],p=self.ImportTab) self.exposedBentos_UI(anchorDock) #------------------------------------------------------------------------------------------------------------ self.bentosFactory_UI(anchorDock) modulePath = ''.join(os.path.dirname(inspect.getfile(self.exposedBentos_UI))) mc.textField( self.pathTxFld ,e=True,tx=modulePath)
def log(message): try: text = cmds.text(s.GUI["text2"], q=True, label=True) text = "%s\n:> %s" % (text, message) cmds.text(s.GUI["text2"], e=True, label=text) cmds.scrollLayout(s.GUI["layout2"], e=True, sp="down") cmds.refresh(cv=True) except RuntimeError: pass
def stereoPlayblastUI(): global txtf global interaxialSleder global zeroSleder global win global interFloatField global interFloatSlider global zeroFloatField global zeroFloatSlider core = None Title = 'StereoPlayblastWin' cams = checkCam() heightB = len( cams ) modifyWin = heightB*25 #m = len( checkCam() )*25 if mc.windowPref('StereoPlayblastWin',exists=1):mc.windowPref('StereoPlayblastWin',remove=1) if mc.window('StereoPlayblastWin', exists=1):mc.deleteUI('StereoPlayblastWin') win = mc.window('StereoPlayblastWin', title = Title, wh=(470,220 + modifyWin)) mc.scrollLayout( 'scrollLayout' ) cl1 = mc.columnLayout( cat=( 'left', 3 ), cw=200, rs=5, adj=1 ) mc.button( l='Creat 3D camera', c="stereoPlayblast.creatStereo();stereoPlayblast.winNewH( len( stereoPlayblast.checkCam() )*25 );stereoPlayblast.stereoPlayblastUI()" ) mc.rowLayout( 'stereoRow', numberOfColumns=3, adjustableColumn=3 ) mc.text( l='Interaxial Separation', w=100, al='right' ) interFloatField = mc.floatField( w=70, h=20, s=10, value=6.3500, pre=3 ) interFloatSlider = mc.floatSlider( h=15, minValue=-0.000, maxValue=1000.000) #interaxialSleder = mc.floatSliderGrp( label='interaxial Separation', w= 450, cal=[100, 'right'], field=True, minValue=-0.000, maxValue=1000.000, fieldMinValue=0.000, fieldMaxValue=1000.000, ss=1.000, value=6.3500, precision=3 ) mc.setParent('..') mc.rowLayout( 'zeroRow', numberOfColumns=3, adjustableColumn=3 ) mc.text( l='Zero Parallax', w=100, al='right' ) zeroFloatField = mc.floatField( w=70, h=20, value=254.000, precision=3 ) zeroFloatSlider = mc.floatSlider( w=200, h=20, min=0, max=100000, step=0.1) #zeroSleder = mc.floatSliderGrp( label='Zero Parallax', w= 450, cal=[100, 'right'], field=True, minValue=-0.000, maxValue=1000.000, fieldMinValue=0.000, fieldMaxValue=1000.000, ss=1.00, value=254.000,precision=3 ) mc.popupMenu() mc.menuItem( l='Set Key', c='mc.sekKeyframe' ) mc.setParent('..') mc.frameLayout(l = 'Camera List', borderStyle='etchedIn') cl2 = mc.columnLayout() updateCamList(cams) #mc.frameLayout(l = 'button', borderStyle='etchedIn') #cl3 = mc.columnLayout( cat=( 'left', 3 ), cw=200, rs=5, adj=1 ) mc.setParent('..') rl1 = mc.rowLayout( 'camShow', numberOfColumns=4, adjustableColumn=3, p=cl1 ) mc.button( l='Hide some',w=150, c="stereoPlayblast.activeSome()", p=rl1 ) mc.button( l='playblast', w=150, c="stereoPlayblast.playBlastUser( '' )", p=rl1 ) mc.button(l = 'export camera',w=150, c="stereoPlayblast.exportCam()", p=rl1) mc.setParent('..') txtf = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,295,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'),p=cl1,bc = browse, cc = getPath ) rl2 = mc.rowLayout( 'cameraShow', numberOfColumns=4, adjustableColumn=3, p=cl1 ) mc.button( l='path save',w=150, c="stereoPlayblast.saveP()", p=rl2 ) mc.button( l='left',w=150, c="stereoPlayblast.playBlastUser( 'left' )",p= rl2 ) mc.button( l='right',w=150, c="stereoPlayblast.playBlastUser( 'right' )", p=rl2 ) mc.showWindow( 'StereoPlayblastWin' ) stereoOr() loadpreV()
def __rebuildUI(layout): "Rebuild the complete UI after a tool was added or removed" cmds.setParent(layout) cmds.scrollLayout(layout, edit=True, visible=0) for child in cmds.scrollLayout(layout, query=True, childArray=True): cmds.deleteUI(child) cmds.setParent(layout) buildMainToolUI() cmds.scrollLayout(layout, edit=True, visible=1)
def Char_OpenPicture(picPath = ''): if os.path.isfile(picPath): if re.match('^.+\.(jpg|jpeg|bmp|png|iff|tif)$',os.path.basename(picPath)): picWin = 'Char_PictureWinName' if cmds.window(picWin,q = True,ex = True): cmds.deleteUI(picWin) cmds.window(picWin,wh = [1024,768],t = '图片预览',s = True) cmds.scrollLayout('scrollLyPic',cr = True,hst = 1000,vst = 1000,mcw = 1000) cmds.picture('opImage',image=picPath ) cmds.showWindow(picWin)
def UI_hideWin(self): mc.scrollLayout(self.hideScrollName, bgc=[0.2, 0.2, 0.2], horizontalScrollBarThickness=self.scrollBarThickness, verticalScrollBarThickness=self.scrollBarThickness, p=self.mainColumName) mc.columnLayout(self.attrHideColumnName, p=self.hideScrollName, bgc=[0.2, 0.2, 0.2])
def build(self): if mc.window( self.win, ex=1 ): mc.deleteUI( self.win ) if mc.windowPref ( self.win, ex=1 ): mc.windowPref ( self.win, r=1 ) mc.window( self.win, title=self.title, wh=(168,213) ) mc.scrollLayout( 'scrollLayout' ) mc.columnLayout( cat=( 'left', 3 ), cw=100, rs=5, adj=0 ) mc.button( l=self.butitle, c=self.do, width=150 ) mc.text( l=self.textTitle ) self.txtField = mc.scrollField( editable=True, wordWrap=True, width=150, height=150 ) mc.setParent( '..' )
def __init__(s, anim, validation, changeCallback): """ Modify animation window """ with report.Report(): s.anim = anim s.validation = validation # Name validation s.change = changeCallback s.layers = getAllLayers() # Grab up to date layer info winName = "Animation_Entry" if cmds.window(winName, ex=True): cmds.deleteUI(winName) window = cmds.window(winName, t="Animation", rtf=True) cmds.columnLayout(adj=True) title("Create / Edit an Animation:") name = cmds.textFieldGrp( l="Name: ", tx=s.anim.data["name"], adj=2, tcc=lambda x: s.valid(name, s.updateName(x))) frame = cmds.intFieldGrp( l="Frame Range: ", nf=2, v1=s.anim.data["range"][0], v2=s.anim.data["range"][1], cc= lambda x, y: s.valid(frame, s.updateRange(x,y)) ) title("Animation Layers") cmds.scrollLayout(cr=True, bgc=(0.2,0.2,0.2)) def addLayer(layer): enable = False if layer == "BaseAnimation" else True cmds.rowLayout(nc=3, adj=3) cmds.iconTextCheckBox( i="Solo_OFF.png", si="Solo_ON.png", v=True if enable and layer in s.anim.data["layers"]["solo"] else False, en=enable, cc=lambda x: s.updateLayer(layer, "solo", x) ) cmds.iconTextCheckBox( i="Mute_OFF.png", si="Mute_ON.png", v=True if enable and layer in s.anim.data["layers"]["mute"] else False, en=enable, cc=lambda x: s.updateLayer(layer, "mute", x) ) cmds.text( l="| " * s.layers[layer]["depth"] + layer if enable else layer, al="left", en=enable, ) cmds.setParent("..") for layer in (reversed(["BaseAnimation"] + s.layers.keys())): addLayer(layer) cmds.showWindow(window)
def createUI(): preUI() mc.window( 'gitMayaWin', title="Git Tools", iconName='', widthHeight=(200, 55) ) mc.menuBarLayout() mc.menu( label='File' ) mc.menuItem( label='Create Repo', c=lambda *args: createRepo() ) mc.setParent( '..' ) mc.columnLayout( adjustableColumn=True ) mc.rowLayout( numberOfColumns=3, columnWidth3=(80, 80, 80)) mc.button( label='Create Repo', w=80, h=80) mc.button( label='Clone Repo', w=80, h=80) mc.setParent( '..' ) mc.separator(h=10, style='none') mc.textFieldButtonGrp( 'repoPath', label='Repo Path', text='', buttonLabel='Browse', bc=lambda *args: getFolder() ) mc.button( label='Refresh', c=lambda *args: initRepo() ) mc.separator(h=10, style='none') mc.tabLayout(innerMarginWidth=5, innerMarginHeight=5) mc.columnLayout( 'Files', adjustableColumn=True ) mc.rowColumnLayout(nc=5) mc.separator(h=20, style='none') mc.text(l='Working Copy Changes') mc.separator(h=20, style='none') mc.separator(h=20, style='none') mc.text(l='Staged Changes') mc.columnLayout( 'workingChangesColor', adjustableColumn=True) mc.setParent( '..' ) mc.textScrollList( 'workingChanges', numberOfRows=16, allowMultiSelection=True) mc.columnLayout( adjustableColumn=True ) mc.button( label='>>', c=lambda *args: addChanged()) mc.button( label='>' ) mc.separator(h=30, style='none') mc.button( label='<', c=lambda *args: remSelected()) mc.button( label='<<' ) mc.setParent( '..' ) mc.columnLayout( 'stagedChangesColor', adjustableColumn=True ) mc.setParent( '..' ) mc.textScrollList( 'stagedChanges', numberOfRows=16, allowMultiSelection=True) mc.setParent( '..' ) mc.textFieldButtonGrp( 'commitMessage', label='Message', text='', buttonLabel='Commit', bc=lambda *args: doCommit() ) mc.separator(h=20) mc.setParent( '..' ) mc.columnLayout( 'History', adjustableColumn=True ) mc.intFieldGrp( 'commitCount', numberOfFields=1, label='Number of Commits', value1=10, cc=lambda *args: getCommits()) mc.scrollLayout(h=250, horizontalScrollBarThickness=16, verticalScrollBarThickness=16) mc.rowColumnLayout( 'commitsGrid', numberOfColumns=2, cw=([1,450],[2,150]) ) mc.setParent( '..' ) mc.setParent( '..' ) mc.text(l='Commited Changes') mc.textScrollList( 'commitChanges', numberOfRows=16, allowMultiSelection=True) mc.showWindow( 'gitMayaWin' ) postUI()
def createWin(): winName = "GenerateTerrainWindow" versionNum = 0.1 if cmds.window(winName, exists = True): cmds.deleteUI(winName) cmds.window(winName, sizeable=True, titleBar=True, resizeToFitChildren=False, menuBar=True, widthHeight = (450,500), title="Generate Landscape Window " + str(versionNum)) cmds.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16) cmds.columnLayout(columnAttach=('left',5), rowSpacing=10, columnWidth=250) # Start of widgets # ----- Terrain Generation ----- # cmds.text(label = "------------------------------ Terrain Generator ------------------------------", width = 500) cmds.rowLayout(numberOfColumns = 5, columnWidth5 = (50,75,75,75,75), columnAlign=(1,'center')) cmds.text(label = " Min elevation: ", width = 150) minElField = cmds.intField(value = -5, editable = True) cmds.setParent("..") cmds.rowLayout(numberOfColumns = 5, columnWidth5 = (50,75,75,75,75), columnAlign=(1,'center')) cmds.text(label = " Max elevation: ", width = 150) maxElField = cmds.intField(value = 10, editable = True) cmds.setParent("..") cmds.rowLayout(numberOfColumns = 5, columnWidth5 = (50,75,75,75,75), columnAlign=(1,'center')) cmds.button(label = "Generate Terrain", width = 150, command = partial(randomizePlaneVerts, minElField, maxElField)) cmds.text(label = " Select the plane that you wish to use, then click 'Generate Terrain'") cmds.setParent("..") # ----- Object Generation ----- # cmds.text(label = "------------------------------ Object Generator ------------------------------", width = 500) cmds.rowLayout(numberOfColumns = 5, columnWidth5 = (50,75,75,75,75), columnAlign=(1,'center')) cmds.button(label = "Store Pieces", width = 150, command = partial(storeSelectedPieces)) cmds.text(label = " Select the architecture objects that you wish to include, then click 'Store Pieces'") cmds.setParent("..") cmds.rowLayout(numberOfColumns = 5, columnWidth5 = (50,75,75,75,75), columnAlign=(1,'center')) cmds.text(label = " # objects to generate: ", width = 150) intFieldVal = cmds.intField(value = 5, minValue = 0, maxValue = 50, editable = True) cmds.setParent("..") cmds.rowLayout(numberOfColumns = 5, columnWidth5 = (50,75,75,75,75), columnAlign=(1,'center')) cmds.text(label = " Name of ground plane: ", width = 150) planeNameField = cmds.textField(text = "ground_plane", editable = True) cmds.setParent("..") cmds.button(label = "Generate Architecture", width = 150, command = partial(makeRandomPieces, intFieldVal, planeNameField)) cmds.text(label = "------------------------------------------------------------------------------", width = 500) cmds.showWindow()
def resultDialogue(attributesList): if cmds.window('attributeCompareWindow', ex=True): cmds.deleteUI('attributeCompareWindow') cmds.window('attributeCompareWindow', t='Compare Results', w=500, h=500) cmds.scrollLayout() mainLayout = cmds.rowLayout(nc=3) col1 = cmds.columnLayout(w=150, p=mainLayout) cmds.textField(w=150, tx='Object/Attribute', p=col1) col2 = cmds.columnLayout(w=150, p=mainLayout) cmds.textField(w=150, tx=cmds.ls(sl=True)[0], p=col2) col3 = cmds.columnLayout(w=150, p=mainLayout) cmds.textField(w=150, tx=cmds.ls(sl=True)[1], p=col3) for attribute in attributesList: aError_Code = 'Null' bError_Code = 'Null' if (cmds.attributeQuery(attribute, ex=True, n=cmds.ls(sl=True)[0]) == False): aError_Code = 'Attribute Not Exist' if (cmds.attributeQuery(attribute, ex=True, n=cmds.ls(sl=True)[1]) == False): bError_Code = 'Attribute Not Exist' try: cmds.textField(w=150, tx=str( cmds.getAttr(cmds.ls(sl=True)[0] + '.' + attribute, asString=True)), bgc=[0.767, 0, 0], p=col2) except: cmds.textField(w=150, tx=aError_Code, bgc=[0.3, 0.3, 0.3], p=col2) try: cmds.textField(w=150, tx=str( cmds.getAttr(cmds.ls(sl=True)[1] + '.' + attribute, asString=True)), bgc=[0, 0.767, 0], p=col3) except: cmds.textField(w=150, tx=bError_Code, bgc=[0.27, 0.27, 0.27], p=col3) cmds.textField(w=150, tx=attribute, bgc=[0.3, 0.3, 0.3], p=col1) cmds.showWindow('attributeCompareWindow')
def UI(): bdWin = "FootballUtils" if cmds.window(bdWin, q=True, ex=True): cmds.deleteUI(bdWin) cmds.window(bdWin, title="Football Utils") cmds.scrollLayout(horizontalScrollBarThickness=16) bdMainCL = cmds.columnLayout(columnAttach=("both", 5), rowSpacing=10, columnWidth=320) #Bip List bdFL1 = cmds.frameLayout(label="Bips", bs="etchedOut", w=300, mw=5, cll=1, p=bdMainCL) bdRL = cmds.rowLayout(numberOfColumns=2, columnWidth2=(150, 150), p=bdFL1) bdBipList = cmds.textScrollList('bipList', numberOfRows=10, allowMultiSelection=True, height=100, sc=bdSelectBip, p=bdRL) bdGenericList = cmds.textScrollList('genericList', numberOfRows=10, allowMultiSelection=True, height=100, sc=bdSelectGeneric, p=bdRL) bdPopulateBipList() cmds.button(l="Rename Bips", c=bd_renameBips, p=bdFL1) bdFL2 = cmds.frameLayout(label="Generic", bs="etchedOut", w=300, mw=5, cll=1, p=bdMainCL) cmds.button(l="Import Generic Character", al="right", c=bdImportGeneric) cmds.button(l="Duplicate Generic Character", al="right", c=bdDuplicateGeneric) cmds.text( l='Note: Even if there is only one Generic, click Duplicate Generic\n Use the Global_Scale_Anim to scale the Generic chars' ) cmds.button(l="Copy Anim ", al="right", c=bd_mocapToCotrollers) cmds.button(l="Bake Anim", al="left", c=bd_bakeControllers) cmds.button(l="Remove Mocap data", c=bdRemoveMocapData) #END JOINTS CREATION cmds.showWindow(bdWin)
def stereoPlayblastUI(): global txtf win = 'StereoPlayblastWin' core = None Title = 'StereoPlayblastWin' cams = checkCam() heightB = len( cams ) modifyWin = heightB*25 #m = len( checkCam() )*25 if mc.windowPref(win,exists=1):mc.windowPref(win,remove=1) if mc.window(win, exists=1):mc.deleteUI(win) mc.window(win, title = Title, wh=(470,220 + modifyWin)) mc.scrollLayout( 'scrollLayout' ) cl1 = mc.columnLayout( cat=( 'left', 3 ), cw=200, rs=5, adj=1 ) mc.button( l='Creat 3D camera', c="creatStereo();winNewH( len( checkCam() )*25 );stereoPlayblastUI()" ) mc.rowLayout( 'stereoRow', numberOfColumns=3, adjustableColumn=3 ) #mc.text( l='interaxial Separation', w=100, al='right' ) mc.floatSliderGrp( 'interaxialSleder', label='interaxial Separation', w= 450, cal=[100, 'right'], field=True, minValue=-0.000, maxValue=1000.000, fieldMinValue=0.000, fieldMaxValue=1000.000, ss=1.000, value=6.3500, precision=3 ) mc.setParent('..') mc.rowLayout( 'zeroRow', numberOfColumns=3, adjustableColumn=3 ) #mc.text( l='Zero Parallax', w=100, al='right' ) #mc.floatField( 'zeroField', w=80, h=20, value=254.000 ) #mc.floatSlider( 'zeroSleder', w=200, h=2 0, min=0, max=100000, step=0.1) mc.floatSliderGrp( 'zeroSleder', label='Zero Parallax', w= 450, cal=[100, 'right'], field=True, minValue=-0.000, maxValue=1000.000, fieldMinValue=0.000, fieldMaxValue=1000.000, ss=1.00, value=254.000,precision=3 ) camListStereo = mc.ls( type='stereoRigTransform' ) if camListStereo == []: mc.floatSliderGrp( 'interaxialSleder', e=1, enable=False ) mc.floatSliderGrp( 'zeroSleder', e=1, enable=False ) else: stereoShape = mc.listRelatives( camListStereo[0],s=1 )[0] mc.connectControl( 'interaxialSleder', stereoShape+'.interaxialSeparation' ) mc.connectControl( 'zeroSleder', stereoShape+'.zeroParallax' ) #mc.floatField( 'interaxialField', w=80, h=20, value=6.350 ) #mc.floatSlider( 'interaxialSleder', w=200, h=20, min=0, max=100000, step=0.1 ) mc.setParent('..') mc.frameLayout(l = 'Camera List', borderStyle='etchedIn') cl2 = mc.columnLayout() updateCamList(cams) #mc.frameLayout(l = 'button', borderStyle='etchedIn') #cl3 = mc.columnLayout( cat=( 'left', 3 ), cw=200, rs=5, adj=1 ) mc.setParent('..') rl1 = mc.rowLayout( 'camShow', numberOfColumns=4, adjustableColumn=3, p=cl1 ) mc.button( l='Hide some',w=150, c="activeSome()", p=rl1 ) mc.button( l='playblast', w=150, c="playBlastUser( '' )", p=rl1 ) mc.button(l = 'export camera',w=150, c="exportCam()", p=rl1) mc.setParent('..') txtf = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,295,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'),p=cl1,bc = browse, cc = getPath ) rl2 = mc.rowLayout( 'cameraShow', numberOfColumns=4, adjustableColumn=3, p=cl1 ) mc.button( l='path save',w=150, c="saveP()", p=rl2 ) mc.button( l='left',w=150, c="playBlastUser( 'left' )",p= rl2 ) mc.button( l='right',w=150, c="playBlastUser( 'right' )", p=rl2 ) mc.showWindow( win ) loadpreV()
def resizeTextScrollers(self): width = cmds.scrollLayout('reviewScrollLayout', q=True, w=True) - 20 height = cmds.scrollLayout('reviewScrollLayout', q=True, h=True) cmds.scrollField('comment', e=True, h=(height / 2) - 120) cmds.scrollField('comment', e=True, w=width) cmds.scrollField('history', e=True, h=(height / 2) - 120) cmds.scrollField('history', e=True, w=width) cmds.rowColumnLayout('SceneNodeActivatorRC', e=True, columnWidth=[(1, (width / 2) - 1), (2, (width / 2) - 1)])
def CreateTurntableTab(self): print "Creating the turntable tab" cmds.formLayout( "TurntableCounterLayout", p = "TabLayout", numberOfDivisions=100) cmds.scrollLayout( "TurnTableScrollLayout" , p = "TurntableCounterLayout") cmds.columnLayout( "TurnTableLayout", p = "TurnTableScrollLayout", adjustableColumn = True ) cmds.text("TurntableCounter", p = "TurntableCounterLayout", bgc = [0.361, 0, 0], label = "Turntable Count = 0" + ", Min required is 1" , w = 309, h = 20, font = "boldLabelFont") cmds.formLayout( "TurntableCounterLayout", edit=True, attachForm=[("TurnTableScrollLayout", 'top', 5), ("TurnTableScrollLayout", 'left', 5), ("TurnTableScrollLayout", 'right', 5), ("TurntableCounter", 'left', 5), ("TurntableCounter", 'bottom', 5), ("TurntableCounter", 'right', 5) ], attachControl=[("TurnTableScrollLayout", 'bottom', 5, "TurntableCounter")], attachNone=("TurntableCounter", 'top') ) cmds.separator("BufferTT", h = 600, p = "TurnTableLayout", style = "none") print "Created the turntable tab"
def uploadGui(self): if cmds.window('HugePropsDataUpload', q=1, exists=1): cmds.deleteUI('HugePropsDataUpload') MyUploadtool = cmds.window('HugePropsDataUpload',title='Huge Props Data Upload',widthHeight=(550,500),sizeable=False) cmds.columnLayout(adjustableColumn=True) cmds.text(label='Huge Props Data Upload',height=30, backgroundColor=[0.5, 0.5, 0.6]) cmds.separator(style='out') cmds.columnLayout(adjustableColumn=True) cmds.columnLayout(adjustableColumn=True) cmds.text('Name The Huge Props',align='center',backgroundColor=[0.5, 0.6, 0.5]) cmds.columnLayout(adjustableColumn=True) cmds.text(' ') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100),(2,200),(3,50)]) cmds.text('Huge Props Name: ',align='right',height=25) cmds.textField('Huge_Props_Name',editable=False) cmds.button('edit_lock',label='New',command=lambda *arg: self.edit_lock()) cmds.setParent('..') cmds.text(' ') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1,200),(2,350)]) cmds.columnLayout(adjustableColumn=True) cmds.text('Huge Props List',align='center',backgroundColor=[0.5, 0.6, 0.5]) cmds.scrollLayout('hugePropsScrollLayout', height=200) self.HugePropsListPlus() cmds.setParent('..') cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.text('AR and Props List',align='center',backgroundColor=[0.5, 0.6, 0.5]) cmds.scrollLayout('mainScrollLayout', height=200) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.separator(style='out') cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1,250),(2,150),(3,150)]) cmds.button(label='Add',height=50,command=lambda *arg: self.add()) cmds.button(label='Upload',height=50,command=lambda *arg: self.Upload()) cmds.button(label='Remove',height=50,command=lambda *arg: self.remove()) cmds.setParent('..') cmds.separator(style='out') cmds.setParent('..') cmds.showWindow(MyUploadtool)
def about(): ''' About Window ''' windowName = 'lock_n_hideAboutWin' if cmd.window(windowName, exists=1): cmd.deleteUI(windowName) # cmd.windowPref( windowName, remove = True ) cmd.window(windowName, w=450, h=380, s=1, tb=1, t="About Lock 'n Hide") cmd.scrollLayout(childResizable=1, horizontalScrollBarThickness=0) cmd.columnLayout(adjustableColumn=1, rowSpacing=10, columnOffset=("both", 10)) title = "About Lock 'n Hide" generalTitle = "The Gist of It" aboutText = formatUIText(''' Lock 'n Hide was written by Jordan Hueckstaedt. It utilizes a relatively simple work around to enable locking and hiding attributes on referenced nodes.''') detailsTitle = "The Devil in the Details" details = formatUIText(''' Lock 'n Hide saves the current state of an attribute on scene load and uses the Maya API to force an attribute's locked and keyable state. The user can restore the original saved state of that attribute at any time. This script does not allow unlocking or unhiding referenced attributes.''') footerText = dedent(''' Lock 'n Hide Version %s Copyright 2012 Jordan Hueckstaedt Lock 'n Hide is released under LGPL v3 License Website: rubberguppy.com Email: [email protected] Special thanks to Eric Pavey for letting me release his pickle attribute code/concept under LGPL ''' % __version__) # Why do I need a blank line here for the last line to show up? What the hell is going on?!? contactTitle = 'See a bug? Want to suggest a feature? Contact me!' contact = dedent(''' ''') cmd.text(label=title, wordWrap=1, align='center', fn='boldLabelFont') cmd.separator(style='in') cmd.text(label=generalTitle, wordWrap=1, align='center', fn='obliqueLabelFont') cmd.text(label=aboutText, wordWrap=1, align='center') cmd.separator(style='in') cmd.text(label=detailsTitle, wordWrap=1, align='center', fn='obliqueLabelFont') cmd.text(label=details, wordWrap=1, align='center') cmd.separator(style='in') # cmd.text(label = contactTitle, wordWrap = 1, align = 'center', fn = 'obliqueLabelFont') # cmd.text(label = contact, wordWrap = 1, align = 'center') # cmd.separator(style = 'in') cmd.text(label=footerText, wordWrap=1, align='center') cmd.showWindow(windowName)
def UI_channelBoxWin(self): mc.scrollLayout(self.cbScrollName, w=self.channelboxLayoutWidth + self.scrollBarThickness, bgc=[0.2, 0.2, 0.2], horizontalScrollBarThickness=self.scrollBarThickness, verticalScrollBarThickness=self.scrollBarThickness, p=self.mainColumName) mc.columnLayout(self.attrCbColumnName, w=self.channelboxLayoutWidth, p=self.cbScrollName, bgc=[0.2, 0.2, 0.2])
def help(): ''' Help window ''' windowName = 'lock_n_hideHelpWin' if cmd.window(windowName, exists=1): cmd.deleteUI(windowName) # cmd.windowPref( windowName, remove = True ) cmd.window(windowName, w=450, h=430, s=1, tb=1, t="Lock 'n Hide Help") cmd.scrollLayout(childResizable=1, horizontalScrollBarThickness=0) cmd.columnLayout(adjustableColumn=1, rowSpacing=10, columnOffset=("both", 10)) title = "Lock 'n Hide" generalTitle = 'General' general = formatUIText(''' Lock 'n Hide adds the ability to lock and hide attributes on referenced nodes. Lock 'n Hide buttons work on attributes selected in the Channel Box. If no attributes are selected, all the attributes will be affected.''') buttonsTitle = 'Buttons' buttons = formatUIText(''' The Lock button locks attributes. The Lock 'n Hide button locks and hides attributes. The Reset button will unlock the selected attributes. If no attributes are selected, all the attributes on the selected node will be unlocked and unhidden. The "Reset All Objects" under the Options menu will restore all the nodes in the current scene to their original state.''') noteTitle = 'Note' note = formatUIText(''' Lock 'n Hide should not allow users to unlock or unhide an attribute that is locked or hidden in a referenced file. This is to protect asset integrity and keep Maya's operations consistent as unlocked attributes that were previously locked in a referenced file will not save/restore their current data with scene. Future versions of this script could theoretically store this data in the same way that locked/unlocked states are saved now. However, I have no plans to do so at this time (I don't want studios calling to complain that I've broken their pipelines).''') cmd.text(label=title, wordWrap=1, align='center', fn='boldLabelFont') cmd.separator(style='in') cmd.text(label=generalTitle, wordWrap=1, align='center', fn='obliqueLabelFont') cmd.text(label=general, wordWrap=1, align='left') cmd.separator(style='in') cmd.text(label=buttonsTitle, wordWrap=1, align='center', fn='obliqueLabelFont') cmd.text(label=buttons, wordWrap=1, align='left') cmd.separator(style='in') cmd.text(label=noteTitle, wordWrap=1, align='center', fn='obliqueLabelFont') cmd.text(label=note, wordWrap=1, align='left') # fn = 'boldLabelFont', 'obliqueLabelFont', 'fixedWidthFont' cmd.showWindow(windowName)
def initialiseModuleTab (self, tabHeight, tabWidth): moduleSpecific_scrollHeight = 120 scrollHeight = tabHeight - moduleSpecific_scrollHeight - 163 self.UIElements["moduleColumn"] = cmds.columnLayout(adj=True, rs=3) self.UIElements["moduleFrameLayout"] = cmds.frameLayout(height=scrollHeight, collapsable=False, borderVisible=False, labelVisible=False) self.UIElements["moduleList_Scroll"] = cmds.scrollLayout(hst=0) self.UIElements["moduleList_column"] = cmds.columnLayout(columnWidth=self.scrollWidth, adj=True, rs=2) #First separator cmds.separator() for module in utils.findAllModules('Modules/Blueprint'): self.createModuleInstallButton(module) cmds.setParent(self.UIElements['moduleList_column']) cmds.separator() cmds.setParent(self.UIElements['moduleColumn']) cmds.separator() self.UIElements['moduleName_row'] = cmds.rowLayout(nc=2,columnAttach=(1,'right',0),columnWidth=[(1,80)],adjustableColumn=2) cmds.text(label='Module Name :') self.UIElements['moduleName'] = cmds.textField(enable=False,alwaysInvokeEnterCommandOnReturn=True, enterCommand=self.renameModule) cmds.setParent(self.UIElements['moduleColumn']) columnWidth = (tabWidth -20)/3 self.UIElements['moduleButtons_rowColumn'] = cmds.rowColumnLayout(numberOfColumns=3,ro=[(1,'both',2),(2,'both',2),(3,'both',2)],columnAttach=[(1,'both',3),(2,'both',3),(3,'both',3)],columnWidth=[(1,columnWidth),(2,columnWidth),(3,columnWidth)]) self.UIElements['rehookBtn'] = cmds.button(enable=False,label='Re-hook', c=self.rehookModule_setup) self.UIElements['snapRootBtn'] = cmds.button(enable=False,label='Snap Root> Hook', c=self.snapRootToHook) self.UIElements['constrainRootBtn'] = cmds.button(enable=False,label='Constrain Root > Hook', c=self.constrainRootToHook) self.UIElements['groupSelectedBtn'] = cmds.button(label='Group Selected', c=self.groupSelected) self.UIElements['ungroupBtn'] = cmds.button(enable=False,label='Ungroup', c=self.ungroupSelected) self.UIElements['mirrorModuleBtn'] = cmds.button(enable=False,label='Mirror Module', c=self.mirrorSelection) self.UIElements['duplicateModuleBtn'] = cmds.button(enable=True,label='Duplicate', c=self.duplicateModule) self.UIElements['deleteModuleBtn'] = cmds.button(enable=False,label='Delete') self.UIElements['symmetryMoveCheckBox'] = cmds.checkBox(enable=True,label='Symmetry Move', onc=self.setupSymmetryMoveExpressions_CheckBox, ofc=self.deleteSymmetryMoveExpressions) cmds.setParent(self.UIElements["moduleColumn"]) cmds.separator() self.UIElements['moduleSpecificRowColumnLayout'] = cmds.rowColumnLayout(nr=1,rowAttach=[1,'both',0], rowHeight=[1,moduleSpecific_scrollHeight]) self.UIElements['moduleSpecific_Scroll'] = cmds.scrollLayout(hst=0,width=390) self.UIElements['moduleSpecific_column'] = cmds.columnLayout(columnWidth = self.scrollWidth, columnAttach=['both', 5], rs=2) cmds.setParent(self.UIElements['moduleColumn']) cmds.separator()
def existMATUI(): mc.frameLayout('frame_MATERIAL',w=ui.rowWidth,l='Existing Materials List',ec=partial(delay,'existMATUI','()'),cll=1) if mc.scrollLayout('materiallist',q=1,ex=1)==True: mc.deleteUI('materiallist') mc.setParent('frame_MATERIAL') mc.scrollLayout('materiallist',w=ui.rowWidth,h=390)#h=len(ls.shaders())*25) mc.rowColumnLayout(w=ui.rowWidth-10,numberOfColumns=2) for each in sorted(ls.shaders()): mc.button(w=ui.rowWidth-55,l=each,c=partial(delay,'mc.select','(\''+ str(each)+'\')')) mc.button(w=45,l='ASSIGN',c=partial(delay,'mc.hyperShade','(assign=\''+ str(each)+'\')')) #mc.button(w=40,l='GRAPH') mc.setParent('..');mc.setParent('..')
def ui(self): ''' Launch a UI to display the marks that were recorded. ''' with utl.MlUi('ml_stopwatchReport', 'Stopwatch Report', width=400, height=400, info='''This is the report from the stopwatch you just ran. Adjust the start frame, and then press the frame buttons to jump to that frame. The fields on the right can be used for notes.''', menu=False) as win: self.uiSlider = mc.intSliderGrp(field=True, label='Start Frame', value=self.startFrame, minValue=((-0.5*self.frameMarks[-1])+self.startFrame), maxValue=(self.frameMarks[-1]/2)+self.startFrame, fieldMinValue=-1000, fieldMaxValue=1000, changeCommand=self.uiUpdateStartFrame) self.frameRateField = mc.intFieldGrp(label='Frame Rate', value1=self.frameRate, enable1=False, extraLabel='fps', annotation='') mc.scrollLayout() mc.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 50), (2, 80), (3, 340)]) mc.text('Frame') mc.text('Duration') mc.text('Notes') for i in range(3): mc.separator(style='single', height=15) self.uiButton = list() for i in range(len(self.frameMarks)): #frame button frame = self.frameMarks[i]+self.startFrame self.uiButton.append(mc.button(label=str(frame), annotation='Go to frame %i' % frame,command='import maya.cmds;maya.cmds.currentTime(%i,edit=True)' % frame)) #duration text if i: mc.text(label=str(self.frameMarks[i]-self.frameMarks[i-1])) else: mc.text(label='Start') #notes field mc.textField() #add the stop mc.text(label='') mc.text(label='Stop') mc.setParent('..') mc.setParent('..') #next and prev buttons! mc.paneLayout(configuration='vertical2',separatorThickness=1) mc.button(label='<< Previous', command=self.previousFrame, annotation='Go to the previous frame in the list.') mc.button(label='Next >>', command=self.nextFrame, annotation='Go to the next frame in the list.')
def hairballUI(): window = mc.window( title="Hairball v%s" % _version, iconName='hairball', widthHeight=(200, 55) ) mc.scrollLayout( 'scrollLayout' ) mc.columnLayout( adjustableColumn=True ) mc.button(label='Reload', command=''' import maya.cmds as mc import hairTools.hairTools as hairTools mc.deleteUI( "%s", window=True) hairTools.hairballUI() ''' % window) mc.frameLayout( label='Grow', labelAlign='center', borderStyle='etchedIn' ) mc.columnLayout( adjustableColumn=True ) densityField = mc.floatSliderGrp( label='Density', cw3=[80, 80, 120], field=True, value = .4, fs=.01, minValue=.01, maxValue=1.0, fmx=200.0 ) layerField = mc.intSliderGrp( label='Layers', cw3=[80, 80, 120], field=True, value = 5, minValue=1, maxValue=15, fmx=200 ) twistField = mc.floatSliderGrp( label='Twist', cw3=[80, 80, 120], field=True, value = 0, fs=.01, minValue=-1.0, maxValue=1.0, fmx=5.0, fmn=-5.0 ) mc.button( label='Cough it up!', command=''' import maya.cmds as mc import hairTools.hairTools as hairTools hairTools.makeHair(mc.ls(sl=True, fl=True), mc.floatSliderGrp("%s", q=True, value=True), mc.intSliderGrp("%s", q=True, v=True), mc.floatSliderGrp("%s", q=True, value=True)) ''' % (densityField, layerField, twistField)) mc.setParent( '..' ) mc.setParent( '..' ) mc.frameLayout( label='Groom', labelAlign='center', borderStyle='etchedIn' ) mc.columnLayout( adjustableColumn = True) rand1Field = mc.floatSliderGrp( label='Start', cw3=[80, 80, 120], field=True, value = .1, fs=.1, minValue=0, maxValue=5.0, fmx=200.0 ) rand2Field = mc.floatSliderGrp( label='Middle', cw3=[80, 80, 120], field=True, value = .4, fs=.1, minValue=0, maxValue=5.0, fmx=200.0 ) rand3Field = mc.floatSliderGrp( label='End', cw3=[80, 80, 120], field=True, value = .6, fs=.1, minValue=0, maxValue=5.0, fmx=200.0 ) mc.button( label='Muss it up.', command=''' import maya.cmds as mc import hairTools.hairTools as hairTools hairTools.randomizeHair(mc.ls(sl=True, fl=True), [mc.floatSliderGrp("%s", q=True, value=True), mc.floatSliderGrp("%s", q=True, v=True), mc.floatSliderGrp("%s", q=True, v=True)]) ''' % (rand1Field, rand2Field, rand3Field)) mc.setParent( '..' ) mc.setParent( '..' ) mc.frameLayout( label='Trim', labelAlign='center', borderStyle='etchedIn' ) mc.columnLayout( adjustableColumn = True) minTrimField = mc.floatSliderGrp( label='Min Length', cw3=[80, 80, 120], field=True, value = .3, fs=.1, minValue=0.1, maxValue=1.0 ) percentTrimField = mc.floatSliderGrp( label='Percent to trim', cw3=[80, 80, 120], field=True, value = .5, fs=.1, minValue=0.1, maxValue=1.0 ) mc.button( label='A little off the top.', command=''' import maya.cmds as mc import hairTools.hairTools as hairTools hairTools.trimHair(mc.ls(sl=True), mc.floatSliderGrp("%s", q=True, value=True), mc.floatSliderGrp("%s", q=True, value=True)) ''' % (minTrimField, percentTrimField)) mc.setParent( '..' ) mc.setParent( '..' ) mc.showWindow( window ) mc.window(window, e=True, w=310, h=400)
def exposedBentos_UI(self,anchor): leftPanel = mc.frameLayout( collapsable=False,labelVisible=False, borderStyle='etchedIn',mw=5,mh=5,p=anchor ) mc.columnLayout( adjustableColumn=True, rs=5 ) mc.text(l='Available Bentos') mc.scrollLayout( horizontalScrollBarThickness=0,verticalScrollBarThickness=8) scrollWdth = mc.columnLayout( adjustableColumn=True, rs=5,w=self.canvasSize[0]/5*2-27,h=self.canvasSize[1]-20) dishList = self.IO.exposeZipTemplate() dishName = '' for dish in dishList: dishName = os.path.basename(dish).split('.zip')[0] btn = mc.button(l=dishName,h=28,ann='test') mc.button(btn,e=True,c=partial( self.switch_module, dishName ,dish ))
def __init__(s, templateData): with report.Report(): s.template = templateData s.joints = [] def parse(data): for c in [a for a in data if a[:1] != "_"]: j = Joint(c, data[c]) j.btn = {} s.joints.append(j) data[c] = j parse(data[c]) parse(s.template) s.missing = 0 # count missing entries winName = "TemplateWin" if cmds.window(winName, ex=True): cmds.deleteUI(winName) window = cmds.window(winName, rtf=True, t="Retarget Skeleton") outer = cmds.columnLayout(adj=True) cmds.text(hl=True, h=60, l="Select a <strong>JOINT</strong> in the Maya scene. Then click the corresponding <strong>BUTTON</strong> to forge a connection.") cmds.scrollLayout(h=400, bgc=(0.2,0.2,0.2), cr=True) wrapper = cmds.rowLayout(nc=5, adj=1) col1 = cmds.columnLayout(adj=True, p=wrapper) cmds.text(l="Joint") cmds.separator() col2 = cmds.columnLayout(adj=True, p=wrapper) cmds.text(l="Position") cmds.separator() col3 = cmds.columnLayout(adj=True, p=wrapper) cmds.text(l="Rotation") cmds.separator() col4 = cmds.columnLayout(adj=True, p=wrapper) cmds.text(l="Scale") cmds.separator() col5 = cmds.columnLayout(adj=True, p=wrapper) cmds.text(l="R.Order") cmds.separator() for j in s.joints: s.addBaseBtn(j, col1) s.addAttrBtn(j, POSITION, col2) s.addAttrBtn(j, ROTATION, col3) s.addAttrBtn(j, SCALE, col4) s.addROrderBtn(j, col5) s.btnSave = cmds.button(l="Click to Save", en=False, h=50, p=outer, c=lambda x: s.save()) cmds.showWindow(window) s.marker = markers.Markers() cmds.scriptJob(uid=[window, s.marker.__exit__], ro=True) cmds.warning("%s to target." % s.missing)