def __init__(self): self.uiCmd = AssignPsd_uiCmd( self ) if cmds.uiTemplate( 'worldBasePsdTemplate', exists=True ): cmds.deleteUI( 'worldBasePsdTemplate', uiTemplate=True ) template = cmds.uiTemplate( 'worldBasePsdTemplate' ) cmds.text( defineTemplate=template, l='' ) if cmds.window( "assignPsd_ui", ex=1 ): cmds.deleteUI( "assignPsd_ui" ) self.win = cmds.window( "assignPsd_ui", title="Assign UI" ) cmds.columnLayout() cmds.setUITemplate( template, pushTemplate=True ) cmds.rowColumnLayout( nc=3, cw=[(1,120),(2,120),(3,60)] ) cmds.text( l='Blend Shape Controler' ) self.txf = cmds.textField() cmds.popupMenu() cmds.menuItem( l='Load Selected', c=self.uiCmd.loadSel ) cmds.button( l='Select', c= self.uiCmd.selControlCmd ) cmds.setParent( '..' ) cmds.text(h=10) cmds.rowColumnLayout( nc=3, cw=[(1,50),(2,200),(3,50)] ) cmds.text() cmds.button( l="Assign BlendShape", c=self.uiCmd.assignCmd, h=25 ) cmds.text() cmds.setParent( '..' ) cmds.text() cmds.rowColumnLayout( nc=1, cw=(1,300) ) cmds.separator() cmds.setParent( '..' ) cmds.text() cmds.rowColumnLayout( nc=3, cw=[(1,50),(2,200),(3,50)] ) cmds.text() self.fixModeButton = cmds.button( l="", h=25 ) self.fixModeButton_condition() cmds.text() cmds.setParent( '..' ) cmds.text() ''' cmds.rowColumnLayout( nc=1, cw=( 1,300 ) ) self.scroll = cmds.textScrollList() ''' cmds.window( self.win, e=1, wh=( 305, 150 ) ) cmds.showWindow( self.win ) cmds.setUITemplate( template, popTemplate=True ) self.scriptJobSetting()
def __init__(self): self.uiCmd = AssignPsd_uiCmd(self) if cmds.uiTemplate('worldBasePsdTemplate', exists=True): cmds.deleteUI('worldBasePsdTemplate', uiTemplate=True) template = cmds.uiTemplate('worldBasePsdTemplate') cmds.text(defineTemplate=template, l='') if cmds.window("assignPsd_ui", ex=1): cmds.deleteUI("assignPsd_ui") self.win = cmds.window("assignPsd_ui", title="Assign UI") cmds.columnLayout() cmds.setUITemplate(template, pushTemplate=True) cmds.rowColumnLayout(nc=3, cw=[(1, 120), (2, 120), (3, 60)]) cmds.text(l='Blend Shape Controler') self.txf = cmds.textField() cmds.popupMenu() cmds.menuItem(l='Load Selected', c=self.uiCmd.loadSel) cmds.button(l='Select', c=self.uiCmd.selControlCmd) cmds.setParent('..') cmds.text(h=10) cmds.rowColumnLayout(nc=3, cw=[(1, 50), (2, 200), (3, 50)]) cmds.text() cmds.button(l="Assign BlendShape", c=self.uiCmd.assignCmd, h=25) cmds.text() cmds.setParent('..') cmds.text() cmds.rowColumnLayout(nc=1, cw=(1, 300)) cmds.separator() cmds.setParent('..') cmds.text() cmds.rowColumnLayout(nc=3, cw=[(1, 50), (2, 200), (3, 50)]) cmds.text() self.fixModeButton = cmds.button(l="", h=25) self.fixModeButton_condition() cmds.text() cmds.setParent('..') cmds.text() ''' cmds.rowColumnLayout( nc=1, cw=( 1,300 ) ) self.scroll = cmds.textScrollList() ''' cmds.window(self.win, e=1, wh=(305, 150)) cmds.showWindow(self.win) cmds.setUITemplate(template, popTemplate=True) self.scriptJobSetting()
def __createUI(self): self.win = CurveToolUI.win_name if not cmds.uiTemplate('CurveToolsUITemplate', exists=True): cmds.uiTemplate('CurveToolsUITemplate') if cmds.window(self.win, exists=True): cmds.deleteUI(self.win) self.win = cmds.window(self.win, t=CurveToolUI.win_title, mb=True, w=656, h=385) self.main_menu = cmds.menu(label="Menu", parent=self.win) #cmds.menuItem(label="Refresh List", c=self.handleRefreshMenu) self.help_menu = cmds.menu(label="Help", parent=self.win) #cmds.menuItem(label="Help", c=self.handleHelpMenu) self.mainLayout = cmds.rowColumnLayout(nc=2, cw=[(1, 292), (2, 360)]) self.leftLayout = cmds.rowColumnLayout(nr=3, parent=self.mainLayout, rh=[(1, 48), (2, 256), (3, 48)]) self.topRow = cmds.rowColumnLayout(nc=3, parent=self.leftLayout) self.shapesList = cmds.textScrollList(parent=self.leftLayout, nr=24) self.btmRow = cmds.rowColumnLayout(nc=3, parent=self.leftLayout, w=128) self.createBtn = cmds.button(l="Create", w=96, h=48, parent=self.topRow) self.replaceBtn = cmds.button(l="Replace", w=96, h=48, parent=self.topRow) self.appendBtn = cmds.button(l="Append", w=96, h=48, parent=self.topRow) self.saveBtn = cmds.button(l="Save", w=96, h=48, parent=self.btmRow) self.overwriteBtn = cmds.button(l="Overwrite", w=96, h=48, parent=self.btmRow) self.deleteBtn = cmds.button(l="Delete", w=96, h=48, parent=self.btmRow) self.paneLayout = cmds.paneLayout(parent=self.mainLayout) self.viewport = cmds.modelPanel(mbv=False, parent=self.paneLayout) #------------------------------------------- install click handlers --- cmds.button(self.createBtn, e=True, c=self.__handleCreateClick) cmds.button(self.replaceBtn, e=True, c=self.__handleReplaceClick) cmds.button(self.appendBtn, e=True, c=self.__handleAppendClick) cmds.button(self.saveBtn, e=True, c=self.__handleSaveClick) cmds.button(self.overwriteBtn, e=True, c=self.__handleOverwriteClick) cmds.button(self.deleteBtn, e=True, c=self.__handleDeleteClick) cmds.textScrollList(self.shapesList, e=True, sc=self.__handleShapeListSelection) #----------------------------------------- setup UiDeleted callback --- self.__uiCallback = OpenMayaUI.MUiMessage.addUiDeletedCallback( self.win, self.__handleUIClosed ) cmds.showWindow(self.win)
def build(self): self.destroy() if mc.uiTemplate(self.Uit, q=True, ex=True): mc.deleteUI(self.Uit, uit=True) mc.uiTemplate(self.Uit) mc.button(dt=self.Uit, w=150, h=36) mc.text(dt=self.Uit, font='fixedWidthFont') self.Win = mc.window(self.Win, wh=self.widthHeight, title=self.Title) mc.setUITemplate(self.Uit, pushTemplate=True) mc.columnLayout() mc.button(l='Find Duplicated Texture', c=lambda x: findDuplicatedTexturePath.doIt()) mc.setParent('..') mc.setUITemplate(popTemplate=True)
def ae_code_new(node): #print('ae_code_new: ' + node) if not cmds.uiTemplate('Exprespy', ex=True): cmds.uiTemplate('Exprespy') cmds.setUITemplate('Exprespy', pushTemplate=True) ctl = cmds.scrollField('codeEd', h=500) cmds.setUITemplate(popTemplate=True) cmds.scrollField(ctl, e=True, tx=getCode(node), cc=_partial(_ae_setCode, ctl, node)) cmds.scriptJob(p=ctl, rp=True, ac=(node + '.cd', _partial(_ae_codeChange, ctl, node)))
def pushOptionsUITemplate(): if not cmds.uiTemplate("oa_optionsTemplate", exists=True): cmds.uiTemplate("oa_optionsTemplate") cmds.frameLayout( defineTemplate="oa_optionsTemplate", collapsable=True, collapse=False, labelVisible=True, borderVisible=False, ) cmds.columnLayout(defineTemplate="oa_optionsTemplate", adjustableColumn=True) cmds.checkBoxGrp(defineTemplate="oa_optionsTemplate", columnWidth=[2, 240], numberOfCheckBoxes=1, label="") cmds.optionMenuGrp(defineTemplate="oa_optionsTemplate", columnAlign=[1, "right"], columnWidth=[2, 160]) cmds.setUITemplate("oa_optionsTemplate", pushTemplate=True)
def pushOptionsUITemplate(): '''Standardize the look of the options UI. Python translation of fileOptions.mel:pushOptionsUITemplate(), which is not a global proc. ''' if not cmds.uiTemplate('optionsTemplate', exists=True): cmds.uiTemplate('optionsTemplate') cmds.frameLayout(defineTemplate='optionsTemplate', collapsable=True, collapse=False, labelVisible=True, labelIndent=5, marginWidth=5, marginHeight=5) cmds.columnLayout(defineTemplate='optionsTemplate', adjustableColumn=True) cmds.setUITemplate('optionsTemplate', pushTemplate=True)
def pushOptionsUITemplate(): if (not cmds.uiTemplate('oa_optionsTemplate', exists=True)): cmds.uiTemplate('oa_optionsTemplate') cmds.frameLayout(defineTemplate='oa_optionsTemplate', collapsable=True, collapse=False, labelVisible=True, borderVisible=False) cmds.columnLayout(defineTemplate='oa_optionsTemplate', adjustableColumn=True) cmds.checkBoxGrp(defineTemplate='oa_optionsTemplate', columnWidth=[2, 240], numberOfCheckBoxes=1, label='') cmds.optionMenuGrp(defineTemplate='oa_optionsTemplate', columnAlign=[1, "right"], columnWidth=[2, 160]) cmds.setUITemplate('oa_optionsTemplate', pushTemplate=True)
def create(self): imagePath = ExportImportUIInfo._uiImagePath + '/detail.png' width = DetailUIInfo._width height = DetailUIInfo._height bgc = DetailUIInfo._bgc form = cmds.formLayout(w=width, h=height) image = cmds.image(image=imagePath) template = "uiTemplate" if not cmds.uiTemplate(template, ex=1): cmds.uiTemplate(template) cmds.checkBox(dt=template, v=1, cc=PartUIInfo.cmdCheck) cmds.floatField(dt=template, vis=0, v=1.0, pre=2, w=40, cc=PartUIInfo.cmdField) cmds.setUITemplate(template, pushTemplate=1) shoulderLCheck = cmds.checkBox(l='ShoulderL') shoulderLWeight = cmds.floatField() shoulderRCheck = cmds.checkBox(l='ShoulderR') shoulderRWeight = cmds.floatField() collarLCheck = cmds.checkBox(l='CollarL') collarLWeight = cmds.floatField() collarRCheck = cmds.checkBox(l='CollarR') collarRWeight = cmds.floatField() chestMoveCheck = cmds.checkBox(l='ChestMove') chestMoveWeight = cmds.floatField() chestCheck = cmds.checkBox(l='Chest') chestWeight = cmds.floatField() waistCheck = cmds.checkBox(l='Waist') waistWeight = cmds.floatField() torsoRotateCheck = cmds.checkBox(l='TorsoRotate') torsoRotateWeight = cmds.floatField() rootCheck = cmds.checkBox(l='Root') rootWeight = cmds.floatField() hipCheck = cmds.checkBox(l='Hip') hipWeight = cmds.floatField() cmds.setUITemplate(popTemplate=1) cmds.formLayout(form, e=1, attachForm=[(image, 'left', 0), (image, 'top', 0), (shoulderRCheck, 'left', 20), (shoulderRCheck, 'top', 65), (shoulderLCheck, 'left', 160), (shoulderLCheck, 'top', 65), (collarRCheck, 'left', 67), (collarRCheck, 'top', 110), (collarLCheck, 'left', 127), (collarLCheck, 'top', 110), (chestMoveCheck, 'left', 97), (chestMoveCheck, 'top', 135), (chestCheck, 'left', 97), (chestCheck, 'top', 152), (waistCheck, 'left', 97), (waistCheck, 'top', 205), (torsoRotateCheck, 'left', 97), (torsoRotateCheck, 'top', 255), (rootCheck, 'left', 97), (rootCheck, 'top', 273), (hipCheck, 'left', 97), (hipCheck, 'top', 291), (shoulderRWeight, 'left', 20), (shoulderRWeight, 'top', 72), (shoulderLWeight, 'left', 170), (shoulderLWeight, 'top', 72), (collarRWeight, 'left', 72), (collarRWeight, 'top', 110), (collarLWeight, 'left', 122), (collarLWeight, 'top', 110), (chestMoveWeight, 'left', 98), (chestMoveWeight, 'top', 133), (chestWeight, 'left', 98), (chestWeight, 'top', 155), (waistWeight, 'left', 98), (waistWeight, 'top', 205), (torsoRotateWeight, 'left', 98), (torsoRotateWeight, 'top', 255), (rootWeight, 'left', 98), (rootWeight, 'top', 273), (hipWeight, 'left', 98), (hipWeight, 'top', 291)]) cmds.setParent('..') DetailUIInfo._checkBoxGroup = [ shoulderLCheck, shoulderRCheck, collarLCheck, collarRCheck, chestMoveCheck, chestCheck, waistCheck, torsoRotateCheck, rootCheck, hipCheck ] DetailUIInfo._floatFieldGroup = [ shoulderLWeight, shoulderRWeight, collarLWeight, collarRWeight, chestMoveWeight, chestWeight, waistWeight, torsoRotateWeight, rootWeight, hipWeight ] DetailUIInfo._form = form.split('|')[-1] return form
# #############################################################################
def __init__(self, *args): self.repairString = '' if cmds.window( 'dateAndPath_ui', ex=1 ): cmds.deleteUI( 'dateAndPath_ui', wnd=1 ) self.win = cmds.window( 'dateAndPath_ui', title='Confirm Text UI') if not cmds.uiTemplate( 'checkBoxTemp', ex=1 ): cmds.uiTemplate( 'checkBoxTemp' ) cmds.checkBox( dt='checkBoxTemp', h=20, onc=self.update, ofc=self.update ) cmds.setUITemplate( 'checkBoxTemp', pushTemplate=1 ) form = cmds.formLayout() assetCheck = cmds.frameLayout( l='Asset' ) self.assetCheck = cmds.rowColumnLayout( nc=5, co=(1,'left',10), cw=[(1,100),(2,100),(3,100),(4,100),(5,100)] ) cmds.checkBox( l='Modeling' ) cmds.checkBox( l='Blend Shape' ) cmds.checkBox( l='Scale' ) cmds.checkBox( l='Texture' ) cmds.text( l='' ) cmds.checkBox( l='Shader' ) cmds.checkBox( l='UV' ) cmds.checkBox( l='Cloth' ) cmds.checkBox( l='Hair' ) cmds.checkBox( l='Rigging' ) cmds.setParent( form ) layoutCheck = cmds.frameLayout( l='Layout' ) self.layoutCheck = cmds.rowColumnLayout( nc=5, co=(1,'left',10), cw=[(1,130),(2,140),(3,100),(4,100),(5,30)] ) cmds.checkBox( l='Camera' ) cmds.checkBox( l='Matte Camera' ) cmds.checkBox( l='BG' ) cmds.checkBox( l='Frame Length' ) cmds.text( l='' ) cmds.checkBox( l='Matte Painting' ) cmds.checkBox( l='Position' ) cmds.setParent( form ) productionCheck = cmds.frameLayout( l='Production' ) self.productionCheck = cmds.rowColumnLayout( nc=5, co=(1,'left',10), cw=[(1,130),(2,140),(3,100),(4,100),(5,30)] ) cmds.checkBox( l='Animation' ) cmds.checkBox( l='Facial Ani' ) cmds.checkBox( l='Hair Sim' ) cmds.checkBox( l='Cloth Sim' ) cmds.text( l='' ) cmds.checkBox( l='Cache' ) cmds.checkBox( l='Lighting' ) cmds.checkBox( l='FX' ) cmds.setParent( form ) scrollField = cmds.scrollField( editable=True, wordWrap=False, h=80 ) closeBt =cmds.button( l='Close', c= self.closeWindow, h=30 ) cmds.formLayout( form, e=1, af=[ (assetCheck,'left',5 ),(assetCheck,'top',5 ),(assetCheck,'right',5 ), (layoutCheck,'left',5 ),(layoutCheck,'top',75 ),(layoutCheck,'right',5 ), (productionCheck,'left',5 ),(productionCheck,'top',145 ),(productionCheck,'right',5 ), (scrollField, 'left', 5), (scrollField, 'right', 5), (scrollField, 'top', 215), (scrollField, 'bottom', 40 ), (closeBt, 'left', 5 ),(closeBt, 'right', 5 ),(closeBt, 'bottom', 5 )] ) cmds.window( self.win, e=1, wh=[515,357 ] ) cmds.showWindow( self.win ) self.scrollField = scrollField self.editFieldString() self.checkBoxs = cmds.lsUI( type='checkBox' )
def main (): # GUI object variables _symBtnW = 36 _grdCols = 6 # check for window if cmds.window ('win_fmmu', exists = True): cmds.showWindow ('win_fmmu') else: # check for GUI templates if cmds.uiTemplate ('tpml_frml', exists = True): cmds.deleteUI ('tpml_frml') if cmds.uiTemplate ('tpml_grdl', exists = True): cmds.deleteUI ('tpml_grdl') if cmds.uiTemplate ('tmpl_symBtn', exists = True): cmds.deleteUI ('tmpl_symBtn') if cmds.uiTemplate ('tmpl_sprtr', exists = True): cmds.deleteUI ('tmpl_sprtr') if cmds.uiTemplate ('tmpl_flofld', exists = True): cmds.deleteUI ('tmpl_flofld') # create GUI templates cmds.uiTemplate ('tpml_frml') cmds.uiTemplate ('tpml_grdl') cmds.uiTemplate ('tmpl_symBtn') cmds.uiTemplate ('tmpl_sprtr') cmds.uiTemplate ('tmpl_flofld') # define GUI templates cmds.frameLayout (defineTemplate = 'tpml_frml', borderVisible = True, borderStyle = 'etchedOut', collapsable = True, preCollapseCommand = "cmds.window ('win_fmmu', edit = True, height = True)") cmds.gridLayout (defineTemplate = 'tpml_grdl', numberOfColumns = _grdCols, cellWidthHeight = (_symBtnW, _symBtnW)) cmds.symbolButton (defineTemplate = 'tmpl_symBtn', width = _symBtnW, height = _symBtnW) cmds.separator (defineTemplate = 'tmpl_sprtr') cmds.floatField (defineTemplate = 'tmpl_flofld', width = 50, height = 30, precision = 3, step = 0.05,) # create GUI cmds.window ('win_fmmu', sizeable = False, resizeToFitChildren = True, retain = True) cmds.columnLayout () cmds.frameLayout ('showHide_frml', useTemplate = 'tpml_frml', label = 'matchMove') # cmds.columnLayout ('main_clmnl') cmds.separator (useTemplate = 'tmpl_sprtr', width = cmds.frameLayout ('showHide_frml', query = True, width = True) ) cmds.gridLayout (useTemplate = 'tpml_grdl') cmds.setUITemplate ('tmpl_symBtn', pushTemplate = True) cmds.symbolButton ('button_stabilizer', image = 'ford_matchMoveUtilities__stabilize.xpm', command = 'fmmu.stabilizer()', annotation = 'stabilizer') cmds.symbolButton (image = 'ford_matchMoveUtilities__writeShakeTracker.xpm', command = 'fmmu.write_shake_track_node()', annotation = 'write track') cmds.symbolButton (image = 'ford_matchMoveUtilities__constrain_locator_to_vertex.xpm', command = 'fmmu.constrain_locator_to_vertex()', annotation = 'locator to vertex') cmds.symbolButton (image = 'ford_matchMoveUtilities__bakeTextureRange.xpm', command = 'fmmu.bake_texture_range(512)', annotation = 'bake 512') cmds.symbolButton (image = 'ford_matchMoveUtilities__bakeTextureRange.xpm', command = 'fmmu.bake_texture_range(1024)', annotation = 'bake 1024') cmds.symbolButton (image = 'ford_matchMoveUtilities__cones_to_locators.xpm', command = 'fmmu.add_cones_to_prediction_locators()', annotation = 'put cones to every locator') cmds.frameLayout ('adjustCam_frml', parent = 'main_clmnl', useTemplate = 'tpml_frml', visible = False) cmds.gridLayout (useTemplate = 'tpml_grdl') cmds.setUITemplate ('tmpl_flofld', pushTemplate = True) cmds.floatField ('field_overscan', value = 1, minValue = 0.1, maxValue = 2.5, changeCommand = 'fmmu.adjust_camera("overscan")', enterCommand = 'fmmu.adjust_camera("overscan")', dragCommand = 'fmmu.adjust_camera("overscan")') cmds.floatField ('field_screenPosX', value = 0.5, minValue = 0.1, maxValue = 2.5, changeCommand = 'fmmu.adjust_camera("x")', enterCommand = 'fmmu.adjust_camera("x")', dragCommand = 'fmmu.adjust_camera("x")') cmds.floatField ('field_screenPosY', value = 0.5, minValue = 0.1, maxValue = 2.5, changeCommand = 'fmmu.adjust_camera("y")', enterCommand = 'fmmu.adjust_camera("y")', dragCommand = 'fmmu.adjust_camera("y")') cmds.showWindow ('win_fmmu')
def __init__(self, *args): self.repairString = '' if cmds.window('dateAndPath_ui', ex=1): cmds.deleteUI('dateAndPath_ui', wnd=1) self.win = cmds.window('dateAndPath_ui', title='Confirm Text UI') if not cmds.uiTemplate('checkBoxTemp', ex=1): cmds.uiTemplate('checkBoxTemp') cmds.checkBox(dt='checkBoxTemp', h=20, onc=self.update, ofc=self.update) cmds.setUITemplate('checkBoxTemp', pushTemplate=1) form = cmds.formLayout() assetCheck = cmds.frameLayout(l='Asset') self.assetCheck = cmds.rowColumnLayout(nc=5, co=(1, 'left', 10), cw=[(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)]) cmds.checkBox(l='Modeling') cmds.checkBox(l='Blend Shape') cmds.checkBox(l='Scale') cmds.checkBox(l='Texture') cmds.text(l='') cmds.checkBox(l='Shader') cmds.checkBox(l='UV') cmds.checkBox(l='Cloth') cmds.checkBox(l='Hair') cmds.checkBox(l='Rigging') cmds.setParent(form) layoutCheck = cmds.frameLayout(l='Layout') self.layoutCheck = cmds.rowColumnLayout(nc=5, co=(1, 'left', 10), cw=[(1, 130), (2, 140), (3, 100), (4, 100), (5, 30)]) cmds.checkBox(l='Camera') cmds.checkBox(l='Matte Camera') cmds.checkBox(l='BG') cmds.checkBox(l='Frame Length') cmds.text(l='') cmds.checkBox(l='Matte Painting') cmds.checkBox(l='Position') cmds.setParent(form) productionCheck = cmds.frameLayout(l='Production') self.productionCheck = cmds.rowColumnLayout(nc=5, co=(1, 'left', 10), cw=[(1, 130), (2, 140), (3, 100), (4, 100), (5, 30)]) cmds.checkBox(l='Animation') cmds.checkBox(l='Facial Ani') cmds.checkBox(l='Hair Sim') cmds.checkBox(l='Cloth Sim') cmds.text(l='') cmds.checkBox(l='Cache') cmds.checkBox(l='Lighting') cmds.checkBox(l='FX') cmds.setParent(form) scrollField = cmds.scrollField(editable=True, wordWrap=False, h=80) closeBt = cmds.button(l='Close', c=self.closeWindow, h=30) cmds.formLayout(form, e=1, af=[(assetCheck, 'left', 5), (assetCheck, 'top', 5), (assetCheck, 'right', 5), (layoutCheck, 'left', 5), (layoutCheck, 'top', 75), (layoutCheck, 'right', 5), (productionCheck, 'left', 5), (productionCheck, 'top', 145), (productionCheck, 'right', 5), (scrollField, 'left', 5), (scrollField, 'right', 5), (scrollField, 'top', 215), (scrollField, 'bottom', 40), (closeBt, 'left', 5), (closeBt, 'right', 5), (closeBt, 'bottom', 5)]) cmds.window(self.win, e=1, wh=[515, 357]) cmds.showWindow(self.win) self.scrollField = scrollField self.editFieldString() self.checkBoxs = cmds.lsUI(type='checkBox')
import maya.cmds as cmds if cmds.uiTemplate( 'ExampleTemplate', exists=True ): cmds.deleteUI( 'ExampleTemplate', uiTemplate=True ) cmds.uiTemplate('ExampleTemplate') cmds.frameLayout(defineTemplate='ExampleTemplate', borderVisible=True, labelVisible=True, collapsable=True, collapse=False) cmds.button(defineTemplate='ExampleTemplate', width=100, height=15) window = cmds.window() cmds.setUITemplate( 'ExampleTemplate', pushTemplate=True) cmds.columnLayout() l1 = cmds.frameLayout(label='Numbers', collapse=True) cmds.columnLayout() for number in ('One', 'Two', 'Three'): cmds.button(label=number) cmds.setParent( '..' ) cmds.setParent( '..' ) l2 = cmds.frameLayout(label='Colors') cmds.columnLayout() for color in ('Red', 'Green', 'Blue'):
def initializeTemplates(): guiBackgroundColor = [.45,.45,.45] guiTextFieldColor = [.4,.4,.4] guiHeaderColor = [.25,.25,.25] guiSubMenuColor = [.65,.65,.65] guiButtonColor = [.35,.35,.35] guiHelpBackgroundColor = [0.8, 0.8, 0.8] guiHelpBackgroundReservedColor = [0.411765 , 0.411765 , 0.411765] guiHelpBackgroundLockedColor = [0.837, 0.399528, 0.01674] if mc.uiTemplate( 'cgmUITemplate', exists=True ): mc.deleteUI( 'cgmUITemplate', uiTemplate=True ) mc.uiTemplate('cgmUITemplate') mc.separator(dt='cgmUITemplate', height = 10, style = 'none') mc.button(dt = 'cgmUITemplate', height = 15, backgroundColor = guiButtonColor,align = 'center') mc.window(dt = 'cgmUITemplate', backgroundColor = guiBackgroundColor) mc.optionMenu(dt='cgmUITemplate',backgroundColor = guiButtonColor) mc.optionMenuGrp(dt ='cgmUITemplate', backgroundColor = guiButtonColor) mc.textField(dt = 'cgmUITemplate',backgroundColor = [1,1,1],h=20) mc.formLayout(dt='cgmUITemplate', backgroundColor = guiBackgroundColor) mc.textScrollList(dt='cgmUITemplate', backgroundColor = guiBackgroundColor) mc.frameLayout(dt='cgmUITemplate', backgroundColor = guiBackgroundColor) # Define our header template if mc.uiTemplate( 'cgmUIHeaderTemplate', exists=True ): mc.deleteUI( 'cgmUIHeaderTemplate', uiTemplate=True ) mc.uiTemplate('cgmUIHeaderTemplate') mc.text(dt='cgmUIHeaderTemplate', backgroundColor = guiHeaderColor) mc.separator(dt='cgmUIHeaderTemplate', height = 5, style = 'none',backgroundColor = guiHeaderColor) mc.formLayout(dt='cgmUIHeaderTemplate', backgroundColor = guiHeaderColor) mc.rowLayout(dt='cgmUIHeaderTemplate', backgroundColor = guiHeaderColor) mc.rowColumnLayout(dt='cgmUIHeaderTemplate', backgroundColor = guiHeaderColor) mc.columnLayout(dt='cgmUIHeaderTemplate', backgroundColor = guiHeaderColor) mc.textScrollList(dt='cgmUIHeaderTemplate', backgroundColor = guiHeaderColor) mc.frameLayout(dt='cgmUIHeaderTemplate', backgroundColor = guiHeaderColor) mc.textField(dt = 'cgmUIHeaderTemplate',backgroundColor = [1,1,1],h=20) # Define our sub template if mc.uiTemplate( 'cgmUISubTemplate', exists=True ): mc.deleteUI( 'cgmUISubTemplate', uiTemplate=True ) mc.uiTemplate('cgmUISubTemplate') mc.formLayout(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) mc.text(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) mc.separator(dt='cgmUISubTemplate', height = 2, style = 'none', backgroundColor = guiSubMenuColor) mc.rowLayout(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) mc.rowColumnLayout(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) mc.columnLayout(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) mc.scrollLayout(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) mc.textField(dt = 'cgmUISubTemplate',backgroundColor = [1,1,1],h=20) mc.textScrollList(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) mc.frameLayout(dt='cgmUISubTemplate', backgroundColor = guiSubMenuColor) # Define our instructional template if mc.uiTemplate( 'cgmUIInstructionsTemplate', exists=True ): mc.deleteUI( 'cgmUIInstructionsTemplate', uiTemplate=True ) mc.uiTemplate('cgmUIInstructionsTemplate') mc.text(dt = 'cgmUIInstructionsTemplate', backgroundColor = guiHelpBackgroundColor) mc.formLayout(dt='cgmUIInstructionsTemplate', backgroundColor = guiHelpBackgroundColor) mc.rowLayout(dt='cgmUIInstructionsTemplate', backgroundColor = guiHelpBackgroundColor) mc.rowColumnLayout(dt='cgmUIInstructionsTemplate', backgroundColor = guiHelpBackgroundColor) mc.columnLayout(dt='cgmUIInstructionsTemplate', backgroundColor = guiHelpBackgroundColor) mc.textField(dt = 'cgmUIInstructionsTemplate',backgroundColor = [1,1,1],h=20) mc.textScrollList(dt='cgmUIInstructionsTemplate', backgroundColor = guiHelpBackgroundColor) mc.frameLayout(dt='cgmUIInstructionsTemplate', backgroundColor = guiHelpBackgroundColor) # Define our Reserved if mc.uiTemplate( 'cgmUIReservedTemplate', exists=True ): mc.deleteUI( 'cgmUIReservedTemplate', uiTemplate=True ) mc.uiTemplate('cgmUIReservedTemplate') mc.textField(dt = 'cgmUIReservedTemplate', backgroundColor = guiTextFieldColor,h=20) mc.formLayout(dt='cgmUIReservedTemplate', backgroundColor = guiButtonColor) mc.rowLayout(dt='cgmUIReservedTemplate', backgroundColor = guiButtonColor) mc.rowColumnLayout(dt='cgmUIReservedTemplate', backgroundColor = guiButtonColor) mc.columnLayout(dt='cgmUIReservedTemplate', backgroundColor = guiButtonColor) mc.frameLayout(dt='cgmUIReservedTemplate', backgroundColor = guiButtonColor) # Define our Locked if mc.uiTemplate( 'cgmUILockedTemplate', exists=True ): mc.deleteUI( 'cgmUILockedTemplate', uiTemplate=True ) mc.uiTemplate('cgmUILockedTemplate') mc.textField(dt = 'cgmUILockedTemplate', backgroundColor = guiHelpBackgroundLockedColor, h=20) mc.frameLayout(dt='cgmUILockedTemplate', backgroundColor = guiHelpBackgroundLockedColor)
def rigAidGUI (): # >>> check main GUI element existence <<< ######################## if cmds.window ( 'rigAid_window', exists = True ): cmds.showWindow ( 'rigAid_window' ) # >>> check template existences <<< ############################## else: if cmds.uiTemplate ( 'template_window', exists = True ): cmds.deleteUI ( 'template_window', uiTemplate = True ) if cmds.uiTemplate ( 'template_column', exists = True ): cmds.deleteUI ( 'template_column', uiTemplate = True ) if cmds.uiTemplate ( 'template_frame', exists = True ): cmds.deleteUI ( 'template_frame', uiTemplate = True ) if cmds.uiTemplate ( 'template_button', exists = True ): cmds.deleteUI ( 'template_button', uiTemplate = True ) if cmds.uiTemplate ( 'template_radioBtn',exists = True ): cmds.deleteUI ( 'template_radioBtn', uiTemplate = True ) if cmds.uiTemplate ( 'template_row', exists = True ): cmds.deleteUI ( 'template_row', uiTemplate = True ) if cmds.uiTemplate ( 'template_sprtor', exists = True ): cmds.deleteUI ( 'template_sprtor', uiTemplate = True ) # >>> define GUI element templates <<< ############################## cmds.uiTemplate ( 'template_window' ) cmds.uiTemplate ( 'template_column' ) cmds.uiTemplate ( 'template_frame' ) cmds.uiTemplate ( 'template_button' ) cmds.uiTemplate ( 'template_radioBtn' ) cmds.uiTemplate ( 'template_row' ) cmds.uiTemplate ( 'template_sprtor' ) cmds.window ( defineTemplate = 'template_window', sizeable = False, toolbox = True, topLeftCorner = ( 200, 300 ), resizeToFitChildren = True ) cmds.columnLayout ( defineTemplate = 'template_column', ) cmds.frameLayout ( defineTemplate = 'template_frame', borderVisible = True, borderStyle = 'etchedOut', collapsable = True, preCollapseCommand = 'cmds.window ( \'rigAid_window\', edit=1, height=1)' ) cmds.rowLayout ( defineTemplate = 'template_row' ) cmds.button ( defineTemplate = 'template_button', width = 110, height = 20, align = 'left', actOnPress = True ) cmds.radioButton ( defineTemplate = 'template_radioBtn', align = 'left', recomputeSize = True ) cmds.separator ( defineTemplate = 'template_sprtor', width = 110, height = 2, style = 'in', horizontal = True ) # >>> GUI layout <<< #################################################### cmds.window ( 'rigAid_window', title = 'ford`s rigAid', useTemplate = 'template_window', retain = True ) cmds.columnLayout ( 'master_column', useTemplate = 'template_column' ) cmds.frameLayout ( 'showHide_frame', label = 'showHide', borderVisible = False, useTemplate = 'template_frame' ) cmds.columnLayout ( 'main_column', useTemplate = 'template_column' ) cmds.frameLayout ( 'frame_creation', label = 'creation', useTemplate = 'template_frame' ) cmds.columnLayout ( 'column_creation', useTemplate = 'template_column' ) cmds.setParent ( 'main_column' ) cmds.frameLayout ( 'frame_orientation', label = 'orientation', useTemplate = 'template_frame' ) cmds.columnLayout ( 'column_orientation', useTemplate = 'template_column' ) cmds.separator ( useTemplate = 'template_sprtor' ) cmds.rowLayout ( 'row_adjustOrient', numberOfColumns = 2, columnWidth = ( 1, 28 ), useTemplate = 'template_row' ) cmds.columnLayout ( 'column_selectAxis', useTemplate = 'template_column' ) cmds.setParent ( 'row_adjustOrient' ) cmds.columnLayout ( 'column_orientProperties', useTemplate = 'template_column' ) cmds.setParent ( 'main_column' ) cmds.frameLayout ( 'frame_control', label = 'control', useTemplate = 'template_frame' ) cmds.columnLayout ( 'column_control', useTemplate = 'template_column' ) # >>> creation buttons <<< ##################################################### cmds.setUITemplate ( 'template_button', pushTemplate = True ) cmds.setParent ( 'column_creation' ) cmds.separator ( useTemplate = 'template_sprtor' ) cmds.button ( label = 'arrow #2', command = 'fra.create2Arrowhead ()' ) cmds.button ( label = 'arrow #4', command = 'fra.create4Arrowhead ()' ) cmds.button ( label = 'sphere', command = 'fra.createSphere ()' ) cmds.button ( label = 'cube', command = 'fra.createNURBScube ()' ) cmds.button ( label = 'circle', command = 'fra.createCircle ()' ) cmds.button ( label = 'spheriaclArrow #4', command = 'fra.createSpherical4Arrowhead ()' ) cmds.button ( label = 'curveLocator', command = 'fra.createNURBSlocator ()' ) cmds.button ( label = 'Locator', command = 'fra.createLocator ()' ) cmds.button ( label = 'piramyd', command = 'fra.createPiramyd ()' ) cmds.button ( label = 'circleArrow #1', command = 'fra.createCircle1Arrowhead ()' ) cmds.separator ( useTemplate = 'template_sprtor' ) cmds.button ( label = 'convert2control', command = 'fra.convertToControl ()' ) cmds.separator ( useTemplate = 'template_sprtor' ) cmds.button ( label = 'command4curve', command = 'fra.createCurveCommand ()' ) # >>> orientation button / options <<< ##################################################### cmds.setUITemplate ( 'template_radioBtn', pushTemplate = True ) cmds.setParent ( 'column_selectAxis' ) cmds.radioCollection ( 'radioCollection_axis' ) cmds.radioButton ( 'axisX', label = 'x', select = True ) cmds.radioButton ( 'axisY', label = 'y' ) cmds.radioButton ( 'axisZ', label = 'z' ) cmds.setParent ( 'column_orientProperties' ) cmds.checkBox ( 'check_keepShape', label = 'keepShape', align = 'left' ) cmds.separator ( useTemplate = 'template_sprtor', width = 70 ) cmds.radioCollection ( 'radioCollection_direction' ) cmds.radioButton ( 'plus', label = '+', select = True ) cmds.radioButton ( 'minus', label = '-' ) cmds.setUITemplate ( 'template_button', pushTemplate = True ) cmds.setParent ( 'column_orientation' ) cmds.separator ( useTemplate = 'template_sprtor' ) cmds.button ( label = 'do orient', command = 'fra.smartOrient ()' ) # >>> control buttons <<< ##################################################### cmds.setUITemplate ( 'template_button', pushTemplate = True ) cmds.setParent ( 'column_control' ) cmds.separator ( useTemplate = 'template_sprtor' ) cmds.intSlider ( 'boneNum', width = 110, minValue = 1, maxValue = 10, value = 1, dragCommand = '''cmds.button ( 'button_boneBreaker', edit = True, label = 'bone breaker #' + str ( cmds.intSlider ('boneNum', query=1, value=1) ), width = 110)''') cmds.button ( 'button_boneBreaker', label = 'bone breaker #' + str ( cmds.intSlider ('boneNum', query=1, value=1) ), command = 'fra.splitJoint ()' ) cmds.separator ( useTemplate = 'template_sprtor' ) cmds.button ( label = 'zero all', command = 'fra.resetControls ()' ) cmds.button ( label = 'select LRA', command = 'fra.selectLRA ()' ) cmds.button ( label = 'hide LRA', command = 'fra.hideLRA ()' ) # >>> show GUI <<< ######################################################### cmds.showWindow ( 'rigAid_window' )
def initializeTemplates(): guiBackgroundColor = [.45, .45, .45] guiTextFieldColor = [.4, .4, .4] guiHeaderColor = [.25, .25, .25] guiSubMenuColor = [.65, .65, .65] guiButtonColor = [.35, .35, .35] guiHelpBackgroundColor = [0.8, 0.8, 0.8] guiHelpBackgroundReservedColor = [0.411765, 0.411765, 0.411765] guiHelpBackgroundLockedColor = [0.837, 0.399528, 0.01674] if mc.uiTemplate('cgmUITemplate', exists=True): mc.deleteUI('cgmUITemplate', uiTemplate=True) mc.uiTemplate('cgmUITemplate') mc.separator(dt='cgmUITemplate', height=10, style='none') mc.button(dt='cgmUITemplate', height=15, backgroundColor=guiButtonColor, align='center') mc.window(dt='cgmUITemplate', backgroundColor=guiBackgroundColor) mc.optionMenu(dt='cgmUITemplate', backgroundColor=guiButtonColor) mc.optionMenuGrp(dt='cgmUITemplate', backgroundColor=guiButtonColor) mc.textField(dt='cgmUITemplate', backgroundColor=[1, 1, 1], h=20) mc.formLayout(dt='cgmUITemplate', backgroundColor=guiBackgroundColor) mc.textScrollList(dt='cgmUITemplate', backgroundColor=guiBackgroundColor) mc.frameLayout(dt='cgmUITemplate', backgroundColor=guiBackgroundColor) # Define our header template if mc.uiTemplate('cgmUIHeaderTemplate', exists=True): mc.deleteUI('cgmUIHeaderTemplate', uiTemplate=True) mc.uiTemplate('cgmUIHeaderTemplate') mc.text(dt='cgmUIHeaderTemplate', backgroundColor=guiHeaderColor) mc.separator(dt='cgmUIHeaderTemplate', height=5, style='none', backgroundColor=guiHeaderColor) mc.formLayout(dt='cgmUIHeaderTemplate', backgroundColor=guiHeaderColor) mc.rowLayout(dt='cgmUIHeaderTemplate', backgroundColor=guiHeaderColor) mc.rowColumnLayout(dt='cgmUIHeaderTemplate', backgroundColor=guiHeaderColor) mc.columnLayout(dt='cgmUIHeaderTemplate', backgroundColor=guiHeaderColor) mc.textScrollList(dt='cgmUIHeaderTemplate', backgroundColor=guiHeaderColor) mc.frameLayout(dt='cgmUIHeaderTemplate', backgroundColor=guiHeaderColor) # Define our sub template if mc.uiTemplate('cgmUISubTemplate', exists=True): mc.deleteUI('cgmUISubTemplate', uiTemplate=True) mc.uiTemplate('cgmUISubTemplate') mc.formLayout(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) mc.text(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) mc.separator(dt='cgmUISubTemplate', height=2, style='none', backgroundColor=guiSubMenuColor) mc.rowLayout(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) mc.rowColumnLayout(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) mc.columnLayout(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) mc.scrollLayout(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) mc.textField(dt='cgmUISubTemplate', backgroundColor=[1, 1, 1], h=20) mc.textScrollList(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) mc.frameLayout(dt='cgmUISubTemplate', backgroundColor=guiSubMenuColor) # Define our instructional template if mc.uiTemplate('cgmUIInstructionsTemplate', exists=True): mc.deleteUI('cgmUIInstructionsTemplate', uiTemplate=True) mc.uiTemplate('cgmUIInstructionsTemplate') mc.text(dt='cgmUIInstructionsTemplate', backgroundColor=guiHelpBackgroundColor) mc.formLayout(dt='cgmUIInstructionsTemplate', backgroundColor=guiHelpBackgroundColor) mc.rowLayout(dt='cgmUIInstructionsTemplate', backgroundColor=guiHelpBackgroundColor) mc.rowColumnLayout(dt='cgmUIInstructionsTemplate', backgroundColor=guiHelpBackgroundColor) mc.columnLayout(dt='cgmUIInstructionsTemplate', backgroundColor=guiHelpBackgroundColor) mc.textField(dt='cgmUIInstructionsTemplate', backgroundColor=[1, 1, 1], h=20) mc.textScrollList(dt='cgmUIInstructionsTemplate', backgroundColor=guiHelpBackgroundColor) mc.frameLayout(dt='cgmUIInstructionsTemplate', backgroundColor=guiHelpBackgroundColor) # Define our Reserved if mc.uiTemplate('cgmUIReservedTemplate', exists=True): mc.deleteUI('cgmUIReservedTemplate', uiTemplate=True) mc.uiTemplate('cgmUIReservedTemplate') mc.textField(dt='cgmUIReservedTemplate', backgroundColor=guiTextFieldColor, h=20) mc.formLayout(dt='cgmUIReservedTemplate', backgroundColor=guiButtonColor) mc.rowLayout(dt='cgmUIReservedTemplate', backgroundColor=guiButtonColor) mc.rowColumnLayout(dt='cgmUIReservedTemplate', backgroundColor=guiButtonColor) mc.columnLayout(dt='cgmUIReservedTemplate', backgroundColor=guiButtonColor) mc.frameLayout(dt='cgmUIReservedTemplate', backgroundColor=guiButtonColor) # Define our Locked if mc.uiTemplate('cgmUILockedTemplate', exists=True): mc.deleteUI('cgmUILockedTemplate', uiTemplate=True) mc.uiTemplate('cgmUILockedTemplate') mc.textField(dt='cgmUILockedTemplate', backgroundColor=guiHelpBackgroundLockedColor, h=20) mc.frameLayout(dt='cgmUILockedTemplate', backgroundColor=guiHelpBackgroundLockedColor)
def create(self): imagePath = ExportImportUIInfo._uiImagePath + '/part.png' width = PartUIInfo._width height = PartUIInfo._height bgc = DetailUIInfo._bgc form = cmds.formLayout(w=width, h=height) image = cmds.image(image=imagePath) template = "uiTemplate" if not cmds.uiTemplate(template, ex=1): cmds.uiTemplate(template) cmds.checkBox(dt=template, v=1, cc=PartUIInfo.cmdCheck) cmds.floatField(dt=template, vis=0, v=1.0, pre=2, w=40, cc=PartUIInfo.cmdField) cmds.setUITemplate(template, pushTemplate=1) headCheck = cmds.checkBox(l='Head') headField = cmds.floatField() bodyCheck = cmds.checkBox(l='Body') bodyField = cmds.floatField() armLCheck = cmds.checkBox(l='ArmL') armLField = cmds.floatField() armRCheck = cmds.checkBox(l='ArmR') armRField = cmds.floatField() handLCheck = cmds.checkBox(l='HandL') handLField = cmds.floatField() handRCheck = cmds.checkBox(l='HandR') handRField = cmds.floatField() legLCheck = cmds.checkBox(l='LegL') legLField = cmds.floatField() legRCheck = cmds.checkBox(l='LegR') legRField = cmds.floatField() cmds.setUITemplate(popTemplate=1) cmds.formLayout(form, e=1, attachForm=[(image, 'left', 0), (image, 'top', 0), (headCheck, 'left', 92), (headCheck, 'top', 8), (bodyCheck, 'left', 94), (bodyCheck, 'top', 125), (armRCheck, 'left', 20), (armRCheck, 'top', 105), (armLCheck, 'left', 165), (armLCheck, 'top', 105), (handRCheck, 'left', 20), (handRCheck, 'top', 174), (handLCheck, 'left', 160), (handLCheck, 'top', 174), (legRCheck, 'left', 40), (legRCheck, 'top', 280), (legLCheck, 'left', 155), (legLCheck, 'top', 280), (headField, 'left', 95), (headField, 'top', 8), (bodyField, 'left', 95), (bodyField, 'top', 125), (armRField, 'left', 20), (armRField, 'top', 105), (armLField, 'left', 166), (armLField, 'top', 105), (handRField, 'left', 27), (handRField, 'top', 174), (handLField, 'left', 162), (handLField, 'top', 174), (legRField, 'left', 40), (legRField, 'top', 280), (legLField, 'left', 148), (legLField, 'top', 280)]) cmds.setParent('..') PartUIInfo._checkBoxGroup = [ headCheck, bodyCheck, armLCheck, armRCheck, handLCheck, handRCheck, legLCheck, legRCheck ] PartUIInfo._floatFieldGroup = [ headField, bodyField, armLField, armRField, handLField, handRField, legLField, legRField ] PartUIInfo._bodyCheck = bodyCheck.split('|')[-1] PartUIInfo._boydField = bodyField.split('|')[-1] return form
def main (): # GUI variables symBtnWidth = 36 btnHeight = 20 gridCols = 3 winWidth = symBtnWidth * gridCols # check main GUI element existence if cmds.window ('rigAid_window', exists = True): cmds.showWindow ('rigAid_window') else: # check template existences if cmds.uiTemplate ('template_window', exists = True): cmds.deleteUI ('template_window', uiTemplate = True) if cmds.uiTemplate ('template_column', exists = True): cmds.deleteUI ('template_column', uiTemplate = True) if cmds.uiTemplate ('template_frame', exists = True): cmds.deleteUI ('template_frame', uiTemplate = True) if cmds.uiTemplate ('template_button', exists = True): cmds.deleteUI ('template_button', uiTemplate = True) if cmds.uiTemplate ('template_radioBtn', exists = True): cmds.deleteUI ('template_radioBtn', uiTemplate = True) if cmds.uiTemplate ('template_row', exists = True): cmds.deleteUI ('template_row', uiTemplate = True) if cmds.uiTemplate ('template_grid', exists = True): cmds.deleteUI ('template_grid', uiTemplate = True) if cmds.uiTemplate ('template_symButton', exists = True): cmds.deleteUI ('template_symButton', uiTemplate = True) if cmds.uiTemplate ('template_separator', exists = True): cmds.deleteUI ('template_separator', uiTemplate = True) # create GUI templates cmds.uiTemplate ('template_window') cmds.uiTemplate ('template_column') cmds.uiTemplate ('template_frame') cmds.uiTemplate ('template_button') cmds.uiTemplate ('template_radioBtn') cmds.uiTemplate ('template_row') cmds.uiTemplate ('template_grid') cmds.uiTemplate ('template_symButton') cmds.uiTemplate ('template_separator') # define GUI templates cmds.window (defineTemplate = 'template_window', sizeable = False, toolbox = True, resizeToFitChildren = True) cmds.columnLayout (defineTemplate = 'template_column') cmds.frameLayout (defineTemplate = 'template_frame', borderVisible = True, borderStyle = 'etchedOut', collapsable = True, preCollapseCommand = 'cmds.window ( \'rigAid_window\', edit=1, height=1)') cmds.rowLayout (defineTemplate = 'template_row') cmds.gridLayout (defineTemplate = 'template_grid') cmds.symbolButton (defineTemplate = 'template_symButton', width = symBtnWidth, height = symBtnWidth, image = 'ford_riggingAid__shelf.xpm') cmds.button (defineTemplate = 'template_button', width = winWidth, height = btnHeight, align = 'left', actOnPress = True) cmds.radioButton (defineTemplate = 'template_radioBtn', align = 'left', recomputeSize = True) cmds.separator (defineTemplate = 'template_separator', width = winWidth, height = 2, style = 'in', horizontal = True) # GUI layout cmds.window ('rigAid_window', title = 'ford`s rigAid', useTemplate = 'template_window', retain = True) cmds.columnLayout ('master_column', useTemplate = 'template_column') cmds.frameLayout ('showHide_frame', label = 'showHide', borderVisible = False, useTemplate = 'template_frame') cmds.columnLayout ('main_column', useTemplate = 'template_column') cmds.frameLayout ('frame_creation', label = 'creation', useTemplate = 'template_frame') cmds.columnLayout ('column_creation', useTemplate = 'template_column') cmds.gridLayout ('grid_creation', useTemplate = 'template_grid', numberOfColumns = gridCols, cellWidthHeight = (symBtnWidth, symBtnWidth)) cmds.setParent ('main_column') cmds.frameLayout ('frame_orientation', label = 'orientation', useTemplate = 'template_frame') cmds.columnLayout ('column_orientation', useTemplate = 'template_column') cmds.gridLayout ('grid_orientButtons', useTemplate = 'template_grid', numberOfColumns = 2, cellWidthHeight = (winWidth / 2, symBtnWidth)) cmds.setParent ('column_orientation') cmds.gridLayout ('grid_selectAxis', useTemplate = 'template_grid', numberOfColumns = 3, cellWidthHeight = (winWidth / 3, 20)) cmds.setParent ('main_column') cmds.frameLayout ('frame_control', label = 'control', useTemplate = 'template_frame') cmds.columnLayout ('column_control', useTemplate = 'template_column') cmds.setParent ('main_column') cmds.frameLayout ('frame_setup', label = 'setup', useTemplate = 'template_frame') cmds.columnLayout ('column_setup', useTemplate = 'template_column') # >>> creation buttons <<< _______________________________________________________________________________________ cmds.separator (useTemplate = 'template_separator' ) cmds.setParent ('grid_creation' ) cmds.setUITemplate ('template_symButton', pushTemplate = True ) cmds.symbolButton (command ='fra.create2Arrowhead()', image = 'ford_riggingAid__create2Arrowhead.xpm' ) cmds.symbolButton (command ='fra.create4Arrowhead()', image = 'ford_riggingAid__create4Arrowhead.xpm' ) cmds.symbolButton (command ='fra.createSphere()', image = 'ford_riggingAid__createSphere.xpm' ) cmds.symbolButton (command ='fra.createNURBScube()', image = 'ford_riggingAid__createNURBScube.xpm' ) cmds.symbolButton (command ='fra.createCircle()', image = 'ford_riggingAid__createCircle.xpm' ) cmds.symbolButton (command ='fra.createSpherical4Arrowhead()', image = 'ford_riggingAid__createSpherical4Arrowhead.xpm') cmds.symbolButton (command ='fra.createNURBSlocator()', image = 'ford_riggingAid__createNURBSlocator.xpm') cmds.symbolButton (command ='fra.createLocator()', image = 'ford_riggingAid__createLocator.xpm' ) cmds.symbolButton (command ='fra.createPiramyd()', image = 'ford_riggingAid__createPiramyd.xpm' ) cmds.symbolButton (command ='fra.createCircle1Arrowhead()', image = 'ford_riggingAid__createCircle1Arrowhead.xpm') # cmds.setParent ( 'column_creation' ) cmds.setUITemplate ( 'template_button', pushTemplate = True ) cmds.separator ( useTemplate = 'template_separator' ) cmds.button ( label = ' convert2control', command = 'fra.convertToControl ()' ) cmds.separator ( useTemplate = 'template_separator' ) cmds.button ( label = ' command4curve', command = 'fra.createCurveCommand ()' ) # >>> orientation button / options <<< ________________________________________________________________________________ # cmds.setParent ( 'grid_orientButtons' ) cmds.setUITemplate ( 'template_symButton', pushTemplate = True ) cmds.symbolButton ( 'orientMinusButton', command = 'fra.smartOrient (\'minus\')', width = winWidth / 2, image = 'ford_riggingAid__orientXminus.xpm' ) cmds.symbolButton ( 'orientPlusButton', command = 'fra.smartOrient (\'plus\')', width = winWidth / 2, image = 'ford_riggingAid__orientXplus.xpm' ) # cmds.setParent ( 'grid_selectAxis' ) cmds.setUITemplate ( 'template_radioBtn', pushTemplate = True ) cmds.radioCollection( 'radioCollection_axis' ) cmds.radioButton ( 'X', label = 'X', select = True, onCommand = 'fra.setButtonIcon ()' ) cmds.radioButton ( 'Y', label = 'Y', onCommand = 'fra.setButtonIcon ()' ) cmds.radioButton ( 'Z', label = 'Z', onCommand = 'fra.setButtonIcon ()' ) # cmds.setParent ( 'column_orientation' ) cmds.separator ( useTemplate = 'template_separator' ) cmds.checkBox ( 'check_keepShape', label = 'keepShape', align = 'left', changeCommand = 'fra.setButtonIcon ()' ) # >>> control buttons <<< ________________________________________________________________________________________ cmds.setUITemplate ( 'template_button', pushTemplate = True ) cmds.setParent ( 'column_control' ) cmds.separator ( useTemplate = 'template_separator' ) cmds.intSlider ( 'boneNum', width = winWidth, minValue = 1, maxValue = 10, value = 1, dragCommand = '''cmds.button ( 'button_boneBreaker', edit = True, label = 'bone breaker #' + str ( cmds.intSlider ( 'boneNum', query=1, value=1) ), width = ''' + str ( winWidth ) + ''')''' ) cmds.button ( 'button_boneBreaker', label = ' bone breaker #' + str ( cmds.intSlider ('boneNum', query=1, value=1) ), command = 'fra.splitJoint ()' ) cmds.separator ( useTemplate = 'template_separator' ) cmds.button ( label = ' zero all', command = 'fra.resetControls ()' ) cmds.button ( label = ' select LRA', command = 'fra.selectLRA ()' ) cmds.button ( label = ' hide LRA', command = 'fra.hideLRA ()' ) # >>> control buttons <<< ________________________________________________________________________________________ cmds.setParent ( 'column_setup' ) cmds.separator ( useTemplate = 'template_separator' ) cmds.button ( label = ' ribbon', command = 'fra.setupRibbon ()' ) cmds.button ( label = ' strechy', command = 'fra.setupStrechy ()' ) # >>> show GUI <<< _______________________________________________________________________________________________ cmds.showWindow ( 'rigAid_window' )
def create_ui(self): print "Creating UI..." # Create template template = "moduleManagerTemplate" window = "moduleManagerWindow" if cmds.uiTemplate(template, exists=1): cmds.deleteUI(template, uiTemplate=True) cmds.uiTemplate(template) cmds.frameLayout(defineTemplate=template, borderVisible=True, labelVisible=True, collapse=False, marginWidth=2, marginHeight=2) cmds.columnLayout(adjustableColumn=True, defineTemplate=template, columnAttach=("both", 1)) cmds.button(defineTemplate=template, label="Default Text") # Create window if cmds.window(window, exists=1): cmds.deleteUI(window, window=True) cmds.window(window, title=self.title, menuBar=True) cmds.setUITemplate(template, pushTemplate=1) # Create the menu cmds.menu(tearOff=False, label="Update") cmds.menuItem(command=lambda *args: self.update_scripts(), label="Network") cmds.menu(tearOff=False, label="Windows") cmds.menuItem(command=lambda *args: cmds.GraphEditor(), label="Graph Editor") cmds.menuItem(command=lambda *args: cmds.HypershadeWindow(), label="Hypershade") cmds.menuItem(command=lambda *args: cmds.OutlinerWindow(), label="Outliner") cmds.menuItem(command=lambda *args: cmds.ReferenceEditor(), label="Reference Editor") cmds.menuItem(command=lambda *args: cmds.ScriptEditor(), label="Script Editor") cmds.menu(helpMenu=True, tearOff=False, label="Help") cmds.menuItem( command=lambda *args: cmds.launch(web="http://download.autodesk.com/global/docs/maya2014/en_us/Commands/"), label="MEL Commands") cmds.menuItem( command=lambda *args: cmds.launch( web="http://download.autodesk.com/global/docs/maya2014/en_us/CommandsPython/"), label="PYTHON Commands") cmds.menuItem( command=lambda *args: cmds.launch(web="http://download.autodesk.com/global/docs/maya2014/en_us/Nodes/"), label="Nodes and Attributes") cmds.menuItem(divider=True) cmds.menuItem(command=self.openAboutWindow, label="About") # Create Version Frame cmds.frameLayout(label=(" Version " + str(self.version))) cmds.columnLayout(columnAttach=("both", 1)) cmds.rowColumnLayout(numberOfColumns=2) cmds.textField('dateFld', width=175, editable=False, text=("Last Save: N/A")) cmds.button(width=110, command=lambda *args: mel.incrementalSave(), label="Incremental Save") cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.tabLayout('TabList') # Create tab UI for each module tabs = [] for module in self.modules: tabs.append(module.create_ui()) # Create Info Tab infoTab = self.create_info_tab() cmds.setParent('..') tabs.append((infoTab, "Info")) # Add Tabs / Show Window cmds.tabLayout('TabList', edit=1, tabLabel=tabs) cmds.showWindow(window) def dockWindow(window): dWindow = "moduleManagerDockedWindow" if cmds.dockControl(dWindow, exists=1): cmds.deleteUI(dWindow) formLayout = str(cmds.formLayout(parent=window)) cmds.dockControl(dWindow, allowedArea="all", content=formLayout, area="right", label=self.title) cmds.control(window, p=formLayout, e=1, w=310) cmds.setParent('..') dockWindow(window)
def __init__(self, name): if cmds.uiTemplate(name, ex=True): self._name = name else: self._name = cmds.uiTemplate(name)