def OpenMayaCommonGlobalsCreateTab(self): log.debug("OpenMayaCommonGlobalsCreateTab()") scLo = "scrollLayout" parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) if self.rendererTabUiDict.has_key('common'): self.rendererTabUiDict.pop('common') uiDict = {} self.rendererTabUiDict['common'] = uiDict clo = "clo" with pm.frameLayout(clo, labelVisible=False, collapsable=False, mw=8, mh=5, borderVisible=False): with pm.columnLayout(adj=True): uiDict['imgpath'] = pm.text(label="Path:", align="left", font="smallBoldLabelFont") uiDict['imgname'] = pm.text(label="File Name:", align="left", font="smallBoldLabelFont") uiDict['imgsize'] = pm.text(label="Image Size:", align="left", font="smallBoldLabelFont") with pm.scrollLayout(scLo, horizontalScrollBarThickness=0) as sl: print "Scroll layout", sl with pm.columnLayout("commonTabColumn", adjustableColumn=True, width=400) as ctc: print "common", ctc with pm.frameLayout(label="File Output", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): pm.textFieldGrp(label="File Name Prefix:") pm.attrEnumOptionMenuGrp( "imageMenuMayaSW", label="Image Format:", attribute=self.renderNode.imageFormat) uiDict['imageNumbering'] = pm.optionMenuGrp( label="Frame/Animation ext:", changeCommand=self.setFrameNumbering) for value in ["name.ext", "name.#.ext"]: pm.menuItem(value) if self.defaultGlobals.animation.get(): uiDict['imageNumbering'].setSelect(2) self.addRenderDefaultGlobalsUIElement( attName='extensionPadding', uiType='int', displayName='Frame Padding:', uiDict=uiDict) with pm.frameLayout(label="Frame Range", collapsable=True, collapse=False) as frameRangeLayout: uiDict['frameRangeLayout'] = frameRangeLayout with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderDefaultGlobalsUIElement( attName='startFrame', uiType='float', displayName='Start Frame:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='endFrame', uiType='float', displayName='End Frame:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='byFrame', uiType='float', displayName='By Frame:', uiDict=uiDict) with pm.frameLayout(label="Renderable Cameras", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): for cam in pm.ls(type="camera"): pm.checkBoxGrp(label=cam.name(), value1=cam.renderable.get(), cc=pm.Callback( self.switchCamRenderable, cam)) with pm.frameLayout(label="Image Size", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): uiDict['imageSizePresets'] = pm.optionMenuGrp( label="Presets:", changeCommand=self.setImageSize) for imgFormat in self.imageFormatData: pm.menuItem(imgFormat[0]) #uiDict['imageSizePresets'].setSelect(12) self.addRenderDefaultResGlobalsUIElement( attName='aspectLock', uiType='bool', displayName='Maintain aspect ratio', uiDict=uiDict) self.addRenderDefaultResGlobalsUIElement( attName='width', uiType='int', displayName='Width:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "width")) self.addRenderDefaultResGlobalsUIElement( attName='height', uiType='int', displayName='Height:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "height")) self.addRenderDefaultResGlobalsUIElement( attName='deviceAspectRatio', uiType='float', displayName='Device Aspect:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "devAsp")) #self.addRenderDefaultResGlobalsUIElement(attName='pixelAspect', uiType='float', displayName='Pixel Aspect:', uiDict=uiDict, callback=self.updateImageSize) with pm.frameLayout(label="Render Scripts", collapsable=True, collapse=False): with pm.columnLayout(adjustableColumn=True, width=400): self.addRenderDefaultGlobalsUIElement( attName='preMel', uiType='string', displayName='Pre Render Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postMel', uiType='string', displayName='Post Render Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='preRenderLayerMel', uiType='string', displayName='Pre Layer Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postRenderLayerMel', uiType='string', displayName='Post Layer Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='preRenderMel', uiType='string', displayName='Pre Frame Mel:', uiDict=uiDict) self.addRenderDefaultGlobalsUIElement( attName='postRenderMel', uiType='string', displayName='Post Frame Mel:', uiDict=uiDict) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(clo, "right", 0), (clo, "left", 0), (clo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)], attachControl=[(scLo, "top", 0, clo)]) #self.setImageSize("HD_540") # set default self.OpenMayaCommonGlobalsUpdateTab()
def buildUI(self): _notifySavingDisabled() self.win = pm.window(title='Pymel Control Panel') self.win.show() with pm.paneLayout(configuration='vertical3', paneSize=([1,20,100], [3,20,100]) ) as self.pane: # Lef Column: Api Classes self.classScrollList = pm.textScrollList('apiClassList') # Center Column: Api Methods # Would LIKE to do it like this, but there is currently a bug with # objectType UI, such that even if # layout('window4|paneLayout5', q=1, exists=1) == True # when you run: # objectTypeUI('window4|paneLayout5') # you will get an error: # RuntimeError: objectTypeUI: Object 'window4|paneLayout5' not found. # with formLayout() as apiForm: # #with scrollLayout() as scroll: # with tabLayout('apiMethodCol') as self.apiMethodCol: # pass # status = helpLine(h=60) # So, instead, we do it old-school... apiForm = pm.formLayout() self.apiMethodCol = pm.tabLayout('apiMethodCol') pm.setParent(apiForm) status = pm.cmds.helpLine(h=60) pm.setParent(self.pane) apiForm.attachForm( self.apiMethodCol, 'top', 5 ) apiForm.attachForm( self.apiMethodCol, 'left', 5 ) apiForm.attachForm( self.apiMethodCol, 'right', 5 ) apiForm.attachControl( self.apiMethodCol, 'bottom', 5, status ) apiForm.attachPosition( status, 'bottom', 5, 20 ) apiForm.attachForm( status, 'bottom', 5 ) apiForm.attachForm( status, 'left', 5 ) apiForm.attachForm( status, 'right', 5 ) # Right Column: Mel Methods melForm = pm.formLayout() label1 = pm.text( label='Unassigned Mel Methods' ) self.unassignedMelMethodLister = pm.textScrollList() label2 = pm.text( label='Assigned Mel Methods' ) self.assignedMelMethodLister = pm.textScrollList() label3 = pm.text( label='Disabled Mel Methods' ) self.disabledMelMethodLister = pm.textScrollList() pm.setParent(self.pane) melForm.attachForm( label1, 'top', 5 ) melForm.attachForm( label1, 'left', 5 ) melForm.attachForm( label1, 'right', 5 ) melForm.attachControl( self.unassignedMelMethodLister, 'top', 0, label1 ) melForm.attachForm( self.unassignedMelMethodLister, 'left', 5 ) melForm.attachForm( self.unassignedMelMethodLister, 'right', 5 ) melForm.attachPosition( self.unassignedMelMethodLister, 'bottom', 5, 33 ) melForm.attachControl( label2, 'top', 5, self.unassignedMelMethodLister) melForm.attachForm( label2, 'left', 5 ) melForm.attachForm( label2, 'right', 5 ) melForm.attachControl( self.assignedMelMethodLister, 'top', 0, label2 ) melForm.attachForm( self.assignedMelMethodLister, 'left', 5 ) melForm.attachForm( self.assignedMelMethodLister, 'right', 5 ) melForm.attachPosition( self.assignedMelMethodLister, 'bottom', 5, 66 ) melForm.attachControl( label3, 'top', 5, self.assignedMelMethodLister) melForm.attachForm( label3, 'left', 5 ) melForm.attachForm( label3, 'right', 5 ) melForm.attachControl( self.disabledMelMethodLister, 'top', 0, label3 ) melForm.attachForm( self.disabledMelMethodLister, 'left', 5 ) melForm.attachForm( self.disabledMelMethodLister, 'right', 5 ) melForm.attachForm( self.disabledMelMethodLister, 'bottom', 5 ) pm.setParent('..') pm.popupMenu(parent=self.unassignedMelMethodLister, button=3 ) pm.menuItem(l='disable', c=pm.Callback( PymelControlPanel.disableMelMethod, self, self.unassignedMelMethodLister ) ) pm.popupMenu(parent=self.assignedMelMethodLister, button=3 ) pm.menuItem(l='disable', c=pm.Callback( PymelControlPanel.disableMelMethod, self, self.assignedMelMethodLister ) ) pm.popupMenu(parent=self.disabledMelMethodLister, button=3 ) pm.menuItem(l='enable', c=pm.Callback( PymelControlPanel.enableMelMethod)) self.classScrollList.extend( self.classList ) self.classScrollList.selectCommand( lambda: self.apiClassList_selectCB() ) pm.scriptJob(uiDeleted=[str(self.win),cacheResults]) self.win.show()
def show_UI(self): # Init main window if (pm.window("main_window", exists=True)): pm.deleteUI("main_window") self.main_window = pm.window(t=MAIN_WINDOW_TITLE, wh=MAIN_WINDOW_DIMENSIONS, s=MAIN_WINDOW_RESIZEABLE) # Main vertical layout window_v_layout = pm.columnLayout(adj=True, rs=MAIN_WINDOW_CONTENT_SPACING, h=MAIN_WINDOW_DIMENSIONS[1]) # Checklist scroll layout checklist_scroll_layout = pm.scrollLayout(cr=True) # Checklist vertical layout checklist_vertical_layout = pm.columnLayout(adj=True) # Checklist header checklist_frame_layout = pm.frameLayout(l='Checker Options') opVars = pm.language.Env.optionVars # Show function checklist for fn_name in self.lookup_order: # If option is in opVars, use that value # Otherwise, use default value fn = self.functions[fn_name] if fn_name in opVars: option = opVars[fn_name] self.options[fn_name] = option else: option = self.options[fn_name] # Per-row layout checklist_row_layout = pm.rowLayout(nc=2, cl2=('right', 'center'), cw2=CHECKLIST_COLUMN_WIDTHS) # Function description label pm.text(l=fn.desc, align='right') # Begin radio buttons radio_row_layout = pm.rowLayout(nc=3) collection = pm.radioCollection() # Draw skip radio button set_skip = pm.Callback(self.set_option, fn_name, self.checker_option.SKIP) skip_button = pm.radioButton(l='Skip', onc=set_skip) # Draw check radio button if fn.checkFn: set_check = pm.Callback(self.set_option, fn_name, self.checker_option.CHECK) check_button = pm.radioButton(l='Check', onc=set_check) # Draw cleanup radio button if fn.cleanupFn: set_cleanup = pm.Callback(self.set_option, fn_name, self.checker_option.CLEANUP) cleanup_button = pm.radioButton(l='Cleanup', onc=set_cleanup) # End radio row collection pm.setParent('..') # End radio row layout pm.setParent('..') # End per-row layout pm.setParent('..') # Set selected radio button based on selected option if option is self.checker_option.SKIP: selected = skip_button elif option is self.checker_option.CHECK: selected = check_button else: selected = cleanup_button pm.radioCollection(collection, edit=True, select=selected) # End checklist vertical layout pm.setParent('..') # End checklist scroll layout pm.setParent('..') log_frame_layout = pm.frameLayout(l='Log Output') # Start log scroll layout log_scroll_layout = pm.scrollLayout(cr=True, h=LOG_SCROLL_AREA_HEIGHT) # Log text object # The -32 is prevent the horizontal scrollbar from appearing self.log_text = pm.text(l=self.log_results, h=MAX_LOG_HEIGHT, al='left', w=MAIN_WINDOW_DIMENSIONS[0] - 32, ww=True) # End log scroll layout pm.setParent('..') pm.setParent('..') # Start button horizontal layout button_h_layout = pm.rowLayout(nc=3, cw3=(128, 128, 128), ct3=('both', 'both', 'both'), h=MAIN_BUTTON_AREA_HEIGHT) # If Run and Export Selected, check and attempt to export pm.button(l='Run and Export Selected', c=self.check_and_export) # If Check/Cleanup, run check and cleanup pm.button(l='Run', c=self.check) # If Cancel, close the window pm.button(l='Close', c=self.close_main_window) # End button horizontal layout pm.setParent('..') # End main vertical layout pm.setParent('..') pm.showWindow(self.main_window)
def _build_fk_tab(parent_layout): # Create column Layout with embedded shelf layout in second tab fk_tab_layout = pm.columnLayout('fkTab', adjustableColumn=True) pm.separator(height=5, style='none') pm.gridLayout(numberOfColumns=3, numberOfRows=2, cellWidth=72, cellHeight=44) cmd_str = ('import pymel.core as pm; ' \ 'import mimic_utils; ' \ 'pm.setFocus("fkTab");') for i in range(6): axis = i + 1 sel_cmd_str = cmd_str + ' mimic_utils.select_fk_axis_handle({})' \ .format(axis) button_img = 'a{}FkIcon.png'.format(axis) button_ann = 'Selects Axis {} FK Controller'.format(axis) pm.symbolButton(image=button_img, command=sel_cmd_str, annotation=button_ann) pm.setParent('..') # UI spacing pm.separator(height=3, style='none') pm.separator(height=11, style='out') pm.rowLayout(numberOfColumns=7, adjustableColumn=7, columnAttach=(1, 'left', 3), columnWidth=[(1, 20), (2, 45), (3, 22), (4, 45), (5, 22), (6, 45)], height=20) pm.text(label='A1:') pm.textField("t_a1", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 1), changeCommand=pm.Callback(mimic_utils.set_axis, 1)) pm.text(label=' A2:') pm.textField("t_a2", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 2), changeCommand=pm.Callback(mimic_utils.set_axis, 2)) pm.text(label=' A3:') pm.textField("t_a3", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 3), changeCommand=pm.Callback(mimic_utils.set_axis, 3)) # UI spacing pm.text(label='') pm.setParent('..') pm.separator(height=2, style='none') pm.rowLayout(numberOfColumns=7, adjustableColumn=7, columnAttach=(1, 'left', 3), columnWidth=[(1, 20), (2, 45), (3, 22), (4, 45), (5, 22), (6, 45)], height=20) pm.text(label='A4:') pm.textField("t_a4", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 4), changeCommand=pm.Callback(mimic_utils.set_axis, 4)) pm.text(label=' A5:') pm.textField("t_a5", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 5), changeCommand=pm.Callback(mimic_utils.set_axis, 5)) pm.text(label=' A6:') pm.textField("t_a6", font=FONT, rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 6), changeCommand=pm.Callback(mimic_utils.set_axis, 6)) # UI Spacing pm.text(label='') pm.setParent('..') pm.separator(height=7, style='none') # Get and set FK pose buttons pm.gridLayout(nc=2, cw=109, ch=25) pm.button(label="Get Pose", command=mimic_utils.get_fk_pose, annotation='Gets selected robot\'s current axis rotation ' \ 'values\nand prints them above') pm.button(label='Set Pose', command=mimic_utils.set_fk_pose, annotation='Sets selected robot\'s current axis rotation ' \ 'values\nto the input values above') pm.setParent('..') # Clear FK pose button pm.button(label='Clear', command=mimic_utils.clear_fk_pose_ui, annotation='Clears axis rotation input fields above') pm.separator(height=14, style='out') # Keyframe FK button pm.button(label="Set FK Keyframe", command=mimic_utils.key_fk, backgroundColor=[.7, .7, .7], annotation='Keyframes Robot\'s IK-FK hierarchy in FK mode:\n' \ 'target_CTRL:\n' \ ' ik = 0\n' \ ' visibility = 0\n' \ 'a*FK_CTRL:\n' \ ' rotateX, Y, or Z\n' \ 'FK_CTRLS\n' \ ' visibility = 1') pm.setParent(parent_layout) return fk_tab_layout
def make_quit_app_job(): pm.scriptJob(e=("quitApplication", pm.Callback(quit_app)))
def gui(self): """GUI for Plebes """ if pm.window('plebesDialog', exists=True): pm.deleteUI('plebesDialog') win = pm.window('plebesDialog', title='Rig Plebe', sizeable=False) win.setHeight(475) win.setWidth(300) layout = pm.frameLayout(height=475, width=300, marginHeight=10, marginWidth=10, labelVisible=False) template_label = pm.text(label='Choose a Character Template:') self.template_menu = pm.optionMenu('template_menu', alwaysCallChangeCommand=True) self.template_menu.changeCommand( pm.Callback(self.template_change, self.template_menu)) self.help = pm.scrollField(editable=False, wordWrap=True, height=200, text=" ") self.populate_template_menu(self.template_menu) import_fbx_btn = pm.button(label='Import FBX') import_fbx_btn.setCommand(self.import_fbx) import_fbx_btn.setAnnotation( "Import the FBX of your skinned character.") fbx_naming_btn = pm.button(label='Fix FBX Naming') fbx_naming_btn.setCommand(self.fix_fbx_naming) fbx_naming_btn.setAnnotation( "Replaces FBXASCxxx with '_' in node names from imported FBX \n" "files. This is needed when the FBX uses characters that are \n" "not supported in Maya.") pm.separator(style='in') get_guides_btn = pm.button(label='Import Guides') get_guides_btn.setCommand(self.import_guides) get_guides_btn.setAnnotation("Import a mGear biped guide template.") align_guides_btn = pm.button(label='Align Guides') align_guides_btn.setCommand(self.align_guides) align_guides_btn.setAnnotation( "Position the guides to match your character.\n\n" "Note! You will need to adjust some of the guides manually (e.g. " "the heel position and inner and outer foot).") rig_btn = pm.button(label='Build Rig') rig_btn.setCommand(self.rig) rig_btn.setAnnotation("Builds the mGear rig based on the guides.") attach_btn = pm.button(label='Attach Plebe to Rig') attach_btn.setCommand(self.attach_to_rig) attach_btn.setAnnotation( "Constrain the characters joints to the mGear rig.") win.show()
def _build_hotkeys_frame(parent_layout): hotkeys_frame = pm.frameLayout(label="Hotkeys", collapsable=True) hotkeys_column = pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') # Toggle IK/FK mode Hotkey toggle_mode_cmd_name = 'mimic_toggleIkFkMode' toggle_mode_annotation_str = 'Toggles Mimic Robot plugin IK/FK mode' toggle_mode_command_str = 'import mimic_utils; ' \ 'mimic_utils.toggle_ik_fk_ui()' pm.rowLayout(numberOfColumns=4, adjustableColumn=2, columnAttach=(1, 'left', 0), columnWidth=[(1, 72), (3, 45), (4, 50)], height=20) # Find hotkey assignment, if one exists, to populate the ui toggle_mode_hotkey_name = toggle_mode_cmd_name + 'Hotkey' toggle_mode_key = mimic_utils.find_hotkey(toggle_mode_hotkey_name) if not toggle_mode_key: toggle_mode_key = ' key' pm.text(label='Toggle IK/FK:') pm.textField("t_toggleIkFk", font=FONT, placeholderText=toggle_mode_key) pm.button(label='Create', width=45, height=20, command=pm.Callback(mimic_utils.assign_hotkey, toggle_mode_cmd_name, toggle_mode_annotation_str, toggle_mode_command_str)) pm.button(label='Remove', width=50, height=20, command=pm.Callback(mimic_utils.remove_hotkey, toggle_mode_cmd_name)) pm.setParent('..') pm.separator(height=3, style='none') # Keyframe IK/FK Hotkey key_ik_fk_cmd_name = 'mimic_keyIkFk' key_ik_fk_annotation_str = 'Keys Mimic robot IK/FK attributes' key_ik_fk_command_str = 'import mimic_utils; ' \ 'mimic_utils.key_ik_fk()' pm.rowLayout(numberOfColumns=4, adjustableColumn=2, columnAttach=(1, 'left', 0), columnWidth=[(1, 72), (3, 45), (4, 50)], height=20) # Find hotkey assignment, if one exists, to populate the ui key_IkFk_hotkey_name = key_ik_fk_cmd_name + 'Hotkey' key_IkFk_key = mimic_utils.find_hotkey(key_IkFk_hotkey_name) if not key_IkFk_key: key_IkFk_key = ' key' pm.text(label='Key IK/FK:') pm.textField("t_keyIkFk", font=FONT, placeholderText=key_IkFk_key) pm.button(label='Create', width=45, height=20, command=pm.Callback(mimic_utils.assign_hotkey, key_ik_fk_cmd_name, key_ik_fk_annotation_str, key_ik_fk_command_str)) pm.button(label='Remove', width=50, height=20, command=pm.Callback(mimic_utils.remove_hotkey, key_ik_fk_cmd_name)) pm.setParent(hotkeys_column) pm.separator(height=8, style='none') pm.setParent(parent_layout)
def createEditUI(self, *args): _logger.debug('createEditUI') self.editGrpForm = pm.columnLayout(columnOffset=("left", -1), columnAlign="left", adjustableColumn=True) pm.setParent(self.editGrpFrame) if (self.numberOfImagePlanesInScene() <= 0): pm.text("No image planes in scene to edit", align="center") pm.setParent(self.editGrpForm) else: self.alignGrpForm = pm.rowLayout(nc=5) pm.setParent(self.alignGrpForm) pm.text(" Camera ") pm.button(label='Select', width=120, command=pm.Callback(self.on_camselect_btn)) pm.button(label='Look through', width=120, command=pm.Callback(self.on_camlookthrough_btn)) pm.text(" ") _logger.debug('currentImgPlane[0] is %s' % self.currentImgPlane) # pm.checkBox( label='In all views', width=99, value=pm.imagePlane(self.currentImgPlane[0], q=1, showInAllViews=1), onc=self.on_views_change_all, ofc=self.on_views_change_current) pm.setParent(self.editGrpFrame) pm.floatSliderGrp("opacitySlider", label="Opacity", columnWidth3=(80, 50, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=0, fieldMaxValue=1, minValue=0, maxValue=1, step=0.01, cc=pm.Callback(self.on_opacity_change)) pm.floatSliderGrp("colorOffsetSlider", label="Brightness", columnWidth3=(80, 50, 60), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=0, fieldMaxValue=1, minValue=0, maxValue=1, step=0.01, cc=pm.Callback(self.on_colorOffset_change)) pm.floatSliderGrp("sizeSlider", label="Size", columnWidth3=(80, 60, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=0.1, fieldMaxValue=5.0, minValue=0.1, maxValue=5.0, step=0.1, cc=pm.Callback(self.on_size_change)) pm.floatSliderGrp("offsetXSlider", label="Offset X", columnWidth3=(80, 50, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=-1.0, fieldMaxValue=1.0, minValue=-1.0, maxValue=1.0, step=0.01, cc=pm.Callback(self.on_offsetX_change)) pm.floatSliderGrp("offsetYSlider", label="Offset Y", columnWidth3=(80, 50, 80), columnAlign3=("right", "left", "left"), adjustableColumn=0, field=True, fieldMinValue=-1.0, fieldMaxValue=1.0, minValue=-1.0, maxValue=1.0, step=0.01, cc=pm.Callback(self.on_offsetY_change)) #set slider values to current values self.updateImagePlaneEditSliders() pm.setParent(self.editGrpFrame) pm.formLayout( self.mainForm, e=True, attachForm=([self.editGrpFrame, 'left', 6]), attachControl=([self.editGrpFrame, 'top', 3, self.modeGrpFrame])) pm.setParent(self.mainForm)
def create(self): # create window "Imageplane Manager" ## destroy the window if it already exists try: pm.deleteUI(self.WINDOW_NAME, window=True) except: pass # draw the window self.WINDOW_NAME = pm.window(self.WINDOW_NAME, title=self.WINDOW_TITLE, width=self.WINDOW_SIZE[0], height=self.WINDOW_SIZE[1], sizeable=False) #main form _logger.debug("Creating Main Form") topLevelColumn = pm.columnLayout(adjustableColumn=True, columnAlign="center") self.mainForm = pm.formLayout(nd=100) #FIRST FL Manage Plane Manages control frame Layout***************************************************** self.modeGrpFrame = pm.frameLayout(label='Image Planes', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') #attach 'Manage Plane Manages control' group to main pm.formLayout(self.mainForm, e=True, attachForm=( [self.modeGrpFrame, 'top', 16], [self.modeGrpFrame, 'left', 6], )) self.modeGrpForm = pm.formLayout(nd=100) #Option Menu: available image planes self.imgplanesOptionMenu = pm.optionMenu(label='Image Planes', width=200, changeCommand=pm.Callback( self.on_imp_change)) # create menu item list for all image planes in scene _logger.debug("Creat item for all image planes in scnee") self.imp_option_list() pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.imgplanesOptionMenu, 'top', 10], [self.imgplanesOptionMenu, 'left', 20])) #Del, Del All, Select Button self.Sel_btn = pm.button(label='Sel', width=50, command=pm.Callback(self.on_select_btn)) self.Del_btn = pm.button(label='Del', width=50, command=pm.Callback(self.on_delete_btn)) pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.Sel_btn, 'top', 10]), attachControl=([ self.Sel_btn, 'left', 10, self.imgplanesOptionMenu ])) pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.Del_btn, 'top', 10]), attachControl=([self.Del_btn, 'left', 10, self.Sel_btn])) _logger.debug("Import new Btn") #File open: import new imageplane self.import_btn = pm.button(label='Import New', width=self.WINDOW_SIZE[0], command=pm.Callback(self.importWindowUI)) _logger.debug("ImportOption Menu") pm.formLayout(self.modeGrpForm, e=True, attachForm=([self.import_btn, 'left', 20]), attachControl=([ self.import_btn, 'top', 5, self.imgplanesOptionMenu ])) pm.setParent(self.mainForm) #SEC FL Edit Image Plane ************************************************************************** _logger.debug("Framelayout: Edit Image Plane") self.editGrpFrame = pm.frameLayout(label='Edit Image Plane', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') _logger.debug("createEditUI()") self.createEditUI() _logger.debug("attach 'Manage Plane Manages control' group to main") #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.editGrpFrame, 'left', 6]), attachControl=([self.editGrpFrame, 'top', 3, self.modeGrpFrame])) pm.setParent(self.mainForm) _logger.debug("Camera Retarget UI") #THIRD Camera Retarget ************************************************************************* self.cameraGrpFrame = pm.frameLayout(label='Camera Retarget', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn', cl=True) self.createCameraUI() self.cameraGrpForm = pm.formLayout(nd=100) #self.audioGrpForm = pm.formLayout(nd=100) #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.cameraGrpFrame, 'left', 6]), attachControl=([self.cameraGrpFrame, 'top', 3, self.editGrpFrame])) pm.setParent(self.mainForm) _logger.debug("Tools UI") #FOURTH FL Pro-Tools ************************************************************************* self.toolsGrpFrame = pm.frameLayout(label=' Pro - Tools', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') _logger.debug("Create Tools UI") self.createToolsUI() self.toolsGrpForm = pm.formLayout(nd=100) #self.audioGrpForm = pm.formLayout(nd=100) #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.toolsGrpFrame, 'left', 6]), attachControl=([self.toolsGrpFrame, 'top', 3, self.cameraGrpFrame])) #self.modeGrpForm = pm.formLayout(nd=100) pm.setParent(self.mainForm) #FIFTH FL Audio ************************************************************************* _logger.debug("Audio UI") self.audioGrpFrame = pm.frameLayout(label='Audio', collapsable=True, width=self.WINDOW_SIZE[0], borderStyle='etchedIn') self.audioGrpForm = pm.formLayout(nd=100) #self.audioGrpForm = pm.formLayout(nd=100) #attach 'Manage Plane Manages control' group to main pm.formLayout( self.mainForm, e=True, attachForm=([self.audioGrpFrame, 'left', 6]), attachControl=([self.audioGrpFrame, 'top', 3, self.toolsGrpFrame])) pm.showWindow()
def RecostructUI(self): template = pm.uiTemplate() template.define(pm.frameLayout , mh=6 , mw=5) template.define(pm.columnLayout , adj=1 , rs=2) with pm.window('RecostructWin' , title='Recostruct Subdiv v1.3' , menuBar=True , menuBarVisible=True) as win: pm.window('RecostructWin' , edit=True , width=420 , height=172) with pm.frameLayout(lv=False , bv=False , mh=2 , mw=7): with template: with pm.columnLayout(): pm.button(label='Recostruct Subdiv' , c=pm.Callback(self.Main) , h=40 , bgc=self.clrs['orange']) with pm.frameLayout('more' , l='More' , cll=True , cl=True , ec=pm.Callback(self.expand) , cc=pm.Callback(self.collapse)): with pm.columnLayout(cat=('left' , -20)): pm.checkBoxGrp( numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='Settings: ' , label1='Keep original (Recostructing is not undoable)' , v1=True , on1=pm.Callback(self.keepOrig_True) , of1=pm.Callback(self.keepOrig_False) ) pm.checkBoxGrp( numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='' , label1='Recostruct vertex positions' , v1=True , on1=pm.Callback(self.curvature_True) , of1=pm.Callback(self.curvature_False) , ) pm.checkBoxGrp( 'sharpCorners' , numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='' , label1='Sharp corners' , v1=True , on1=pm.Callback(self.sharpCorners_True) , of1=pm.Callback(self.sharpCorners_False) , ) pm.checkBoxGrp( numberOfCheckBoxes=1 , columnAlign=(1 , 'right') , label='' , label1='Turn Off progress bar (Increase speed)' , v1=False , on1=pm.Callback(self.progress_False) , of1=pm.Callback(self.progress_True) ) rb = pm.radioButtonGrp(numberOfRadioButtons=1 , on1=pm.Callback(self.reverse_False) , label='' , sl=1 , label1='Default starting point (For most cases)') pm.radioButtonGrp(numberOfRadioButtons=1 , on1=pm.Callback(self.reverse_True) , shareCollection=rb , label='' , label1='Reverse starting point (For special cases)') with pm.frameLayout(l='Progress'): pm.progressBar('progress' , h=25 , ii=True) with pm.rowColumnLayout( numberOfColumns=2 , cal=[(1 , 'left') , (2 , 'right')] , columnWidth=[(1 , 275) , (2 , 125)] ): pm.textField('meshes' , text='' , ed=False , width=200) pm.text('meshesNum' , label='' , height=25)
def _draw(self): # create buttons under parent and save them in local variables grid_layout_width = pm.gridLayout("selectionManager_gridLayout1", q=True, w=True) form_layout = pm.formLayout(p="selectionManager_gridLayout1", w=grid_layout_width, nd=100) with form_layout: self.replaceButton = pm.button(ann="Replace", l="R", w=17) self.addButton = pm.button(ann="Add", l="+", w=17) self.subtractButton = pm.button(ann="Subtract", l="-", w=17) self.saveButton = pm.button( ann="Save as quick selection set with the description as the " "name of the set", l="S", w=17) self.updateButton = pm.button( ann="Updates the list with the current selection", l="U", w=17) self.deleteButton = pm.button(ann="Deletes this button set", l="D", w=17) self.descriptionField = pm.textField(text=self.description, w=204) self.description = self.description self.layout = pm.formLayout( form_layout, edit=True, attachForm=[(self.replaceButton, "left", 0), (self.replaceButton, "top", 0), (self.replaceButton, "bottom", 0), (self.addButton, "top", 0), (self.addButton, "bottom", 0), (self.subtractButton, "top", 0), (self.subtractButton, "bottom", 0), (self.saveButton, "top", 0), (self.saveButton, "bottom", 0), (self.updateButton, "top", 0), (self.updateButton, "bottom", 0), (self.deleteButton, "top", 0), (self.deleteButton, "bottom", 0), (self.descriptionField, "top", 0), (self.descriptionField, "bottom", 0), (self.descriptionField, "right", 0)], attachControl=[(self.addButton, "left", 0, self.replaceButton), (self.subtractButton, "left", 0, self.addButton), (self.saveButton, "left", 0, self.subtractButton), (self.updateButton, "left", 0, self.saveButton), (self.deleteButton, "left", 0, self.updateButton), (self.descriptionField, "left", 0, self.deleteButton)], attachPosition=[(self.replaceButton, "right", 0, 5), (self.addButton, "right", 0, 10), (self.subtractButton, "right", 0, 15), (self.saveButton, "right", 0, 20), (self.updateButton, "right", 0, 25), (self.deleteButton, "right", 0, 30)]) self.replaceButton.setCommand(pm.Callback(self.selection_set.replace)) self.addButton.setCommand(pm.Callback(self.selection_set.add)) self.subtractButton.setCommand(pm.Callback( self.selection_set.subtract)) self.saveButton.setCommand(pm.Callback(self.save_button)) self.updateButton.setCommand(pm.Callback(self.selection_set.update)) self.deleteButton.setCommand(pm.Callback(self.delete_button))
def baseUI(): if pm.window('LDM', exists=1): pm.deleteUI('LDM') baseWin = pm.window('LDM', t='Asset manager', w=280, h=100) with baseWin: mainLayout = pm.columnLayout() attrLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) ADD = pm.button(l='ADD ATTR', w=140, h=30) COP = pm.button(l='COPY ATTR', w=140, h=30) ADD.setCommand(pm.Callback(addMTOAAttr)) COP.setCommand(pm.Callback(copyMTOAAttr)) smallLayout = pm.rowColumnLayout(nc=4, parent=mainLayout) LIN = pm.button(l='LINE', w=100, h=30) LIN.setCommand(pm.Callback(lineUp)) CRV = pm.button(l='CRV', w=60) CRV.setCommand(pm.Callback(curvesUI)) SI = pm.button(l='SI', w=60) SI.setCommand(pm.Callback(selectInstances)) BBOX = pm.button(l='BBOX', w=60) BBOX.setCommand(pm.Callback(boundingBox)) pm.separator(h=5, style='none') sbdLayout = pm.rowColumnLayout(nc=6, parent=mainLayout) SOF = pm.button(l='MAYA SMOOTH OFF', w=130, h=40) DIV0 = pm.button(l='0', w=30, h=40) DIV1 = pm.button(l='1', w=30, h=40) DIV2 = pm.button(l='2', w=30, h=40) DIV3 = pm.button(l='3', w=30, h=40) DIV4 = pm.button(l='4', w=30, h=40) pm.separator(h=5, style='none') colorLayout = pm.rowColumnLayout(nc=3, parent=mainLayout) TXGET = pm.button(l='GET COLOR', w=80, h=40) DSGET = pm.button(l='GET DISPL', w=80) GETMAT = pm.button(l='GET MATERIAL', w=120) matLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) TXSHOW = pm.button(l='SHOW TX', w=140, h=30) TXCLN = pm.button(l='CLEAN TX', w=140) matLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) attrField = pm.textField(tx='GEN_BASE_A', w=90, h=30) SETMAT = pm.button(l='SET MATERIAL', w=190) pm.separator(h=6, style='none') orgLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) PRG = pm.button(l='SETUP STATIC', w=140, h=45) DYN = pm.button(l='SETUP DYNAMIC', w=140) PRG.setCommand(pm.Callback(assetPrxOrganize)) DYN.setCommand(pm.Callback(assetDynOrganize)) pm.separator(h=6, style='none') checkLayout = pm.rowColumnLayout(nc=4, parent=mainLayout) PRX = pm.button(l='PROXY', w=60, h=40) SI = pm.button(l='STANDIN', w=60, h=40) CHK = pm.button(l='CHECK SCENE', w=130, h=40) DEL = pm.button(l='DEL', w=30, h=40) CHK.setCommand(pm.Callback(checkAttr)) DEL.setCommand(pm.Callback(delUnlock)) pm.separator(h=15, style='none') convertLayout = pm.rowColumnLayout(nc=1, parent=mainLayout) GTA = pm.button(l='CONVERT TO STANDIN', w=280, h=50) SOF.setCommand(pm.Callback(setSBD, 'off')) DIV0.setCommand(pm.Callback(setSBD, 0)) DIV1.setCommand(pm.Callback(setSBD, 1)) DIV2.setCommand(pm.Callback(setSBD, 2)) DIV3.setCommand(pm.Callback(setSBD, 3)) DIV4.setCommand(pm.Callback(setSBD, 4)) TXGET.setCommand(pm.Callback(txGet, 'mtoa_constant_mColor', '.jpg')) DSGET.setCommand(pm.Callback(txGet, 'mtoa_constant_mDisp', '.exr')) TXSHOW.setCommand(pm.Callback(txShow)) TXCLN.setCommand(pm.Callback(txClean)) SETMAT.setCommand(pm.Callback(setMAT, attrField)) GETMAT.setCommand(pm.Callback(getMAT)) PRX.setCommand(pm.Callback(switchProxy)) SI.setCommand(pm.Callback(switchStandin)) GTA.setCommand(pm.Callback(geoToAsset)) baseWin.show()
def ui(): win_title = 'Draw A Snowpiece' win_name = 'snow_window' win_width = 300 win_height = 160 if pm.window(win_name, exists=True): pm.deleteUI(win_name) ### create the menu window snow_win = pm.window(win_name, title=win_title, widthHeight=(win_width, win_height), sizeable=False) col_layout1 = pm.columnLayout(adj=True) row_layout1 = pm.rowLayout(nc=2, cw2=((win_width / 2 - 10), (win_width / 2 + 10)), parent=col_layout1) ### select object button button_sel_obj = pm.button(label='Select Object', width=100, command=pm.Callback(select_obj, 0)) ### select destination point button button_sel_end_point = pm.button(label='Select Destination Point', width=130, command=pm.Callback(select_obj, 2)) ### slider for scale slider_scale = pm.floatSliderGrp(label='Scale', field=True, minValue=-2.0, maxValue=2.0, fieldMinValue=-2.0, fieldMaxValue=2.0, value=0.5, cw3=(40, 50, 200), adj=3, parent=col_layout1) ### slider for angle slider_angle = pm.floatSliderGrp(label='Angle', field=True, minValue=-30, maxValue=30, fieldMinValue=-30, fieldMaxValue=30, value=0, cw3=(40, 50, 200), adj=3, parent=col_layout1) ### slider for level slider_level = pm.intSliderGrp(label='Level', field=True, minValue=0, maxValue=10, fieldMinValue=0, fieldMaxValue=10, value=4, cw3=(40, 50, 200), adj=3, parent=col_layout1) ### layout for run button and cancel button row_layout2 = pm.rowLayout(nc=2, cw2=((win_width / 2), (win_width / 2)), co2=(20, 20), parent=col_layout1) button_run = pm.button(label='Run', width=100) button_run.setCommand( pm.Callback(on_click_run, slider_scale=slider_scale, slider_angle=slider_angle, slider_level=slider_level, snow_win=snow_win)) button_cancel = pm.button(label='Cancel', width=100, command=pm.Callback(snow_win.delete)) snow_win.show() snow_win.setWidthHeight((win_width, win_height))
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_Grades05() 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.lighting = sal.Grading_Section(name = 'Lighting', fileName = r"%s/Comments/proj06_lighting.txt" % (self.path), field = self.total.queryLight(), toUpdate = self.total) self.lighting.create() pm.setParent(grading) self.mat = sal.Grading_Section(name = 'Materials/Textures', fileName = r"%s/Comments/proj06_mat.txt" % (self.path), field = self.total.queryMat(), toUpdate = self.total) self.mat.create() pm.setParent(grading) self.ray = sal.Grading_Section(name = 'Raytracing', fileName = r"%s/Comments/proj06_ray.txt" % (self.path), field = self.total.queryRay(), toUpdate = self.total) self.ray.create() pm.setParent(grading) self.compFocal = sal.Grading_Section02(name = 'Comp/Focal Length', fileName = r"%s/Comments/proj06_compFocal.txt" % (self.path), field = self.total.queryComp(), toUpdate = self.total) self.compFocal.create() pm.setParent(grading) self.antiAliasing = sal.Grading_Section02(name = 'Antialias/Noise Qual', fileName = r"%s/Comments/proj06_antiAliasing.txt" % (self.path), field = self.total.queryAnti(), toUpdate = self.total) self.antiAliasing.create() pm.setParent(grading) self.pro = sal.Grading_Prof02(name = 'Professionalism', fileName = r"%s/Comments/proj06_prof.txt" % (self.path), field = self.total.queryPro(), fileStart = r"%s/Startup/proj06_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 ui_create(self): self.ui_close() self.window = pm.window(WIN_NAME, title=SCRIPT_NAME, maximizeButton=False) with self.window: pm.setUITemplate('DefaultTemplate', pushTemplate=True) with pm.formLayout() as self.ui_LAY_mainForm: with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top: pm.tabLayout(self.ui_TAB_top, e=True, height=1) with pm.formLayout() as self.ui_LAY_attachForm: with pm.tabLayout( tabsVisible=False, scrollable=True, innerMarginWidth=4) as self.ui_TAB_inner: with pm.columnLayout(adjustableColumn=True ) as self.ui_LAY_mainColumn: with self.ui_createFrame('Manual Orient', collapsed=True): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): # pm.separator(style='none', height=5) pm.button( label='Create Tripod', height=MAIN_BUTTONS_HEIGHT, command=self.ui_onBtnCreateTripod) # pm.separator(style='none', height=5) with self.ui_createFrame('Automatic Orient'): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): with self.ui_createButtonTextFieldRowLayout( ): pm.button( label='Set Object', command=pm.Callback( self. ui_onBtnSetCompClicked, OriData.OriObject)) self.ui_TXTFLD_objectName = pm.textField( editable=False) with self.ui_createButtonTextFieldRowLayout( ): pm.button( label='Set Pivot', command=pm.Callback( self. ui_onBtnSetCompClicked, OriData.OriPivot)) self.ui_TXTFLD_pivotVtx = pm.textField( editable=False) with self.ui_createButtonTextFieldRowLayout( ): pm.button( label='Set Aim', command=pm.Callback( self. ui_onBtnSetCompClicked, OriData.OriAim)) self.ui_TXTFLD_aimVtx = pm.textField( editable=False) with self.ui_createButtonTextFieldRowLayout( ): pm.button( label='Set Up', command=pm.Callback( self. ui_onBtnSetCompClicked, OriData.OriUp)) self.ui_TXTFLD_upVtx = pm.textField( editable=False) # pm.separator(style='none', height=5) with pm.formLayout() as ui_LAY_btnForm: ui_BTN_reset = pm.button( label='Reset', height=MAIN_BUTTONS_HEIGHT, command=self. ui_onBtnResetClicked) self.ui_BTN_fixOrient = pm.button( label='Fix Orientation', height=MAIN_BUTTONS_HEIGHT, command=self.ui_onBtnFixOrient) ui_LAY_btnForm.attachForm( ui_BTN_reset, 'top', 5) ui_LAY_btnForm.attachForm( ui_BTN_reset, 'left', 2) ui_LAY_btnForm.attachPosition( ui_BTN_reset, 'right', 2, 50) ui_LAY_btnForm.attachForm( ui_BTN_reset, 'bottom', 2) ui_LAY_btnForm.attachForm( self.ui_BTN_fixOrient, 'top', 5) ui_LAY_btnForm.attachPosition( self.ui_BTN_fixOrient, 'left', 2, 50) ui_LAY_btnForm.attachForm( self.ui_BTN_fixOrient, 'right', 2) ui_LAY_btnForm.attachForm( self.ui_BTN_fixOrient, 'bottom', 2) self.ui_btn_close = pm.button(label='Close', height=MAIN_BUTTONS_HEIGHT, command=self.ui_close) pm.setUITemplate('DefaultTemplate', popTemplate=True) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0) self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5, self.ui_btn_close) self.ui_LAY_mainForm.attachNone(self.ui_btn_close, 'top') self.ui_LAY_mainForm.attachForm(self.ui_btn_close, 'left', 5) self.ui_LAY_mainForm.attachForm(self.ui_btn_close, 'bottom', 5) self.ui_LAY_mainForm.attachForm(self.ui_btn_close, 'right', 5)
def gui(): global wnd_connector_window, windowKeepAlive global chk_keepAlive, chk_appendPad global txt_rootJoint, txt_endJoint global opt_shapeOptions wnd_connector_window = pm.window(title="Connector Window", width=windowWidth, height=windowHeight, sizeable=True) pm.columnLayout(numberOfChildren=2, columnAlign="left") mainTabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) tab_1 = pm.columnLayout(numberOfChildren=2) # Tab1 begin pm.text(label="<i>Things to work on</i>") pm.text( label= "Autosnapper\nJoint connector\nShape maker integration\nJoint orient tool", align="left") pm.setParent(mainTabs) # Tab1 end tab_2 = pm.columnLayout(width=windowWidth - 10, height=windowHeight - 50) #Tab 2 begin pm.frameLayout(collapsable=True, label="Pad Object", width=450) pm.rowLayout(numberOfColumns=3, columnWidth=[(1, 150), (2, 200), (3, 100)]) pm.text(label="Choose an object to pad:") pm.text("padObject", label="<i>nothing selected</i>") pm.button(label="Choose item", command=pm.Callback(selectItem)) pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 350)]) pm.text("Automatically append \"_pad\" to end?") chk_appendPad = pm.checkBox("appendPad", value=True, label="") pm.setParent("..") pm.rowLayout(numberOfColumns=3) pm.text(width=150, label="") pm.button(label="Pad this", command=pm.Callback(padObject)) pm.text(width=150, label="") pm.setParent("..") pm.setParent(mainTabs) #Tab 2 end tab_3 = pm.columnLayout(numberOfChildren=2, columnAlign="left") pm.frameLayout(label="Choose options:", width=450) pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text(label="Choose a shape:") opt_shapeOptions = pm.optionMenu(width=100) pm.menuItem(label="Circle") pm.menuItem(label="Sphere") pm.menuItem(label="Square") pm.menuItem(label="Cube") pm.menuItem(label="2D Arrow") pm.menuItem(label="3D Arrow") pm.menuItem(label="Round Pointer") pm.menuItem(label="COG Circle") pm.menuItem(label="Compass") pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text(label="Enter a name.\nLeave blank for default shape name.") txt_shapeName = pm.textField(placeholderText="shape") pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text( label="Insert a suffix.\nLeave blank for default\n\"icon\" to be added" ) txt_shapeSuffix = pm.textField(placeholderText="icon") pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnAlign=([1, "left"], [2, "right"]), width=450, columnWidth=([1, 200], [2, 250])) pm.text(label="Shape is placed on:") opt_placementOption = pm.optionMenu(width=150) pm.menuItem(label="Origin") pm.menuItem(label="Currently Selected Object") pm.setParent("..") pm.rowLayout(numberOfColumns=1, columnAlign=([1, "center"]), width=450, columnWidth=([1, 450])) pm.button(label="Create Shape", command=pm.Callback(createShape, opt_shapeOptions, txt_shapeName, txt_shapeSuffix, opt_placementOption)) pm.setParent("..") pm.setParent(mainTabs) #Tab 3 end tab_4 = pm.columnLayout(numberOfChildren=1, columnAlign="left") pm.rowLayout(numberOfColumns=3, width=450, columnWidth=([1, 150], [2, 200], [3, 150])) pm.text(label="Select the root joint:") txt_rootJoint = pm.textField(placeholderText="Choose joint", editable=False) pm.button(label="Select root", command=pm.Callback(fkikSelectRoot)) pm.setParent("..") pm.rowLayout(numberOfColumns=3, width=450, columnWidth=([1, 150], [2, 200], [3, 150])) pm.text(label="Select the end joint\n(for IK creation)") txt_endJoint = pm.textField(placeholderText="Choose joint", editable=False) pm.button(label="Select end joint", command=pm.Callback(fkikSelectEnd)) pm.setParent("..") pm.rowLayout(numberOfColumns=2, width=450, columnWidth=([1, 350], [2, 150])) pm.text(label="Create controls on respective joints?") chk_control_create = pm.checkBox("", value=True) pm.setParent("..") pm.rowLayout(numberOfColumns=2, width=450, columnWidth=([1, 350], [2, 150])) pm.text("Create controls in hierarchy?") chk_control_hierarchy = pm.checkBox(label="", value=True) pm.setParent("..") pm.rowLayout(numberOfColumns=2, width=450, columnWidth=([1, 350], [2, 150])) pm.text(label="Connect controls on respective joints?") chk_control_connect = pm.checkBox(label="", value=True) pm.setParent("..") pm.setParent(mainTabs) pm.setParent("..") mainTabs.setTabLabel([tab_1, "TODO"]) mainTabs.setTabLabel([tab_2, "Snapper"]) mainTabs.setTabLabel([tab_3, "Shape Maker"]) mainTabs.setTabLabel([tab_4, "FK/IK Creator"]) chk_keepAlive = pm.checkBox( "Automatically close window", value=windowKeepAlive, changeCommand=pm.Callback(autocloseWindowToggle)) pm.showWindow(connector_window)
def createImageFormatControls(self): self.createGlobalsNode() self.createImageFormats() if pm.optionMenuGrp("openMayaImageFormats", q=True, exists=True): pm.deleteUI("openMayaImageFormats") self.imageFormatCtrl = pm.optionMenuGrp("openMayaImageFormats", label="Image Formats", cc=pm.Callback(self.imageFormatCallback)) for pr in self.imageFormats: log.debug("adding image format: " + pr) pm.menuItem(pr) return self.imageFormatCtrl
def create(self): # destroy the window if it already exists try: pm.deleteUI(self.WINDOW_NAME, window=True) except: pass # draw the window with pm.window(self.WINDOW_NAME) as res_window: with pm.columnLayout(adjustableColumn=True): cmds.checkBox(label='Use Color Temperature', onCommand=pm.Callback(self.test, True), offCommand=pm.Callback(self.test, False)) self.canvasName = cmds.canvas(rgbValue=(1, 0, 1), width=100, height=20) self.tempertaure = cmds.intSliderGrp(field=True, label='Temperature', minValue=0, maxValue=15000, fieldMinValue=1000, fieldMaxValue=100000000376832, value=6500, enable=False, changeCommand=pm.Callback(self.set_aiColorTemperature)) pm.separator(style='in', height=4) self.exposure = cmds.floatSliderGrp(label='Exposure', field=True, minValue=-5.0, maxValue=5.0, fieldMinValue=-100.0, fieldMaxValue=100.0, value=5, changeCommand=pm.Callback(self.set_float_attr, exposure=True)) pm.separator(style='in', height=4) self.sample = cmds.intSliderGrp(field=True, label='Samples', minValue=0, maxValue=10, fieldMinValue=0, fieldMaxValue=20, value=1, changeCommand=pm.Callback(self.set_int_attr, sample=True)) self.radius = cmds.floatSliderGrp(label='Radius', field=True, minValue=0, maxValue=10.0, fieldMinValue=0, fieldMaxValue=100.0, value=0, changeCommand=pm.Callback(self.set_float_attr, radius=True)) cmds.checkBox(label='Normalize',value=True, onCommand=pm.Callback(self.checkbox,"n",True), offCommand=pm.Callback(self.checkbox,"n", False)) pm.separator(style='in', height=4) cmds.checkBox(label='Cast Shadows',value=True, onCommand=pm.Callback(self.checkbox,"cs",True), offCommand=pm.Callback(self.checkbox,"cs", False)) self.shadow_density = cmds.floatSliderGrp(label='Shadow Density', field=True, minValue=0, maxValue=1, fieldMinValue=0, fieldMaxValue=1, value=1.0, changeCommand=pm.Callback(self.set_float_attr, shadow_density=True)) pm.separator(style='in', height=4) cmds.checkBox(label='Cast Volumetric Shadows',value=True, onCommand=pm.Callback(self.checkbox,"cvs",True), offCommand=pm.Callback(self.checkbox,"cvs", False)) self.volumeSamples = cmds.intSliderGrp(field=True, label='Volume Sample', minValue=0, maxValue=10, fieldMinValue=0, fieldMaxValue=20, value=2,changeCommand=pm.Callback(self.set_int_attr, volumeSamples=True)) self.status_line = pm.textField(editable=False) cmds.button(label=u"刷新选择",command=pm.Callback(self.refresh)) pm.text(label=u'此面板参数一经修改,就会影响所选灯光中含有对应属性的数值') res_window.setWidthHeight((500, 400))
def show_window(self): window_name = "设置通道".decode("utf-8") self.pass_dict = { 'red': ["红".decode("utf-8"), [1, 0, 0]], 'green': ["绿".decode("utf-8"), [0, 1, 0]], 'black': ["黑".decode("utf-8"), [0, 0, 0]], 'blue': ["蓝".decode("utf-8"), [0, 0, 1]], 'rim': ["边缘光".decode("utf-8"), [1, 1, 1]] } self.pop = {} if pm.window(window_name, q=1, ex=1): pm.deleteUI(window_name) if pm.windowPref(window_name, exists=1): pm.windowPref(window_name, remove=1) with pm.window(window_name): with set_template(): with pm.frameLayout(): with pm.rowLayout(numberOfColumns=3, columnWidth3=[420, 50, 50]): self.renderer = self.render_settings.currentRenderer.get( ) pm.text('info_text', label='') self.show_sg_attrs() pm.checkBox('hair_check', label='hair', onCommand=pm.Callback( self.show_hair_attrs), offCommand=pm.Callback(self.show_sg_attrs)) pm.checkBox('all_check', label='all', onCommand=pm.Callback(self.show_all_attrs), offCommand=pm.Callback(self.show_sg_attrs)) with pm.frameLayout(): with pm.rowLayout(numberOfColumns=5): pm.button('create_aov', label="创建mask aov".decode("utf-8"), command=self.add_mask_aov) if self.renderer == "arnold": rim_btn = pm.button( label="创建rim aov".decode('utf-8'), command=self.add_rim_aov) costom_btn = pm.button( label="创建常用aov".decode("utf-8")) popup_menu_left = pm.popupMenu(parent=costom_btn, button=1) pm.menuItem(parent=popup_menu_left, label='AO', command=pm.Callback( self.create_costom_aov, "AO")) pm.menuItem(parent=popup_menu_left, label='ambocc', command=pm.Callback( self.create_costom_aov, "ambocc")) pm.menuItem(parent=popup_menu_left, label='lambert', command=pm.Callback( self.create_costom_aov, "lambert")) popup_menu_right = pm.popupMenu(parent=costom_btn, button=3) pm.menuItem(parent=popup_menu_right, label='Set AO samples', command=self.set_ao_samples) pm.button(label="创建自定义aov".decode("utf-8"), command=self.add_custom_aov) if self.renderer == "mentalRay": pm.button(label=u"重建aov", command=self.rebuld_aov) elif self.renderer == 'arnold': pm.button(label=u"重建aov", command=self.rebuild_arnold_aov_final) with pm.frameLayout(): with pm.rowLayout(numberOfColumns=len(self.pass_dict)): all_pass = ["red", "green", "blue", "black", "rim"] if self.renderer == "mentalRay": all_pass = all_pass[:-1] for i in all_pass: pm.button(label=self.pass_dict[i][0], backgroundColor=self.pass_dict[i][1]) self.pop[i] = pm.popupMenu( button=1, postMenuCommand=pm.Callback( self.show_aov_lists, i))
def __init__(self, operation=0, setTargetFromSelection=True, menuBarVisible=True, space=om.MSpace.kObject, minDeltaLength=0.00001, templateDuplicate=True, visibleDuplicate=True): """ :param operation: (int) 0=Smooth delta, 1=Copy vertex, 2=Closest point, 3=Closest vertex, 4=Average vertex :param setTargetFromSelection: (bool) if there is no previous target stored (=first time running the UI in the maya instance) use the current selection :param space: (int) om.MSpace.k___ :param menuBarVisible: (bool) settings menuBar visibility :param minDeltaLength: (float) deltas shorter than this are ignored :param templateDuplicate: (bool) duplicate.template=___ :param visibleDuplicate: (bool) duplicate.visibility=___ """ initializeMaya() self.minDeltaLengthDefault = minDeltaLength with pm.verticalLayout() as mainLayout: with pm.menuBarLayout() as self.menuBar: self.space = pm.menu(label='Space', tearOff=True) pm.radioMenuItemCollection() self.spaces = [] for name, value in self.getSpaceStrings(space): self.spaces.append( pm.menuItem(label=name, radioButton=value, command=pm.Callback( self.syncMelVariablesWithUi))) pm.menu(label='Settings') self.templateDuplicate = pm.menuItem( label='template DUPLICATE', checkBox=templateDuplicate) self.visibleDuplicate = pm.menuItem(label='visible DUPLICATE', checkBox=visibleDuplicate) self.minDeltaLength = pm.menuItem( label='minDeltaLength: {}'.format(minDeltaLength), command=pm.Callback(self.setMinDeltaLengthDialog)) pm.menu(label='Help') # pm.menuItem(label='TODO: demo video (vimeo)') # pm.menuItem(label='TODO: latest installer (...)') pm.menuItem(label='latest version (github)', command=pm.Callback(self.getLatestVersion)) self.menuBar.setMenuBarVisible(menuBarVisible) with pm.horizontalLayout() as targetLayout: pm.button(l='Target:', c=pm.Callback(self.setTargetFromSelection)) self.target = pm.textField(en=False) variableTest = mm.eval('whatIs "$prDP_operation"') if variableTest != 'Unknown': self.target.setText(mm.eval('$tempMelVar=$prDP_driver')) targetLayout.redistribute(0, 1) pm.popupMenu(parent=targetLayout, button=3) pm.menuItem(label='intermediate of selection', c=pm.Callback(self.setTargetFromSelectionIntermediate)) pm.menuItem(label='DUPLICATE of selection', c=pm.Callback(self.setTargetFromDuplicateOfSelection)) with pm.verticalLayout() as operationLayout: self.operation1 = pm.radioButtonGrp( labelArray2=['Smooth delta', 'Copy vertex'], numberOfRadioButtons=2, columnWidth2=[110, 110], columnAlign2=['left', 'left'], changeCommand=pm.Callback(self.syncMelVariablesWithUi)) self.operation1.setSelect(operation + 1) self.operation2 = pm.radioButtonGrp( shareCollection=self.operation1, labelArray2=['Closest point', 'Closest vertex'], numberOfRadioButtons=2, columnWidth2=[110, 110], columnAlign2=['left', 'left'], changeCommand=pm.Callback(self.syncMelVariablesWithUi)) pm.separator() self.operation3 = pm.radioButtonGrp( shareCollection=self.operation1, label1='Average vertex', numberOfRadioButtons=1, columnWidth=[1, 110], columnAlign=[1, 'left'], changeCommand=pm.Callback(self.syncMelVariablesWithUi)) operationLayout.redistribute(5, 5, 1, 5) pm.popupMenu(parent=operationLayout, button=3) pm.menuItem(label='toggle menuBar', c=pm.Callback(self.toggleMenuBar)) with pm.horizontalLayout() as toolLayout: pm.button(label='Enter Tool', command=pm.Callback(self.enterTool)) pm.button(label='Close', command=pm.Callback(self.close)) toolLayout.redistribute() mainLayout.redistribute(0, 0, 0, 1) if setTargetFromSelection and not self.target.getText(): self.setTargetFromSelection() self.show() self.syncMelVariablesWithUi()
def _build_ik_tab(parent_layout): # Create column Layout for IK controls ik_tab_layout = pm.columnLayout('ikTab', adj=True, width=100) pm.gridLayout(numberOfColumns=3, cellWidth=72, cellHeight=126) # Flip robot base button pm.symbolButton(image='flipBaseIcon.png', command=mimic_utils.flip_robot_base, annotation='Changes IK solution by flipping robot\'s base') # Flip robot elbow button pm.symbolButton( image='flipElbowIcon.png', command=mimic_utils.flip_robot_elbow, annotation='Changes IK solution by flipping robot\'s elbow') # FLip robot wrist button pm.symbolButton( image='flipWristIcon.png', command=mimic_utils.flip_robot_wrist, annotation='Changes IK solution by flipping robot\'s wrist') pm.setParent(ik_tab_layout) # Set parent to IK tab column layout pm.gridLayout(numberOfColumns=2, cellWidth=108, cellHeight=52) # Invert Axis 4 button pm.symbolButton(image='flipA4Icon.png', command=pm.Callback(mimic_utils.invert_axis, 4), annotation='Inverts Axis 6 rotation +/- 360 degrees') # Invert Axis 6 button pm.symbolButton(image='flipA6Icon.png', command=pm.Callback(mimic_utils.invert_axis, 6), annotation='Inverts Axis 6 rotation +/- 360 degrees') pm.setParent(ik_tab_layout) # Set parent to IK tab column layout pm.separator(height=5, style='none') pm.separator(height=11, style='out') # Key Animation Tool checkbox pm.rowLayout(numberOfColumns=1) pm.checkBox('cb_keyToolCtrl', label="Key tool controller", annotation='If checked, Tool Controller\'s Translate ' \ 'and Rotate attributes will be keyed', value=1) pm.setParent(ik_tab_layout) # Set parent to IK tab column layout pm.separator(height=5, style='none') # Keyframe IK configuration button pm.button(label='Set IK Keyframe', command=mimic_utils.key_ik, annotation='Keyframes Robot\'s IK-FK hierarchy in IK mode:\n' \ 'target_CTRL:\n' \ ' ik = 1\n' \ ' visibility = 1\n' \ ' IK Solution 1, 2, and 3\n' \ 'a*FK_CTRL:\n' \ ' rotateX, Y, or Z\n' \ 'FK_CTRLS\n' \ ' visibility = 0') pm.setParent(parent_layout) return ik_tab_layout
def __init__(self, **options): super(UI, self).__init__(**options) pm.menu(label='Options', tearOff=True, parent=self) pm.menuItem(label='Export members', c=pm.Callback(self.export_members)) pm.menuItem(label='Import members', c=pm.Callback(self.import_members)) pm.menuItem(label='---', enable=False) self.select_members_in_scene = pm.menuItem('Select members in scene', checkBox=DEFAULTS['select_members_in_scene']) with pm.verticalLayout() as main_layout: with pm.horizontalLayout() as content_layout: with pm.verticalLayout() as set_layout: with pm.verticalLayout() as set_top_layout: pm.button(label='load selection', c=pm.Callback(self.load_sets_from_selection)) pm.button(label='load all', c=pm.Callback(self.load_sets_from_scene)) pm.separator() pm.button(label='select in scene', c=pm.Callback(self.select_sets_in_scene)) set_top_layout.redistribute() self.sets_list = pm.textScrollList(allowMultiSelection=True, sc=pm.Callback(self.load_members)) # load_members set_layout.redistribute(0, 1) with pm.verticalLayout() as member_layout: with pm.verticalLayout() as member_head_layout: self.active_set = pm.textField(enable=False) with pm.horizontalLayout() as member_selection_layout: pm.button(label='+', c=pm.Callback(self.add_members_from_selection)) pm.button(label='-', c=pm.Callback(self.remove_members_from_selection)) pm.button(label='fix', c=pm.Callback(self.fix_member_order)) member_selection_layout.redistribute() pm.separator() member_head_layout.redistribute() with pm.horizontalLayout() as dag_layout: self.dag_member_list = pm.textScrollList(allowMultiSelection=True, sc=pm.Callback(self.dag_selection)) with pm.verticalLayout(w=20) as dag_button_layout: pm.text('dag') pm.button(label='UP', c=pm.Callback(self.move_dag_members_up)) pm.button(label='DN', c=pm.Callback(self.move_dag_members_down)) pm.button(label='-', c=pm.Callback(self.remove_active_dag_member)) dag_button_layout.redistribute() dag_layout.redistribute(3, 1) with pm.horizontalLayout() as dn_layout: self.dn_member_list = pm.textScrollList(allowMultiSelection=True, sc=pm.Callback(self.dn_selection)) with pm.verticalLayout(w=20) as dn_button_layout: pm.text('dn') pm.button(label='UP', c=pm.Callback(self.move_dn_members_up)) pm.button(label='DN', c=pm.Callback(self.move_dn_members_down)) pm.button(label='-', c=pm.Callback(self.remove_active_dn_member)) dn_button_layout.redistribute() dn_layout.redistribute(3, 1) member_layout.redistribute(0, 1, 1) content_layout.redistribute(4, 5) main_layout.redistribute() self.show() self.load_sets_from_selection()
def baseUI(): if pm.window('ATM', exists=1): pm.deleteUI('ATM') baseWin = pm.window('ATM', t='Attribute manager', w=280, h=100) with baseWin: mainLayout = pm.columnLayout() addLayout = pm.rowColumnLayout(nc=3, parent=mainLayout) floatField = pm.textField(tx='mTileUV', w=120, h=25) ADFL = pm.button(l='ADD FLOAT', w=80, h=25) DLFL = pm.button(l='DEL FLOAT', w=80, h=25) stringField = pm.textField(tx='mColor mDisp mMat', w=120, h=25) ADST = pm.button(l='ADD STRING', w=80, h=25) DLST = pm.button(l='DEL STRING', w=80, h=25) colorField = pm.textField(tx='mMask_A', w=120, h=25) ADCL = pm.button(l='ADD COLOR', w=80, h=25) DLCL = pm.button(l='DEL COLOR', w=80, h=25) allLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) ADALL = pm.button(l='ADD ALL', w=140, h=35) DLALL = pm.button(l='DELETE ALL', w=140, h=35) pm.separator(h=10, style='none') setLayout = pm.rowColumnLayout(nc=3, parent=mainLayout) floatSetField = pm.textField(tx='mTileUV', w=60, h=25) floatValField = pm.textField(tx='256', w=150, h=25) SETFL = pm.button(l='SET FLOAT', w=70, h=25) stringSetField = pm.textField(tx='mMat', w=60, h=25) stringValField = pm.textField(tx='GEN_BASE_A', w=150, h=25) SETST = pm.button(l='SET STRING', w=70, h=25) colorSetField = pm.textField(tx='mMask_A', w=60, h=25) colorValField = pm.textField(tx='R', w=150, h=25) SETCL = pm.button(l='SET COLOR', w=70, h=25) ADFL.setCommand(pm.Callback(addFloatAttr, floatField)) DLFL.setCommand(pm.Callback(delFloatAttr, floatField)) ADST.setCommand(pm.Callback(addStringAttr, stringField)) DLST.setCommand(pm.Callback(delStringAttr, stringField)) ADCL.setCommand(pm.Callback(addColorAttr, colorField)) DLCL.setCommand(pm.Callback(delColorAttr, colorField)) ADALL.setCommand( pm.Callback(addAll, floatField, stringField, colorField)) DLALL.setCommand( pm.Callback(delAll, floatField, stringField, colorField)) SETFL.setCommand( pm.Callback(setAttrFloat, floatSetField, floatValField)) SETST.setCommand( pm.Callback(setAttrString, stringSetField, stringValField)) SETCL.setCommand( pm.Callback(setAttrColor, colorSetField, colorValField)) baseWin.show()
def __init__(self): ui_labelWidth = 140 ui_inputWidth = 240 if pm.window(WIN_NAME, exists=True): pm.deleteUI(WIN_NAME, window=True) with pm.window( WIN_NAME, title=WIN_TITLE, maximizeButton=False, menuBar=True, menuBarVisible=True ) as self.window: pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.menu(label='Edit', tearOff=False) pm.menuItem(label='Reset Settings', command=self.ui_resetSettings) pm.menu(label='Help', tearOff=False) pm.menuItem(label='Help on ' + WIN_TITLE, command=self.ui_showHelp) with pm.formLayout() as self.ui_LAY_mainForm: with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top: pm.tabLayout(self.ui_TAB_top, e=True, height=1) with pm.formLayout() as self.ui_LAY_attachForm: with pm.tabLayout(tabsVisible=False, scrollable=True, innerMarginWidth=4) as self.ui_TAB_inner: with pm.columnLayout(adjustableColumn=True) as self.ui_LAY_mainColumn: with pm.frameLayout( label='Control Panel', collapsable=True, collapse=False, marginHeight=3 ) as self.ui_LAY_frameControlPanel: with pm.rowColumnLayout( numberOfColumns=12, columnSpacing=([3, 2], [4, 2], [5, 2], [6, 2]), rowSpacing=[1, 5], # Label X Y Z XYZ Mag Sep Reset Bias Sep Min Max columnWidth=[(1, 60), (2, 20), (3, 20), (4, 20), (5, 80), (6, 60), (7, 20), (8, 20), (9, 120), (10, 20), (11, 60), (12, 60)] ) as self.ui_LAY_mainRowColumn: # ----- Header Row ----- pm.text(label='') pm.text(label='') pm.text(label='') pm.text(label='') pm.text(label='') pm.text(label='Magnitude', ) pm.text(label='') pm.text(label='') pm.text(label='Bias', ) pm.text(label='') pm.text(label='Min', ) pm.text(label='Max', ) # ----- Translate Row ----- pm.text(label='Translate ', align='right') pm.button(label='X', command=pm.Callback(self.randomizeTranslate, ['tx'])) pm.button(label='Y', command=pm.Callback(self.randomizeTranslate, ['ty'])) pm.button(label='Z', command=pm.Callback(self.randomizeTranslate, ['tz'])) pm.button(label='XYZ', command=pm.Callback(self.randomizeTranslate, ['tx', 'ty', 'tz'])) self.ui_FLTFLD_translateMagnitude = pm.floatField('ui_FLTFLD_translateMagnitude', changeCommand=self.ui_refresh, value=10) pm.text(label='') self.ui_BTN_translateBiasReset = pm.button(label='0') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_translateBias = pm.intSliderGrp( 'ui_INTSLGRP_translateBias', columnWidth=[1, 30], field=True, minValue=-100, maxValue=100, fieldMinValue=-100, fieldMaxValue=100, value=0, step=1, fieldStep=1, sliderStep=1, changeCommand=self.ui_refresh, dragCommand=self.ui_refresh ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.button(self.ui_BTN_translateBiasReset, edit=True, command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_translateBias)) pm.text(label='=') self.ui_FLTFLD_translateMin = pm.floatField(enable=False, value=-5) self.ui_FLTFLD_translateMax = pm.floatField(enable=False, value=95) # ----- Rotate Row ----- pm.text(label='Rotate ', align='right') pm.button(label='X', command=pm.Callback(self.randomizeRotate, ['rx'])) pm.button(label='Y', command=pm.Callback(self.randomizeRotate, ['ry'])) pm.button(label='Z', command=pm.Callback(self.randomizeRotate, ['rz'])) pm.button(label='XYZ', command=pm.Callback(self.randomizeRotate, ['rx', 'ry', 'rz'])) self.ui_FLTFLD_rotateMagnitude = pm.floatField('ui_FLTFLD_rotateMagnitude', changeCommand=self.ui_refresh, value=90) pm.text(label='') self.ui_BTN_rotateBiasReset = pm.button(label='0') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_rotateBias = pm.intSliderGrp( 'ui_INTSLGRP_rotateBias', columnWidth=[1, 30], field=True, minValue=-100, maxValue=100, fieldMinValue=-100, fieldMaxValue=100, value=0, step=1, fieldStep=1, sliderStep=1, changeCommand=self.ui_refresh, dragCommand=self.ui_refresh ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.button(self.ui_BTN_rotateBiasReset, edit=True, command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_rotateBias)) pm.text(label='=') self.ui_FLTFLD_rotateMin = pm.floatField(enable=False, value=-5) self.ui_FLTFLD_rotateMax = pm.floatField(enable=False, value=95) # ----- Scale Row ----- pm.text(label='Scale ', align='right') pm.button(label='X', command=pm.Callback(self.randomizeScale, ['sx'])) pm.button(label='Y', command=pm.Callback(self.randomizeScale, ['sy'])) pm.button(label='Z', command=pm.Callback(self.randomizeScale, ['sz'])) pm.flowLayout(columnSpacing=2) pm.button(label='XYZ', command=pm.Callback(self.randomizeScale, ['sx', 'sy', 'sz'])) pm.button(label='Uniform', command=pm.Callback(self.randomizeScale, ['uniform'])) pm.setParent('..') self.ui_FLTFLD_scaleMagnitude = pm.floatField('ui_FLTFLD_scaleMagnitude', changeCommand=self.ui_refresh, value=2) pm.text(label='') self.ui_BTN_scaleBiasReset = pm.button(label='0') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_scaleBias = pm.intSliderGrp( 'ui_INTSLGRP_scaleBias', columnWidth=[1, 30], field=True, minValue=-100, maxValue=100, fieldMinValue=-100, fieldMaxValue=100, value=0, step=1, fieldStep=1, sliderStep=1, changeCommand=self.ui_refresh, dragCommand=self.ui_refresh ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) pm.button(self.ui_BTN_scaleBiasReset, edit=True, command=pm.Callback(self.ui_resetBias, self.ui_INTSLGRP_scaleBias)) pm.text(label='=') self.ui_FLTFLD_scaleMin = pm.floatField(enable=False, value=-5) self.ui_FLTFLD_scaleMax = pm.floatField(enable=False, value=95) with pm.frameLayout( label='Seed Control', collapsable=True, collapse=False, marginHeight=3 ) as self.ui_LAY_frameSeedControl: with pm.columnLayout(adjustableColumn=False): with pm.rowLayout( numberOfColumns=2, columnWidth2=[ui_labelWidth, ui_inputWidth], columnAttach=[1, 'right', 5] ): pm.text(label='Use Seed') self.ui_CHK_useSeed = pm.checkBox( 'ui_CHK_useSeed', value=True, label='', changeCommand=self.ui_refresh ) with pm.rowLayout( numberOfColumns=2, columnWidth2=[ui_labelWidth, ui_inputWidth], columnAttach=[1, 'right', 5] ): pm.text(label='Seed') pm.setUITemplate('DefaultTemplate', popTemplate=True) # strange slider group visual with default template self.ui_INTSLGRP_seedValue = pm.intSliderGrp( 'ui_INTSLGRP_seedValue', field=True, minValue=1, maxValue=10000, fieldMinValue=1, fieldMaxValue=10000, value=1234, step=1, fieldStep=1, sliderStep=1 ) pm.setUITemplate('DefaultTemplate', pushTemplate=True) # pm.setParent(self.ui_mainForm) self.ui_BTN_close = pm.button( label='Close', command=self.ui_close ) pm.setUITemplate('DefaultTemplate', popTemplate=True) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0) self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0) self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0) self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5, self.ui_BTN_close) self.ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'left', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 5) self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 5) self.prefSaver = prefsaver.PrefSaver(serializers.SerializerOptVar(OPT_VAR_NAME)) self.ui_initSettings() self.ui_loadSettings() self.window.show() pm.refresh()
def ui(): global __blenTxt if pm.window('blendShapeCtrlerUI', q=True, exists=True): pm.deleteUI('blendShapeCtrlerUI') with pm.window('blendShapeCtrlerUI'): with pm.columnLayout(adj=True): pm.button(l='Slider', c=pm.Callback(slider)) pm.button(l='Both Side Slider', c=pm.Callback(bothShide)) pm.button(l='Square Slider', c=pm.Callback(square)) pm.button(l='Square(small) Slider', c=pm.Callback(square_small)) with pm.rowLayout(nc=3): pm.button(l='Sym Translate', c=pm.Callback(rigSymTranslate)) pm.separator(h=16, style='in') with pm.rowLayout(nc=3): pm.button(l='SetBlendShapeNode', w=100, c=pm.Callback(setBlendShapeNode)) __blenTxt = pm.text(l='') with pm.rowLayout(nc=3): pm.button(l='Connect Blen', w=100, c=pm.Callback(connectBlen)) pm.button(l='DisConnect Blen', w=100, c=pm.Callback(disconnectBlen)) pm.separator(h=16, style='in') with pm.rowLayout(nc=3): pm.button(l='Regist Ctrl', w=80, c=pm.Callback(registBlenCtrl)) pm.button(l='Reset All', w=80, c=pm.Callback(resetBlenCtrl)) pm.button(l='Reset Selected', w=80, c=pm.Callback(resetCtrl)) pm.separator(h=8, style='in') with pm.rowLayout(nc=3): pm.button(l='Pose To Shelf', w=100, c=pm.Callback(poseToShelf))
def ui(self): ''' main ui creator ''' #TODO: only run once. use singleton instance if pm.window(self.name, q = True, ex = True): pm.deleteUI(self.name) #main window self.widgets['mainWindow'] = pm.window(self.name, title = self.name, widthHeight = (720, 400)) self.widgets['mainForm'] = pm.formLayout(parent = self.widgets['mainWindow']) #top left column self.widgets['topLColumn'] = pm.columnLayout(adjustableColumn = True, parent = self.widgets['mainForm'], h = 168) self.widgets['cameraText'] = pm.text(label = "Cameras", h = 20) self.widgets['cameraList'] = pm.iconTextScrollList(h = 105, allowMultiSelection = True, selectCommand = pm.Callback(self.updateLayers)) self.widgets['nameSep'] = pm.separator(horizontal = True, style = 'none', h = 13) self.widgets['sceneName'] = pm.textFieldGrp(label = 'Scene Name', text = self.scene.namebase, adjustableColumn = 2, columnWidth2 = [80, 0]) #top right column self.widgets['topRColumn'] = pm.columnLayout(parent = self.widgets['mainForm'], h = 168, adjustableColumn = True, rowSpacing = 1) self.widgets['outputDir'] = pm.textFieldButtonGrp(label = 'Output Path', tx = self.output, adjustableColumn = 2, columnWidth = [1, 80], buttonLabel = 'Browse...', bc = pm.Callback(self.changeOutputDestination)) self.widgets['project'] = pm.textFieldGrp(label = 'Project', adjustableColumn = 2, columnWidth = [1, 80], text = self.fileInfo.getProject()) self.widgets['department'] = pm.textFieldGrp(label = 'Department', adjustableColumn = 2, columnWidth = [1, 80], text = MusterSubmit.defaults['department']) self.widgets['pool'] = pm.optionMenuGrp(label = 'Pool', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.savePoolOpt)) self.widgets['renderer'] = pm.optionMenuGrp(label = 'Renderer', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.saveRendererOpt)) self.widgets['user'] = pm.optionMenuGrp(label = 'User', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.saveUserOpt)) self.widgets['memPri'] = pm.rowLayout(parent = self.widgets['topRColumn'], numberOfColumns = 2, adjustableColumn2 = 1) self.widgets['memory'] = pm.intSliderGrp(parent = self.widgets['memPri'], label = 'Memory', columnWidth = [1,80], field = True, step = 512, value = 16384, maxValue = 65536, minValue = 512, w = 200) self.widgets['priority'] = pm.intFieldGrp(parent = self.widgets['memPri'], label = 'Priority', columnWidth = [1,50], value1 = self.priority) #top middle row self.widgets['topMRow'] = pm.rowLayout(parent = self.widgets['mainForm'], numberOfColumns = 6, adjustableColumn6 = 3) self.widgets['sep'] = pm.separator(style = "none", w = 15) self.widgets['allLayers'] = pm.checkBox(label = 'All Layers', w = 110, value = True, cc = pm.Callback(self.setAllRenderable)) self.widgets['postCopy'] = pm.checkBox(label = 'Post Copy', w = 100, value = True) self.widgets['byFrame'] = pm.intFieldGrp(label = 'By Frame', columnWidth = [1, 50], value1 = int(pm.SCENE.defaultRenderGlobals.byFrame.get())) self.widgets['padding'] = pm.intFieldGrp(label = 'Padding', columnWidth = [1, 50], value1 = int(pm.SCENE.defaultRenderGlobals.extensionPadding.get())) self.widgets['packet'] = pm.intFieldGrp(label = 'Packet', columnWidth = [1, 50], value1 = int(MusterSubmit.defaults['packet'])) #main layout self.widgets['scrollLayout'] = pm.scrollLayout(parent = self.widgets['mainForm'], childResizable = True) #bottom row self.widgets['bottomRow'] = pm.rowLayout(numberOfColumns = 3, parent = self.widgets['mainForm'], adjustableColumn = 1) self.widgets['progress'] = pm.progressBar(w = 300, progress = -1) self.widgets['paused'] = pm.checkBox(label = 'Paused', w = 60) self.widgets['Submit'] = pm.button(label = 'Submit', w = 150, c = pm.Callback(self.submit)) #form Layout self.widgets['mainForm'].attachForm(self.widgets['topLColumn'], 'top', 0) self.widgets['mainForm'].attachForm(self.widgets['topLColumn'], 'left', 0) self.widgets['mainForm'].attachNone(self.widgets['topLColumn'], 'bottom') self.widgets['mainForm'].attachPosition(self.widgets['topLColumn'], 'right', 0, 40) self.widgets['mainForm'].attachForm(self.widgets['topRColumn'], 'top', 0) self.widgets['mainForm'].attachControl(self.widgets['topRColumn'], 'left', 0, self.widgets['topLColumn']) self.widgets['mainForm'].attachNone(self.widgets['topRColumn'], 'bottom') self.widgets['mainForm'].attachForm(self.widgets['topRColumn'], 'right', 0) self.widgets['mainForm'].attachControl(self.widgets['topMRow'], 'top', 0, self.widgets['topRColumn']) self.widgets['mainForm'].attachForm(self.widgets['topMRow'], 'left', 0) self.widgets['mainForm'].attachNone(self.widgets['topMRow'], 'bottom') self.widgets['mainForm'].attachForm(self.widgets['topMRow'], 'right', 0) self.widgets['mainForm'].attachControl(self.widgets['scrollLayout'], 'top', 0, self.widgets['topMRow']) self.widgets['mainForm'].attachForm(self.widgets['scrollLayout'], 'left', 0) self.widgets['mainForm'].attachControl(self.widgets['scrollLayout'], 'bottom', 0, self.widgets['bottomRow']) self.widgets['mainForm'].attachForm(self.widgets['scrollLayout'], 'right', 0) self.widgets['mainForm'].attachNone(self.widgets['bottomRow'], 'top') self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'left', 0) self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'bottom', 0) self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'right', 0) #end form layout self._populateUI() pm.scriptJob(uiDeleted = [self.widgets['mainWindow'].name(), pm.Callback(self.saveUI)]) #saves ui settings to optionVar pm.scriptJob(e = ['renderLayerChange', pm.Callback(self.updateLayers)], p = self.widgets['mainWindow'].name()) #reloads layers scroll when a layer is created or deleted #show created ui self.widgets['mainWindow'].show() self.getOptionVars()
def buildUI(self, filter=None): if filter: match = False for i, info in enumerate( self.methodInfoList): argUtil = factories.ApiArgUtil( self.apiClassName, self.apiMethodName, i ) if filter.intersection( argUtil.getInputTypes() + argUtil.getOutputTypes() ): match = True break if match == False: return False self.layout = { 'columnAlign' : [1,'right'], 'columnAttach' : [1,'right',8] } #print className, self.methodName, melMethods isOverloaded = len(self.methodInfoList)>1 self.frame = pm.frameLayout( w=FRAME_WIDTH, labelVisible=False, collapsable=False) logger.debug("building row for %s - %s" % (self.methodName, self.frame)) col = pm.columnLayout() enabledArray = [] self.rows = [] self.overloadPrecedenceColl = None self.enabledChBx = pm.checkBox(label=self.methodName, changeCommand=pm.CallbackWithArgs( MethodRow.enableCB, self ) ) if isOverloaded: self.overloadPrecedenceColl = pm.radioCollection() for i in range( len(self.methodInfoList) ) : self.createMethodInstance(i) else: #row = rowLayout( self.methodName + '_rowMain', nc=2, cw2=[200, 400] ) #self.enabledChBx = checkBox(label=self.methodName, changeCommand=CallbackWithArgs( MethodRow.enableCB, self ) ) #text(label='') self.createMethodInstance(0) #setParent('..') pm.setParent(col) pm.separator(w=800, h=6) #self.row = rowLayout( self.methodName + '_rowSettings', nc=4, cw4=[200, 160, 180, 160] ) #self.rows.append(row) self.row = pm.rowLayout( self.methodName + '_rowSettings', nc=2, cw2=[200, 220], **self.layout ) self.rows.append(self.row) # create ui elements pm.text(label='Mel Equivalent') self.melNameTextField = pm.textField(w=170, editable=False) self.melNameOptMenu = pm.popupMenu(parent=self.melNameTextField, button=1, postMenuCommand=pm.Callback( MethodRow.populateMelNameMenu, self ) ) pm.setParent('..') self.row2 = pm.rowLayout( self.methodName + '_rowSettings2', nc=3, cw3=[200, 180, 240], **self.layout ) self.rows.append(self.row2) pm.text(label='Use Name') self.nameMode = pm.radioButtonGrp(label='', nrb=3, cw4=[1,50,50,50], labelArray3=['api', 'mel', 'other'] ) self.altNameText = pm.textField(w=170, enable=False) self.altNameText.changeCommand( pm.CallbackWithArgs( MethodRow.alternateNameCB, self ) ) self.nameMode.onCommand( pm.Callback( MethodRow.nameTypeCB, self ) ) isEnabled = self.data.get('enabled', True) # UI SETUP melName = self.data.get('melName', '') try: #self.melNameOptMenu.setValue( melName ) self.melNameTextField.setText(melName) if melName != '': self.parent.parent.assignMelMethod( melName ) except RuntimeError: # it is possible for a method name to be listed here that was set from a different view, # where this class was a super class and more mel commands were available. expand the option list, # and make this frame read-only pm.menuItem( label=melName, parent=self.melNameOptMenu ) self.melNameOptMenu.setValue( melName ) logger.debug( "making %s frame read-only" % self.methodName ) self.frame.setEnable(False) self.enabledChBx.setValue( isEnabled ) self.row.setEnable( isEnabled ) self.row2.setEnable( isEnabled ) name = self.data['useName'] if name == 'API' : self.nameMode.setSelect( 1 ) self.altNameText.setEnable(False) elif name == 'MEL' : self.nameMode.setSelect( 2 ) self.altNameText.setEnable(False) else : self.nameMode.setSelect( 3 ) self.altNameText.setText(name) self.altNameText.setEnable(True) if self.overloadPrecedenceColl: items = self.overloadPrecedenceColl.getCollectionItemArray() try: val = self.data.get('overloadIndex', 0) if val is None: logger.info( "no wrappable options for method %s" % self.methodName ) self.frame.setEnable( False ) else: self.overloadPrecedenceColl.setSelect( items[ val ] ) except: pass # # ensure we don't use a value that is not valid # for val in range(val, len(enabledArray)+1): # try: # if enabledArray[val]: # break # except IndexError: # val = None # if val is not None: # self.overloadPrecedenceColl.setSelect( items[ val ] ) pm.setParent('..') pm.setParent('..') # frame pm.setParent('..') # column return True
def build(self): '''builds ui objects for tab''' self.widgets['mainRow'] = pm.rowLayout(parent = self.parent.widgets['scrollLayout'], numberOfColumns = 6, h = 50, adjustableColumn = 3, bgc = self.bgc) self.widgets['frontSpacer'] = pm.separator(style = 'none', w = 12) self.widgets['renderable'] = pm.checkBox(parent = self.widgets['mainRow'], value = self.layer.renderable.get(), w = 50, label = "", cc = pm.Callback(self.updateRenderable)) self.widgets['cameraName'] = pm.text(parent = self.widgets['mainRow'], label = self.camera.getParent().stripNamespace(), w = 140) self.widgets['layerName'] = pm.iconTextButton(parent = self.widgets['mainRow'], label = self.layer.name(), w = 220, style = 'textOnly', c = pm.Callback(self.layer.setCurrent), dcc = pm.Callback(self.updateLayerName)) self.widgets['frameRange'] = pm.textFieldGrp(parent = self.widgets['mainRow'], text = '%d - %d' % (self.parent.startFrame, self.parent.endFrame)) self.widgets['backSpacer'] = pm.separator(style = 'none', w = 1) if not self.layer.renderable.get(): self.updateRenderable()
def createMenu(self): """Create the Dillo Tools menu""" pm.evalDeferred(pm.Callback(menu.createMenu, self._tools))
def baseUI(): if pm.window('ASSEMBLER', exists=1): pm.deleteUI('ASSEMBLER') baseWin = pm.window('ASSEMBLER', t='Shot Assembler', w=280, h=100) with baseWin: mainLayout = pm.columnLayout() inputLayout = pm.rowColumnLayout(nc=6, parent=mainLayout) pm.text(l=' PART ') partField = pm.textField(tx='REEL_01', w=60, h=30) pm.text(l=' SEQ ') sequenceField = pm.textField(tx='010', w=45, h=30) pm.text(l=' SHOT ') shotField = pm.textField(tx='010', w=45, h=30) pm.separator(h=5, style='none') createLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) ANM = pm.button(l='CREATE\r\nANIMATION SCENE', w=140, h=55) RND = pm.button(l='CREATE\r\nRENDER SCENE', w=140, h=55) ANM.setCommand( pm.Callback(shotAssemble, partField, sequenceField, shotField, listANM, actANM)) RND.setCommand( pm.Callback(shotAssemble, partField, sequenceField, shotField, listRND, actRND)) OPANM = pm.button(l='OPEN ANIMATION SCENE', w=140, h=25) OPRND = pm.button(l='OPEN RENDER SCENE', w=140) OPANM.setCommand( pm.Callback(dna.shotOpen, partField, sequenceField, shotField, listANM)) OPRND.setCommand( pm.Callback(dna.shotOpen, partField, sequenceField, shotField, listRND)) pm.separator(h=6, style='none') editLayout = pm.rowColumnLayout(nc=1, parent=mainLayout) check = pm.button(l='CHECK SCENE', w=280, h=45) check.setCommand(pm.Callback(dna.checkScene)) addLayout = pm.rowColumnLayout(nc=3, parent=mainLayout) add_A = pm.button(l='ADD ASSSETS', w=90, h=30) del_A = pm.button(l='DEL ASSETS', w=90) upd = pm.button(l='UPDATE REFS', w=100) add_A.setCommand(pm.Callback(dna.addAsset)) del_A.setCommand(pm.Callback(dna.delAsset)) upd.setCommand(pm.Callback(dna.updateRefs)) updLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) fixALL = pm.button(l='FIX ALL', w=240, h=30) snv = pm.button(l='SNV', w=40) fixALL.setCommand(pm.Callback(dna.fixAll)) snv.setCommand(pm.Callback(saveNext)) pm.separator(h=8, style='none') addLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) pm.text(l=' ADD ASSETS: ') assetListField = pm.textField(tx='BENDER', w=180, h=30) createLayout = pm.rowColumnLayout(nc=2, parent=mainLayout) addANM = pm.button(l='FOR AMIMATION', w=140, h=50) addRND = pm.button(l='FOR RENDER', w=140) addANM.setCommand(pm.Callback(refDataList, assetListField, 'RIG')) addRND.setCommand(pm.Callback(refDataList, assetListField, 'GEO')) baseWin.show()