def ui(): if pm.window(win, q=True, exists=True ): pm.deleteUI(win) with pm.window(win, wh=[300,600], t=title): with pm.frameLayout( lv=False, cll=False, mw=1, mh=1): with pm.columnLayout(adj=True): with pm.tabLayout(tv=False): with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False): with pm.rowLayout(nc=3, adj=2): pm.image( image = shelfIcon ) pm.text(l=' %s'%title, fn='boldLabelFont', align='left') pm.image( image = alfredIcon ) pm.separator( h=8, style='in') with pm.frameLayout(lv=False, cll=False, mw=0, mh=0, bv=False): with pm.frameLayout(lv=False, cll=False, mw=3, mh=3, bv=False): # Scene ----------------------- with pm.frameLayout(l='Scene', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Reference Editor 2 : ', align='right', w=150) pm.button(label='Open UI...', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='File Traveler : ', align='right', w=150) pm.button(label='Open UI...', w=180, en=False ) # Camera ----------------------- with pm.frameLayout(l='Camera', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Create Camera : ', align='right', w=150) with pm.columnLayout(): pm.button(label='Create Turntable Camera', w=180, en=False ) pm.button(label='Create Frustum Camera', w=180, en=False ) pm.button(label='Create Stereo Camera', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='Set Camera Playback Range : ', align='right', w=150) pm.button(label='set', c=pm.Callback( sm.setCamPlaybackRange ), w=180 ) with pm.rowLayout( nc=10 ): pm.text(label='HUD : ', align='right', w=150) pm.button(label='Scene Name HUD', w=180, en=False ) with pm.rowLayout( nc=10 ): pm.text(label='Export Camera : ', align='right', w=150) pm.button(label='for After Effect...', w=180, en=False ) # Asset ----------------------- with pm.frameLayout(l='Asset', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout( nc=10 ): pm.text(label='Toggle Display CharacterGeo : ', align='right', w=150) pm.button(label='( preview / render )', c=pm.Callback( sm.toggleDisplayCharacterGeo ), w=180 )
def layersReplace(self, attribute): if attribute is not "none": self.thisNode = pm.PyNode(attribute).node() log.debug("layersReplace {0}".format(attribute)) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) materialEntries = self.thisNode.materialEntryMtl.numElements() #print "layersReplace: node has ", self.thisNode.materialEntryMtl.numElements(), "layers" if self.layersUi is not None and pm.columnLayout(self.layersUi, q=True, exists=True): pm.deleteUI(self.layersUi) with pm.columnLayout(adj=True, parent=self.uiParent) as self.layersUi: for layerNumber in range(materialEntries): layerIndex = self.thisNode.materialEntryMtl.elementByPhysicalIndex(layerNumber).index() with pm.frameLayout(label="Layer {0}".format(layerNumber), collapsable=True, collapse=False, bv=True) as fl: log.debug("create layers UI {0}".format(self.thisNode.materialEntryMtl[layerIndex])) with pm.columnLayout(adj=True): attribute = self.thisNode.materialEntryMtl[layerIndex] if attribute.isConnected(): pm.frameLayout(fl, edit=True, label=attribute.inputs(p=1)[0]) pm.attrColorSliderGrp(label="Material", at=attribute) attribute = self.thisNode.materialEntryMsk[layerIndex] pm.attrFieldSliderGrp(label="Mask", at=attribute) attribute = self.thisNode.materialEntryMode[layerIndex] pm.attrEnumOptionMenuGrp(label="Mode", at=attribute) with pm.columnLayout(adj=True): pm.button(label="Remove Layer", c=pm.Callback(self.removeLayer, layerIndex), height=18) pm.button(label="Layer Up", c=pm.Callback(self.moveLayerUp, layerIndex), height=18) pm.button(label="Layer Down", c=pm.Callback(self.moveLayerDown, layerIndex), height=18) pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
def __init__(self, baseUi, parent): BaseUi.__init__(self, parent) self.uiparent = parent self.baseUi = baseUi self.tmpJnts = [] self.attrCtrl = None #ui try: pm.deleteUI(self.rigCol) except: pass with pm.columnLayout(adj=True, rs=3, parent=self.uiparent) as self.rigCol: with pm.rowColumnLayout(nc=2, co=[(1, 'left', 130), (2, 'left', 5)]): pm.text(l='Finger Name') with pm.optionMenu(w=60) as self.fingerNameMenu: pm.menuItem(l='index') pm.menuItem(l='middle') pm.menuItem(l='ring') pm.menuItem(l='pinky') pm.menuItem(l='thumb') with pm.rowColumnLayout(nc=3, co=[(1, 'left', 30), (2, 'left', 5), (3, 'left', 5)]): pm.text(l='attrCtrl') self.attrCtrlTxtFld = pm.textField(w=230, ed=False) self.loadAttrCtrlButt = pm.button(l='<<', c=pm.Callback(self.loadAttrCtrl)) pm.text(l='tmpJnts') self.tmpJntsTxtFld = pm.textField(w=230, ed=False) self.loadTmpJntButt = pm.button(l='<<', c=pm.Callback(self.loadTmpJnts)) self.baseUi.clearElemSideTxtFld()
def __init__(self, baseUi, parent): BaseUi.__init__(self, parent) self.uiparent = parent self.baseUi = baseUi self.tmpJnts = [] self.defaultAxis = 'y' #ui try: pm.deleteUI(self.rigCol) except: pass with pm.columnLayout(adj=True, rs=3, parent=self.uiparent) as self.rigCol: with pm.rowColumnLayout(nc=2, co=[(1, 'left', 155), (2, 'left', 5)]): pm.text(l='axis') with pm.optionMenu(w=60) as self.axisMenu: pm.menuItem(l='x') pm.menuItem(l='y') pm.menuItem(l='z') with pm.columnLayout(adj=True, rs=2, co=['left', 165]): self.ribbonChkBox = pm.checkBox(l='Ribbon Lo/Hi', v=False) with pm.rowColumnLayout(nc=3, co=[(1, 'left', 30), (2, 'left', 5), (3, 'left', 5)]): pm.text(l='tmpJnts') self.tmpJntsTxtFld = pm.textField(w=230, ed=False) self.loadTmpJntButt = pm.button(l='<<', c=pm.Callback(self.loadTmpJnts)) self.axisMenu.setValue(self.defaultAxis) self.baseUi.clearElemSideTxtFld()
def createUI(): if pm.window( moduleWin, exists = True, q = True ): pm.deleteUI( moduleWin) ModuleUI()
def helpWin(self,*args): """ Display the help window """ if(pm.window('msArmRigHelpWin',exists=True)): pm.deleteUI('msArmRigHelpWin',window=True) with pm.window('msArmRigHelpWin',title="Arm Rig Help",rtf=True) as mainWin: with pm.columnLayout(): pm.text(' Locators should be placed for:') pm.text(' Shoulder') pm.text(' Elbow') pm.text(' Wrist') pm.text('\n') pm.text(' Upper Torso: Shoulder insertion. Clavicle or upper back joint.') pm.text(' Lower Torso: COG or something following the root.') pm.text(' World Mover: World mover control or equivalent.') pm.text(' (Used for space switch setup).') pm.text('\n') pm.text(' Switch Control: Place IK / FK switch on this control, usually the Hand control.') pm.text(' Switch control should be in place and zeroed.') pm.text('\n') pm.text(' Note: Locators should not be zeroed. They should have their world space') pm.text(' values in their translate attributes in the channel box.') pm.text('\n') mainWin.show()
def doUpdateScnAOV(type, *args): #// first, update string attr in each AOV if type == 0: updateAOVStrAttr() # next, update AOV list AOVList = [] sceneAOVs = aovs.AOVInterface().getAOVNodes(names=True) for aovName, aovNode in sceneAOVs: if( aovName.find('id_') == 0 and aovNode.hasAttr('isID') ): AOVList.append( str(aovName) ) enumUIParent = pm.optionMenu( 'enumAOVList', q=True, parent=True ) curr_aov = pm.optionMenu( 'enumAOVList', q=True, value=True ) if curr_aov == None: return pm.deleteUI('enumAOVList') pm.optionMenu( 'enumAOVList', bgc=[0.2, 0.2, 0.2], label="AOVs: ", width=120, parent=enumUIParent ) for aov in AOVList: pm.menuItem( aov ) if( ( len(curr_aov) != 0 ) and ( len( pm.ls(aovs.AOVInterface().getAOVNode(curr_aov)) ) != 0 ) ): pm.optionMenu( 'enumAOVList', e=True, value=curr_aov ) #// if curr_aov is not existing... return 1
def __init__(self): """A GUI Class Args: args (None): Just in case... """ self.name='aw_assimilator' self.width=200 self.height=120 self.title_blue_cl=[.1,.15,.2] self.close_red_cl=[0.5,0.2,0.2] self.go_green_cl=[.1,.4,.2] if pm.window(self.name, q=True, exists=True): pm.deleteUI(self.name) if pm.windowPref(self.name, ex=True): pm.windowPref(self.name, r=True) self.win = pm.window(self.name,widthHeight=(self.width, self.height),title=self.name) # Window creation self.column_layout = pm.columnLayout(w=self.width) # Text Spacers! pm.text(l="\nSelect Source then Targets\n", fn='boldLabelFont', al='center', w=self.width, bgc=self.title_blue_cl) pm.text(l="", al='center') pm.text(l="Ready?", al='center', w=self.width) pm.text(l="", al='center', w=self.width) # Make a button and assign a command to it self.flow_layout=pm.flowLayout(w=self.width) pm.button('assimilateBtn',command=lambda *args: self.aw_assimilator(),label="Yes!", p=self.flow_layout, w=self.width/2, bgc=self.go_green_cl) pm.button('assimilateKillBtn',command=lambda *args: pm.deleteUI(self.name),label="Cancel", p=self.flow_layout, w=self.width/2-3, bgc=self.close_red_cl) self.win.show()
def __init__(self, path): self.path = path # the path to save the presets preset_win = 'preset_win' if pm.window(preset_win, exists= True): pm.deleteUI(preset_win) if pm.windowPref(preset_win, exists= True): pm.windowPref(preset_win, remove= True) temp_win = pm.window(preset_win, title= 'presets', width= 300,sizeable= False) pm.columnLayout(adjustableColumn= True) pm.text(label= '') pm.text(label= 'Preset Name') self.field = pm.textField() pm.text(label= '') pm.text(label= 'Description') pm.text(label= '') self.scroll = pm.scrollField(width= 300, wordWrap= True) pm.text(label= '') pm.button(label= 'Create Preset', command= pm.Callback(self.create_preset)) pm.text(label= '') temp_win.show()
def gui(): ''' # gui for the script ''' win = 'rigid_body_win' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global obj_scroll_list, name_field, tab_layout my_win = pm.window(win, title= 'BAKE', toolbox= True, width= 300) tab_layout = pm.tabLayout() ui_creator = pm.columnLayout(adjustableColumn= False) name_field = pm.textFieldGrp(label = 'System Name', text= 'Name', columnWidth2= [145, 150]) obj_scroll_list = pm.textScrollList(width= 300, height= 200, allowMultiSelection= True) pm.rowColumnLayout(nc=3, columnWidth= ([1,100], [2,100], [1,100])) pm.button(label= 'Load', command= pm.Callback(load_objects), width= 100) pm.button(label= '+', command= pm.Callback(add_objects), width= 100) pm.button(label= '-', command= pm.Callback(remove_objects), width= 100) pm.setParent('..') pm.button(label= 'Create Baking System', height= 50, width= 300, command= pm.Callback(create_baking_system)) pm.tabLayout( tab_layout, edit=True, tabLabel=((ui_creator, 'Setup'))) my_win.show()
def _delete_login_menu(): """ Deletes the displayed Shotgun user login menu. """ if pm.menu(MENU_LOGIN, exists=True): pm.deleteUI(MENU_LOGIN)
def __init__(self): self.moduleInstance = None self.UIwidgets = {} self.windowName = "createRigUI" self.windowTitle = "jhAutoRig Window" self.widthHeight = [475, 550] if pm.window(self.windowName, exists=True): pm.deleteUI(self.windowName) self.UIwidgets["window"] = pm.window( self.windowName, title=self.windowTitle, w=self.widthHeight[0], h=self.widthHeight[1], mxb=False, mnb=False, sizeable=False, ) self.UIwidgets["ui_main_layout"] = pm.columnLayout(adj=True) self.initialize_modulesSettings() self.initialize_buildButton() pm.showWindow(self.windowName) self.createScriptJob()
def ui(): columnWidth1st = 120 if pm.window('AlembicMasterUI', q=True, exists=True) : pm.deleteUI('AlembicMasterUI') with pm.window('AlembicMasterUI',menuBar=True, s=True): with pm.columnLayout(adj=True): with pm.frameLayout( label='Export Alembic', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=3, adj=2): pm.text(label='file :', w=columnWidth1st, align='right') pm.textField('path_TFG', text="D:/") pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_TFG', 0, 'Alembic (*.abc)' ) ) with pm.rowLayout(nc=2, adj=2 ): startFrame=pm.animation.playbackOptions(q=1, minTime=1) EndFrame=pm.animation.playbackOptions(q=1, maxTime=1) with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='Export',bgc=(0.19,0.29,0.19),c=pm.Callback(exportScene)) pm.radioButtonGrp( 'timeRange_RBG', label='Time range :', labelArray3=['Camera Setting','Time Slider', 'Start/End'], numberOfRadioButtons=3, select=1, cw = [1,columnWidth1st], on1=pm.Callback( callback_timerangeSelect, 1), on2=pm.Callback( callback_timerangeSelect, 2), on3=pm.Callback( callback_timerangeSelect, 3), ) pm.floatFieldGrp( 'timeRange_FFG', label='Start / End : ', value1=1, value2=24, numberOfFields=2, cw = [1,117], en=False) with pm.frameLayout( label='Rebuild Scene', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='New Scene', bgc=(0.24,0.49,0.24), c=pm.Callback(buildscene)) with pm.frameLayout( label='Import Alembic', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=3, adj=2): pm.text(label='file :', w=columnWidth1st, align='right') pm.textField('path_ABC2', text="D:/") pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_ABC2', 1, 'Alembic (*.abc)' ) ) with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='Import', bgc=(0.19,0.19,0.28), c=pm.Callback(importAbcFile)) with pm.frameLayout( label='Save Scene', mw=3, mh=3,cll=True, bs='etchedIn'): with pm.columnLayout(adj=True): with pm.rowLayout(nc=3, adj=2): pm.text(label='file :', w=columnWidth1st, align='right') pm.textField('path_TFG2', text="D:/") pm.symbolButton( image='navButtonBrowse.png', c=pm.Callback( browseIt, 'path_TFG2', 0 ) ) with pm.rowLayout(nc=2, adj=2): pm.text(l='',w=columnWidth1st) pm.button(l='Save Scene', w=64, bgc=(0.22,0.23,0.43), c=pm.Callback(saveScene))
def build(): if pm.window('RemapWin', q = 1, ex = 1): pm.deleteUI('RemapWin') if pm.windowPref('RemapWin', q=1, ex = 1): pm.windowPref('RemapWin', r = True) with pm.window('RemapWin', title = 'RemapWin', wh = (150, 50), s = 0) as win: with pm.columnLayout(rs = 2, adj = 1): pm.button(l = u'创建色阶节点', c = run) pm.button(l = u'删除节点', c = deleteNodes)
def __init__(self): self.window = 'sdkflip' self.title = 'ec Set Driven Key Utility' self.width_height = (312, 289) if py.window(self.window, exists=True): py.deleteUI(self.window) py.window(self.window, title=self.title, wh=self.width_height, sizeable=False) py.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16) py.rowLayout("objRow", numberOfColumns=4, columnAlign2=("left", "right"), p="sdkflip") py.columnLayout("objCol", p="objRow") self.source_field = py.textField("sourceText", tx="Source Driver", p="objCol") py.columnLayout("objbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="objbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "sourcetxt")) py.columnLayout("tarCol", p="objRow") self.target_field = py.textField("targetText", tx="Target Driver", p="tarCol") py.columnLayout("tarbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="tarbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "targettxt")) py.frameLayout("scrollFrame", label="Driver Attributes", cll=False, borderStyle="etchedIn", p="sdkflip") py.rowLayout("scrollRow", p="scrollFrame") self.scroll_list = py.textScrollList("attrList", w=300, h=200, numberOfRows=8, allowMultiSelection=True, p="scrollRow") py.rowLayout("comRow", numberOfColumns=4, p="sdkflip") py.text("preText", l="Target Prefix", p="comRow") self.prefix_field = py.textField("prefixText", tx="rt", w=70, p="comRow") py.button(label="Mirror", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, True)) py.button(label="Copy", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, False)) py.showWindow(self.window)
def refresh_engine(engine_name, prev_context, menu_name): """ refresh the current engine """ current_engine = tank.platform.current_engine() # first make sure that the disabled menu is reset, if it exists... if pm.menu("ShotgunMenuDisabled", exists=True): pm.deleteUI("ShotgunMenuDisabled") # if the scene opened is actually a file->new, then maintain the current # context/engine. if pm.sceneName() == "": return current_engine new_path = pm.sceneName().abspath() # this file could be in another project altogether, so create a new Tank # API instance. try: tk = tank.tank_from_path(new_path) except tank.TankError, e: OpenMaya.MGlobal.displayInfo("Shotgun: Engine cannot be started: %s" % e) # render menu create_tank_disabled_menu(menu_name) # (AD) - this leaves the engine running - is this correct? return current_engine
def show( reset=False ): if pm.about(batch=True): print 'menu not available in batch mode.' return else: # -- get things ready for building the menu menu_name = "Impress Example" pm.setParent( MAYA_WINDOW ) if pm.menu( menu_name, exists=True ): if reset: pm.deleteUI( menu_name ) else: main_menu = pm.menu( menu_name, edit=True ) return main_menu if not pm.menu( menu_name, exists=True ): main_menu = pm.menu( menu_name, tearOff=True ) # -- build the menu with main_menu: with pm.subMenuItem( 'Display', aob=True, tearOff=True ): ui.commandMenuItem( performExample )
def GUI(): winName = 'squishy_ik_win' if pmc.window(winName, exists=1): pmc.deleteUI(winName) win = pmc.window(winName, t='Squishy IK') pmc.formLayout(numberOfDivisions=100) pmc.rowColumnLayout(nc=2, rs=[15, 15], columnOffset=(1, 'both', 5)) pmc.text(l='1 - Create Placement Locators') pmc.button(l='Make Locators', c=pmc.Callback(makeAutoRigLocators)) pmc.separator() pmc.separator() pmc.text(l='2 - Place locators where the spine begins and ends') pmc.button(l='Select Locators', c=pmc.Callback(selectAutoRigLocators)) pmc.separator() pmc.separator() pmc.text(l='3 - With the locators place, go ahead and create the rig!') pmc.button(l='Create Squishy Spine', c=pmc.Callback(squishySplineIkCallback)) pmc.separator() pmc.separator() pmc.text(l='4 - Select the joints to add to the skin cluster') pmc.button(l='Select Bind Joints', c=pmc.Callback(selectSquishyJointsCallback)) win.show()
def loadDriven(self, *args): """ Load object name for driven object in text field """ sel = pm.ls(sl=True, fl=True) pm.textFieldButtonGrp(self.drivenField, edit=True, text=sel[0]) # Clear the menu items so list doesn't grow items = pm.optionMenu(self.drivenAttField, q=True, ill=True) if(items): pm.setParent(self.drivenAttField, menu=True) for each in items: pm.deleteUI(each) # Check if blendshape if 'BlendShape' in str(type(sel[0])): bs = sel[0] temp = pm.aliasAttr(bs, q=1) temp.sort() targets = [] for each in temp: if each.startswith('weight'): continue targets.append(each) for tgt in targets: try: pm.menuItem(parent=self.drivenAttField, label=tgt) except Exception, e: print e pm.warning('%s failed to create / connect' % tgt)
def __init__(self, title, widthHeight, tabs_names, frameLayoutPerTab, collapseStyle=0, descr=''): ### SETTING UP COLOR SCHEME ### colorScheme = col.ColorSwatches([col.ColorSwatch(47,52,64), col.ColorSwatch(63,86,102), col.ColorSwatch(234,96,69), col.ColorSwatch(245,229,192), col.ColorSwatch(248,202,77)]) colorScheme.insertBetweens(3) self.col_fls=colorScheme.getColorList() self.close_red_cl=[0.5,0.2,0.2] self.title_blue_cl=[.1,.15,.2] self.go_green_cl=[.1,.4,.2] ### SETTING UP COLOR SCHEME ### if(pm.windowPref(title, q=True, ex=True)): pm.windowPref(title, remove=True) if(pm.window(title, q=True, ex=True)): pm.deleteUI(title) #self vars self.window = pm.window(title, wh=(widthHeight[0], widthHeight[1]), title=title) self.title=title self.wh = widthHeight self.tabs_names = tabs_names self.fl_perTab = frameLayoutPerTab self.collapseStyle=collapseStyle self.descr=descr #Defaults self.frameLayouts={} self.close_btn='' self.tabLayout='' self.docker=None self._createLayout() self.window.show()
def createUI(): global m2uwin if m2uwin is not None: pm.deleteUI(m2uwin, window=True) v = m2u.getVersion() m2uwin = pm.window( title="m2u "+v+" (maya)", iconName='m2u', widthHeight=(150, 300) ) pm.columnLayout() pm.rowLayout(numberOfColumns = 2) pm.button( label='Connect', c=cbConnect ) pm.button( label='Setup Cameras', c=cbSetupCamera ) pm.setParent('..') pm.checkBox( label='Sync Camera', onc = cbSyncCamera, ofc = cbSyncCameraOff, v = False) pm.checkBox( label='Sync Objects', onc = cbSyncObjects, ofc = cbSyncObjectsOff, v = False) pm.checkBox( label='Sync Visibility', onc = cbSyncVisibility, ofc = cbSyncVisibilityOff, v = False) pm.separator() pm.button( label='Fetch Selected', c = cbFetchSelected) pm.button( label='Send Selected To Editor', c = cbSendSelectedToEd) #pm.button( label='Import Content Test', c = cbUDKImportContent) pm.setParent( '..' ) pm.showWindow( m2uwin )
def __init__(self): winName = 'SineRigWin333' if pm.window(winName, exists=1): pm.deleteUI(winName,window=1) win = pm.window(winName, t='SineRig') pm.columnLayout(adj=1) pm.text('X Axis should be joint chain aim axis.') # Control self.cnt_fld = pm.textFieldButtonGrp(l='Control',bl='Load') pm.textFieldButtonGrp( self.cnt_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.cnt_fld,e=1,text=pm.ls(sl=1)[0]) ) # Name self.name_fld = pm.textFieldGrp(l='Name') # Base jnt self.base_fld = pm.textFieldButtonGrp(l='Base Joint',bl='Load') pm.textFieldButtonGrp( self.base_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.base_fld,e=1,text=pm.ls(sl=1)[0]) ) # Tip jnt self.tip_fld = pm.textFieldButtonGrp(l='Tip Joint',bl='Load') pm.textFieldButtonGrp( self.tip_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.tip_fld,e=1,text=pm.ls(sl=1)[0]) ) # Create button pm.button(l="Create",c=self.createRig) ##### Development Aide pm.textFieldButtonGrp(self.cnt_fld,e=1,text='TopFin_Base_ctrlA') pm.textFieldGrp(self.name_fld,e=1,text='Fin') pm.textFieldButtonGrp(self.base_fld,e=1,text='TopFinA_jnt_1') pm.textFieldButtonGrp(self.tip_fld,e=1,text='TopFinA_jnt_12') pm.showWindow(win)
def gui(): ''' creates the gui for the tool ''' win = 'uvtools' if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) global scroll_list, dyn_uis myWin = pm.window(win, title='Anim UV Tool' , sizeable = True, mnb = True, width = 500, height = 400, backgroundColor= [.68,.68,.68]) pm.scrollLayout(width= 500) pm.button(label= 'Creates Nodes', command= create_nodes, width= 500) row_layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= [[1, 150], [2, 10], [3, 340]]) pm.columnLayout(adjustableColumn= False, width=150) scroll_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(create_ui)) pm.button(label= 'List Nodes', command= list_nodes, width= 148) pm.setParent(row_layout) pm.text(label= '') dyn_uis = pm.columnLayout(adjustableColumn= False, width= 340) # listing the nodes at start up list_nodes() myWin.show()
def __init__(self): if pm.window(win, q=True, exists=True ): pm.deleteUI(win) with pm.window(win, wh=[300,600], t=title): with pm.frameLayout( lv=False, cll=False, mw=1, mh=1): with pm.formLayout() as mainForm: # 상단 with pm.tabLayout(tv=False) as top: with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False): with pm.rowLayout(nc=3, adj=2): pm.image( image = shelf_icon ) pm.text(l=' %s'%title, fn='boldLabelFont', align='left') pm.image( image = alfredIcon ) # # Contents start =========================================================== # 중단 with pm.tabLayout(tv=False, scr=True, childResizable=True) as self.mid: #with pm.columnLayout(adj=True): with pm.frameLayout( lv=False, cll=False, mw=3, mh=3, bv=False): uiContents() # # Contents end ============================================================= # # 하단 with pm.columnLayout(adj=True) as btm: pm.helpLine() # 팝업메뉴 # 왼쪽 마우스 클릭 pm.popupMenu(button=1, p=top) pm.menuItem(l='Add To Shelf', c=pm.Callback( self.addToShalf ) ) # 오른쪽 마우스 클릭 pm.popupMenu(button=3, p=top) pm.menuItem(l='Help', en=False ) # 폼조정 pm.formLayout( mainForm, e=True, attachForm=[ (top, 'top', 3), (top, 'left', 3), (top, 'right', 3), (self.mid, 'left', 3), (self.mid, 'right', 3), (btm, 'left', 3), (btm, 'right', 3), (btm, 'bottom', 3), ], attachControl=[ (self.mid, 'top', 3, top), (self.mid, 'bottom', 0, btm) ], )
def gui(): ''' Main Interface ''' win = "Layout" if pm.window(win, exists=True): pm.deleteUI(win, window=True) win = pm.window("Layout", w=300) main = pm.columnLayout() scroll = pm.scrollLayout(w=400, height=200) get_references() global asset_1, asset_2, asset_3 asset_1 = Asset_Widget(scroll, 'trafficLight') asset_2 = Asset_Widget(scroll, 'mailBox1') asset_3 = Asset_Widget(scroll, 'mailBox2') ''' asset_widget(scroll) asset_widget(scroll) asset_widget(scroll) asset_widget(scroll) ''' win.show()
def ui_fixComponentShading(*args): ### UI setup global UI_name UI_name = [ 'chk_find', 'chk_fix', 'chk_layer', 'btn_run' ] if pm.window( 'fix_component_shading', exists=True ): pm.deleteUI( 'fix_component_shading', window=True ) ui_layout['window'] = pm.window( 'fix_component_shading', title='Fix Component Shading', sizeable=False, h=200, w=200 ) ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] ) pm.checkBox( UI_name[0], label=' Find Component Shading Object', value=1, w=200, p=ui_layout['mainLayout'] ) pm.checkBox( UI_name[1], label=' Fix Component Shading Object', w=200, p=ui_layout['mainLayout'] ) pm.checkBox( UI_name[2], label=' Fix Ecah Render Layer', w=200, p=ui_layout['mainLayout'] ) ui_layout['ui_sub1'] = pm.formLayout(p=ui_layout['mainLayout'] ) btn = pm.button( UI_name[3] ,label=' Execute !', command=pm.Callback( doExecution ), w=100, p=ui_layout['ui_sub1'] ) pm.formLayout( ui_layout['ui_sub1'], e=True, attachForm=[ (btn, 'left', 50 ) ] ) pm.separator( h=8, w=200, style='single', p=ui_layout['mainLayout'] ) ui_layout['ui_sub2'] = pm.columnLayout(p=ui_layout['mainLayout'] ) pm.text(label=' --- This script will keep the material \n in the CURRENT render layer, so \n it better to run it in MASTER layer! --- ', bgc=[0.05, 0.05, 0.05], align='left', p=ui_layout['ui_sub2'] ) pm.showWindow( ui_layout['window'] )
def rebuild(self): children = self._container.getChildArray() if children: for child in self._container.getChildArray(): pm.deleteUI(child) self._fields = [] with self._container: for index in range(self._attribute.numElements()): name = self._attribute[index].get() if not name: continue self._fields.append(LinkField( attribute = self._attribute[index], *self._fieldArgs, **self._fieldKwargs )) if not self._fields: pm.textField(text = '', editable = False, *self._fieldArgs, **self._fieldKwargs)
def show(): if pm.menu('alfredTools2', exists=True): pm.deleteUI('alfredTools2') gMainWindow = pm.melGlobals['gMainWindow'] # 마야 상단에 메뉴 생성 alfredToolsMenu = pm.menu('alfredTools2', label = "Alfred Tools 2", parent = gMainWindow, tearOff = True, allowOptionBoxes = True, #familyImage = familyImage, #mnemonic = 'alfred', # 뭔지 모르겠음. #helpMenu = True, # help메뉴 뒤로감 ) pm.menuItem( dl='Asset', divider=True, p=alfredToolsMenu ) pm.menuItem( l='Modeling', p=alfredToolsMenu, en=False ) pm.menuItem( l='Surfacing', p=alfredToolsMenu, c=pm.Callback( menuCmd_surfacing ) ) pm.menuItem( l='Rigging', p=alfredToolsMenu, c=pm.Callback( menuCmd_rig ) ) pm.menuItem( dl='Layout', divider=True, p=alfredToolsMenu ) pm.menuItem( l='Shot', p=alfredToolsMenu, c=pm.Callback(menuCmd_layout) ) pm.menuItem( dl='Animation', divider=True, p=alfredToolsMenu ) pm.menuItem( l='Animation', p=alfredToolsMenu, en=False ) pm.menuItem( l='Motion Capture', p=alfredToolsMenu, c=pm.Callback( menuCmd_motionCapture ) ) pm.menuItem( dl='FX', divider=True, p=alfredToolsMenu ) pm.menuItem( l='FX', p=alfredToolsMenu, en=False ) pm.menuItem( dl='Render', divider=True, p=alfredToolsMenu ) pm.menuItem( l='Scene Assembly', p=alfredToolsMenu, c=pm.Callback(menuCmd_sceneAssembly) ) pm.menuItem( l='Surfacing', p=alfredToolsMenu, c=pm.Callback( menuCmd_surfacing ) ) pm.menuItem( l='Lighting', p=alfredToolsMenu, en=False ) pm.menuItem( l='Render', p=alfredToolsMenu, c=pm.Callback(menuCmd_render) )
def __init__(self, *args, **kwargs): self.log = logging.getLogger(self.__class__.__name__) self._refreshEvent = None if 'name' in kwargs: name = kwargs.pop('name') elif 'n' in kwargs: name = kwargs.pop('n') else: name = '' self._name = '{0}{1}'.format(self.__class__.__name__, name) if 'title' in kwargs: title = kwargs.pop('title') elif 't' in kwargs: title = kwargs.pop('t') else: title = '' kwargs['title'] = '{0} | {1}'.format(self.TITLE, title) if title else self.TITLE if pm.window(self._name, exists = True): pm.deleteUI(self._name) self._window = pm.window(self._name, *args, **kwargs)
def UI(): # find ui files ehm_uiPath = pm.internalVar( uad=True ) + 'scripts/ehm_tools/ui/' # delete window if exists if pm.window( 'offsetBlends.ui', q=True, exists=True ): pm.deleteUI( 'offsetBlends.ui' ) # load ui uiFile = pm.loadUI( uiFile = ehm_uiPath + 'offsetBlends.ui' ) # connect base button pm.button( "ofb_selectBase_btn", edit=True, command = "offsetBlends.addToTextField('ofb_base_tf')" ) # connect modified button pm.button( "ofb_selectModified_btn", edit=True, command = "offsetBlends.addToTextField('ofb_modified_tf')" ) # connect object to change buttons pm.button( "ofb_selectGeos_btn", edit=True, command = "offsetBlends.addToTextScroll('ofb_geos_tsl')" ) # connect apply change buttons pm.button( "ofb_apply_btn", edit=True, command = "offsetBlends.OffsetBlends()" ) # show ui pm.showWindow( uiFile )
def showDialog(dialog, dInst=True, dockable=False, *args): """ Show the defined dialog window Attributes: dialog (QDialog): The window to show. """ if dInst: try: for c in maya_main_window().children(): if isinstance(c, dialog): c.deleteLater() except Exception: pass # Create minimal dialog object # if versions.current() >= 20180000: # windw = dialog(maya_main_window()) # else: windw = dialog() # ensure clean workspace name if hasattr(windw, "toolName") and dockable: control = windw.toolName + "WorkspaceControl" if pm.workspaceControl(control, q=True, exists=True): pm.workspaceControl(control, e=True, close=True) pm.deleteUI(control, control=True) desktop = QtWidgets.QApplication.desktop() screen = desktop.screen() screen_center = screen.rect().center() windw_center = windw.rect().center() windw.move(screen_center - windw_center) # Delete the UI if errors occur to avoid causing winEvent # and event errors (in Maya 2014) try: if dockable: windw.show(dockable=True) else: windw.show() return windw except Exception: windw.deleteLater() traceback.print_exc()
def initialize(): """ This will setup the menu and interface mechanisms for the Crab Rigging Tool. :return: """ # -- If the menu already exists, we will delete it to allow # -- us to rebuild it if pm.menu(CRAB_MENU_OBJ, exists=True): pm.deleteUI(CRAB_MENU_OBJ) # -- Create the new menu for Crab new_menu = pm.menu( CRAB_MENU_OBJ, label=CRAB_MENU_NAME, tearOff=True, parent=pm.language.melGlobals['gMainWindow'], ) add_menu_item('Creator', crab.creator.launch) add_menu_item('Animator', crab.animator.launch) pm.menuItem(divider=True, parent=new_menu) add_menu_item('Edit', _menu_edit_rig) add_menu_item('Build', _menu_build_rig) pm.menuItem(divider=True, parent=new_menu) add_menu_item('Website', _menu_goto_website) pm.menuItem(divider=True, parent=new_menu) add_menu_item('Reload', _menu_reload) # -- We specifically only want this menu to be visible # -- in the rigging menu cached_menu_set = pm.menuSet(query=True, currentMenuSet=True) rigging_menu_set = pm.mel.findMenuSetFromLabel("Rigging") # -- Set our menu to the rigging menu and add it to # -- the menu set pm.menuSet(currentMenuSet=rigging_menu_set) pm.menuSet(addMenu=new_menu) # -- Restore the users cached menu set pm.menuSet(currentMenuSet=cached_menu_set)
def Control_MM_UI(): if pm.popupMenu('ControlMenu', ex=1): pm.deleteUI('ControlMenu') CtlMenu = pm.popupMenu('ControlMenu', mm=1, b=(1), aob=1, ctl=0, alt=0, sh=0, p="ControlBase", pmo=1) pm.menuItem(p=CtlMenu, l="Print Fn", rp="SW", c="print 'SouthWest'") pm.menuItem(p=CtlMenu, l="Circle", rp="NE", c="pm.circle()")
def __init__(self): super(CheckIntersectionWin, self).__init__() self.show() pos = self.pos() loadUi(UI_PATH, self) self.move(pos) self.setWindowTitle(u"maya模型穿插检测") # 避免出现重复的窗口 object_name = "TopologyDetectionWin" if pm.window(object_name, ex=1): pm.deleteUI(object_name) self.setObjectName(object_name) #设置默认值 self.lineEdit_time.setReadOnly(True) self.textEdit_Pos.setReadOnly(True) #滚动条 self.ver_scr1 = self.listWidget_ID.verticalScrollBar() self.ver_scr2 = self.textEdit_Pos.verticalScrollBar() # NOTE 添加保护 flag self.ver_scr1.protected = True self.ver_scr2.protected = True self.ver_scr1.valueChanged.connect( partial(self.move_scrollbar, self.ver_scr1)) self.ver_scr2.valueChanged.connect( partial(self.move_scrollbar, self.ver_scr2)) self.listWidget_ID.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) # 消息响应 self.btn_other.clicked.connect(self.do_check_other) self.btn_self.clicked.connect(self.do_check_self) self.btn_select_all.clicked.connect(self.select_all) self.listWidget_ID.itemSelectionChanged.connect( self.item_click_multiple) self.hitface_list = [] # 储存穿插面
def mayaShow(self, name="MF_AVG_NORMAL"): # NOTE 如果变量存在 就检查窗口多开 try: if pm.workspaceControl(name, q=1, ex=1): pm.deleteUI(name) window = pm.workspaceControl(name, label=self.windowTitle()) except: if pm.window(name, q=1, ex=1): pm.deleteUI(name) window = pm.window(name, label=self.windowTitle()) pm.showWindow(window) # NOTE 将Maya窗口转换成 Qt 组件 ptr = self.mayaToQT(window) ptr.setLayout(QtWidgets.QVBoxLayout()) ptr.layout().setContentsMargins(0, 0, 0, 0) ptr.layout().addWidget(self) return ptr
def __init__(self, *args): self.WIN = self.__class__.uiName # Check if window exists if pm.window(self.WIN, exists=True): pm.deleteUI(self.WIN) # Initiate Methods #self.helloWorld() #self.existChecker() cmds.polyCube(n='companionCube') # create test cube var = self.getListExistingObjects( 'companionCube') # check existing items print(var) # Create Window self.WIN = pm.window(self.WIN, s=True, title='My UI') self.WIN.show()
def clean(): global _menu global _menuItems global _window global _cont global _files with mayautils.undo_on_error(): _window.hide() for item in _menuItems: pmc.deleteUI(item) pmc.deleteUI(_menu) _window = None _cont = None _files = None _menu = None _menuItems = []
def __init__(self): ''' Export animation. ''' self.noSelError = 'Nothing selected! Please select the MAINC control of a rig.' win = 'ExportRigsWin' if pm.window(win, exists=1): pm.deleteUI(win, window=1) pm.window(win, title='Export Animation', rtf=1) pm.columnLayout(adj=1) pm.text('Select rig "MAINC" control.') self.fNameFld = pm.textFieldGrp(l='Name for export file', text='anim_01') pm.button(l='Export Anim', c=self.exportSelected) pm.showWindow(win)
def doScale(percent, *args, **kwargs): files = getFileNode() workspace = kxTool.KXTool().getPorjPath() percent = percent scaled = "_scale_to_%s" %percent for f in files: imagePath = getImagePath(f) if imagePath: newPath = setNewPath(imagePath, workspace, scaled) scaledImage(f, imagePath, newPath, percent) replaceImage(f, newPath) messageBox = QtGui.QMessageBox(uiTool.getMayaWindow()) messageBox.setText(u"所选物体的贴图以转换成0.5倍尺寸") messageBox.show() if pm.window("scaleImageTool", ex = 1): pm.deleteUI("scaleImageTool")
def ui_main(): """ """ windowName = 'ms_transShader_mainUI' windowWidth = 200 windowHeight = 120 if pm.window(windowName, q=1, ex=1): pm.deleteUI(windowName) pm.window(windowName, t='MS_TransShader', s=0, mxb=0, mnb=0) pm.columnLayout(adj=1) pm.button(l='Export', h=60, c=exportShader) pm.button(l='Import', h=60, c=importShader) pm.setParent('..') pm.window(windowName, e=1, w=windowWidth, h=windowHeight) pm.showWindow(windowName)
def __init__(self): #Store UI elements in a dictionary self.UIElements = {} if pm.window("blueprint_UI_window", exists=True): pm.deleteUI("blueprint_UI_window") self.windowWidth = 400 self.windowHeight = 598 self.UIElements["window"] = pm.window("blueprint_UI_window", width=self.windowWidth, height=self.windowHeight, title="blueprint_UI_window") self.UIElements["topLevelColumn"] = pm.columnLayout( adjustableColumn=True, columnAlign="center") #Setup Tabs #every child creates new tab tabHeight = 500 self.UIElements["tabs"] = pm.tabLayout(height=tabHeight, innerMarginWidth=5, innerMarginHeight=5) tabWidth = pm.tabLayout(self.UIElements["tabs"], q=True, width=True) tabWidth = 400 self.scrollWidth = tabWidth - 40 self.initializeModuleTab(tabHeight, tabWidth) pm.tabLayout(self.UIElements["tabs"], edit=True, tabLabelIndex=([1, "Modules"])) #3. Lock and Publish Buttons pm.setParent(self.UIElements["topLevelColumn"]) self.UIElements["lockPublishColumn"] = pm.columnLayout( adj=True, columnAlign="center", rs=3) #single column pm.separator() self.UIElements["lockBtn"] = pm.button(label="Lock", command=partial(self.lock)) pm.separator() self.UIElements["publishBtn"] = pm.button(label="Publish") pm.separator() #Display window pm.showWindow(self.UIElements["window"])
def gui(): if pm.window('Bone_Stretch_Window', q=1, exists=1): pm.deleteUI('Bone_Stretch_Window') #Bone_Stretch_Window win_width = 240 window_object = pm.window('Bone_Stretch_Window', title="ByrdRigs' Bone Stretch", w=win_width, bgc=window_bgc) main_layout = pm.columnLayout() pm.text(l='Select the starting locator, ending locator, and the bone.', w=win_width, ww=1) pm.frameLayout(l='Manual', w=win_width, bgc=color_1, cl=1, cll=1, cc=windowResize) pm.button(l='Selection', w=win_width, c=getSelection) pm.button(l='Bone Rename', w=win_width, c=boneRename) pm.button(l='Start Loc', w=win_width, c=startLoc) pm.button(l='Distance Node', w=win_width, c=distanceNode) pm.button(l='Mult Node', w=win_width, c=multNode) pm.button(l='Condition Node', w=win_width, c=conditionNode) pm.button(l='Locator Connection', w=win_width, c=locConnection) pm.button(l='Distance Connection', w=win_width, c=distanceConnection) pm.button(l='Mult Connection', w=win_width, c=multConnection) pm.button(l='Condition Connection', w=win_width, c=conConnection) pm.button(l='Clean Up', w=win_width, c=cleanUp) pm.setParent(main_layout) pm.frameLayout(l='Auto', w=win_width, bgc=color_2, cl=1, cll=1, cc=windowResize) pm.button(l='All in one', w=win_width, c=completeSystem) pm.window('Bone_Stretch_Window', e=1, wh=(240, 70), rtf=1) pm.showWindow(window_object) print('Window Created:', window_object)
def __init__(self, dock=False): # So first we check if we want this to be able to dock if dock: # If we should be able to dock, then we'll use this function to get the dock parent = getDock() else: # Otherwise, lets remove all instances of the dock incase it's already docked deleteDock() # Then if we have a UI called lightingManager, we'll delete it so that we can only have one instance of this # A try except is a very important part of programming when we don't want an error to stop our code # We first try to do something and if we fail, then we do something else. try: pm.deleteUI('lightingManager') except: logger.debug('No previous UI exists') # Then we create a new dialog and give it the main maya window as its parent # we also store it as the parent for our current UI to be put inside parent = QtWidgets.QDialog(parent=getMayaMainWindow()) # We set its name so that we can find and delete it later parent.setObjectName('lightingManager') # Then we set the title parent.setWindowTitle('Lighting Manager') # Finally we give it a layout dlgLayout = QtWidgets.QVBoxLayout(parent) # Now we are on to our actual widget # We've figured out our parent, so lets send that to the QWidgets initialization method super(LightingManager, self).__init__(parent=parent) # We call our buildUI method to construct our UI self.buildUI() # Now we can tell it to populate with widgets for every light self.populate() # We then add ourself to our parents layout self.parent().layout().addWidget(self) # Finally if we're not docked, then we show our parent if not dock: parent.show()
def __init__(self): #Store UI elements in a dictionary self.UIElements = {} if pm.window("mo_UI_window", exists=True): pm.deleteUI("mo_UI_window") self.windowWidth = 400 self.windowHeight = 598 self.UIElements["window"] = pm.window("mo_UI_window", width=self.windowWidth, height=self.windowHeight, title="mo_UI_window") self.UIElements["topLevelColumn"] = pm.columnLayout( adjustableColumn=True, columnAlign="center") #Setup Tabs #every child creates new tab tabHeight = 500 tabWidth = 400 self.scrollWidth = tabWidth - 40 self.UIElements["tabs"] = pm.tabLayout(height=tabHeight, innerMarginWidth=5, innerMarginHeight=5) riggTab = self.initializeRiggTab(tabHeight, tabWidth) pm.setParent("..") animTab = self.initializeAnimTab(tabHeight, tabWidth) pm.setParent("..") displayTab = self.initializeDisplayTab(tabHeight, tabWidth) pm.setParent("..") modelTab = self.initializeModelTab(tabHeight, tabWidth) pm.setParent("..") renderTab = self.initializeRenderTab(tabHeight, tabWidth) pm.tabLayout(self.UIElements["tabs"], edit=True, tabLabel=((riggTab, 'mo_rigg'), (animTab, 'mo_anim'), (displayTab, 'mo_display'), (modelTab, 'mo_model'), (renderTab, 'mo_render'))) #Display window pm.showWindow(self.UIElements["window"])
def UI(self): width = 410 height = 210 # create window if pm.window('ehm_Colorize_UI', exists=True): pm.deleteUI('ehm_Colorize_UI') pm.window('ehm_Colorize_UI', title='change color', w=width, h=height, mxb=False, mnb=False, sizeable=False) # main layout mainLayout = pm.columnLayout(w=width, h=height) formLayout = pm.formLayout(w=width - 10, h=height - 10) frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False) # left column and form pm.setParent(formLayout) buttonsLayout = pm.rowColumnLayout(nc=8) # find color icons iconPath = os.path.join(ehsan_script_directory, 'ui', 'icons') icons = os.listdir(iconPath) colorIcons = [] for icon in icons: if 'color_' in icon: colorIcons.append(icon) # button for icon in colorIcons: colorCode = int(icon.partition('.')[0].partition('_')[2]) pm.symbolButton(image=os.path.join(iconPath, icon), w=50, h=50, c=partial(self.colorize, None, colorCode)) # show window pm.showWindow('ehm_Colorize_UI')
def __init__(self): win = 'portal_pose_library_warning' if pm.window(win, exists=True): pm.deleteUI(win) if pm.windowPref(win, exists=True): pm.windowPref(win, remove=True) self.window = pm.window(win, title='Warning', width=400, height=300, sizeable=False) pm.columnLayout(adjustableColumn=True) pm.text(label='ERROR', bgc=[1, 0, 0], align='center', height=25) pm.text(label='ALREADY A RANDOM QUESTION', align='center') pm.text(label='') pm.button(label='CLOSE', command=pm.Callback(self.close)) self.window.show()
def mvgCreateMenu(): gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow') menuName = "mvgMenu" menuLabel = "MayaMVG" if (pm.menu(menuName, exists=True)): pm.deleteUI(menuName) if (gMainWindow != ""): pm.setParent(gMainWindow) menu = pm.menu(menuName, label=menuLabel, tearOff=True) pm.menuItem(parent=menu, label='Open...', command=pm.Callback(openMVGWindow_CB)) pm.menuItem(parent=menu, label='Export selection as ABC', command=pm.Callback(exportSelectionAsABC_CB)) pm.menuItem(parent=menu, label='Create locator from vertex', command=pm.Callback(createLocatorFromVertex_CB)) pm.menuItem(parent=menu, divider=True)
def createImageFormatControls(self): log.debug("createImageFormatControls()") self.createGlobalsNode() self.createImageFormats() # self.imageFormatCtrl = pm.optionMenuGrp(label="Image Formats") if pm.optionMenuGrp("openMayaImageFormats", q=True, exists=True): pm.deleteUI("openMayaImageFormats") self.imageFormatCtrl = pm.optionMenuGrp("openMayaImageFormats", label="Image Formats", cc=pm.Callback( self.imageFormatCallback)) for pr in self.imageFormats: log.debug("adding image format: " + pr) pm.menuItem(pr) # pm.scriptJob(attributeChange=[self.renderGlobalsNode.imageFormat, pm.Callback(self.imageFormatCallback)], parent = self.imageFormatCtrl) return self.imageFormatCtrl
def about(self, *args, **kwargs): ''' ''' now = datetime.datetime.now() year = now.year release, version = lcUpdate.Update.update_get_current_version() aboutName = 'lct_about' w = 220 h = 243 if pm.control(aboutName, exists=True): pm.deleteUI(aboutName) aboutWindow = pm.window(aboutName, t="LEOCOV Toolbox - About", widthHeight=[w, h], rtf=False, mnb=False, mxb=False, s=False, toolbox=True) pm.columnLayout(w=w, cw=w, cal='center') pm.text(l='', al='center', w=w) pm.text(l='LEOCOV Toolbox', al='center', w=w) pm.text(l='', al='center', w=w) pm.text(l='Release: {}'.format(release), al='center', w=w) pm.text(l='Version: {}'.format(version), al='center', w=w) pm.text(l='', al='center', w=w) pm.button(l='License', al='center', w=w, command=lambda *args: webbrowser.open('http://lct.leocov.com/license', new=2)) pm.button(l='Privacy Policy', al='center', w=w, command=lambda *args: webbrowser.open('http://lct.leocov.com/privacy', new=2)) pm.button(l='Release Notes', w=w, command=lambda *args: webbrowser.open('http://lct.leocov.com/release_notes', new=2)) pm.button(l='First Launch Window', al='center', w=w, command=lambda *args: UI.lcToolbox_first_launch_window(force_show=True)) pm.text(l='', al='center', w=w) pm.text(l='Leonardo Covarrubias - {} {}'.format("Copyright", year), al='center', w=w) pm.text(l='', al='center', w=w) pm.rowColumnLayout(nc=3, cw=([1, 60], [2, 100], [3, 60])) pm.text(l='', al='center', w=50) pm.button('about_close', l='Close', w=100, h=25, command=lambda *args: pm.deleteUI(aboutWindow)) pm.text(l='', al='center', w=50) aboutWindow.show() pm.window(aboutWindow, edit=True, h=h, w=(w + 2))
def __init__(self, parent=None): super(main, self).__init__() self._name = 'ControlCreatorWindow' try: pm.deleteUI(self._name) except: pass if parent: assert isinstance(parent, QtWidgets.QMainWindow), \ 'Parent is not of type QMainWindow' self.setParent(parent) else: self.setParent(mayaWindow()) self.setWindowFlags(QtCore.Qt.Window) self.setWindowTitle('Control Maker') self.setObjectName(self._name) self.setStyleSheet(uiStyle.styleSheet) self.createMenuBar() self.createStatusBar()
def __init__(self): self.windows_name = 'cgru_afanasy_wnd' if pm.window(self.windows_name, exists=True): pm.deleteUI(self.windows_name) self.window = pm.window(self.windows_name, t='Afanasy') with pm.columnLayout(adj=True): labels_width = 90 with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='Start Frame') pm.intField('cgru_afanasy__start_frame', v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1)) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='End Frame') pm.intField('cgru_afanasy__end_frame', v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1)) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='Frame Per Task') pm.intField('cgru_afanasy__frames_per_task', v=pm.optionVar.get( 'cgru_afanasy__frames_per_task_ov', 1)) with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)): pm.text(l='By Frame') pm.intField('cgru_afanasy__by_frame', v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1)) pm.checkBox('cgru_afanasy__paused', l='Start Paused', v=0) pm.checkBox('cgru_afanasy__separate_layers', l='Submit Render Layers as Separate Tasks', v=1) pm.button(l='LAUNCH', c=self.launch) pm.checkBox('cgru_afanasy__close', l='Close After', v=1) pm.showWindow(self.window)
def show(self): if pm.window("dataConvertWin", ex=True): pm.deleteUI("dataConvertWin") pm.window("dataConvertWin", t=u"自动输出 %s" % __version__, mb=True, cc=lambda *args: self._close_main_window()) self.menu_list() tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) child1 = self.child_tab_export() child2 = self.child_tab_import() pm.tabLayout(tabs, edit=True, tabLabel=((child1, u'输出'), (child2, u'导入'))) pm.showWindow("dataConvertWin")
def SJ_scaleAnimationwdUI(): if pm.window('scaleani',ex=True): pm.deleteUI('scaleani',wnd=True) pm.window('scaleani',t='ScaleAnimationToolV1.0') pm.columnLayout(adj=True) pm.text(l='缩放动画工具V1.0 ',fn='fixedWidthFont',h=50,w=10) pm.flowLayout( columnSpacing=0) pm.text(l='起始帧 ',fn='fixedWidthFont',h=30,w=130) pm.text(l='结束帧 ',fn='fixedWidthFont',h=30,w=130) pm.setParent( '..' ) pm.flowLayout( columnSpacing=0) pm.textField('startnum',tx=u"1",w=130,h=30,ann="") pm.textField('endnum',tx=u"100",w=130,h=30,ann="") pm.setParent( '..' ) pm.button(l='获取key帧属性',c=getattr,bgc=[0.4,0.6,0.5],w=160,h=50) pm.textScrollList("keyattr",allowMultiSelection=1) pm.button(l='缩放动画',c=scaleani,bgc=[0.4,0.6,0.5],w=160,h=50) pm.button(l='去除小数点帧数',c=anisplits,bgc=[0.4,0.6,0.5],w=160,h=50) pm.showWindow()
def runMayaUiDemo(): ''' Description Function for load the class and delete the exists 'UI' in the scene. :Type - standalone function :param None :return None :example to execute from assets import assetTool reload(assetTool) wind = assetTool.runMayaUiDemo() wind.show() ''' if (pymel.window("MainWindow_poseCopy", ex=True)): pymel.deleteUI('MainWindow_poseCopy') wind = UI_MainWindow()
def setup_window(): win_name = "twinPipeSetupUI" if pm.window(win_name, exists=True): pm.deleteUI(win_name) with pm.window(win_name, title="TwinPipe Setup", height=400): with pm.verticalLayout(): pm.button(label="Install Git Tools...", bgc=(0.5, 0.6, 0.4), c=lambda _: git_setup()) pm.button(label="Clone Project from MBOXX", bgc=(0.5, 0.6, 0.65), c=lambda _: clone_project()) pm.button(label="Set Project", bgc=(0.4, 0.55, 0.45), c=lambda _: set_project()) pm.separator() pm.button(label="Map MBOXX to M:\\ drive", c=lambda _: mboxx_setup())
def gui(): win = 'quiz_maker' if pm.window(win, exists=True): pm.deleteUI(win) if pm.windowPref(win, exists=True): pm.windowPref(win, remove=True) global scroll_field, scroll_list my_win = pm.window(win, title='Quiz Maker', toolbox=True, width=550, height=400) dir_path = os.path.dirname(__file__) file_path = os.path.join(dir_path, 'questions.txt') main_layout = pm.columnLayout() maker = Quiz_Maker(file_path) my_win.show()
def __init__(self): version = "1.0" if pm.window('RigToolsRenameWin', exists=True): pm.deleteUI('RigToolsRenameWin', window=True) self.window = pm.window('RigToolsRenameWin', title="Rig Tools Rename v%s" % version, iconName='RigToolsRenameWin') with pm.columnLayout(adj=1): with pm.columnLayout(adjustableColumn=True): pm.text('Assumes only one rig in the scene.') pm.text('Will only rename things with default naming.') self.cbFld = pm.checkBoxGrp(numberOfCheckBoxes=2, label='Type:', labelArray2=['FK', 'IK']) self.nameFld = pm.textFieldGrp(label='Name') pm.button(l='Rename', c=self.rename) pm.showWindow(self.window)
def start_up_shotgun(project_name="df"): # get tk tk = sg_lib.get_tk_object() # get path os_type = os_lib.get_os_type() if os_type == "osx": os_type = "mac" storage = tk.shotgun.find_one("LocalStorage", [["code", "is", "primary"]], ["%s_path" % os_type]) storage_path = storage["%s_path" % os_type] if not storage_path: return project_path = os.path.join(storage_path, project_name) # get current user sg_login = os_lib.get_shotgun_login() current_user = tk.shotgun.find_one("HumanUser", [["login", "is", sg_login]], ["login"]) # login authentication impl = tank_vendor.shotgun_authentication.user_impl.SessionUser( host=r"http://shotgun.antsanimation.com", login=current_user["login"], session_token=None, http_proxy=None) user = tank_vendor.shotgun_authentication.user.ShotgunUser(impl) tank.api.set_authenticated_user(user) # tank.util.get_current_user(tk) # clear old engine if tank.platform.current_engine(): tank.platform.current_engine().destroy() if pm.menu("ShotgunMenu", exists=True): pm.deleteUI("ShotgunMenu") if pm.menu("ShotgunMenuDisabled", exists=True): pm.deleteUI("ShotgunMenuDisabled") # start up new engine context = tk.context_from_path(project_path) user_context = context.create_copy_for_user(current_user) tank.platform.engine.start_engine(engine_name, user_context.tank, user_context)
def __init__(self, parent=None): super(main, self).__init__() try: pm.deleteUI('RenamerWindow') except: pass if parent: assert isinstance(parent, QtWidgets.QMainWindow), \ 'Parent is not of type QMainWindow' self.setParent(parent) else: self.setParent(mayaMainWindow) self.setWindowFlags(QtCore.Qt.Window) self.setWindowTitle('Renamer') self.setObjectName('RenamerWindow') # init UI self._initMainUI() self.createMenuBar() self.statusBar()
def make_window(*args): if pymel.namespace(exists=':Avatar_Rig'): namespace = 'Avatar_Rig:' else: namespace = '' window_name = 'offsets' if pymel.window('window1', exists=True): print 'yes!' pymel.deleteUI('window1') window = pymel.window(title=window_name, widthHeight=(250, 100)) pymel.columnLayout(adjustableColumn=True) pymel.text('Rig Namespace') pymel.textField('Rig_Namespace', text=namespace) pymel.button('Import Offsets', command=import_offsets) pymel.button('Save Offsets', command=save_offsets) pymel.button('Remove_Offsets', command=remove_offsets) pymel.showWindow(window)