def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.") self.deformers = pm.ls(type="cage") for i in range(len(self.deformers)): frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=3) : pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name())) pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm) pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc) pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs) self.deformers = pm.ls(type="cageARAP") for i in range(len(self.deformers)): frameLayout = pm.frameLayout( label=self.deformers[i].name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=4) : pm.button( l="Del", c=pm.Callback( self.deleteNode, self.deformers[i].name())) pm.attrControlGrp( label="cage mode", attribute= self.deformers[i].cgm) pm.attrControlGrp( label="blend mode", attribute= self.deformers[i].bm) pm.attrControlGrp( label="constraint mode", attribute= self.deformers[i].constraintMode) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="rotation consistency", attribute= self.deformers[i].rc) pm.attrControlGrp( label="Frechet sum", attribute= self.deformers[i].fs) pm.attrControlGrp( label="constraint weight", attribute= self.deformers[i].constraintWeight)
def gui(): file_path = os.path.dirname(__file__) basename = os.path.basename(file_path) file_name = '%s.questions' % (basename) #print file_name, basename, file_path questions_file = os.path.join(file_path, file_name) #print questions_file f = open(questions_file, 'r') info = pickle.load(f) f.close() win = 'quiz_win' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global quiz my_win = pm.window(win, title= basename, toolbox= True, width= 400, height= 600) pm.scrollLayout() quiz = Quiz(info) pm.button(label= 'Done', height= 35, command= pm.Callback(check)) my_win.show()
def createUISet(self): self._childLayout = pm.columnLayout( adj=True ) with self._childLayout: pm.text(l="Click cage mesh first, then shift+click target mesh, and click the menu item.") for type in deformerTypes: deformers = pm.ls(type=type) for node in deformers: frameLayout = pm.frameLayout( label=node.name(), collapsable = True) with frameLayout: with pm.rowLayout(numberOfColumns=2) : pm.button( l="Del", c=pm.Callback( self.deleteNode, node)) pm.attrFieldSliderGrp( label="iteration", min=1, max=100, attribute=node.it) with pm.rowLayout(numberOfColumns=2) : pm.attrControlGrp( label="rotation consistency", attribute= node.rc) pm.attrFieldSliderGrp( label="global rotation", min=-720, max=720, attribute=node.ir) with pm.rowLayout(numberOfColumns=3) : pm.attrControlGrp( label="blend mode", attribute= node.bm) pm.attrControlGrp( label="tet mode", attribute= node.tm) pm.attrControlGrp( label="area weight", attribute= node.aw) with pm.rowLayout(numberOfColumns=2) : pm.attrControlGrp( label="visualise energy", attribute= node.ve) pm.attrFieldSliderGrp( label="visualisation multiplier", min=0.001, max=1000, attribute=node.vmp) for j in range(node.blendMesh.numElements()): with pm.rowLayout(numberOfColumns=1) : pm.attrFieldSliderGrp(label=node.blendWeight[j].getAlias(), min=-1.0, max=2.0, attribute= node.blendWeight[j])
def UI_controlModuleSelected(self, *args): moduleNameInfo = pm.textScrollList(self.UIElements["controlModule_textScrollList"], query = True, selectItem = True) if len(moduleNameInfo) == 0: pm.text(self.UIElements["nameText"], edit = True, label = 'No Animation Modules to Install') pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = '') pm.button(self.UIElements["installButton"], edit = True, enable = False) return else: moduleName = moduleNameInfo[0] mod = None for controlModule in self.controlModuleCompatability: if controlModule[1] == moduleName: mod = controlModule[0] if mod != None: moduleTitle = mod.TITLE moduleDescription = mod.DESCRIPTION pm.text(self.UIElements["nameText"], edit = True, label = moduleTitle) pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = moduleDescription) pm.button(self.UIElements["installButton"], edit = True, enable = True, command = partial(self.InstallModule, mod, moduleName))
def __init__(self): respresets = [4096, 2048, 1024, 512, 256, 128, 64, 32] with pm.frameLayout(l='Options', cll=True, cl=False, bs='out'): with pm.columnLayout(): pm.text('Map Size:') pm.separator(st='in', width=160, height=8) with pm.rowColumnLayout(nc=3, cw=[20, 60]): pm.text(l='Width:') self.width = pm.intField(v=1024, width=42) with pm.optionMenu(): for i in respresets: pm.menuItem(l=i) pm.text(l='Height:') self.height = pm.intField(v=1024, width=42) with pm.optionMenu(): for i in respresets: pm.menuItem(l=i) pm.button(l='Get Map Size') pm.separator(st='in', width=160, height=8) with pm.columnLayout(): self.compSpace = pm.checkBox(l='Retain Component Spaceing', cc=lambda *args: pm.texMoveContext('texMoveContext', e=True, scr=self.compSpace.getValue()), v=pm.texMoveContext('texMoveContext', q=True, scr=True)) self.pixelUnits = pm.checkBox(l='Transform In Pixels')
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 __init__(self, template): self.template = template self.win = "arnold_filter_list_win" if pm.window(self.win, exists=True): pm.deleteUI(self.win) pm.window(self.win, title="Add Light Filter", sizeable=False, resizeToFitChildren=True) #pm.windowPref(removeAll=True) pm.columnLayout(adjustableColumn=True, columnOffset=("both", 10), #columnAttach=('both',1), rowSpacing=10) self.scrollList = pm.textScrollList('alf_filter_list', nr=4, ams=False) pm.textScrollList(self.scrollList, e=True, doubleClickCommand=Callback(self.addFilterAndHide)) for label, nodeType in self.filters(): pm.textScrollList(self.scrollList, edit=True, append=label) pm.rowLayout(numberOfColumns=2, columnAlign2=("center", "center")) pm.button(width=100, label="Add", command=Callback(self.addFilterAndHide)) pm.button(width=100, label="Cancel", command=Callback(pm.deleteUI, self.win, window=True)) pm.setParent('..') pm.setParent('..') pm.showWindow(self.win)
def _buildupWindow(self): if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()): _pmCore.deleteUI(self._window, window=True) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout(adjustableColumn=True) _pmCore.scrollLayout(width=300, height=250, childResizable=True) _pmCore.gridLayout(numberOfColumns=2, cellHeight = self._iconSize, cellWidth=self._iconSize) for versionNum in _Database.getVersionList(self._fileID): versionInfo = _Database.getVersionInfo(self._fileID, versionNum) print versionInfo thumbnailPath = versionInfo[3] if not _os.path.exists(versionInfo[3]): thumbnailPath = "cube.png" button = _pmCore.iconTextButton(self._versionBtnName(versionNum), style='iconAndTextVertical', image1=thumbnailPath, label=self._versionBtnName(versionNum), command=_pmCore.Callback(self._versionSelected, versionNum)) self._uiWidget[self._versionBtnName(versionNum)] = button _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.separator(style='none', height=10) _pmCore.text(label="Comments: ", align='left') self._uiWidget['commentLayout'] = _pmCore.scrollLayout(width=300, height=120, childResizable=True) _pmCore.setParent('..') _pmCore.separator(style='none', height=10) self._uiWidget['comment'] = _pmCore.scrollField(width=300, height=80) _pmCore.button(label='Add Comment', command=_pmCore.Callback(self._commentAdded))
def GUI(self): self._win = pmc.window(self.WINDOW_NAME, title=self.WINDOW_TITLE) pmc.columnLayout(adjustableColumn=True) self._slider = pmc.intSliderGrp(label='Segments', field=True, min=2, max=100, value=2) pmc.button(label='Okay', c=pmc.Callback(self._callback)) pmc.button(label='Cancel', c=pmc.Callback(pmc.deleteUI, self._win)) self._win.show()
def initialize_buildButton(self): """ creates the BUILD and CLOSE buttons on the bottom """ button_width = self.widthHeight[0] / 2 - 6 button_height = 36 buttonLayoutSpacing = self.widthHeight[0] - button_width * 2 - 10 self.UIwidgets["buildButtonLayout"] = pm.rowColumnLayout( numberOfColumns=2, parent=self.UIwidgets["ui_main_layout"] ) pm.rowColumnLayout( self.UIwidgets["buildButtonLayout"], edit=True, columnAlign=([1, "center"], [2, "center"]), columnOffset=([1, "left", 3], [3, "right", 5]), columnSpacing=[2, buttonLayoutSpacing], ) self.UIwidgets["buildButton"] = pm.button( l=" :: BUILD ALL :: ", width=button_width, height=button_height, parent=self.UIwidgets["buildButtonLayout"], command=self.build_rig, ) self.UIwidgets["closeButton"] = pm.button( l=" :: PRINT MODULE INFO :: ", width=button_width, height=button_height, parent=self.UIwidgets["buildButtonLayout"], command=self.tmp_module_information, )
def initialiseLayout(self): #======================================================================= # Define Top Level Layout #======================================================================= self.widgets['top_level_layout'] = pm.verticalLayout(ratios=[2,1]) #======================================================================= # Define Reorder Buttons Layout #======================================================================= pm.setParent(self.widgets['top_level_layout']) self.widgets['reorder_buttons_layout'] = pm.horizontalLayout() self.widgets['button_top'] = pm.button(label='TOP' ,command=self.attr_top_cmd) self.widgets['button_up'] = pm.button(label='UP' ,command=self.attr_up_cmd) self.widgets['button_dn'] = pm.button(label='DN' ,command=self.attr_dn_cmd) self.widgets['button_bot'] = pm.button(label='BOT' ,command=self.attr_bot_cmd) #======================================================================= # Define Reorder Buttons Layout #======================================================================= pm.setParent(self.widgets['top_level_layout']) self.widgets['separator_layout'] = pm.horizontalLayout(ratios=[1,2,1]) self.widgets['separator_text'] = pm.text('Separator :') self.widgets['separator_name'] = pm.textField() self.widgets['button_separator'] = pm.button(label = "Add", command=self.add_separator_cmd) #======================================================================= # Redistribute #======================================================================= self.widgets['reorder_buttons_layout'].redistribute() self.widgets['separator_layout'].redistribute() self.widgets['top_level_layout'].redistribute()
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): ''' # class to sort and give info on shaders ''' self.layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth=([1, 150], [2, 150], [3, 250])) pm.columnLayout() pm.text(label= 'Shaders') self.shader_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(self.update_connections_list)) pm.button(label= 'Refresh', width= 150, command= pm.Callback(self.update_shader_list)) pm.setParent(self.layout) pm.columnLayout() pm.text(label='Connections') self.connections_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(self.write_info)) self.check_box = pm.checkBox(label= 'Select Node') pm.setParent(self.layout) pm.columnLayout() pm.text(label='Node Info') self.info_field = pm.scrollField(wordWrap= True, width= 250, height= 200) self.attr_check_box = pm.checkBox(label= 'Show All') self.update_shader_list()
def ui_reload_tools(self, *uiargs, **kwargs): ''' Source toolbox base path for tools scripts/folders ''' if self.verbose: print '\t...Reloading tools' # TO-DO: # Add additional registration for tools which # will provide more information to the UI. # - Help Info (button) # - Neat name for button # : This will likely require a secondary # utility script to perform file parsing # possibly using the ast module for literal_eval # or using a JSON/XML format. # - Folder support ## SIMPLE VERSION ## # As the simple version, only take script files at face value and execute. # Check paths if self.ui_path.getText(): source_path = self.ui_path.getText() else: source_path = self.ui_path.getPlaceholderText() source_path = os.path.normpath(source_path) if not os.path.exists(source_path): pm.warning('The toolbox path you are trying to source does not exist.') return # Add to sys.path if source_path not in sys.path: if self.verbose: print 'Adding source path to the sys.path...' sys.path.append(source_path) if self.verbose: print 'Sourcing from: ', source_path # Find contents of folder and identify scripts. tool_dir = os.walk(source_path) tool_file_list = [x for x in tool_dir.next()[2] if not '__init__' in x] if self.verbose: print 'tool_file_list: ', tool_file_list if not tool_file_list: pm.warning('Could not find any valid tool files to add.') return # Kill old toolbox lists (archives) if self.toolbox_archive: pm.deleteUI(self.toolbox_archive) # Add UI elements which represent the files on disk. pm.setParent(self.ui_toolbox_layout) with pm.scrollLayout() as self.toolbox_archive: for tool in tool_file_list: exec_path = os.path.join(source_path, tool) if self.verbose: print exec_path pm.button( label= tool.partition('.')[0], command= pm.Callback(execfile, exec_path) )
def createUI( SWindowTitle, pApplyCallback ): windowID = 'vcgnWindowID' # If Window is Already Open, Delete it and Open a New One if pm.window( windowID, exists=True ): pm.deleteUI( windowID ) # Init Window pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True ) pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ]) pm.text( label='Min Value:' ) # Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01 MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Minimum Value, It Can't Go below 0.0 or above 1.0" ) pm.separator( h=10, style='none' ) pm.text( label='Max Value:' ) # Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01 MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Maximum Value, It Can't Go below 0.0 or above 1.0" ) pm.separator( h=10, style='none' ) # Formatting pm.separator( h=10, style='none' ) pm.separator( h=10, style='none' ) pm.separator( h=10, style='none' ) pm.text( label='Noise Type:' ) # Noise Options - Enabled in 2.0 NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=True, annotation="Select Alternate Distributions and Generation Functions Here" ) pm.menuItem( label='Simple', parent='NoiseFunctions', annotation="A Simple Psuedo Random Noise Function that generates Random Values Between Min and Max" ) pm.menuItem( label='Perlin', parent='NoiseFunctions', annotation="Try Moving the Object Around for More Variety with Perlin Noise" ) pm.menuItem( label='3D Weighted', parent='NoiseFunctions', annotation="This Function Uses a Mixed Up Vertex List Randomly Adjust the Appearance of a Psuedo Random Number Generation" ) pm.menuItem( label='Triangular', parent='NoiseFunctions', annotation="This Function Uses a Psuedo Random Number Generator with a Triangular Distribution" ) pm.menuItem( label='Gamma', parent='NoiseFunctions', annotation="This Function Uses the Gamma Distribution, Does Not Work Well with Low Min Values, Suggestion Minimum 0.1" ) pm.separator( h=10, style='none' ) # Formatting pm.separator( h=10, style='none' ) pm.separator( h=10, style='none' ) pm.separator( h=10, style='none' ) # Buttons pm.separator( h=10, style='none' ) pm.button( label='Apply', command=functools.partial(pApplyCallback, NoiseOption, MaxValueField, MinValueField) ) def cancelCallback( *Args ): if pm.window( windowID, exists=True ): pm.deleteUI( windowID ) pm.button( label='Cancel', command=cancelCallback ) pm.showWindow()
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, rigObject, callback): self._rig = rigObject self._callback = callback self._row = FluidRowLayout(numberOfChildren = 3, separation = Format.SEPARATION) with self._row: NameField(node = self._rig.node, type = pm.nt.Transform, width = Format.Text.WIDTH) pm.button(label = 'Edit', width = Format.Button.WIDTH / 2 - Format.SEPARATION / 2, command = lambda *args: self.editRig()) pm.button(label = 'Delete', width = Format.Button.WIDTH / 2 - Format.SEPARATION / 2, command = lambda *args: self.deleteRig()) self._deleteDialog = ConfirmationDialog( title = 'Rig Editor | Delete', message = 'Do you want to delete {0}?'.format(self._rig.node), confirm = 'Delete', deny = 'Cancel', icon = Window.Icon.WARNING ) pm.scriptJob( nodeDeleted = [self._rig._node, self._callback], parent = self._row, replacePrevious = True )
def __init__(self, questions_file): self.file = open(questions_file, 'r') self.questions = self.file.readlines() self.file.close() self.main_layout = pm.columnLayout() self.name_field = pm.textFieldGrp(label= 'Quiz Name') self.layout = pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 75], [2, 475])) pm.columnLayout() pm.text(label= 'Questions') self.question_scroll_list = pm.textScrollList(width= 60, height= 400, selectCommand= pm.Callback(self.read_questions), allowMultiSelection= True) pm.setParent(self.layout) pm.columnLayout() pm.text(label= 'Questions Info') self.question_scroll_field = pm.scrollField(wordWrap= True, height= 400, width= 475) pm.setParent(self.main_layout) pm.button(label= 'Create Quiz', command= pm.Callback(self.create_quiz), width= 550, height= 50) self.list_questions()
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 __init__(self, node): self.node = node # the polymove UV node self.layout = pm.frameLayout(label= '%s' % (self.node), width= 340, collapsable= True) pm.button(label= 'Delete UI', command= pm.Callback(self.delete_ui))
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 rh_dynamicJoint(): #Create a variable for the window name winName = 'DynamicJoint' winTitle = 'rh_DynamicJoint_prototype_v0.23' #Delete the window if it exists if pm.window(winName, exists = True): pm.deleteUI(winName, window = True) #Build the main window pm.window(winName, title = winTitle, sizeable = True) #name field pm.textFieldGrp('NameTFG',label = 'Set up name:', text = 'Ribbon45hp', ed = True) pm.columnLayout(adjustableColumn = True) #side pm.radioButtonGrp('ColSel',nrb = 3,label = 'Side:',la3 = ['l','m','r'],sl = 1) pm.columnLayout(adjustableColumn = True) #axis pm.radioButtonGrp('AxisSel',nrb = 3,label = 'Axis:',la3 = ['x','y','z'],sl = 1) pm.columnLayout(adjustableColumn = True) #ccSize pm.floatSliderGrp('Cc_Size',label = 'Control Size:',f = True,min = 1,max = 10,fmn = 1,fmx = 100,v = 1) pm.columnLayout(adjustableColumn = True) #joint number pm.intSliderGrp('Joint_Num',label = 'Number Of Joints:',f = True,min = 4,max = 49,fmn = 1,fmx = 100,v = 4) pm.columnLayout(adjustableColumn = True) #inbound pm.button(label = 'Ready For Tasking', command = 'inbound()') pm.columnLayout(adjustableColumn = True) #bringTheRain pm.button(label = 'Target Acquire', command = 'bringTheRain()') pm.columnLayout(adjustableColumn = True) #Show the window pm.showWindow(winName) pm.window(winName, edit = True, width = 378, height = 210)
def initUI(self): pm.setUITemplate("DefaultTemplate", pushTemplate=True) form = pm.formLayout() binMeshExportPath = pm.optionVar.get('mtap_binMeshExportPath', pm.workspace.path + "/geo/export.binarymesh") prefix = pm.optionVar.get('mtap_binMeshExportPathPrefix', "prefix") createProxy = pm.optionVar.get('mtap_binMeshCreateProxy', True) percentage = pm.optionVar.get('mtap_binMeshPercentage', 0.1) createStandin = pm.optionVar.get('mtap_binMeshCreateStandin', True) oneFilePerMesh = pm.optionVar.get('mtap_binMeshOneFilePerMesh', False) useTransform = pm.optionVar.get('mtap_binMeshUseTransform', False) with pm.columnLayout('StandinLayout') as StandinLayout: with pm.frameLayout('StandinLayout', label="Standin export options", collapsable=False): with pm.columnLayout('StandinColumnLayout'): self.pathUI = pm.textFieldButtonGrp(label="Standin directory", text=binMeshExportPath, buttonLabel="File", buttonCommand=self.fileBrowser) self.prefixUI = pm.textFieldGrp(label="Prefix", text=prefix) self.createProxyUI = pm.checkBoxGrp(label="Create proxy", value1=createProxy) self.percentageUI = pm.floatFieldGrp(label="Percentage", value1=percentage) self.createStdInUI = pm.checkBoxGrp(label="Create StandIn", value1=createStandin) self.oneFilePerMeshUI = pm.checkBoxGrp(label="One File Per Mesh", value1=oneFilePerMesh) self.doTransformUI = pm.checkBoxGrp(label="Use Transform", value1=useTransform) with pm.rowColumnLayout(numberOfColumns=2): pm.button(label="Create BinaryMesh", c=self.doit) pm.button(label="Cancel", c=self.cancel) pm.formLayout(form, edit=True, attachForm=[(StandinLayout, 'top', 5), (StandinLayout, 'bottom', 5), (StandinLayout, 'right', 5), (StandinLayout, 'left', 5)]) pm.setUITemplate("DefaultTemplate", popTemplate=True)
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 uiContents(): with pm.frameLayout(l='Color', cll=True, mw=3, mh=3 ): with pm.columnLayout(adj=True): with pm.rowLayout(nc=2): pm.text(label='Set Override Color : ', align='right', w=130) with pm.rowColumnLayout( nc=10 ): wh=18 for i in range(0,32): rgb = (0,0,0) if i == 0: rgb = (0.5,0.5,0.5) anno = 'Reset' pm.symbolButton( i=iconPath+'ui_colorNone.png', annotation=anno, w=wh, h=wh, c=pm.Callback( setColor.setColor, color=i ) ) else: rgb = pm.colorIndex( i, q=True ) anno = '- index : %d\n- RGB : %03.3f %03.3f %03.3f\n- name : %s'%(i, rgb[0], rgb[1], rgb[2], setColor.color_intToStr(i) ) pm.canvas( rgbValue = rgb, annotation = anno, w=wh, h=wh, pressCommand = pm.Callback( setColor.setColor, color=i ) ) #partial( self.setColor, i, True , self._toShape)) #partial( self.setColor, i, False, False)) pm.separator(h=8,style='in') with pm.rowLayout( nc=10 ): pm.text(label='Set Wire Frame Color : ', align='right', w=130) pm.button(label='Object Color Palette', c=pm.Callback( pm.mel.objectColorPalette ), w=180 ) # ====================================== # Buttons # ======================================
def GUI(self): # Create GUI with window and 3 buttons self._win = pmc.window(self.WINDOW_NAME, title = self.WINDOW_TITLE) pmc.columnLayout(adjustableColumn = True) pmc.button(label = "Stretch It!", c = pmc.Callback(self._callbackBind)) pmc.button(label = "Cancel", c = pmc.Callback(pmc.deleteUI, self._win)) self._win.show()
def __init__(self, debug=0): title="TransferBlendShapes" 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.win = pm.window(title, title="Transfer BlendShapes Tool") self.rowColumnLayoutA = pm.rowColumnLayout() self.intro = pm.text( label='complete the following steps in order' ) self.frameLayoutA = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 1 Load Target Mesh', borderStyle='in' ) self.columnlayoutA = pm.columnLayout() self.frameLayoutB = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 2 Import Mask', borderStyle='in' ) self.columnlayoutA = pm.columnLayout() self.frameLayoutC = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 3 Manipulate Match Mesh', borderStyle='in' ) self.columnlayoutB = pm.columnLayout() self.frameLayoutD = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 4 Transfer Blends', borderStyle='in' ) self.columnlayoutC = pm.columnLayout() #self.dockControl = pm.dockControl(label=title, area='right', content=title, allowedArea=['right', 'left'], sizeable=True) # fameA content self.names = {'Target':None} # Generating x number of fields based on dictionary keys of self.names for name in self.names: self.names[name] = pm.textFieldButtonGrp(cw = ((1, 76), (2, 176)), parent=self.frameLayoutA, label = name, placeholderText = 'Enter Name Here or >>>> ', buttonLabel = 'load selected', tcc= self.prepTargetMeshOn, buttonCommand = pm.Callback(self.nameField_load, name)) self.btn_prepTgt = pm.button(parent=self.frameLayoutA, enable=False, w=40, h=20, label="Prep Target", command=self.prepTargetMesh) self.fA_fillText = pm.text(parent=self.frameLayoutA, label=' ' ) # fameB content self.importText = pm.text(parent=self.frameLayoutB, label='Import the desired facial mask' ) self.manipulateText = pm.text(parent=self.frameLayoutB, label='Use the avalable controls to manipulate the mask' ) self.fitText = pm.text(parent=self.frameLayoutB, label='Roughly fit the mask to the target mesh' ) self.btn_trueHuman = pm.button(parent=self.frameLayoutB, enable=True, w=40, h=20, label="Human Anatomy", command=self.humanAnatomyImport) self.btn_trueMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Anatomy", command=self.muzzleAnatomyImport) self.btn_toonHuman = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Human Toon", command=self.humanToonImport) self.btn_toonMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Toon", command=self.muzzleToonImport) self.fB_fillText = pm.text(parent=self.frameLayoutB, label=' ' ) # fameC content self.matchMeshText = pm.text(parent=self.frameLayoutC, label='activate match mesh and refine your geometry to better match the target' ) self.btn_trueHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="Activate Match Mesh", command=self.matchMesh) self.btn_templateHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="template Target Mesh", command=self.tempTgt) self.btn_referenceHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="reference Target Mesh", command=self.refTgt) self.sldr_smooth = pm.intSliderGrp(parent=self.frameLayoutC, field=True, label='Match Mesh Divisions', minValue=-0, maxValue=4, fieldMinValue=-0, fieldMaxValue=4, value=0, cc=self.div_Slider_change) self.fC_fillText = pm.text(parent=self.frameLayoutC, label=' ' ) # fameD content self.btn_go = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="Transfer Shapes", command=self.execute) self.btn_no = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="NO DONT DO IT!", command=self.close) self.fE_fillText = pm.text(parent=self.frameLayoutD, label=' ' ) self.win.show() if debug: test = ['mask_blendPipe_GEO', 'mask_hiRes_GEO'] for name, test_val in zip(self.names, test): self.names[name].setText(test_val)
def uiCreate(self): self.uiClose() self.window = pm.window( WIN_NAME, title=SCRIPT_NAME, maximizeButton=False ) with self.window: with pm.formLayout() as ui_LAY_mainForm: with pm.scrollLayout(childResizable=True) as ui_LAY_mainScroll: with pm.frameLayout( label='Parameters', collapsable=True, marginHeight=3, borderStyle='etchedIn', borderVisible=True, collapse=False ): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_FLTFLDGRP_xPos = pm.floatFieldGrp(numberOfFields=1, label='+X', precision=6) self.ui_FLTFLDGRP_xNeg = pm.floatFieldGrp(numberOfFields=1, label='-X', precision=6) self.ui_FLTFLDGRP_yPos = pm.floatFieldGrp(numberOfFields=1, label='+Y', precision=6) self.ui_FLTFLDGRP_yNeg = pm.floatFieldGrp(numberOfFields=1, label='-Y', precision=6) self.ui_FLTFLDGRP_zPos = pm.floatFieldGrp(numberOfFields=1, label='+Z', precision=6) self.ui_FLTFLDGRP_zNeg = pm.floatFieldGrp(numberOfFields=1, label='-Z', precision=6) pm.separator(style='none', height=5) self.ui_BTN_create = pm.button( label='Create', height=MAIN_BUTTONS_HEIGHT, command=self.ui_on_BTN_create_clicked ) self.ui_BTN_close = pm.button( label='Close', height=MAIN_BUTTONS_HEIGHT, command=self.uiClose ) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'top', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'left', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'right', 2) ui_LAY_mainForm.attachControl(ui_LAY_mainScroll, 'bottom', 2, self.ui_BTN_create) ui_LAY_mainForm.attachNone(self.ui_BTN_create, 'top') ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'left', 2) ui_LAY_mainForm.attachPosition(self.ui_BTN_create, 'right', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'bottom', 2) ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') ui_LAY_mainForm.attachPosition(self.ui_BTN_close, 'left', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 2) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 2) self.setupInitialValues()
def initialiseLayout(self): #======================================================================= # Define Top Level Layout #======================================================================= self.widgets['top_level_layout'] = pm.verticalLayout() #======================================================================= # Define Layout #======================================================================= # Title Layout pm.setParent(self.widgets['top_level_layout']) self.widgets['title_layout'] = pm.horizontalLayout() pm.text('Multi Attributes') pm.text('Connection Index') pm.text('Connection Target') #List Layout pm.setParent(self.widgets['top_level_layout']) self.widgets['list_layout'] = pm.horizontalLayout() pm.setParent(self.widgets['list_layout']) self.widgets["attributes_list"] = pm.textScrollList(selectCommand=self.refresh_connections) pm.setParent(self.widgets['list_layout']) self.widgets["index_list"] = pm.textScrollList(ams=True) pm.setParent(self.widgets['list_layout']) self.widgets["connections_list"] = pm.textScrollList(enable=False) #refresh Button pm.setParent(self.widgets['top_level_layout']) self.widgets["refresh_button"] = pm.button(label="Load Selection", command=self.refresh) # Add Attribute pm.setParent(self.widgets['top_level_layout']) pm.separator() self.widgets['addAttr_layout'] = pm.horizontalLayout() pm.text('Add Attribute:') self.widgets['attr_name'] = pm.textField() self.widgets["add_button"] = pm.button(label="Add", c=self.addAttr_selected) # Misc Buttons pm.setParent(self.widgets['top_level_layout']) self.widgets['buttons_layout'] = pm.horizontalLayout() self.widgets["append_button"] = pm.button(label="Append", command=self.append_selected) self.widgets["remove_button"] = pm.button(label="Remove", command=self.remove_selected) self.widgets["clear_button"] = pm.button(label="Clear", command=self.clear_selected) #======================================================================= # Redistribute #======================================================================= self.widgets['addAttr_layout'].redistribute(1,2,1) self.widgets['list_layout'].redistribute() self.widgets['title_layout'].redistribute() self.widgets['buttons_layout'].redistribute() self.widgets['top_level_layout'].redistribute(1,10,1,1,1,1)
def populate_namespace_horizontal(self): pm.setParent(self.widgets["namespace_horizontal"]) pm.text(label='Namespace : ') self.widgets["nameSpace_textField"] = pm.textField() pm.button(label='Select', c=pm.Callback(self.load_selected_object)) self.widgets["namespace_horizontal"].redistribute()
def createAssetPrompt(self): form = pm.setParent(q=True) f = pm.formLayout(form, e=True, width=150) col2 = pm.columnLayout(p=f, adjustableColumn=True) nsField = pm.textFieldGrp ( 'nsFieldPrompt', l='Name Space', tx='ref' ) refModeField = pm.optionMenuGrp ( l='Assemble Mode' ) pm.menuItem(l='reference') pm.menuItem(l='cache') pm.menuItem(l='import') pm.menuItem(l='copy') pane = pm.paneLayout(p=col2, configuration='top3', ps=[(1, 20, 80), (2, 80, 80), (3, 100, 20)]) folderTreeWidget = FolderTreeWidget() folderTreeWidget.createFolderTree(pane) folderTreeWidget.projectName = self.projectName folderTreeWidget.type = 'asset' folderTreeWidget.getFolderTree() itemListWidget = ItemListBase() itemListWidget.projectName = self.projectName itemListWidget.createList(pane) itemListWidget.refreshList(path=[], task='uvs') infoWidget = InfoWidget() infoWidget.createInfo(pane) folderTreeWidget.itemListWidget = itemListWidget folderTreeWidget.itemListWidget.type = 'asset' folderTreeWidget.itemListWidget.task = 'uvs' itemListWidget.infoWidget = infoWidget b1 = pm.button(p=f, l='Cancel', c='pm.layoutDialog( dismiss="Abort" )') b2 = pm.button(p=f, l='OK', c=lambda x: self.createAssetCallBack(itemListWidget.selectedItem)) spacer = 5 top = 5 edge = 5 pm.formLayout(form, edit=True, attachForm=[(col2, 'right', edge), (col2, 'top', top), (col2, 'left', edge), (b1, 'right', edge), (b1, 'bottom', edge), (b2, 'left', edge), (b2, 'bottom', edge)], attachNone=[], attachControl=[], attachPosition=[(b1, 'right', spacer, 90), (b2, 'left', spacer, 10)])
def reposeAdjusterSimple(): from pymel.core import deleteUI, window, columnLayout, button, showWindow from functools import partial if window('REPOSER_POSE_SIMPLE', ex=True): deleteUI('REPOSER_POSE_SIMPLE') window('REPOSER_POSE_SIMPLE') with columnLayout(): for attr in [ 'origRot', 'origTrans', 'prevRot', 'prevTrans', 'prevRotWorld', 'prevTransWorld', ]: button(l=attr, c=partial(setValueHelper, attr) ) showWindow()
def gui(self, *args): if DrawingOverrideClass.win is not None: try: pm.deleteUI(DrawingOverrideClass.win) except RuntimeError: pass with pm.window(menuBar=True, menuBarVisible=True, width=200, title='Drawing Overrides') as w: DrawingOverrideClass.win = w # start the template block with pm.columnLayout(rowSpacing=5, width=300): self.displayType = pm.optionMenu(label='Display Type') for i in range(3): pm.menuItem(label='{}'.format(self.displayTypeList[i])) self.levelOfDetail = pm.optionMenu(label='Level of Detail') for i in range(2): pm.menuItem(label='{}'.format(self.levelofDetailList[i])) pm.button(label='Execute!', command=pm.Callback(self.execute))
def log_window(): log_window_name = "mgear_shifter_build_log_window" log_window_field_reporter = "mgear_shifter_log_field_reporter" if not pm.window(log_window_name, exists=True): logWin = pm.window(log_window_name, title="Shifter Build Log", iconName='Shifter Log') pm.columnLayout(adjustableColumn=True) pm.cmdScrollFieldReporter(log_window_field_reporter, width=800, height=500, clr=True) pm.button(label='Close', command=('import pymel.core as pm\npm.deleteUI(\"' + logWin + '\", window=True)')) pm.setParent('..') pm.showWindow(logWin) else: pm.cmdScrollFieldReporter(log_window_field_reporter, e=True, clr=True) pm.showWindow(log_window_name) mgear.logInfos()
def SJ_yetiCachewdUI(): if pm.window('yeticache',ex=True): pm.deleteUI('yeticache',wnd=True) pm.window('yeticache',t='yeticacheV3.1') pm.columnLayout(adj=True,w=240) pm.text(l='帧数区间(开始帧,结束帧,Sample',fn='fixedWidthFont',h=50,ann="更新说明V3.1:修复批量毛发路径中,与输出毛发缓存路径名字不匹配问题") pm.flowLayout( columnSpacing=0) pm.textField('rangenuma',tx="0",h=30,w=80) pm.textField('rangenumb',tx="1",h=30,w=80) pm.textField('rangesamnum',tx="1",h=30,w=80) pm.setParent( '..' ) pm.text(l='毛发缓存生成路径', fn='fixedWidthFont',h=50,ann="" ) pm.flowLayout( columnSpacing=0) pm.checkBox("switch" ,label='切换yeti1.3.19',ann="",h=50,w=120) pm.checkBox("single" ,label="单帧缓存指认",ann="",h=50,w=120) pm.setParent( '..' ) pm.textField('pathnum',tx="D:/textest/fur",h=30) pm.button(l=r'批量输出毛发缓存',c=yetiwritecache,h=50) pm.button(l=r'批量替换毛发缓存路径',c=changecache,h=50) pm.showWindow()
def reset_io_UI(): """ Restores IO UI inputs in Mimic UI to defaults :return: """ pm.frameLayout('add_io_frame', edit=True, label="Add IO") # Update io parameters pm.textField('t_ioNameText', edit=True, text='', editable=True) pm.textField('t_ioPostprocIDText', edit=True, text='', editable=True) pm.optionMenu('ioNumberMenu', edit=True, value='1') pm.optionMenu('ioTypeMenu', edit=True, value='digital', enable=True) pm.checkBox('cb_ignoreIO', edit=True, value=0) # Change "Add IO" button to "Update IO" # Change background color of button pm.button('b_add_io', edit=True, label='Add IO', backgroundColor=[.361, .361, .361], command=add_io)
def gui(): # Creating a window. win = pm.window(w=150, h=100) main = pm.columnLayout() # Interface components go after the main layout, # Different components simular flags # They all have a rectangle bounding box! pm.button(w=150, command=work) pm.textFieldButtonGrp(label='Float Attribute', buttonLabel='Apply', buttonCommand=work) pm.intField(w=150, changeCommand=work) pm.floatSliderGrp(changeCommand=work) pm.floatSliderGrp(cc=work, dc=work) # Showing a window win.show()
def snapshot_show(index, *args): """doc""" imgPath = cls.snapNull if cls.linked and os.listdir( cls.vsRepo) and pal_opMenu.getItemListLong(): palName = pal_opMenu.getValue() version = '' shotName = '' if pm.optionMenu(brn_opMenu, q=1, ill=1): version = cls.dirAnim + pm.optionMenu(brn_opMenu, q=1, v=1) if pm.optionMenu(sht_opMenu, q=1, ill=1): shotName = sht_opMenu.getValue() if palName and version and shotName: imgPath = cls.snapshotImgPath(palName, version, str(index + 1), shotName) imgPath = imgPath if os.path.isfile(imgPath) else cls.snapNull pm.image(cls.img_snap, e=1, i=imgPath) pm.button(cls.snapBtnn + str(index + 1), e=1, bgc=cls.snapShow) for i in range(5): if not i == index: pm.button(cls.snapBtnn + str(i + 1), e=1, bgc=cls.snapRest)
def __init__(self): if pm.window('pyleUI', ex=True): self.w = pm.window('pyleUI', q=True) pm.showWindow(self.w) else: self.w = pm.window('pyleUI', t='Pyle_Vector', h=50, w=300) pm.columnLayout(adjustableColumn=True) pm.text(label='SELECT 3 JOINTS PARENT->CHILDREN ORIENTATION', align='center', rs=True) self.button = pm.button(label='DoIt', command='pyletool.doit()') pm.showWindow(self.w)
def __init__(self): # Make a new window win_title = "Control Creator" win_title_safe = win_title.replace(" ", "_") if pm.window(win_title_safe, q=True, exists=True): pm.deleteUI(win_title_safe) window = pm.window(win_title_safe, title=win_title, toolbox=True, backgroundColor=(0.158, 0.254, 0.290)) window.show() with pm.verticalLayout(): pm.text( "1. Select joint in scene\n\n 2. Click controller shape that you want for it" ) pm.button("Cube", command=lambda x: create_control("cube")) pm.button("Circle", command=lambda x: create_control("circle")) with pm.horizontalLayout() as scale_layout: self.scale_float = pm.floatSliderGrp(field=True, maxValue=2, value=1.1, step=0.01) pm.button("Scale Control", command=self.increment_scale) scale_layout.redistribute(4, 2)
def create(): winName = 'test_win' if pm.window(winName, exists=1): pm.deleteUI(winName, wnd=1) pm.window(winName, title=u'模板窗口') pm.window(winName, e=1, w=255, h=1) with pm.columnLayout(adj=1): pm.button() pm.button() pm.button() pm.button() pm.showWindow(winName)
def asd(): pm.window(width=150) # Result: ui.Window('window1') # pm.columnLayout(adjustableColumn=True) # Result: ui.ColumnLayout('window1|columnLayout9') # pm.button(label='Button 1', command='defaultButtonPush()') # Result: ui.Button('window1|columnLayout9|button3') # pm.button(label='Button 2') # Result: ui.Button('window1|columnLayout9|button4') # pm.button(label='Button 3') # Result: ui.Button('window1|columnLayout9|button5') # pm.button(label='Button 4') # Result: ui.Button('window1|columnLayout9|button6') # pm.showWindow()
def nameRulesWindow(self): with core.ui.singleWindow('nameRulesWindow', t='Choose what is displayed to indicate the side of the joints and controllers.') as win: with columnLayout(adj=True): jl = textFieldGrp(l='Joint Left Side', tx=self.settings['joint_left'] ) jr = textFieldGrp(l='Joint Right Side', tx=self.settings['joint_right'] ) cl = textFieldGrp(l='Control Left Side', tx=self.settings['control_left'] ) cr = textFieldGrp(l='Control Right Side', tx=self.settings['control_right'] ) def setSides(): jlText = jl.getText().strip() jrText = jr.getText().strip() clText = cl.getText().strip() crText = cr.getText().strip() if jlText == jrText or clText == crText: confirmDialog(m='The left and right sides must be different\n(but the control and joint text for the same side can be the same)') return if not clText or not crText or not jlText or not jrText: confirmDialog(m='You cannot leave any side empty.') return self.settings['joint_left'] = jlText self.settings['joint_right'] = jrText self.settings['control_left'] = clText self.settings['control_right'] = crText settings.JOINT_SIDE_CODE_MAP['left'] = jlText settings.JOINT_SIDE_CODE_MAP['right'] = jrText settings.CONTROL_SIDE_CODE_MAP['left'] = clText settings.CONTROL_SIDE_CODE_MAP['right'] = crText deleteUI(win) button(l='Apply', c=Callback(setSides))
def create(self): self.mainLayout = pm.columnLayout(adjustableColumn=True) self.infoLayout = pm.columnLayout(adjustableColumn=True) pm.setParent(self.mainLayout) self.layout = pm.columnLayout(adjustableColumn=True) pm.setParent(self.layout) self.total = sal.Total_Grades() self.total.create() pm.button(label = 'Output Grade and Comment', command = pm.Callback(self.check)) pm.setParent(self.layout) grading = pm.frameLayout( label= 'Grading', cll = True, cl = True , borderStyle = 'etchedIn', w = 480) self.compFocal = sal.Grading_Section(name = 'Comp/Focal Length', fileName = r"%s/Comments/proj01_compFocal.txt" % (self.path), field = self.total.queryComp(), toUpdate = self.total) self.compFocal.create() pm.setParent(grading) self.antiAliasing = sal.Grading_Section(name = 'Antialias/Noise Qual', fileName = r"%s/Comments/proj01_antiAliasing.txt" % (self.path), field = self.total.queryAnti(), toUpdate = self.total) self.antiAliasing.create() pm.setParent(grading) self.pro = sal.Grading_Prof(name = 'Professionalism', fileName = r"%s/Comments/proj01_prof.txt" % (self.path), field = self.total.queryPro(), fileStart = r"%s/Startup/proj01_start.db" % (self.path), toUpdate = self.total, infoParent= self.infoLayout) self.pro.create() pm.setParent(self.infoLayout) self.info = sal.Images(self.pro) return self.layout
def _build_add_robot_frame(parent_layout): # Create frame layout with one column add_robot_frame = pm.frameLayout(label="Add Robot", collapsable=True) add_robot_col = pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') # Create list of robots pm.rowLayout(numberOfColumns=2, adjustableColumn=1, columnAttach=(1, 'left', 3), columnWidth=[(1, 158), (2, 45)], height=20) pm.optionMenu('robotImportList') rigs = general_utils.get_rigs_dict() rig_names = general_utils.get_rigs_names(rigs) for rig_name in rig_names: pm.menuItem(label=rig_name) # Get required rigs directories dir_mimic = general_utils.get_mimic_dir() dir_rigs = dir_mimic + '/rigs' add_robot_command_string = \ 'import mimic_utils; reload(mimic_utils); ' \ 'mimic_utils.import_robot("{}"); ' \ 'mimic_utils.add_mimic_script_node(); ' \ 'mimic_utils.add_hud_script_node()' \ .format(dir_rigs) pm.button(label=' Add ', command=add_robot_command_string, width=45, height=20, annotation='Imports selected robot into the scene') pm.setParent(add_robot_frame) pm.separator(style='none') pm.setParent(parent_layout)
def asset_widget(current_parent): ''' Single asset widget. ''' main = pm.frameLayout(labelVisible=False, parent=current_parent) form = pm.formLayout() # Creating Components asset_image = pm.button(width=48, height=48) asset_text = pm.text(height=48, width=125, label='streetLight1') asset_low = pm.button(height=32) asset_med = pm.button(height=32) asset_high = pm.button(height=32) # Positioning Components. # Symbol Button form.attachForm(asset_image, 'top', 5) form.attachForm(asset_image, 'left', 5) # asset text form.attachForm(asset_text, 'top', 5) form.attachForm(asset_low, 'top', 15) form.attachForm(asset_med, 'top', 15) form.attachForm(asset_high, 'top', 15) form.attachControl(asset_text, 'left', 5, asset_image) # form.attachControl(asset_text, 'right', 5, asset_low) form.attachControl(asset_low, 'left', 5, asset_text) form.attachControl(asset_med, 'left', 5, asset_low) form.attachControl(asset_high, 'left', 5, asset_med) form.attachForm(asset_high, 'right', 5) form.attachForm(asset_image, 'bottom', 5) # res buttons # Return parent to orginal layout pm.setParent(current_parent) return main
def __init__(self, *args): win = 'cloth_snapshot_win' version = '0.1' if pm.window(win, exists=1, *args): pm.deleteUI(win, window=1) pm.window(win, rtf=1, title='Cloth Snapshot UI v%s' % version) pm.columnLayout() pm.rowLayout(nc=2) pm.text('Working Directory') self.dirFld = pm.textFieldButtonGrp(bl='Browse') pm.textFieldButtonGrp(self.dirFld, e=1, bc=partial(self.get_dir, self.dirFld)) pm.setParent('..') pm.rowLayout(nc=3, cw3=(150, 150, 150)) pm.button(l='Snapshot Selected', c=self.snapshot) pm.button(l='Diff Snapshots', c=self.diff_snapshot) pm.button(l='Apply Snapshot', c=self.implement_snapshot) pm.setParent('..') pm.showWindow(win)
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 _build_axis_limits_frame(parent_layout): limits_frame = pm.frameLayout(label="Axis Limits", collapsable=True) limits_tab_layout = pm.tabLayout('limits_tab_layout') position_limits_tab = _build_position_limits_tab(limits_tab_layout) velocity_limits_tab = _build_velocity_limits_tab(limits_tab_layout) accel_limits_tab = _build_accel_limits_tab(limits_tab_layout) jerk_limits_tab = _build_jerk_limits_tab(limits_frame) tabs = [(position_limits_tab, 'Position'), (velocity_limits_tab, 'Vel'), (accel_limits_tab, 'Accel'), (jerk_limits_tab, 'Jerk')] assign_tabs(tabs, limits_tab_layout) pm.columnLayout() pm.gridLayout(nc=2, cw=114, ch=25) pm.button(label='Get Axis Limits', command=mimic_utils.write_limits_to_ui) pm.button(label='Set Axis Limits', command=mimic_utils.set_axis_limits) pm.setParent('..') pm.button(label='Clear', width=228, command=mimic_utils.clear_limits_ui) pm.setParent(parent_layout)
def createUI(pWindowTitle): windowID = 'myWindowID' if pm.window(windowID, exists=True): pm.deleteUI(windowID) pm.window(windowID, title=pWindowTitle, widthHeight=(300, 59)) pm.columnLayout(adjustableColumn=True) pm.separator(height=4, style='none') pm.button(label='copy vertex positions', command=copyCallbackDecide, backgroundColor=(0.066, 0.447, 0.443)) pm.separator(height=4, style='none') if copied[0] == 'True': pm.button(label='paste vertex positions', command=pasteCallback, backgroundColor=(0.109, 0.227, 0.29)) if copied[0] == 'False': pm.button(label='paste vertex positions', command=pasteCallbackNull, backgroundColor=(0.321, 0.321, 0.321)) pm.separator(height=4, style='none') pm.setParent('..') pm.showWindow()
def fbIngestTool(): if pm.window('FlyingBarkIngestTool', exists=True): pm.deleteUI('FlyingBarkIngestTool', window=True) pm.window('FlyingBarkIngestTool') pm.columnLayout() pm.rowLayout(nc=3) pm.text(l='PATH') pm.textField('pathTxtField', w=205) pm.button(l='...', c=browseCallBack) pm.setParent('..') pm.separator(h=20) pm.text(label='SETS') pm.separator(h=5) pm.textScrollList('setScrollList', h=150, sc=selectSetCallback) pm.separator(h=10) pm.rowLayout(nc=2) pm.text(label='GROUP DIR') pm.text('groupTxt', l='') pm.setParent('..') pm.separator(h=10) pm.rowLayout(nc=2) pm.text(label='SET_PIECES DIR') pm.text('pieceTxt', l='') pm.setParent('..') pm.separator(h=10) pm.rowLayout(nc=2) pm.text(label='DESCRIPTION FILE') pm.text('descriptionTxt', l='') pm.setParent('..') pm.separator(h=20) pm.rowLayout(nc=2) pm.button('Import', label='Import', w=125, h=50, c=importCallback) pm.button('CancelBtn', label='Close', w=125, h=50, c=cancelCallback) pm.showWindow()
def createTrail(): if pm.window('trailUI',ex=1): pm.deleteUI('trailUI') pm.window('trailUI') pm.columnLayout(adj=1) fsSample = pm.floatSliderGrp('sampleSlider', label='Sample by', cw=(1,70), adj=1, en=1,minValue=0.01, maxValue=100, fieldMinValue=0.01, fieldMaxValue=100,pre=2, field=1, v=1) pm.separator (height=4,style="in") startFrame = pm.playbackOptions(q=1,min=1) currentFrame = pm.currentTime(q=1) if currentFrame > startFrame: startFrame = currentFrame pm.intSliderGrp('startFrameSlider', label='Start frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame) pm.popupMenu(button=3,pmc = functools.partial(setTime,'start')) pm.intSliderGrp('endFrameSlider', label='End frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame+30) pm.popupMenu(button=3,pmc = functools.partial(setTime,'end')) pm.intSliderGrp('trailDivisions', label='Trail divisions', cw=(1,70), adj=1, en=1,minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=10000, field=1, v=40) pm.separator (height=4,style="in") cbUvDistorted = pm.checkBox('cbUV',l='UV distorted',v=1) pm.separator (height=4,style="in") rowBtn = pm.rowColumnLayout(numberOfRows=1) pm.button(l='Create Trail',command=functools.partial(createTrailMesh)) pm.button(l='Rebuil uvs',c=functools.partial(createTrailUv,'')) pm.button(l='ELP !!!',c=openHelpPage) pm.showWindow('trailUI')
def initUI(self): if pm.control(self.WINDOW_NAME, query = True, exists = True): return self.window = pm.window(self.WINDOW_NAME, title = "Align Pivot", mxb = False, width = 300, height = 220) self.window.setWidthHeight([300,220]) self.layout = pm.formLayout(nd=100) with pm.formLayout(nd = 100) as form: self.align_move = pm.checkBox(label = "Align Move Pivot", value = True) self.align_scale = pm.checkBox(label = "Align Scale Pivot", value = False) form.hDistribute() form.attachForm(str(self.align_move), "left", 10) self.fixbox = pm.checkBox(label = "Additional Fixing", value = False) self.align_button = pm.button(label = "Align", command = self.align) self.sep = pm.separator(style = "in") self.reset_move = pm.button(label = "Reset Move Pivot", command = self.resetMove) self.reset_scale = pm.button(label = "Reset Scale Pivot", command = self.resetScale) self.layout.vDistribute(1,1,1.5,0.5,1,1) self.layout.attachForm(str(self.fixbox), "left", 12) self.window.show()
def seqRename(*args): sel = pm.ls(sl=True) selNum = len(sel) if pm.window('seqRename', exists=True): pm.deleteUI('seqRename') window = pm.window('seqRename', title='Sequential Renamer', iconName='Rename', widthHeight=(400, 300)) pm.showWindow(window) layout = pm.rowColumnLayout(numberOfColumns=2, columnAttach=(1, 'right', 0), columnWidth=[(1, 100), (2, 250)]) t1 = pm.text(label='Prefix: ', p=layout) tf1 = pm.textField(p=layout) t2 = pm.text(label='Object Name: ', p=layout) tf2 = pm.textField(p=layout) t3 = pm.text(label='Suffix: ', p=layout) tf3 = pm.textField(p=layout) pm.button(label='Submit', command=partial(printTest, tf3), en=False)
def __init__(self): self.title = "Mantra Standin" self.fileName = "" self.density = .3 self.pointSize = 1 self.showPoints = False self.boundingBox = [-.5, -.5, -.5, .5, .5, .5] pm.setUITemplate("DefaultTemplate", pushTemplate=True) self.height = 500 with pm.frameLayout(collapsable=False, labelVisible=False) as frame: pm.textFieldButtonGrp("stdingfilename", label="GeoFileName", text="", buttonLabel="Select", bc=pm.Callback(self.selectGeoFile), cc=pm.Callback(self.setValue, "stdingfilename")) #string $b = `symbolButton -image "navButtonBrowse.xpm" browser`; with pm.frameLayout(collapsable=False, label="Points"): pm.checkBoxGrp("stdinshowpoints", label="Show Points", value1=False, cc=pm.Callback(self.setValue, "stdinshowpoints")) pm.floatFieldGrp("stdinptdensity", label="PointDensity", value1=0.3, cc=pm.Callback(self.setValue, "stdinptdensity")) pm.intFieldGrp("stdinptsize", label="PointSize", value1=1, cc=pm.Callback(self.setValue, "stdinptsize")) with pm.rowLayout(nc=2): pm.button(label="Create Standin", c=pm.Callback(self.createStandin)) pm.button(label="Cancel", c=pm.Callback(self.delete)) self.show()
def create(self): ''' # creates the actual ui ''' self.layout = pm.rowColumnLayout(numberOfColumns=3, columnWidth=([1, 150], [2, 100], [3, 300])) self.checkbox = pm.checkBox(label='Apply Transforms') pm.button(label='Create Light', height=100, command=pm.Callback(self.create_light)) pm.scrollField(width=300, height=100, wordWrap=True, enable=True, text='Preset Name: %s\n' % (self.data[0]) + 'Light Type: %s\n' % (self.data[1]) + 'Description: %s' % (self.data[2])) pm.separator() pm.separator() pm.separator()
def iscWindow(): if pm.window('iscWin', exists=True): pm.deleteUI('iscWin', window=True) shaderlist = { 'Blinn': 'isc.InstantBlinn(path)', 'Lambert': 'isc.InstantLambert(path)', 'Phong': 'isc.InstantPhong(path)', 'Arnold aiStandardSurface': 'isc.InstantaiStandardSurface(path)' } iscWin = pm.window('iscWin', title='Charles Kinters instant shader', rtf=True, h=256) menuBar = pm.menuBarLayout(w=100) contactMenu = pm.menu(label='Help') contactLink = pm.menuItem( label='Website: http://charles.kinters.net', command= 'pm.launch(web="http://charles.kinters.net/sample-page/contact-me/")') iscWinlayout = pm.rowColumnLayout('iscWinlayout') iscWintitle = pm.text( label='Please select the type of Instant Shader you wish to create.', align='left') iscMenu = pm.optionMenu('iscMenu', label='Shader Type?') skip = pm.menuItem(label='Please Select Shader') for option in shaderlist.keys(): pm.menuItem(label=option) iscPath = pm.folderButtonGrp(label='Path to texture folder:', cl3=('left', 'left', 'left')) btnLayout = pm.rowColumnLayout('butns', nc=2, p='iscWinlayout') SubmitButton = pm.button(label='Create', c=Callback(CreateShader, iscMenu, shaderlist, iscPath), p='butns') close = pm.button(label='Close', command=('pm.deleteUI(\"' + iscWin + '\", window=True)'), p='butns') pm.showWindow(iscWin)
def custom(self): self.customWin = 'customWindow' if (pm.window(self.customWin, ex=True)): pm.deleteUI(self.customWin) if (pm.windowPref(self.customWin, ex=True)): pm.windowPref(self.customWin, remove=True) myWin = pm.window(self.customWin, title='CUSTOM', width=200, height=150) pm.columnLayout(adjustableColumn=True) pm.text(l='Enter label') self.customLabel = pm.textField(editable=True) pm.text(l='Enter custom comment') self.customComment = pm.scrollField(width=200, height=150) self.customFeedback = pm.text(label='') pm.rowColumnLayout(nc=2) # nc = number of rows pm.button(label='create', command=pm.Callback(self.addCustom)) pm.button(label='add', command=pm.Callback(self.saveComment)) myWin.show()
def UI(self): # Clean up old windows which share the name if pm.window(self.win_name, exists=True): pm.deleteUI(self.win_name) # Clean up existing window preferences try: if pm.windowPref(self.win_name, query=True, exists=True) and self.window_development: pm.windowPref(self.win_name, remove=True) except RuntimeError: pass # Declare the GUI window which we want to work with self.my_win = pm.window(self.win_name, widthHeight=[200, 150]) base = pm.verticalLayout() with base: # Using the variable created 2 lines above, we can nest inside that layout element with pm.verticalLayout( ) as header: # We can also assign a variable while creating the layout element pm.text('FK/IK Setup') pm.separator() with pm.verticalLayout( ): # The assignment of a variable to the layout is optional #pm.button( ) # This button does nothing! pm.button(label='Create Guides', command=self.FKIK_create_guides ) # First way to execute a command with a button pm.button(label='Create Joints', command=self.FKIK_create_joints_from_guides ) # First way to execute a command with a button #pm.button( label='Create Orient Helper', command= self.FKIK_query_guide_orient ) # Fix spacing of layout elements base.redistribute(.1) header.redistribute(1, .1) # Last lines of code self.my_win.show()
def _build_keyframing_tools_frame(parent_layout): keyframing_tools_frame = pm.frameLayout(label="Keyframing Tools", collapsable=True) pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') pm.button(label='Delete IK/FK Keyframe', command=mimic_utils.delete_ik_fk_keys, annotation='Deletes keyframes on all attributes ' \ 'at current frame created with\n' \ '"Set IK-FK Keyframe" buttons') pm.button(label='Select Keyframe Hierarchy', command=mimic_utils.select_keyframe_hierarchy, annotation='Selects all objects keyframed ' \ 'with "Set IK-FK Keyframe" buttons:\n' \ ' target_CTRL\n' \ ' FK_CTRLS\n' \ ' a*FK_CTRL\n' \ ' tool_CTRL if one exists') pm.separator(height=5, style='none') pm.setParent(parent_layout)