def __init__(self, parent): self.parent = parent self.mainWindow = parent.mainWindow self.mmmmTools = self.parent.parent self.mmmm = self.mmmmTools self.ini = self.parent.ini self.conf = self.ini.conf self.ui = self.parent self.menuCount = 0 self.submenus = {} try: pm.deleteUI( self.menu, menu=True ) except: print( 'Not deleting old main MmmmTools menu, probably because Maya is just starting and it does not yet exist. For exception code see: "Ui.MainMenu.__init__" ') #traceback.print_exc() try: ##Turns out that the main window is capable of directly supporting menus, almost as if it is a menuBarLayout. try: pm.deleteUI('MmmmTools') except: doNothing = "MmmmTools isn't in menu" self.menu = pm.menu( 'MmmmTools', parent=self.mainWindow, label = 'MmmmTools', tearOff=True ) ## **** Here we need someway to delete old menus! **** eg: self.mmmmTools.persistent.menusToDelete.append( self.menu ) except: print("MmmmTools Menu could not be created. Perhaps it already exists and this is not a problem.") traceback.print_exc()
def ui() : global FFU_E_SETTINGS, FFU_E_WINDOW init() WINDOW_NAME = 'w_ff_utils_export' if( pm.window( WINDOW_NAME, q=True, exists=True ) ) : pm.deleteUI( WINDOW_NAME ) FFU_E_WINDOW = pm.window( WINDOW_NAME, title='Export to Fiction Factory', sizeable=True ) vl = pm.verticalLayout() hl = pm.horizontalLayout( parent=vl ) l1 = pm.frameLayout( parent=hl, label="Scene options" ) for setting in FFU_E_SETTINGS : uiobject = __create_uiobject_from_setting( setting ) l2 = pm.frameLayout( parent=hl, label="FFEXport options" ) for setting in FFU_E_FFEXPORT_SETTINGS : uiobject = __create_uiobject_from_setting( setting ) pm.button( label='Export!', parent=vl, command=lambda *args : ui_do_export() ) FFU_E_WINDOW.setHeight(600) FFU_E_WINDOW.setWidth(200) hl.redistribute( 2.5, 1 ) vl.redistribute( 5, 1 ) FFU_E_WINDOW.show()
def deleteAllWindows(cls): windows = pm.lsUI(typ='window') for win in windows: try: print( win ) if win != 'MayaWindow': pm.deleteUI( win ) x=0 except: print( traceback.format_exc() )
def __create_uiobject_from_setting( setting ) : try : pm.deleteUI( setting.uiobject ) except : pass setting.uiobject = None uiobject = None uiobject = Setting._mappings[setting.datatype][0]( setting.name, label=' '.join(setting.name.split('_')), cc=lambda *args : setting.update() ) getattr( uiobject, Setting._mappings[setting.datatype][1] )( setting.value ) setting.uiobject = uiobject return uiobject
def dock(mainWindow): """ Show dockable window args mainWindow : QtGui.QMainWindow return None """ mainWindow.setObjectName('sampleWindowObject') DOCK_NAME = "dock_name" from pymel import all as pm if pm.dockControl(DOCK_NAME, q=True, ex=1): pm.deleteUI(DOCK_NAME) if pm.window('dummyWindow', q=True, ex=1): pm.deleteUI('dummyWindow') # Create dummy window object to keep the layout pm.window('dummyWindow') pm.columnLayout() floatingLayout = pm.paneLayout( configuration='single', w=300) pm.setParent('..') # Create new dock pm.dockControl( DOCK_NAME, aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Sample Dock", w=300) # Parent QMainWindow object to the layout pm.control('sampleWindowObject', e=True, parent=floatingLayout)
def __load_shelves( layout ) : children = layout.getChildArray() if children : for child in children : pm.deleteUI( child ) shelves_path = pm.internalVar( userShelfDir=True ) shelf_frames = [] shelves = glob( shelves_path + '/shelf*.mel' ) for i in range( 1, len( shelves ) + 1 ) : # shelf_file = shelves[i-1] # shelf_name = os.path.basename(shelves[i-1]).replace( 'shelf_', '' ) shelf_file = pm.Env.optionVars.get( 'shelfFile%s' % i ) shelf_file = os.path.join( shelves_path, '%s.mel' % shelf_file ) shelf_name = pm.Env.optionVars.get( 'shelfName%s' % i ) shelf_frames.append( __create_shelf_frame( shelf_file, shelf_name, layout ) ) layout.redistribute( *[0] * len( shelf_frames ) ) for shelf_frame in shelf_frames : shelf_frame.setCollapse( True ) return shelf_frames
def main(dock=False): """ main """ global checkerWin try: checkerWin.close() except: pass sel = cmds.ls(sl=True, long=True) if len(sel) == 0: sel = "" else: sel = sel[0] checkerWin = ModelChecker(sel) checkerWin.setObjectName("checker_mainWindow") if dock is True: from pymel import all as pm if pm.dockControl('model_checker_dock', q=True, ex=1): pm.deleteUI('model_checker_dock') floatingLayout = pm.paneLayout(configuration='single', w=700) pm.dockControl( 'model_checker_dock', aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Model Checker", w=300) pm.control('checker_mainWindow', e=True, parent=floatingLayout) else: checkerWin.show() checkerWin.raise_()
def main(dock=False): """ main """ global checkerWin try: checkerWin.close() except: pass sel = cmds.ls(sl=True, long=True) if len(sel) == 0: sel = "" else: sel = sel[0] checkerWin = ModelChecker(sel) checkerWin.setObjectName("checker_mainWindow") if dock is True: from pymel import all as pm if pm.dockControl('model_checker_dock', q=True, ex=1): pm.deleteUI('model_checker_dock') floatingLayout = pm.paneLayout(configuration='single', w=700) pm.dockControl('model_checker_dock', aa=['right', 'left'], a='right', fl=False, con=floatingLayout, label="Model Checker", w=300) pm.control('checker_mainWindow', e=True, parent=floatingLayout) else: checkerWin.show() checkerWin.raise_()
def __init__(self, parent): self.parent = parent self.mainWindow = parent.mainWindow self.mmmmTools = self.parent.parent self.mmmm = self.mmmmTools self.ini = self.parent.ini self.conf = self.ini.conf self.ui = self.parent self.menuCount = 0 self.submenus = {} try: pm.deleteUI(self.menu, menu=True) except: print( 'Not deleting old main MmmmTools menu, probably because Maya is just starting and it does not yet exist. For exception code see: "Ui.MainMenu.__init__" ' ) #traceback.print_exc() try: ##Turns out that the main window is capable of directly supporting menus, almost as if it is a menuBarLayout. try: pm.deleteUI('MmmmTools') except: doNothing = "MmmmTools isn't in menu" self.menu = pm.menu('MmmmTools', parent=self.mainWindow, label='MmmmTools', tearOff=True) ## **** Here we need someway to delete old menus! **** eg: self.mmmmTools.persistent.menusToDelete.append( self.menu ) except: print( "MmmmTools Menu could not be created. Perhaps it already exists and this is not a problem." ) traceback.print_exc()
def ui(self): WINDOW = "jointSequence" if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Continue Joints along loops", iconName="JNTS") main_col = pm.columnLayout(adjustableColumn=True) guide_col = pm.columnLayout(parent=main_col) info_txt = "INFO:"+\ "\nFrom selected edges as starting point and"+\ "\ndirection guide, every next edge loop is"+\ "\nobtained till it reaches the end or the"+\ "\nstaring selection edge or the selected end point" guide_txt = "GUIDE:\nSelect 2 edges, each from adjacent loops"+\ "\nfirst edge is the starting point"+\ "\nsecond edge to guide the direction"+\ "\nif third edge is selected, acts as end point" pm.text(guide_txt, align="left", parent=guide_col) pm.separator(parent=guide_col, height=5, style="in") pm.text(info_txt, align="left", parent=guide_col) pm.separator(parent=main_col, height=10) text_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2, columnOffset=(2, "left", 25)) pm.text("number of loops to\nskip inbetween", parent=text_col) self.skip_val = pm.textField(text="0", parent=text_col, width=50) check_col = pm.rowColumnLayout(numberOfColumns=2, parent=main_col, columnOffset=(2, "left", 120)) pm.text("", parent=check_col) self.skn_chk = pm.checkBox("skin", parent=check_col) pm.separator(parent=main_col, style="none", height=5) pm.button("create", parent=main_col, command=lambda x: self.run()) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(220, 230)) return None
def curve_points(): import CustomScripts CustomScripts.curve_through_points() return None def insert_joints(): import insertJointsUI insertJointsUI.insert_joints_UI() return None menuName = "Custom_Menu" mainMenu = pm.PyUI( pm.getMelGlobal('string', 'gMainWindow') ) try: if pm.menu(Custom_Tools, query=True, exists=True): pm.deleteUI(Custom_Tools) except: print "Creating New Menu" with mainMenu: if pm.menu(menuName, query=True, exists = True): pm.menu(menuName, edit=True, deleteAllItems=True) #Custom_Tools = pm.menu( label=menuName, tearOff=True ) Custom_Tools = pm.menu(label=menuName) with Custom_Tools: obj_cr_btn = pm.menuItem( label="Object creator",command=lambda x: obj_creat()) cus_tls_btn = pm.menuItem( label="Custom Tools",command=lambda x: cus_tls()) const_btn = pm.menuItem( label="Constraint",command=lambda x: con_tls()) tnk_trd_bth = pm.menuItem( label="Tank Tread Rig (arun)", command=lambda x: tank_trd()) cpy_sdk_btn = pm.menuItem( label="Copy Sdk (arun)", command=lambda x: copy_sdk()) #tools_btn = pm.menuItem(subMenu=True, label = "Tools", tearOff=True)
def hyperShadeClose(cls): pm.deleteUI('hyperShadePanel1Window')
def __init__(self): self.winTitle = "Gad29Tools" #try: # pm.deleteUI( self.winTitle ) #except: # print( traceback.format_exc() ) if pm.window( self.winTitle, query=True, exists=True ): pm.deleteUI( self.winTitle ) self.win = pm.window( "Gad29Tools" ) #self.win = pm.window( "Gad29Tools" + '_' + str( datetime.datetime.today().strftime('y%Ym%md%dh%Hn%Ms%S') ) ) self.scroll = pm.scrollLayout(parent=self.win) self.col = pm.columnLayout(parent=self.scroll) with self.col: self.jointsSectionLabel = pm.text( "Joints:" ) self.autoOrientXKeepZBtn = pm.button( "auto orient x while keeping z", command = lambda x: self.autoOrientXKeepZForSelected() ) self.autoOrientTipJointsBtn = pm.button( "auto orient tip joints", command = lambda x: self.autoOrientTipJointsForSelected() ) self.autoOrientTipJointsBtn = pm.button( "fix joint complex xforms", command = lambda x: self.fixJointComplexXformsForSelected() ) self.checkJointsBtn = pm.button( "check joints (currently only rot and scale)", command = lambda x: self.checkJoints() ) self.ctrlSectionLabel = pm.text( "\n" + "Controls:" ) self.ctrlSizeFloatField = pm.floatField( value=8.0 ) self.makeAnimCtrlAndZeroBtn = pm.button( "Make Anim Ctrl And Zero (at size given above)", command = lambda x: self.makeAnimCtrlAndZero() ) self.clearSelectedCtrlsPosSlaveBtn = pm.button( "Clear Selected Ctrls Pos Slave", command = lambda x: self.clearSelectedCtrlsPosSlave() ) self.clearSelectedCtrlsRotSlaveBtn = pm.button( "Clear Selted Ctrls Rot Slave", command = lambda x: self.clearSelectedCtrlsRotSlave() ) self.constrainSlavesToSelectedBtn = pm.button( "Constrain Slaves To Selected", command = lambda x: self.constrainSlavesToSelected() ) self.parentingSectionLabel = pm.text( "\n" + "Parenting:" ) self.chainParentBtn = pm.button( "chain parent", command = lambda x: self.chainParent() ) self.chainParentWithZeroesBtn = pm.button( "chain parent with zeroes", command = lambda x: self.chainParentWithZeroes() ) self.parentWithZeroesBtn = pm.button( "parent with zeroes", command = lambda x: self.parentWithZeroes() ) #self.fromBtn = pm.button( "parent without compensation", # command = lambda x: self.parentWithoutCompensation() #) self.connectionsSectionLabel = pm.text( "\n" + "Connections:" ) self.fromBtn = pm.button( "from", command = lambda x: self.setFromAttrsViaChannelBoxAndSelection() ) self.toBtn = pm.button( "to (connect)", command = lambda x: self.connectToAttrsViaChannelBoxAndSelection() ) self.toBtn = pm.button( "to (drive)", command = lambda x: self.driveToAttrsViaChannelBoxAndSelectionOneToOne() ) self.linearizeBtn = pm.button( "linearize", command = lambda x: self.linearizeViaChannelBoxAndSelection() ) self.linearizeBtn = pm.button( "cycle", command = lambda x: self.cycleViaChannelBoxAndSelection() ) self.parentingSectionLabel = pm.text( "\n" + "Misc:" ) self.fromBtn = pm.button( "makeCamPlaneForDrawing", command = lambda x: self.makeCamPlaneForDrawing() ) self.checkForUnfoldNodesBtn = pm.button( "check for unfold nodes", command = lambda x: self.checkForUnfoldNodes() ) self.win.show()
def UI(self): self.WINDOW = "Checker_Material" if pm.window(self.WINDOW, query=True, exists=True): pm.deleteUI(self.WINDOW) pm.window(self.WINDOW, title="Checker Material", iconName="CHM", widthHeight=(290, 110)) self.main_col = pm.columnLayout(adjustableColumn=True, height=100, parent=self.WINDOW) self.button_col = pm.rowColumnLayout(parent=self.main_col, numberOfColumns=9) pm.separator(parent=self.main_col, style="in") self.del_col = pm.rowColumnLayout(parent=self.main_col, numberOfColumns=9) pm.separator(parent=self.main_col, style="in") self.uv_ch_col = pm.rowColumnLayout(parent=self.main_col, numberOfColumns=9) pm.separator(parent=self.main_col, style="in") self.uv_ful_ch_col = pm.rowColumnLayout(parent=self.main_col, numberOfColumns=9) pm.separator(parent=self.main_col, style="in") self.copy_btn_col = pm.columnLayout(parent=self.main_col, adjustableColumn=True) self.tex1_but = pm.button( label="checker1", parent=self.button_col, height=50, command=lambda x: self.assign_shader("myChLambert1", self.ch1_U_tx, self.ch1_V_tx)) pm.separator(parent=self.button_col, horizontal=False, style="in") self.tex2_but = pm.button( label="checker2", parent=self.button_col, height=50, command=lambda x: self.assign_shader("myChLambert2", self.ch2_U_tx, self.ch2_V_tx)) pm.separator(parent=self.button_col, horizontal=False, style="in") self.tex3_but = pm.button( label="checker3", parent=self.button_col, height=50, command=lambda x: self.assign_shader("myChLambert3", self.ch3_U_tx, self.ch3_V_tx)) pm.separator(parent=self.button_col, horizontal=False, style="in") self.tex4_but = pm.button( label="checker4", parent=self.button_col, height=50, command=lambda x: self.assign_shader("myChLambert4", self.ch4_U_tx, self.ch4_V_tx)) pm.separator(parent=self.button_col, horizontal=False, style="in") self.tex5_but = pm.button( label="checker5", parent=self.button_col, height=50, command=lambda x: self.assign_shader("myChLambert5", self.ch5_U_tx, self.ch5_V_tx)) self.del1_but = pm.button( label="delete\nchecker1", parent=self.del_col, height=50, width=55, command=lambda x: self.delete_shader("myChLambert1", self.ch1_U_tx, self.ch1_V_tx)) pm.separator(parent=self.del_col, horizontal=False, style="in") self.del2_but = pm.button( label="delete\nchecker2", parent=self.del_col, height=50, width=55, command=lambda x: self.delete_shader("myChLambert2", self.ch2_U_tx, self.ch2_V_tx)) pm.separator(parent=self.del_col, horizontal=False, style="in") self.del3_but = pm.button( label="delete\nchecker3", parent=self.del_col, height=50, width=55, command=lambda x: self.delete_shader("myChLambert3", self.ch3_U_tx, self.ch3_V_tx)) pm.separator(parent=self.del_col, horizontal=False, style="in") self.del4_but = pm.button( label="delete\nchecker4", parent=self.del_col, height=50, width=55, command=lambda x: self.delete_shader("myChLambert4", self.ch4_U_tx, self.ch4_V_tx)) pm.separator(parent=self.del_col, horizontal=False, style="in") self.del5_but = pm.button( label="delete\nchecker5", parent=self.del_col, height=50, width=55, command=lambda x: self.delete_shader("myChLambert5", self.ch5_U_tx, self.ch5_V_tx)) pm.separator(parent=self.del_col, horizontal=False, style="in") grid_cell_width = 27 sep_width = 4 self.ch1_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col, numberOfRowsColumns=(4, 2), cellWidth=grid_cell_width) self.ch1_U_tx = pm.textField(parent=self.ch1_txt_grid_col) pm.button(label="U", parent=self.ch1_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert1", True, False, self.ch1_U_tx, None, False, None, None)) self.ch1_V_tx = pm.textField(parent=self.ch1_txt_grid_col) pm.button(label="V", parent=self.ch1_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert1", False, True, None, self.ch1_V_tx, False, None, None)) pm.button(label="U+", parent=self.ch1_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert1", True, False, None, None, True, self.ch1_U_tx, None)) pm.button(label="V+", parent=self.ch1_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert1", False, True, None, None, True, None, self.ch1_V_tx)) pm.button(label="U-", parent=self.ch1_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert1", True, False, None, None, False, self.ch1_U_tx, None)) pm.button(label="V-", parent=self.ch1_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert1", False, True, None, None, False, None, self.ch1_V_tx)) pm.separator(parent=self.uv_ch_col, horizontal=False, style="in", width=sep_width) self.ch2_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col, numberOfRowsColumns=(4, 2), cellWidth=grid_cell_width) self.ch2_U_tx = pm.textField(parent=self.ch2_txt_grid_col) pm.button(label="U", parent=self.ch2_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert2", True, False, self.ch2_U_tx, None, False, None, None)) self.ch2_V_tx = pm.textField(parent=self.ch2_txt_grid_col) pm.button(label="V", parent=self.ch2_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert2", False, True, None, self.ch2_V_tx, False, None, None)) pm.button(label="U+", parent=self.ch2_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert2", True, False, None, None, True, self.ch2_U_tx, None)) pm.button(label="V+", parent=self.ch2_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert2", False, True, None, None, True, None, self.ch2_V_tx)) pm.button(label="U-", parent=self.ch2_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert2", True, False, None, None, False, self.ch2_U_tx, None)) pm.button(label="V-", parent=self.ch2_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert2", False, True, None, None, False, None, self.ch2_V_tx)) pm.separator(parent=self.uv_ch_col, horizontal=False, style="in", width=sep_width) self.ch3_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col, numberOfRowsColumns=(4, 2), cellWidth=grid_cell_width) self.ch3_U_tx = pm.textField(parent=self.ch3_txt_grid_col) pm.button(label="U", parent=self.ch3_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert3", True, False, self.ch3_U_tx, None, False, None, None)) self.ch3_V_tx = pm.textField(parent=self.ch3_txt_grid_col) pm.button(label="V", parent=self.ch3_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert3", False, True, None, self.ch3_V_tx, False, None, None)) pm.button(label="U+", parent=self.ch3_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert3", True, False, None, None, True, self.ch3_U_tx, None)) pm.button(label="V+", parent=self.ch3_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert3", False, True, None, None, True, None, self.ch3_V_tx)) pm.button(label="U-", parent=self.ch3_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert3", True, False, None, None, False, self.ch3_U_tx, None)) pm.button(label="V-", parent=self.ch3_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert3", False, True, None, None, False, None, self.ch3_V_tx)) pm.separator(parent=self.uv_ch_col, horizontal=False, style="in", width=sep_width) self.ch4_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col, numberOfRowsColumns=(4, 2), cellWidth=grid_cell_width) self.ch4_U_tx = pm.textField(parent=self.ch4_txt_grid_col) pm.button(label="U", parent=self.ch4_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert4", True, False, self.ch4_U_tx, None, False, None, None)) self.ch4_V_tx = pm.textField(parent=self.ch4_txt_grid_col) pm.button(label="V", parent=self.ch4_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert4", False, True, None, self.ch4_V_tx, False, None, None)) pm.button(label="U+", parent=self.ch4_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert4", True, False, None, None, True, self.ch4_U_tx, None)) pm.button(label="V+", parent=self.ch4_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert4", False, True, None, None, True, None, self.ch4_V_tx)) pm.button(label="U-", parent=self.ch4_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert4", True, False, None, None, False, self.ch4_U_tx, None)) pm.button(label="V-", parent=self.ch4_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert4", False, True, None, None, False, None, self.ch4_V_tx)) pm.separator(parent=self.uv_ch_col, horizontal=False, style="in", width=sep_width) self.ch5_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col, numberOfRowsColumns=(4, 2), cellWidth=grid_cell_width) self.ch5_U_tx = pm.textField(parent=self.ch5_txt_grid_col) pm.button(label="U", parent=self.ch5_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert5", True, False, self.ch5_U_tx, None, False, None, None)) self.ch5_V_tx = pm.textField(parent=self.ch5_txt_grid_col) pm.button(label="V", parent=self.ch5_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert5", False, True, None, self.ch5_V_tx, False, None, None)) pm.button(label="U+", parent=self.ch5_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert5", True, False, None, None, True, self.ch5_U_tx, None)) pm.button(label="V+", parent=self.ch5_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert5", False, True, None, None, True, None, self.ch5_V_tx)) pm.button(label="U-", parent=self.ch5_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert5", True, False, None, None, False, self.ch5_U_tx, None)) pm.button(label="V-", parent=self.ch5_txt_grid_col, command=lambda x: self. tile_uv_val("myChLambert5", False, True, None, None, False, None, self.ch5_V_tx)) self.ch1_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col, numberOfRowsColumns=(2, 1), cellWidth=grid_cell_width * 2) pm.button(label="UV+", parent=self.ch1_UV_col, command=lambda x: self. tile_uv_val("myChLambert1", True, True, None, None, True, self.ch1_U_tx, self.ch1_V_tx)) pm.button(label="UV-", parent=self.ch1_UV_col, command=lambda x: self. tile_uv_val("myChLambert1", True, True, None, None, False, self.ch1_U_tx, self.ch1_V_tx)) pm.separator(parent=self.uv_ful_ch_col, horizontal=False, style="in", width=sep_width) self.ch2_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col, numberOfRowsColumns=(2, 1), cellWidth=grid_cell_width * 2) pm.button(label="UV+", parent=self.ch2_UV_col, command=lambda x: self. tile_uv_val("myChLambert2", True, True, None, None, True, self.ch2_U_tx, self.ch2_V_tx)) pm.button(label="UV-", parent=self.ch2_UV_col, command=lambda x: self. tile_uv_val("myChLambert2", True, True, None, None, False, self.ch2_U_tx, self.ch2_V_tx)) pm.separator(parent=self.uv_ful_ch_col, horizontal=False, style="in", width=sep_width) self.ch3_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col, numberOfRowsColumns=(2, 1), cellWidth=grid_cell_width * 2) pm.button(label="UV+", parent=self.ch3_UV_col, command=lambda x: self. tile_uv_val("myChLambert3", True, True, None, None, True, self.ch3_U_tx, self.ch3_V_tx)) pm.button(label="UV-", parent=self.ch3_UV_col, command=lambda x: self. tile_uv_val("myChLambert3", True, True, None, None, False, self.ch3_U_tx, self.ch3_V_tx)) pm.separator(parent=self.uv_ful_ch_col, horizontal=False, style="in", width=sep_width) self.ch4_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col, numberOfRowsColumns=(2, 1), cellWidth=grid_cell_width * 2) pm.button(label="UV+", parent=self.ch4_UV_col, command=lambda x: self. tile_uv_val("myChLambert4", True, True, None, None, True, self.ch4_U_tx, self.ch4_V_tx)) pm.button(label="UV-", parent=self.ch4_UV_col, command=lambda x: self. tile_uv_val("myChLambert4", True, True, None, None, False, self.ch4_U_tx, self.ch4_V_tx)) pm.separator(parent=self.uv_ful_ch_col, horizontal=False, style="in", width=sep_width) self.ch5_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col, numberOfRowsColumns=(2, 1), cellWidth=grid_cell_width * 2) pm.button(label="UV+", parent=self.ch5_UV_col, command=lambda x: self. tile_uv_val("myChLambert5", True, True, None, None, True, self.ch5_U_tx, self.ch5_V_tx)) pm.button(label="UV-", parent=self.ch5_UV_col, command=lambda x: self. tile_uv_val("myChLambert5", True, True, None, None, False, self.ch5_U_tx, self.ch5_V_tx)) pm.separator(parent=self.uv_ful_ch_col, horizontal=False, style="in", width=sep_width) pm.button(label="copy shader", parent=self.copy_btn_col, command=lambda x: self.copy_shader()) pm.showWindow(self.WINDOW) pm.window(self.WINDOW, edit=True, widthHeight=(290, 340))
def spline_ik_setup_UI(): WINDOW = 'SplineIK' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Spline IK", iconName='SplineIK', widthHeight=(250, 310)) main_column = pm.columnLayout(adjustableColumn=True) pm.separator(height=5, style='in', parent=main_column) name_col = pm.rowColumnLayout(numberOfColumns=2, parent=main_column, columnOffset=(1, "left", 30), columnSpacing=(2, 5), columnWidth=(2, 130)) pm.separator(height=5, style='in', parent=main_column) joint_col = pm.rowColumnLayout(numberOfColumns=3, parent=main_column, columnOffset=(1, "left", 30), columnSpacing=(2, 5)) pm.separator(height=5, style='in', parent=main_column) dense_col = pm.rowColumnLayout(numberOfColumns=4, columnOffset=(1, "left", 5), parent=main_column, columnSpacing=(3, 10)) pm.separator(height=5, style='in', parent=main_column) curve_option_col = pm.rowColumnLayout(numberOfColumns=2, columnOffset=(1, "left", 5), parent=main_column, columnSpacing=(2, 70)) pm.separator(height=5, style='none', parent=main_column) curve_name_col = pm.rowColumnLayout(numberOfColumns=3, columnOffset=(1, "left", 40), parent=main_column, columnSpacing=(2, 5)) pm.separator(height=5, style='none', parent=main_column) curve_simplify_col = pm.rowColumnLayout(numberOfColumns=4, columnOffset=(1, "left", 5), parent=main_column, columnSpacing=(3, 5)) pm.separator(height=5, style='in', parent=main_column) stretch_col = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=main_column, columnOffset=(1, "left", 5)) pm.separator(height=5, style='in', parent=main_column) global_scale_col = pm.rowColumnLayout(numberOfColumns=3, columnWidth=(1, 100), parent=main_column, columnOffset=(1, "left", 5), columnSpacing=(3, 10)) pm.separator(height=20, style='in', parent=main_column) ctrl_jnt_col = pm.rowColumnLayout(numberOfColumns=3, columnOffset=(1, "left", 5), parent=main_column, columnWidth=(3, 50), columnSpacing=(3, 5)) pm.separator(height=20, style='in', parent=main_column) create_btn_col = pm.rowColumnLayout(numberOfColumns=3, parent=main_column, columnOffset=(2, "left", 65), columnWidth=(2, 300)) pm.text(label="Ik name", parent=name_col) name_text = pm.TextField(text="", parent=name_col) pm.text(label="base joint", parent=joint_col) joint_name = pm.textField(text="", parent=joint_col) pm.button( label="<<", parent=joint_col, command=lambda x: joint_name.setText(str(pm.ls(selection=True)[0]))) dense_div_label = pm.text() dense_div_text = pm.textField() dense_chain_chb = pm.checkBox( "dense chain", parent=dense_col, changeCommand=lambda x: (dense_div_label.setEnable(dense_chain_chb.getValue()), dense_div_text.setEditable(dense_chain_chb.getValue()))) pm.separator(style='single', horizontal=False, parent=dense_col, width=20) pm.text(dense_div_label, edit=True, label="divisions", parent=dense_col, enable=dense_chain_chb.getValue()) pm.textField(dense_div_text, edit=True, text="3", parent=dense_col, editable=dense_chain_chb.getValue(), width=50) curve_label = pm.text(label="Curve", parent=curve_name_col) curve_text = pm.textField(text="", parent=curve_name_col, editable=False) curve_btn = pm.button( label="<<", parent=curve_name_col, enable=False, command=lambda x: curve_text.setText(str(pm.ls(selection=True)[0]))) spans_label = pm.text() spans_text = pm.TextField() curve_simple_chb = pm.checkBox( label="simplify curve", parent=curve_simplify_col, enable=True, changeCommand=lambda x: (spans_label.setEnable(curve_simple_chb.getValue()), spans_text.setEditable(curve_simple_chb.getValue()))) pm.separator(style='single', horizontal=False, parent=curve_simplify_col, width=5) pm.text(spans_label, edit=True, label="spans ", parent=curve_simplify_col, enable=curve_simple_chb.getValue()) pm.textField(spans_text, edit=True, text="3", parent=curve_simplify_col, editable=curve_simple_chb.getValue()) curve_create = pm.radioCollection(parent=curve_option_col) pm.radioButton( "AutoCurve", label="Auto Curve", select=True, parent=curve_option_col, onCommand=lambda x: (curve_btn.setEnable(False), curve_label.setEnable(False), curve_text.setEditable(False), curve_simple_chb.setEnable(True), spans_label.setEnable(curve_simple_chb.getValue()), spans_text.setEditable(curve_simple_chb.getValue()))) pm.radioButton( "UseCurve", label="use Curve", select=False, parent=curve_option_col, onCommand=lambda x: (curve_btn.setEnable(True), curve_label.setEnable(True), curve_text.setEditable(True), curve_simple_chb.setEnable(False), spans_label.setEnable(False), spans_text.setEditable(False))) stretch_scale_chb = pm.checkBox() global_scale_chb = pm.checkBox() scale_attr_text = pm.TextField() scale_label = pm.text() stretch_chb = pm.checkBox( label="stretch", parent=stretch_col, changeCommand=lambda x: (stretch_scale_chb.setEditable(stretch_chb.getValue()), global_scale_chb.setEditable(stretch_chb.getValue()), scale_attr_text.setEditable(stretch_chb.getValue() and global_scale_chb.getValue()), scale_label.setEnable(stretch_chb.getValue() and global_scale_chb. getValue()))) pm.checkBox(stretch_scale_chb, edit=True, label="connect scale", parent=stretch_col, editable=stretch_chb.getValue()) pm.checkBox(global_scale_chb, edit=True, label="global scale", parent=global_scale_col, editable=stretch_chb.getValue(), changeCommand=lambda x: (scale_attr_text.setEditable(global_scale_chb.getValue()), scale_label.setEnable(global_scale_chb.getValue()))) pm.text(scale_label, edit=True, label="scale attr", parent=global_scale_col, enable=(stretch_scale_chb.getValue() and stretch_chb.getValue)) pm.textField(scale_attr_text, edit=True, text="", parent=global_scale_col, editable=stretch_chb.getValue(), width=90) pm.text(label="number of control joints ", parent=ctrl_jnt_col) ctrl_jnt_num = pm.textField(text="3", parent=ctrl_jnt_col, width=50) pm.text(label="", parent=create_btn_col) pm.button(label="create", align="center", parent=create_btn_col, width=100, command=lambda x: call_fun(name_text.getText( ), joint_name.getText(), dense_chain_chb.getValue( ), int(dense_div_text.getText()), curve_create.getSelect( ), curve_text.getText(), curve_simple_chb.getValue( ), int(spans_text.getText()), stretch_chb.getValue( ), stretch_scale_chb.getValue(), int(ctrl_jnt_num.getText( )), global_scale_chb.getValue(), scale_attr_text.getText())) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(250, 310)) return None
def constraints_ui(): WINDOW = 'Constraints' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Constraints", iconName='CON', widthHeight=(200, 275)) column_1 = pm.columnLayout(adjustableColumn=True) pm.separator(height=2, style='in', parent=column_1) mulChLbl = pm.Text(label="Multiple Children", parent=column_1) pm.separator(height=5, style='none', parent=column_1) rowCol1 = pm.rowColumnLayout(numberOfRows=3, parent=column_1) txt_row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=rowCol1, columnSpacing=(1, 15)) mulCtrlNm = pm.TextField(parent=txt_row_col_1) mulCtrlBtn = pm.button( label='<<', parent=txt_row_col_1, command=lambda x: mulCtrlNm.setText(str(pm.ls(selection=True)[0]))) row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol1, columnAlign=(2, 'center'), columnSpacing=(1, 25)) prChk = pm.checkBox("Parent", parent=row_col_1) scChk = pm.checkBox("Scale", parent=row_col_1) conBtn = pm.button(label="Constraint", parent=column_1, command=lambda x: mul_con_call(mulCtrlNm, prChk, scChk)) pm.separator(height=20, style='in', parent=column_1) setLbl = pm.Text(label="Selection Set", parent=column_1) pm.separator(height=5, style='none', parent=column_1) rowCol2 = pm.rowColumnLayout(numberOfRows=2, parent=column_1) row_col_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol2, columnAlign=(2, 'center'), columnSpacing=(1, 25)) prSetChk = pm.checkBox("Parent", parent=row_col_2) scSetChk = pm.checkBox("Scale", parent=row_col_2) conSetBtn = pm.button(label="Constraint", parent=column_1, command=lambda x: set_con_call(prSetChk, scSetChk)) pm.separator(height=20, style='in', parent=column_1) delConLbl = pm.Text(label="Delete Constraints", parent=column_1) pm.separator(height=5, style='none', parent=column_1) rowCol3 = pm.rowColumnLayout(numberOfRows=3, parent=column_1) row_col_3_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol3, columnAlign=(2, 'center'), columnSpacing=(1, 25)) row_col_3_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol3, columnAlign=(2, 'center'), columnSpacing=(1, 25)) prDelChk = pm.checkBox("Parent", parent=row_col_3_1) scDelChk = pm.checkBox("Scale", parent=row_col_3_1) ptDelChk = pm.checkBox("Point", parent=row_col_3_2) orDelChk = pm.checkBox("Orient", parent=row_col_3_2) conDelBtn = pm.button( label="Delete", parent=column_1, command=lambda x: del_cons(prDelChk, scDelChk, ptDelChk, orDelChk)) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(200, 275)) return None
def sd_weight_flat_surface(selection, obj_select=True, min_tolerance=0, max_tolerance=0): """ if obj_select = True, hard surfaces (perfectly flat) will automatically be found and corrected, but only if model properly finished. min_tolerance = the minimum angle that will be selected. max_tolerance = the maximum angle that will be selected. """ sd_test_type(selection, [pm.Transform, pm.MeshFace]) if obj_select: # convert selection to edges mm.eval('ConvertSelectionToEdges;') # constrain the selection to a specific angle pm.polySelectConstraint( mode=3, type=0x8000, angle=True, anglebound=(min_tolerance, max_tolerance) ) # save the selection oSel = pm.ls(sl=True, flatten=True) # turn off polySelectConstraint pm.polySelectConstraint(mode=0) # make sure its selected (just in case) pm.select(oSel) # convert to faces mm.eval('ConvertSelectionToFaces;') fSel = pm.ls(sl=True, flatten=True) # create a good ol' progress bar progWind = pm.window(title='progress') pm.columnLayout() progressControl = pm.progressBar(maxValue=len(fSel), width=300) pm.showWindow(progWind) # run through each object and get the face normal of each face # apply the face normal direction to the connected verts for face in fSel: pm.select(face) face_normal = face.getNormal(space='world') verts = pm.polyListComponentConversion( face, fromFace=True, toVertex=True ) pm.select(verts) pm.polyNormalPerVertex(normalXYZ=face_normal) ff = fSel.index(face) pm.progressBar(progressControl, edit=True, progress=ff) pm.deleteUI(progWind)
def create() : global TH_P_WIDGETS init() layerchannel.cleanup() if( pm.dockControl( TH_P_DOCK, exists=True ) ) : pm.deleteUI( TH_P_DOCK ) if( pm.window( TH_P_WIN, exists=True ) ) : pm.deleteUI( TH_P_WIN ) TH_P_WIDGETS[ 'window' ] = pm.window( TH_P_WIN ) TH_P_WIDGETS[ 'main' ] = pm.paneLayout( configuration='vertical3', staticWidthPane=1, paneSize=(3, 0, 100) ) TH_P_WIDGETS[ 'tabs' ] = pm.tabLayout( p=TH_P_WIDGETS[ 'main' ], width=274, height=100 ) TH_P_WIDGETS[ 'column1' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'main' ], width=100, height=100 ) TH_P_WIDGETS[ 'column2' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'main' ], width=10 ) # tabs ########################################################################################## # shelves TH_P_WIDGETS[ 'tab_shelves' ] = pm.verticalLayout( p=TH_P_WIDGETS['tabs'] ) TH_P_WIDGETS[ 'tabs' ].setTabLabel( ( TH_P_WIDGETS[ 'tab_shelves' ], 'Shelves' ) ) shelves.create( TH_P_WIDGETS[ 'tab_shelves' ] ) TH_P_WIDGETS[ 'tab_shelves' ].redistribute() # renaming TH_P_WIDGETS[ 'tab_renaming' ] = pm.verticalLayout( p=TH_P_WIDGETS['tabs'] ) renaming.create( TH_P_WIDGETS[ 'tab_renaming' ] ) TH_P_WIDGETS[ 'tabs' ].setTabLabel( ( TH_P_WIDGETS[ 'tab_renaming' ], 'Renaming' ) ) TH_P_WIDGETS[ 'tab_renaming' ].redistribute() # script editor TH_P_WIDGETS[ 'tab_scripteditor' ] = pm.verticalLayout( p=TH_P_WIDGETS['tabs'] ) TH_P_WIDGETS[ 'tabs' ].setTabLabel( ( TH_P_WIDGETS[ 'tab_scripteditor' ], 'Script Editor' ) ) scripteditor.create( TH_P_WIDGETS[ 'tab_scripteditor' ] ) TH_P_WIDGETS[ 'tab_scripteditor' ].redistribute() # column1 ########################################################################################## # layer editor / channel box TH_P_WIDGETS[ 'channellayer' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column1' ] ) layerchannel.create( TH_P_WIDGETS[ 'channellayer' ] ) TH_P_WIDGETS[ 'channellayer' ].redistribute() # column2 ########################################################################################## # outliner TH_P_WIDGETS[ 'outliner' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column2' ] ) outliner.create( TH_P_WIDGETS[ 'outliner' ] ) TH_P_WIDGETS[ 'outliner' ].redistribute() TH_P_WIDGETS[ 'tabs' ].setSelectTabIndex( 1 ) TH_P_WIDGETS[ 'column1' ].redistribute() TH_P_WIDGETS[ 'column2' ].redistribute() TH_P_WIDGETS[ 'dock_panel' ] = pm.dockControl( TH_P_DOCK, label='th_panel', area='right', allowedArea=[ 'left', 'right' ], sizeable=True, w=540, content=TH_P_WIDGETS[ 'window' ] )
def CustomScripts_UI(): WINDOW = 'CustomScripts' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Custom Scripts", iconName='CS', widthHeight=(200, 400)) column_1 = pm.columnLayout(adjustableColumn=True) pm.separator(height=20, style='in', parent=column_1) pm.button(label='Immediate Parent in Hierarchy', command=lambda x: CustomScripts.immediateParent()) pm.separator(height=20, style='in', parent=column_1) hide_jnt_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=3, columnWidth=(1, 95)) pm.button(label='Hide Joint', command=lambda x: CustomScripts.jntHide(), parent=hide_jnt_col) pm.separator(parent=hide_jnt_col, horizontal=False, width=10) pm.button(label='Show Joint', command=lambda x: CustomScripts.jntShow(), parent=hide_jnt_col, width=95) pm.separator(height=20, style='in', parent=column_1) lod_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=3, columnWidth=(1, 95)) pm.button(label='LOD off', command=lambda x: CustomScripts.lodOff(), parent=lod_col) pm.separator(parent=lod_col, horizontal=False, width=10) pm.button(label='LOD on', command=lambda x: CustomScripts.lodOn(), parent=lod_col, width=95) pm.separator(height=20, style='in', parent=column_1) pm.button(label='Parent( in selection order)', command=lambda x: CustomScripts.parentChain(), parent=column_1) # get object name pm.separator(height=20, style='in', parent=column_1) row_col_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=column_1, columnOffset=(2, 'left', 10)) object_name = pm.TextField(parent=row_col_2) pm.button( label='<<', parent=row_col_2, command=lambda x: object_name.setText(str(pm.ls(selection=True)[0]))) row_col_3 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) prntChk = pm.checkBox("parent", parent=row_col_3) sclChk = pm.checkBox("scale", parent=row_col_3) pm.separator(height=5, style='none', parent=column_1) pm.button( label='Copy Object to selected positions', parent=column_1, command=lambda x: CustomScripts.copyObjects(obj=object_name.getText(), prFlg=prntChk.getValue(), scFlg=sclChk.getValue())) pm.separator(height=20, style='in', parent=column_1) pm.button(label="copy orientation", parent=column_1, command=lambda x: CustomScripts.CopyJntOri()) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(200, 320)) return None
def showUI(self): """ this is teh function that creates the ui: in the future it will likely change to a Qt GUI """ testWindow = 'HS_Normal_Tool' if pm.window(testWindow, exists=True): pm.deleteUI(testWindow) pm.window(testWindow, sizeable=False) pm.rowColumnLayout('normal_Column', numberOfColumns=1, columnWidth=(1, 300), columnAttach=(1, 'left', 5)) pm.rowLayout('flatRow', parent='normal_Column', numberOfColumns=2) pm.button(label='Flat Surface', parent='flatRow', width=100, command=self.btn_connected_flat) self.objCheck = pm.checkBox(label='Object Selection', parent='flatRow', value=True) self.float1 = pm.floatSliderGrp(label='min_tolerance', parent='normal_Column', columnAlign=(1, 'left'), columnWidth=(1, 80), field=True) self.float2 = pm.floatSliderGrp(label='max_tolerance', parent='normal_Column', columnAlign=(1, 'left'), columnWidth=(1, 80), field=True) pm.separator(parent='normal_Column', height=20) pm.rowLayout('curveRow', parent='normal_Column', numberOfColumns=2) pm.button(label='Curved Surface', parent='curveRow', width=100, command=self.btn_hs_tube) self.tubeCheck = pm.checkBox(label='Edge Ring', parent='curveRow', value=True) pm.separator(parent='normal_Column', height=20) pm.button(label='Unlock Selected vtx Normals', parent='normal_Column', command=self.unlockVtxN) pm.separator(parent='normal_Column', height=20) pm.checkBox(label='Toggle vtx Normals', parent='normal_Column', onCommand=self.btn_show_vtx_normals, offCommand=self.btn_hide_vts_normals) self.float3 = pm.floatSliderGrp( label='vtx Length', parent='normal_Column', columnWidth=(1, 55), field=True, dragCommand=self.vtx_normal_length, ) pm.floatSliderGrp( self.float3, label='vtx Length', edit=True, columnWidth=(2, 42), ) pm.separator(parent='normal_Column', height=20) pm.rowLayout('blinnRow', parent='normal_Column', numberOfColumns=2, columnWidth=(2, 200)) pm.button(label='Create Blinn', parent='blinnRow', width=100, command=self.btn_create_blinn) self.blinnCol = pm.colorSliderGrp(label='', parent='blinnRow', width=190, columnWidth=(1, 1), dragCommand=self.edit_blinn) pm.showWindow(testWindow) pm.window(testWindow, edit=True, widthHeight=(300, 265))
for tran in transforms: if pma.nodeType(tran) == 'transform': children = pma.listRelatives(tran, c=True) if children is None: # print '%s, has no childred' %(tran) deleteList.append(tran) if not deleteList: pma.delete(deleteList) return ctrl #################TUTORIAL windowNameTut = "Tutorial" if (pma.window(windowNameTut, exists=True)): pma.deleteUI(windowNameTut) windowTutorial = pma.window(windowNameTut, title=windowNameTut, width=400, height=300, backgroundColor=[0.2, 0.2, 0.2]) pma.columnLayout("testColumn", adjustableColumn=True) pma.text("intro", label="This tool is a super tool to make booleans wrote by Leonardo Iezzi. To make it works correctly, you need to have your base mesh already even if just a cube. With your base mesh selected just press one of the three buttons on the windows to subtract or add those primitives. If you want to use a custom mesh for the operation: select your base mesh then the custom one (it's important to pick your base mesh first) and then press the 'Use custom mesh' button. After you have done, select your base mesh and press 'Clean Up.'", wordWrap=True, height=100, backgroundColor=[0.2, 0.2, 0.2], align='left', parent="testColumn") # pma.text("first", label = "1- Select always your main mesh first",wordWrap= True, height = 40, backgroundColor = [0.2, 0.2, 0.2], align='left', parent = "testColumn") # pma.text("secondo", label = "2- In case you want to use a custom mesh: Select first your main mesh then the mesh you want to add or subtract",wordWrap= True, height = 40, backgroundColor = [0.2, 0.2, 0.2], align='left', parent = "testColumn") # pma.text("third", label = "3- Everythong should works",wordWrap= True, height = 40, backgroundColor = [0.2, 0.2, 0.2], align='left', parent = "testColumn") pma.separator(parent="testColumn", height=20) pma.button("goit", label="Got it", width=120, height=40, backgroundColor=[0.5, 0.5, 0.5], parent="testColumn", command="pma.deleteUI(windowNameTut)")
def refreshGUI(self): if not self.window: return pm.deleteUI(self.window) self.window = self.createGUI() pm.showWindow(self.window)
def create_control_ui(self): btns = self.read_shapes() WINDOW = "create_control" chk_win = pm.window(WINDOW, query=True, exists=True) if chk_win: pm.deleteUI(WINDOW) pm.window(WINDOW, title="Create_Control", iconName="CC") main_split_col = pm.rowColumnLayout(parent=WINDOW, numberOfColumns=3) left_main_col = pm.columnLayout(parent=main_split_col, adjustableColumn=True) hlp_btn_col = pm.columnLayout(parent=left_main_col, columnOffset=("left", 110)) pm.button("?", parent=hlp_btn_col, width=50, command=lambda x: self.open_help()) pm.separator(parent=left_main_col, style="in", height=10) con_obj_col = pm.columnLayout(parent=left_main_col, columnOffset=("left", 70)) self.connect_chk_bx = pm.checkBox("Skinning/Constraint", parent=con_obj_col, value=True) pm.separator(parent=left_main_col, style="none") ctrl_typ_col = pm.rowColumnLayout(parent=left_main_col, numberOfColumns=3, columnOffset=(1, "left", 20), columnSpacing=(2, 10)) pm.text("Control type", parent=ctrl_typ_col) rad_col = pm.columnLayout(parent=ctrl_typ_col) self.ctr_typ_rad_collection = pm.radioCollection(parent=rad_col) self.skin_rad_btn = pm.radioButton( label='Skin', parent=rad_col, select=True, onCommand=lambda x: self.set_ui_edit_mode(flag="Skin")) self.con_rad_btn = pm.radioButton( label='Constraint', parent=rad_col, onCommand=lambda x: self.set_ui_edit_mode(flag="Constraint")) con_typ_col = pm.columnLayout(parent=ctrl_typ_col) self.pr_chk_bx = pm.checkBox("Parent", parent=con_typ_col, value=True, editable=False) self.sc_chk_bx = pm.checkBox("Scale", parent=con_typ_col, editable=False) jnt_opn_col = pm.columnLayout(parent=left_main_col, columnOffset=("left", 100)) self.jnt_cr_chk_bx = pm.checkBox( label="Create Joint", value=True, parent=jnt_opn_col, offCommand=lambda x: self.set_ui_edit_mode(flag="no_joint")) pm.separator(parent=left_main_col, height=10, style="in") pm.text("Control name", parent=left_main_col) re_name_col = pm.gridLayout(parent=left_main_col, numberOfRowsColumns=(2, 2), cellWidthHeight=(138, 20), allowEmptyCells=False) self.msh_nm_lbl = pm.text("Text from Mesh Name", parent=re_name_col) self.ctrl_nm_lbl = pm.text("Rename to Control", parent=re_name_col) self.msh_nm = pm.textField(text="_MSH", parent=re_name_col) self.ctrl_nm = pm.textField(text="_CTRL", parent=re_name_col) pm.separator(parent=left_main_col, height=10, style="none") new_name_col = pm.rowColumnLayout(parent=left_main_col, numberOfColumns=2, columnOffset=(1, "left", 10)) self.new_nm_chk_bx = pm.checkBox( label="Control Name: ", parent=new_name_col, changeCommand=lambda x: self.set_ui_edit_mode(flag="rename_field")) self.ctr_new_nm = pm.textField(text="Control", parent=new_name_col, width=150, editable=False) suf_name_col = pm.rowColumnLayout(parent=left_main_col, numberOfColumns=2, columnOffset=(1, "left", 10)) self.suf_lbl = pm.text("Control Suffix Text: ", parent=suf_name_col) self.suf_nm = pm.textField(text="_CTRL", parent=suf_name_col, width=163, editable=False) pm.separator(parent=left_main_col, height=10, style="none") zero_gp_col = pm.rowColumnLayout(parent=left_main_col, numberOfColumns=2, columnOffset=(1, "left", 50)) self.zero_gp_chk_bx = pm.checkBox( "Zero Node", parent=zero_gp_col, value=True, changeCommand=lambda x: self.set_ui_edit_mode(flag="zero_node")) self.zero_nd_txt = pm.textField(text="_CTRLT", parent=zero_gp_col) scl_lk_col = pm.columnLayout(parent=left_main_col, columnOffset=("left", 50)) self.scl_lk_chk_bx = pm.checkBox("Lock Scale/Visibility/Radius(Joint)", parent=scl_lk_col, value=True) scl_chk_col = pm.columnLayout(parent=left_main_col, columnOffset=("left", 50)) self.scl_ctr_chk_bx = pm.checkBox( "Scale Control to match object", value=True, parent=scl_chk_col, changeCommand=lambda x: self.set_ui_edit_mode(flag="no_scale")) scl_offset_col = pm.rowColumnLayout(parent=left_main_col, numberOfColumns=2, columnOffset=(1, "left", 30)) self.ctrl_off_sz_lbl = pm.text("Control size offset value", parent=scl_offset_col) self.scl_offset_val_txt = pm.textField(text="1", parent=scl_offset_col) pm.separator(parent=left_main_col, height=10, style="in") ctrl_pvt_col = pm.rowColumnLayout(parent=left_main_col, numberOfColumns=2, columnOffset=(1, "left", 80)) self.ctrl_pos_chk_bx = pm.checkBox( "Control at object pivot", parent=ctrl_pvt_col, value=True, changeCommand=lambda x: self.set_ui_edit_mode(flag="position")) pos_rad_col = pm.gridLayout(parent=left_main_col, numberOfRowsColumns=(3, 2), cellWidthHeight=(140, 20), allowEmptyCells=False) self.pos_rad_collection = pm.radioCollection(parent=pos_rad_col) self.top_rad_btn = pm.radioButton(label="Top(Y Axis)", parent=pos_rad_col, editable=False) self.bot_rad_btn = pm.radioButton(label="Bottom(Y Axis)", parent=pos_rad_col, select=True, editable=False) self.left_rad_btn = pm.radioButton(label="Left(X Axis)", parent=pos_rad_col, editable=False) self.right_rad_btn = pm.radioButton(label="Right(X Axis)", parent=pos_rad_col, editable=False) self.front_rad_btn = pm.radioButton(label="Front(Z Axis)", parent=pos_rad_col, editable=False) self.back_rad_btn = pm.radioButton(label="Back(Z Axis)", parent=pos_rad_col, editable=False) pm.separator(parent=main_split_col, height=10, style="in", horizontal=False) scr_lay = pm.scrollLayout(parent=main_split_col) grid_col = pm.gridLayout(parent=scr_lay, numberOfRowsColumns=(1, 5), autoGrow=True, cellWidthHeight=(50, 50), allowEmptyCells=False) for btn in btns: btn = btn.replace("\r", "") btn = btn.replace("\n", "") img = self.icon_path + btn + ".png" if os.path.exists(img): pm.iconTextButton(parent=grid_col, label=btn, style='iconOnly', image=img, command=partial(self.create_shape, nm=btn)) else: rgb = [ random.uniform(.5, 1), random.uniform(.5, 1), random.uniform(.5, 1) ] pm.iconTextButton(parent=grid_col, label=btn, style='iconAndTextVertical', backgroundColor=rgb, command=partial(self.create_shape, nm=btn)) pm.checkBox( self.connect_chk_bx, edit=True, changeCommand=lambda x: self.set_ui_edit_mode(flag="connect")) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(540, 420)) return None
def tread_create_ui(self): self.WINDOW = 'Loop_Motion_Path' if pm.window(self.WINDOW, query=True, exists=True): pm.deleteUI(self.WINDOW) pm.window(self.WINDOW, title="Loop Motion Path", iconName='TR', widthHeight=(200, 220)) column_1 = pm.columnLayout(adjustableColumn=True) pm.separator(height=20, style='none', parent=column_1) self.tread_name = pm.TextField(text='Setup_Name', parent=column_1) pm.separator(height=20, style='none', parent=column_1) # get parent name row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=column_1, columnOffset=(2, 'left', 10)) self.curve_name = pm.TextField(text='PathCurve', parent=row_col_1) pm.button(label='<<', parent=row_col_1, command=lambda x: self.set_path_name()) chk_bx_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=2, columnWidth=(1, 20)) pm.text("", parent=chk_bx_col) self.dup_crv_chk_bx = pm.checkBox("Duplicate Curve", parent=chk_bx_col, value=True) pm.separator(height=20, style='in', parent=column_1) self.jnt_type_lbl = pm.text(label="object placement type", align="left", parent=column_1) pm.separator(height=5, style='none', parent=column_1) self.jnt_typ_radio = pm.radioCollection(parent=column_1) row_layout = pm.rowLayout(numberOfColumns=2, height=20, parent=column_1) sel_chk_bx_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=2, columnWidth=(1, 20)) info_chk_bx_col = pm.ColumnLayout(parent=column_1) self.chk_bx_info = pm.text("", parent=info_chk_bx_col, enable=False) pm.text("", parent=sel_chk_bx_col) self.sel_obj_chk_bx = pm.checkBox("Use Selection On Curve", parent=sel_chk_bx_col, value=False, enable=False) self.divisions = pm.TextField(text='1', parent=column_1) pm.radioButton( label='uniform', parent=row_layout, select=True, onCommand=lambda x: self.ui_set_selection_enable(flag="uniform")) pm.radioButton( label='selection', parent=row_layout, onCommand=lambda x: self.ui_set_selection_enable(flag="selection")) pm.separator(height=20, style='none', parent=column_1) pm.text("Input sample object (default joint)", parent=column_1) sample_row_col = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=column_1, columnOffset=(2, 'left', 10)) self.sample_name = pm.text(label="", parent=sample_row_col) pm.button(label='<<', parent=sample_row_col, command=lambda x: self.set_sample_object()) pm.separator(height=20, style='none', parent=column_1) pm.button(label='Create', parent=column_1, command=lambda x: self.setup_motion_path()) pm.showWindow(self.WINDOW) pm.window(self.WINDOW, edit=True, widthHeight=(200, 320)) return None
def main_ui(self): WIN = "nodes_rename" if pm.window(WIN, query=True, exists=True): pm.deleteUI(WIN) pm.window(WIN, title="Rename Nodes", iconName="RNMND") main_col = pm.columnLayout(parent=WIN, adjustableColumn=True) row_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2) type_list_col = pm.columnLayout(parent=row_col) pm.text(label="Node Type List", parent=type_list_col) pm.separator(height=5, style="none") rename_col = pm.columnLayout(parent=row_col, adjustableColumn=True) self.node_lst = pm.textScrollList('Node_Type_List', numberOfRows=10, parent=type_list_col, height=235, width=150, allowMultiSelection=False) pm.separator(parent=rename_col, height=20, style="none") pm.text(label="Gets name from selected mesh", parent=rename_col) pm.separator(parent=rename_col, height=5, style="none") name_from_col = pm.rowColumnLayout(parent=rename_col, numberOfColumns=2, columnOffset=(2, "left", 11)) pm.text(label="Replace Text", parent=name_from_col) self.replace_txt = pm.textField(parent=name_from_col, text="_MSH") name_to_col = pm.rowColumnLayout(parent=rename_col, numberOfColumns=2, columnOffset=(2, "left", 5)) pm.text(label="Replace With", parent=name_to_col) self.replace_to_txt = pm.textField(parent=name_to_col) pm.button(label="Rename (Replace)", parent=rename_col, command=lambda x: self.rename_call(mode="replace")) pm.separator(parent=rename_col, height=20) pm.text(label="Rename nodes irrespective\n of mesh name", parent=rename_col) pm.separator(parent=rename_col, height=5, style="none") new_name_col = pm.rowColumnLayout(parent=rename_col, numberOfColumns=2, columnOffset=(2, "left", 5)) pm.text(label="Rename", parent=new_name_col) self.rename_txt = pm.textField(parent=new_name_col) pm.button(label="Rename (New)", parent=rename_col, command=lambda x: self.rename_call(mode="rename")) pm.separator(parent=rename_col, height=20) pm.button(label="Refresh node List", parent=rename_col, command=lambda x: self.refresh_node_list()) pm.separator(parent=rename_col, height=20) pm.showWindow(WIN) pm.window(WIN, edit=True, widthHeight=(330, 260)) return None
def closeGUI(self): if not self.window: return pm.deleteUI(self.window)
def create(): global TH_P_WIDGETS init() layerchannel.cleanup() if (pm.dockControl(TH_P_DOCK, exists=True)): pm.deleteUI(TH_P_DOCK) if (pm.window(TH_P_WIN, exists=True)): pm.deleteUI(TH_P_WIN) TH_P_WIDGETS['window'] = pm.window(TH_P_WIN) TH_P_WIDGETS['main'] = pm.paneLayout(configuration='vertical3', staticWidthPane=1) TH_P_WIDGETS['tabs'] = pm.tabLayout(p=TH_P_WIDGETS['main'], width=274, height=100) TH_P_WIDGETS['column1'] = pm.verticalLayout(p=TH_P_WIDGETS['main'], height=100) TH_P_WIDGETS['column2'] = pm.verticalLayout(p=TH_P_WIDGETS['main']) # tabs ########################################################################################## # shelves TH_P_WIDGETS['tab_shelves'] = pm.verticalLayout(p=TH_P_WIDGETS['tabs']) TH_P_WIDGETS['tabs'].setTabLabel((TH_P_WIDGETS['tab_shelves'], 'Shelves')) shelves.create(TH_P_WIDGETS['tab_shelves']) TH_P_WIDGETS['tab_shelves'].redistribute() # renaming TH_P_WIDGETS['tab_renaming'] = pm.verticalLayout(p=TH_P_WIDGETS['tabs']) renaming.create(TH_P_WIDGETS['tab_renaming']) TH_P_WIDGETS['tabs'].setTabLabel( (TH_P_WIDGETS['tab_renaming'], 'Renaming')) TH_P_WIDGETS['tab_renaming'].redistribute() # script editor TH_P_WIDGETS['tab_scripteditor'] = pm.verticalLayout( p=TH_P_WIDGETS['tabs']) TH_P_WIDGETS['tabs'].setTabLabel( (TH_P_WIDGETS['tab_scripteditor'], 'Script Editor')) scripteditor.create(TH_P_WIDGETS['tab_scripteditor']) TH_P_WIDGETS['tab_scripteditor'].redistribute() """ # column1 ########################################################################################## # layer editor / channel box TH_P_WIDGETS[ 'channellayer' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column1' ] ) layerchannel.create( TH_P_WIDGETS[ 'channellayer' ] ) TH_P_WIDGETS[ 'channellayer' ].redistribute() # column2 ########################################################################################## # outliner TH_P_WIDGETS[ 'outliner' ] = pm.verticalLayout( p=TH_P_WIDGETS[ 'column2' ] ) outliner.create( TH_P_WIDGETS[ 'outliner' ] ) TH_P_WIDGETS[ 'outliner' ].redistribute() TH_P_WIDGETS[ 'tabs' ].setSelectTabIndex( 1 ) TH_P_WIDGETS[ 'column1' ].redistribute() TH_P_WIDGETS[ 'column2' ].redistribute() """ TH_P_WIDGETS['dock_panel'] = pm.dockControl(TH_P_DOCK, label='th_panel', area='right', allowedArea=['left', 'right'], sizeable=True, w=540, content=TH_P_WIDGETS['window'])
def __new__(cls, name="pymelLoggingControl", parent=None): if pymel.menu(name, ex=1): pymel.deleteUI(name) self = pymel.menu(name, l='Logging Control', aob=True, p=parent) return pymel.Menu.__new__(cls, self)
def copySDK_UI(): WINDOW = 'copySDK' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="copySDK", iconName='SDKcpy', widthHeight=(210, 370)) # Layout column_1 = pm.columnLayout(adjustableColumn=True) textlabel = pm.text(label="UI for script downloaded from\ highend3d.com\nContact Email : [email protected]", align="center", wordWrap=True) pm.separator(height=20, style='in', parent=column_1) col2 = pm.columnLayout(width=200, adjustableColumn=False, parent=column_1) row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) pm.separator(height=20, style='in', parent=column_1) col3 = pm.columnLayout(width=200, adjustableColumn=False, parent=column_1) row_col_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) row_col_3 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) pm.separator(height=20, style='in', parent=column_1) row_col_4 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) row_col_5 = pm.rowColumnLayout(numberOfRows=2, parent=row_col_4) column_2 = pm.columnLayout(adjustableColumn=False, width=200, columnOffset=["both", 50], parent=column_1) # Widgets cr_attr_chk_bx = pm.checkBox('Create attribute', parent=column_2, editable=False) mode_lbl = pm.text(label="mode", align="center", parent=col2, width=200) mode_radio = pm.radioCollection(parent=column_1) rb1 = pm.radioButton(label='driven', parent=row_col_1, select=True, onCommand=lambda x: pm.checkBox( cr_attr_chk_bx, edit=True, editable=False)) rb1 = pm.radioButton(label='driver', parent=row_col_1, select=False, onCommand=lambda x: pm.checkBox( cr_attr_chk_bx, edit=True, editable=True)) ctr_replace_lbl = pm.text(label="controller", align="center", parent=col3, width=200) search_lbl = pm.text(label="search", align="center", parent=row_col_2, width=100) replace_lbl = pm.text(label="replace", align="center", parent=row_col_2, width=100) search_str = pm.TextField(text='', parent=row_col_3) replace_str = pm.TextField(text='', parent=row_col_3) refresh_button = pm.button( label='Refresh', parent=row_col_5, command=lambda x: populate_attr(field_obj=attr_list)) attr_list = pm.textScrollList('Attr', numberOfRows=10, parent=row_col_5, height=150, width=100, allowMultiSelection=True) populate_attr(field_obj=attr_list) mirror_chk_bx = pm.checkBox('mirror', parent=row_col_4) apply_button = pm.button( label='Apply', parent=column_2, width=100, command=lambda x: sdk_call(mode_radio, attr_list, search_str, replace_str, mirror_chk_bx, cr_attr_chk_bx)) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(210, 370)) return None