def rtb_choose_active(highresListDropdown, *args, **kwargs): ''' ''' global prefix global defaultString global lct_cfg lct_cfg.set('lcRetopoBasicListItem', highresListDropdown.getSelect()) high = highresListDropdown.getValue() if high != defaultString: rtb_scale_layer_mesh(highresListDropdown) pm.picture(prefix + '_picture_layer_mesh', edit=True, enable=True) pm.floatSlider(prefix + '_floatSlider_layer_mesh', edit=True, enable=True) live = pm.PyNode(high.replace('_high', '_live')) liveShape = live.getShape() pm.makeLive(live) else: pm.makeLive(none=True) rtb_scale_layer_mesh(highresListDropdown) pm.picture(prefix + '_picture_layer_mesh', edit=True, enable=False) pm.floatSlider(prefix + '_floatSlider_layer_mesh', edit=True, enable=False) rtb_glow(highresListDropdown)
def library_button_load_pose(self, obj): infos = obj.get_info() #pm.textField(self.widgets['info_text'], e=True, clear=True) # INFO msg = '' for key in ['name', 'user', 'created']: msg = msg + "%s: %s\n" %(key.title(), infos[key]) pm.text(self.widgets['info_text'], e=True, label=msg) # THUMBNAIL pm.iconTextButton(self.widgets['thrumbnail_image'], e=True, image=obj.thumbnail_path) # SAVE BLEND POSE START self.save_blend_pose_start() # LOAD POSE namespace = self.get_active_namespace() obj.load_pose(namespace) # SAVE BLEND POSE END self.save_blend_pose_end() pm.floatSlider(self.widgets['weight_slider'], e=True, value=1)
def rtb_highres_list_populate(highresListDropdown, *args, **kwargs): ''' ''' global defaultString global lct_cfg highresListDropdown.clear() highresListDropdown.addItems([defaultString]) sel = [ obj for obj in pm.ls(dag=True, transforms=True) if obj.getShape() and obj.getShape().nodeType() == 'mesh' ] highres = lcUtility.Utility.filterByToken(sel, 'high') for mesh in highres: highresListDropdown.addItems([mesh]) rtb_glow(highresListDropdown) pm.picture(prefix + '_picture_layer_mesh', edit=True, enable=False) pm.floatSlider(prefix + '_floatSlider_layer_mesh', edit=True, enable=False) if highresListDropdown.getNumberOfItems() < lct_cfg.get( 'lcRetopoBasicListItem'): lct_cfg.set('lcRetopoBasicListItem', highresListDropdown.getNumberOfItems())
def rtb_setup_live_mesh(highresListDropdown, *args, **kwargs): ''' ''' global lct_cfg sel = pm.ls(sl=True) lcGeometry.Geometry.fixNamespaceNames() if sel: for item in sel: pm.undoInfo(chunkName='lc_undo_makelive', openChunk=True) try: pm.parent(item, world=True) lcGeometry.Geometry.unlock_translate_rotate_scale(item) root = pm.group(empty=True, name=item + '_RETOPO') live = pm.duplicate(item, name=item + '_live')[0] high = item.rename(item + '_high') pm.makeIdentity([high, live], apply=True, t=1, r=1, s=1, n=0) lcUtility.Utility.centerPvt([high, live]) highShape = high.getShape() liveShape = live.getShape() highShape.overrideEnabled.set(1) # enable display overrides highShape.overrideDisplayType.set(2) # set to referenced liveShape.overrideEnabled.set(1) # enable display overrides liveShape.overrideDisplayType.set(1) # set to template liveShape.overrideVisibility.set(0) # set visibility to 0 pm.makeLive(live) highresListDropdown.addItems([high]) numItems = highresListDropdown.getNumberOfItems() highresListDropdown.setSelect(numItems) pm.parent(high, root) pm.parent(live, root) pm.connectAttr('persp.translate', high.scalePivot) rtb_scale_layer_mesh(highresListDropdown) rtb_glow(highresListDropdown) lct_cfg.set('lcRetopoBasicListItem', highresListDropdown.getSelect()) pm.picture(prefix + '_picture_layer_mesh', edit=True, enable=True) pm.floatSlider(prefix + '_floatSlider_layer_mesh', edit=True, enable=True) pm.undoInfo(chunkName='lc_undo_makelive', closeChunk=True) pm.select(clear=True) except: pm.undoInfo(chunkName='lc_undo_makelive', closeChunk=True) pm.undo() lcUtility.Utility.lc_print( 'Could not make {0} live'.format(item))
def uvmp_reset_slider(*args, **kwargs): ''' resets the rotation slider to 0 position after its let go ''' global undoChunk if undoChunk == True: # close the undo chunck on slider release pm.undoInfo(closeChunk=True, chunkName='undo_rotate_interactive') undoChunk = False pm.floatSlider(prefix + '_rotate_free', e=True, v=0)
def rtb_update_topo_transparency(): ''' ''' if pm.objExists('lcRetopo'): trans = pm.floatSlider(prefix + '_floatSlider_topo_trans', query=True, value=True) pm.setAttr('lcRetopo.transparency', [trans, trans, trans])
def rtb_scale_layer_mesh(highresListDropdown, *args, **kwargs): ''' ''' global defaultString scale = pm.floatSlider(prefix+'_floatSlider_layer_mesh', query=True, value=True) scale = math.pow(scale,2) #makes the slider a bit progressive, gives a better feel to the scale in the low range scale = 1+scale*5 #remaps 0-1 to 1-6 #iterate over the entire list and adjust scales currentItem = highresListDropdown.getSelect() numItems = highresListDropdown.getNumberOfItems() for item in range(numItems): item = item+1 if item > 1: highresListDropdown.setSelect(item) high = highresListDropdown.getValue() if not high == defaultString: high = pm.PyNode(high.split("'")[0]) #get rid of unicode crap high.setScale([scale, scale, scale]) #return list selection to original highresListDropdown.setSelect(currentItem) #force a viewport refresh pm.refresh()
def rtb_scale_layer_mesh(highresListDropdown, *args, **kwargs): ''' ''' global defaultString scale = pm.floatSlider(prefix + '_floatSlider_layer_mesh', query=True, value=True) scale = math.pow( scale, 2 ) #makes the slider a bit progressive, gives a better feel to the scale in the low range scale = 1 + scale * 5 #remaps 0-1 to 1-6 #iterate over the entire list and adjust scales currentItem = highresListDropdown.getSelect() numItems = highresListDropdown.getNumberOfItems() for item in range(numItems): item = item + 1 if item > 1: highresListDropdown.setSelect(item) high = highresListDropdown.getValue() if not high == defaultString: high = pm.PyNode(high.split("'")[0]) #get rid of unicode crap high.setScale([scale, scale, scale]) #return list selection to original highresListDropdown.setSelect(currentItem) #force a viewport refresh pm.refresh()
def offset_gui(**kwargs): window = 'offset_gui' window_title = 'ecFaceSetup' window_size = (337, 245) if py.window(window, exists=True): py.deleteUI(window, window=True) if py.window('guide_gui', exists=True): py.deleteUI('guide_gui', window=True) if py.window('locator_placement_prompt', exists=True): py.deleteUI('locator_placement_prompt', window=True) window_obj = py.window(window, title=window_title, widthHeight=window_size, sizeable=False) py.frameLayout('offset_scale_frame', label='Scale Offset Controls', p=window) py.floatSlider('offset_scale', p='offset_scale_frame', min=1, max=20, value=1, step=1) py.rowLayout('offset_row', p=window, numberOfColumns=3) py.button('accept_button', label="Accept Configuration", p='offset_row', command=py.Callback(finalize)) py.button('back_button', label="Back to Placement", p='offset_row', command=py.Callback(make_offset_groups, delete=True)) con.connect_offset() py.showWindow(window)
def rtb_update_topo_transparency(): ''' ''' global prefix global lct_cfg if pm.objExists('lcRetopo'): trans = pm.floatSlider(prefix + '_floatSlider_topo_trans', query=True, value=True) trans = math.pow(trans, 0.25) # user feedback slider 'feeling' lct_cfg.set('lcRetopoBasicShader', trans) pm.setAttr('lcRetopo.transparency', [trans, trans, trans])
def makeDockable(childWidget, areaName, width, label): slider = pm.floatSlider() #some throwaway control, feel free to delete this when you're done. dock = pm.dockControl(l = label, content=slider, area = areaName, w = width ) #Returns the string path to the dock control. The control is a QDockWidget under the hood. dockPt = openMayaUi.MQtUtil.findControl(dock) #Find the pointer to the dock control dockWidget = sip.wrapinstance(long(dockPt), QtCore.QObject) #Get that pointer as a Qt widget childWidget.setParent(dockWidget) dockWidget.setWidget(childWidget) #Set the docked widget to be your custom control.
def makeDockable(childWidget, areaName, width, label): slider = pm.floatSlider( ) #some throwaway control, feel free to delete this when you're done. dock = pm.dockControl( l=label, content=slider, area=areaName, w=width ) #Returns the string path to the dock control. The control is a QDockWidget under the hood. dockPt = openMayaUi.MQtUtil.findControl( dock) #Find the pointer to the dock control dockWidget = sip.wrapinstance( long(dockPt), QtCore.QObject) #Get that pointer as a Qt widget childWidget.setParent(dockWidget) dockWidget.setWidget( childWidget) #Set the docked widget to be your custom control.
def __init__(self, par, editor): self.editor = editor ToolsUI.__init__(self, par) with pm.columnLayout(p=par) as self.layout: with pm.rowLayout(nc=4): self.imageDisplay = pm.iconTextCheckBox('imageDisplayButton', image1='imageDisplay.png', v=pm.textureWindow(self.editor, q=True, id=True), cc=self.toggle_image_display, ann=pm.mel.uiRes( 'm_textureWindowCreateToolBar.kDisplayImageAnnot')) pm.popupMenu(button=3, p=self.imageDisplay, pmc=lambda *args: pm.mel.performTextureViewImageRangeOptions(1)) pm.iconTextCheckBox(image1='textureEditorShadeUVs.png', value=pm.textureWindow(self.editor, q=True, displaySolidMap=True), onc=lambda *args: pm.textureWindow(self.editor, e=True, displaySolidMap=True), ofc=lambda *args: pm.textureWindow(self.editor, e=True, displaySolidMap=False), ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kOverlapAnnot')) self.edgeColorBtn = pm.iconTextButton(image1='pbUV/opts01EdgeColor.png', c=self.edge_col_cmd) self.edgeColSld = pm.intSlider(min=1, max=31, value=pm.displayColor('polymesh', q=True, active=True) + 1, dc=self.edge_col_attr) with pm.rowLayout(nc=4): pm.iconTextCheckBox(image1='filteredMode.png', v=pm.textureWindow(self.editor, q=True, iuf=True), onc=lambda *args: pm.textureWindow(self.editor, e=True, iuf=True), ofc=lambda *args: pm.textureWindow(self.editor, e=True, iuf=False), ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kToggleFilteredImageAnnot')) polyOpts = pm.iconTextButton(image1='textureBorder.png', c=self.toggle_tx_border, ann=pm.mel.uiRes( 'm_textureWindowCreateToolBar.kToggleTextureBordersAnnot')) pm.popupMenu(button=3, p=polyOpts, pmc=lambda *args: pm.mel.CustomPolygonDisplayOptions()) self.dimImageBtn = pm.iconTextCheckBox('dimmerButton', image1='dimTexture.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kDimImageAnnot'), onc=lambda *args: self.dim_image_cmd(True), ofc=lambda *args: self.dim_image_cmd(False), value=pm.textureWindow(self.editor, q=True, imageBaseColor=True) < 0.9) self.dimImage = pm.floatSlider(minValue=0.0, maxValue=1.0, value=pm.textureWindow(self.editor, q=True, imageBaseColor=True)[0], cc=self.dim_image_attr, dc=self.dim_image_attr)
def rtb_scale_layer_mesh(highresListDropdown, *args, **kwargs): ''' ''' global defaultString global lct_cfg scale = pm.floatSlider(prefix + '_floatSlider_layer_mesh', query=True, value=True) lct_cfg.set('lcRetopoBasicLayering', scale) scale = math.pow( scale, 4 ) # makes the slider a bit progressive, gives a better feel to the scale in the low range scale = 1 + scale * 2 # remaps 0-1 to 1-2 to be useful as a scale value # iterate over the entire list and adjust scales listItems = highresListDropdown.getItemListLong() for item in listItems: high = pm.menuItem(item, query=True, l=True) if high != defaultString: high = pm.PyNode(high) high.setScale([scale, scale, scale])
def uvmp_rotate_interactive(*args, **kwargs): ''' Enables an interactive rotation slider with aspect ratio correction Because uv's dont have inherent transforms, it doesn't function like a slider would on an object, instead its current slider value is added additionaly to rotate the uv's Feels like an 'inertial' slider Its progressivly modified to give finer control closer to the slider center ''' try: global undoChunk # if we dont use an undo chunk here each tick of the slider creates a new undo state and we run out of undo's very quickly if undoChunk == False: # if we dont use a state check var each drag command tick try's to open a new chunk and breaks the undo queue pm.undoInfo(openChunk=True, chunkName='undo_rotate_interactive') undoChunk = True angle = pm.floatSlider(prefix + '_rotate_free', q=True, v=True) if angle > 0: uvmp_rotate(pow(angle * 2, 2) * -1) else: uvmp_rotate(pow(angle * 2, 2)) except: pass
def populate_detail_layout(self): pm.setParent(self.widgets["detail_vertical"]) v1 = pm.verticalLayout(ratios=[6,1]) h1 = pm.horizontalLayout(parent=v1, ratios=[1,1]) self.widgets['thrumbnail_image'] = pm.iconTextButton(style='iconOnly', parent=h1, w=100, h=100, bgc=[0.4,0.4,0.4]) v2 = pm.verticalLayout(parent=h1, ratios=[1,4,1,4]) pm.text (label='Info :', bgc=[0.1,0.1,0.2]) self.widgets['info_text'] = pm.text(parent=v2, bgc=[0.3,0.3,0.3], label='') pm.text (label = "Selection :", bgc = [0.1,0.1,0.2]) self.widgets['selection_text'] = pm.text(parent=v2, bgc=[0.3,0.3,0.3], label='') h2 = pm.horizontalLayout(parent=v1, ratios=[4,1]) self.widgets['weight_slider'] = pm.floatSlider(parent=h2, min=-0, max=1, value=1, step=0.01, dragCommand=pm.Callback(self.slider_drag_command)) self.widgets['key_button'] = pm.button(label='Key Pose', parent=h2) h1.redistribute() h2.redistribute() v1.redistribute() v2.redistribute() self.widgets['detail_vertical'].redistribute()
def lcRetopoBasicUI(dockable=False, *args, **kwargs): """ """ ci = 0 #color index iterator windowName = 'lcRetopoBasic' shelfCommand = 'import lct.src.lcRetopoBasic.lcRetopoBasic as lcRtB\nreload(lcRtB)\nlcRtB.lcRetopoBasicUI()' icon = basePath + 'lcRetopoBasic.png' winWidth = 204 winHeight = 180 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() # pm.columnLayout(prefix + '_columLayout_main') pm.button(l='Setup for Retopo', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Setup a high res mesh for retopology', command=lambda *args: rtb_setup_live_mesh(highresListDropdown)) ci += 1 # pm.rowColumnLayout(nc=3, cw=([1, 25], [2, 150], [3, 25])) pm.iconTextButton( w=25, h=25, style='iconOnly', image=iconBasePath + 'reloadMeshList.png', annotation='Reload the list of high res meshes', command=lambda *args: rtb_highres_list_populate(highresListDropdown)) highresListDropdown = pm.optionMenu( prefix + '_optionMenu_highres_list', w=150, h=25, bgc=[0.5, 0.5, 0.5], annotation='List of high res meshes in the scene') highresListDropdown.changeCommand( lambda *args: rtb_choose_active(highresListDropdown)) pm.iconTextButton( w=25, h=25, style='iconOnly', image=iconBasePath + 'removeMeshFromList.png', annotation= 'Remove current high res mesh from the list and return it to a normal state', command=lambda *args: rtb_remove(highresListDropdown)) pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=4, cw=([1, 50], [2, 100], [3, 25], [4, 25])) pm.iconTextStaticLabel(w=50, h=25, style='iconOnly', image=iconBasePath + 'meshLayering.png', annotation='Drag slider to change mesh layering') pm.floatSlider( prefix + '_floatSlider_layer_mesh', step=0.01, min=0, max=1, v=0, h=25, dragCommand=lambda *args: rtb_scale_layer_mesh(highresListDropdown)) pm.iconTextButton( w=25, h=25, style='iconOnly', image=iconBasePath + 'toggleXray.png', annotation='Toggle current high res mesh X-Ray', command=lambda *args: rtb_toggle_xray(highresListDropdown)) pm.iconTextButton( w=25, h=25, style='iconOnly', image=iconBasePath + 'hideMesh.png', annotation='Hide the high-res mesh', command=lambda *args: rtb_toggle_hide(highresListDropdown)) pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=3, cw=([1, 50], [2, 100], [3, 50])) pm.iconTextStaticLabel( w=50, h=25, style='iconOnly', image=iconBasePath + 'shaderOpacity.png', annotation='Drag slider to change shader transparency') pm.floatSlider(prefix + '_floatSlider_topo_trans', step=0.1, min=0, max=1, v=0.5, h=25, dragCommand=lambda *args: rtb_update_topo_transparency()) pm.iconTextButton( w=50, h=25, style='iconOnly', image=iconBasePath + 'assignShader.png', annotation= 'Create and/or assign a semi-transparent shader to selected low res mesh', command=lambda *args: rtb_create_retopo_shader()) pm.setParent(prefix + '_columLayout_main') # pm.separator(style='in', h=5, hr=True) #this doesn't seem to be working right pm.rowColumnLayout(nc=2) pm.button( l='Relax', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Relax selected verts and shrink-wrap them to the live mesh', command=lambda *args: rtb_relax_verts(highresListDropdown)) ci += 1 pm.button(l='Shrink-Wrap', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Shrink-wrap selected verts to the live mesh', command=lambda *args: rtb_shrink_wrap_verts(highresListDropdown)) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.progressBar(prefix + '_progress_control', vis=False, w=202) # mainWindow.show() rtb_highres_list_populate(highresListDropdown) #vertex animation cache in viewport 2.0 must be disabled or the mesh will not update properly if pm.objExists('hardwareRenderingGlobals'): pm.PyNode('hardwareRenderingGlobals').vertexAnimationCache.set(0)
def rtb_update_topo_transparency(): ''' ''' if pm.objExists('lcRetopo'): trans = pm.floatSlider(prefix+'_floatSlider_topo_trans', query=True, value=True) pm.setAttr('lcRetopo.transparency', [trans, trans, trans] )
def makeUi(self): ############################ self.win = pm.window('Hair Grabber 2', title='Hair Grabber 2') with self.win: self.col = pm.columnLayout() with self.col: self.row1 = pm.rowLayout(nc=7) with self.row1: self.tipBtn = pm.button(label="tip", width=70, c= lambda x: self.selectBatch(self.tip), ann = 'grabs the tips of a plane or multiple planes' ) self.rootBtn = pm.button(label="root", width=70, c= lambda x: self.selectBatch(self.root), ann = 'grabs the roots of a plane or multiple planes' ) self.middleBtn = pm.button(label="middle", width=70,c= lambda x: self.selectBatch(self.middle) , ann = 'grabs the middle edgeloop of a plane or multiple plains. if the mid checkbox is selected,'\ 'the randT slider above it will control the positioning of the edgeloop in relation to the edge or tip' ) self.middle2Btn = pm.button(label="length", width=60, c = lambda x: self.selectBatch(self.middle2), ann = 'grabs the length edgeloops of the plane or planes.' ) self.transformBtn = pm.button(label="Transform", width=60, c= lambda x: self. transform(), ann = 'selects the transform node if any other component like verts or faces is selected' ) self.edgeFlowBtn = pm.button(label="edgeFlow", width=60, c= lambda x: self.edgeFlow(), ann = 'goes over edgeloops and performs edgeflow on each. it returns a smoother transition in case the geo is jagged'\ 'if the checkbox to the right is selected it also iterates over the length edgeloops ' ) self.lenCheckBox = pm.checkBox(label = '||', value = False , ann = 'length edgeloops activated') self.row2 = pm.rowLayout(nc=7) with self.row2: self.pivotBtn = pm.button(label="pivot", width=70, c = lambda x: self.pivot(), ann = 'sets the pivot for each selected geo plane to its first row of faces and alligns to its normal' ) self.snapPivotBtn = pm.button(label='snapPivot', width=70, c=lambda x: self.snapPivot(), ann = 'if geo is fed in to the haircap field it will snap selected transforms to the closest point on that geo.' ) self.snapBtn = pm.button(label="snap", width=70, c=lambda x: self.snap() , ann = 'if geo is fed in to the haircap field it snaps the verts of whatever geo is selected to it.'\ ' if specific verts selected it will only snap them') self.fillBtn = pm.button(label="fill", width=70, c=lambda x: self.fill( self.amountField.getValue()+1 ), ann = 'duplicates the selected geo. if one is selected itll fill the surroundings of that geo.'\ 'if multiple pices are selected itll iterate from the first one to the next and fill the in betweens' 'you can controll the offset and random rotation with both sliders, and input the amount of'\ 'copies using the amount field to its right' ) self.amountField = pm.intField( 'amount', w = 40, annotation = 'times' , value = 1 ,minValue=1 , maxValue=30) self.transferCheckBox = pm.checkBox(label = 'uv', value = False , ann = 'transfers the UVs from map1 of the haircap to the newly created objects, or if active same function works for transfer button') self.transferBtn = pm.button(label="transfer", width=63, c=lambda x: self.transfer(), ann = 'transfers uvs for current UVsets to selection from last selected, or '\ 'transfers the UVs from map1 of the haircap to the selected objects if uv checkBox is on ' ) self.row3 = pm.rowLayout(nc=5) with self.row3: self.randSliderT = pm.floatSlider( horizontal = True,width = 168, min=0, max=10, value=0, cc = lambda x:self.middleCond(), ann = 'controls the random translate values and affected by the 3 axes under it. if mid is on'\ 'the field will select the edgeloop of selected geo accordint to the placement on the slider'\ 'as well as the percentage of the random transform select button' ) self.Text3 = pm.button(label="randT", width=44, c=lambda x: self.randomize(pm.selected(), transRot = 0 ), ann = ' randomly translates values and affected by the 3 axes under it' ) self.randSliderR = pm.intSlider( horizontal = True,width = 168, min=0, max=90, value=0, step=1 , ann = 'controls the random rotation values and affected by the 3 axes under it. set to max value of 90') self.Text4 = pm.button(label="randR", width=44, c=lambda x: self.randomize(pm.selected(), transRot = 1 ), ann = ' randomly rotates values and affected by the 3 axes under it' ) self.row4 = pm.rowLayout(nc=9) with self.row4: self.midCtrlCheckBox = pm.checkBox(label = 'mid', value = False ) self.TXCheckBox = pm.checkBox(label = ' TX ', value = True ) self.TYCheckBox = pm.checkBox(label = ' TY ', value = True ) self.TZCheckBox = pm.checkBox(label = ' TZ ', value = True ) self.RandTransBtn = pm.button(label="random transform select", width=130, c=lambda x: self.randomTransformSel(pm.selected()), ann = 'uses the left transform slider to select a percent of previously selected geo' ) self.RXCheckBox = pm.checkBox(label = ' RX ', value = True ) self.RYCheckBox = pm.checkBox(label = ' RY ', value = True ) self.RZCheckBox = pm.checkBox(label = ' RZ ', value = True ) self.row5 = pm.rowLayout(nc=8) with self.row5: self.Text1 = pm.text("UVset") self.UvSetSearchName = pm.textField('name of UV set', w = 93, it = "Alpha", ann = 'uses UVs that are upright to determine the roots and tips of a geo plane. a separate UVset can be created'\ 'and loaded to this field.') self.grabUVBtn = pm.button(label="grab", width=30, c=lambda x: self.grabUV() , ann = 'gets the current active UVset of selected object') self.fixUVBtn = pm.button(label="unfold inner", width=73, c=lambda x: self.UVFix() , ann = 'attempts to fix UVs if in the modelling process they get mangled. when the checkbox to the right'\ 'is activated it also flattens the length boarders to the average of tips and roots to give rectangular result.') self.squareCheckBox = pm.checkBox(label = '[]', value = True, ann = 'flattens the length boarders to the average of tips and roots to give rectangular result to UVs' ) self.Text2 = pm.text("haircap") self.capName = pm.textField('name of haircap', w = 93, it = "geo_head", ann = 'write down or select geo and use grab button to the right to feed it to the script.' ) self.grabCapBtn = pm.button(label="grab", width=30, c=lambda x: self.grabCap() , ann = 'grabs the name of active geo' ) self.win.show()
def prompt_ui(): """Displays the Gamma Correction UI.""" win = pm.window(title="Gamma Correct Attribute", width=200) layout = pm.formLayout(parent=win) shader_options = pm.optionMenu(label="Shader") refresh_button = pm.button(label="R", enable=True) attribute_options = pm.optionMenu(label="Attribute") ok_button = pm.button(label="Insert", enable=False) _attach_form(layout, shader_options, ["top", "left"], 5) _attach_form(layout, refresh_button, ["top", "right"], 5) layout.attachControl(shader_options, "right", 5, refresh_button) _attach_form(layout, attribute_options, ["left", "right"], 5) layout.attachControl(attribute_options, "top", 5, shader_options) gamma_slider = pm.floatSlider(min=0.1, max=3.0, step=0.1, value=2.2) gamma_lbl = pm.text(label="2.2") _attach_form(layout, gamma_slider, ["top", "left"], 5) layout.attachControl(gamma_slider, "top", 5, attribute_options) layout.attachControl(gamma_slider, "right", 5, gamma_lbl) _attach_form(layout, gamma_lbl, ["right"], 5) layout.attachControl(gamma_lbl, "top", 5, attribute_options) info_lbl = pm.text(label="Select a node...") _attach_form(layout, info_lbl, ["left", "right"], 5) layout.attachControl(info_lbl, "top", 5, gamma_slider) _attach_form(layout, ok_button, ["bottom", "left", "right"], 5) layout.attachControl(ok_button, "top", 5, info_lbl) # CALLBACKS. def _refresh(*args): shader_options.clear() for m in list_materials(): pm.uitypes.MenuItem(label=m, p=shader_options) refresh_button.setCommand(_refresh) def _on_shader_changed(*args): if len(args) == 0: return ok_button.setEnable(True) attribute_options.clear() # Select all "color" attributes. for a in list_attributes(args[0], typ="float3"): pm.uitypes.MenuItem(label=a, p=attribute_options) shader_options.changeCommand(_on_shader_changed) def _on_attribute_changed(*args): node = shader_options.getValue() info_lbl.setLabel( "%s's input is: %s" % (args[0], get_connection(node + "." + args[0]))) attribute_options.changeCommand(_on_attribute_changed) def _gamma_on_change(*args): gamma_lbl.setLabel("%.2f" % gamma_slider.getValue()) gamma_slider.dragCommand(_gamma_on_change) def _on_insert(*args): plug = "%s.%s" % (shader_options.getValue(), attribute_options.getValue()) correct(plug, gamma=gamma_slider.getValue()) ok_button.setCommand(_on_insert) _refresh() win.show()
def lcRetopoBasicUI(dockable=False, *args, **kwargs): """ """ ci = 0 #color index iterator windowName = 'lcRetopoBasic' shelfCommand = 'import lct.src.lcRetopoBasic.lcRetopoBasic as lcRtB\nreload(lcRtB)\nlcRtB.lcRetopoBasicUI()' icon = basePath+'lcRetopoBasic.png' winWidth = 204 winHeight = 180 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() # pm.columnLayout(prefix+'_columLayout_main') pm.button(l='Setup for Retopo', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Setup a high res mesh for retopology', command=lambda *args: rtb_setup_live_mesh(highresListDropdown) ) ci+=1 # pm.rowColumnLayout(nc=3, cw=([1,25], [2,150], [3,25] ) ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'reloadMeshList.png', annotation='Reload the list of high res meshes', command=lambda *args: rtb_highres_list_populate(highresListDropdown) ) highresListDropdown = pm.optionMenu(prefix+'_optionMenu_highres_list', w=150, h=25, bgc=[0.5,0.5,0.5], annotation='List of high res meshes in the scene' ) highresListDropdown.changeCommand(lambda *args: rtb_choose_active(highresListDropdown) ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'removeMeshFromList.png', annotation='Remove current high res mesh from the list and return it to a normal state', command=lambda *args: rtb_remove(highresListDropdown) ) pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=4, cw=([1,50], [2,100], [3,25], [4,25] ) ) pm.iconTextStaticLabel(w=50, h=25, style='iconOnly', image=iconBasePath+'meshLayering.png', annotation='Drag slider to change mesh layering' ) pm.floatSlider(prefix+'_floatSlider_layer_mesh', step=0.01, min=0, max=1, v=0, h=25, dragCommand=lambda *args: rtb_scale_layer_mesh(highresListDropdown) ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'toggleXray.png', annotation='Toggle current high res mesh X-Ray', command=lambda *args: rtb_toggle_xray(highresListDropdown) ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'hideMesh.png', annotation='Hide the high-res mesh', command=lambda *args: rtb_toggle_hide(highresListDropdown) ) pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=3, cw=([1,50], [2,100], [3,50] ) ) pm.iconTextStaticLabel(w=50, h=25, style='iconOnly', image=iconBasePath+'shaderOpacity.png', annotation='Drag slider to change shader transparency' ) pm.floatSlider(prefix+'_floatSlider_topo_trans', step=0.1, min=0, max=1, v=0.5, h=25, dragCommand=lambda *args: rtb_update_topo_transparency() ) pm.iconTextButton(w=50, h=25, style='iconOnly', image=iconBasePath+'assignShader.png', annotation='Create and/or assign a semi-transparent shader to selected low res mesh', command=lambda *args: rtb_create_retopo_shader() ) pm.setParent(prefix+'_columLayout_main') # pm.separator(style='in', h=5, hr=True) #this doesn't seem to be working right pm.rowColumnLayout(nc=2) pm.button(l='Relax', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Relax selected verts and shrink-wrap them to the live mesh', command=lambda *args: rtb_relax_verts(highresListDropdown) ) ci+=1 pm.button(l='Shrink-Wrap', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Shrink-wrap selected verts to the live mesh', command=lambda *args: rtb_shrink_wrap_verts(highresListDropdown) ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.progressBar(prefix+'_progress_control', vis=False, w=202) # mainWindow.show() rtb_highres_list_populate(highresListDropdown) #vertex animation cache in viewport 2.0 must be disabled or the mesh will not update properly if pm.objExists('hardwareRenderingGlobals'): pm.PyNode('hardwareRenderingGlobals').vertexAnimationCache.set(0)
def wnd_rowFKIK(): global txt_rootJoint, txt_endJoint, txt_handJoint, txt_handDrop global txt_handIconDist, txt_handIconRadius, txt_iconScale global chk_control_create, chk_control_hierarchy, chk_control_connect global chk_createHandControl, chk_arm_control global btn_selectHandControl, btn_selectWasteControl global sld_handIconDistance, sld_handIconRadius, sld_iconScale global opt_handOrient pm.frameLayout(collapsable=True, label="FK/IK") pm.rowLayout(numberOfColumns=3, width=500, columnWidth=([1, 200], [2, 150], [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), width=100) pm.setParent("..") pm.rowLayout(numberOfColumns=3, width=500, columnWidth=([1, 200], [2, 150], [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", command=pm.Callback(fkikSelectEnd), width=100) 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( label="", value=True, onCommand=pm.Callback(toggleJointCreation, True), offCommand=pm.Callback(toggleJointCreation, False)) pm.setParent("..") pm.rowLayout(numberOfColumns=3, columnWidth=([1, 150], [2, 200], [3, 150])) pm.text(label="Control Scale") sld_iconScale = pm.floatSlider( min=0, max=2, value=0.5, width=200, changeCommand=pm.Callback(scaleSliderChanged)) txt_iconScale = pm.textField( editable=True, changeCommand=pm.Callback(txt_iconScaleChanged), text=sld_iconScale.getValue()) 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.rowLayout(numberOfColumns=2, width=450, columnWidth=([1, 350], [2, 150])) pm.text(label="Create arm control at IK handle") chk_arm_control = pm.checkBox(label="", value=True) pm.setParent("..") fkik_innerFrame = pm.frameLayout(label="Hand Connection", collapsable=True) # Embedded frame pm.rowLayout(numberOfColumns=2, columnWidth=([1, 350], [2, 150])) pm.text(label="Create control on hand?") chk_createHandControl = pm.checkBox( label="", value=True, changeCommand=pm.Callback(toggleHandConnection)) pm.setParent("..") pm.rowLayout(numberOfColumns=3, columnWidth=([1, 200], [2, 150], [3, 150])) pm.text(label="Hand Joint:") txt_handJoint = pm.textField(placeholderText="Choose joint", editable=False) btn_selectHandControl = pm.button(label="Select hand Joint", command=pm.Callback(fkikSelectHand)) pm.setParent("..") pm.rowLayout(numberOfColumns=3, columnWidth=([1, 200], [2, 150], [3, 150])) pm.text(label="Hand waste:") txt_handDrop = pm.textField(placeholderText="Choose joint", editable=False) btn_selectWasteControl = pm.button( label="Select secondary\nhand position (waste)", command=pm.Callback(fkikSelectHandIconPoint)) pm.setParent("..") pm.rowLayout(numberOfColumns=2, columnWidth=([1, 350], [2, 150])) pm.text(label="Left or right?") opt_handOrient = pm.optionMenu(width=150) pm.menuItem(label="Left") pm.menuItem(label="Right") pm.setParent("..") pm.rowLayout(numberOfColumns=3, columnWidth=([1, 150], [2, 200], [3, 150])) pm.text(label="Hand icon distance") sld_handIconDistance = pm.floatSlider( min=0, max=10, value=5.0, width=200, changeCommand=pm.Callback(distanceSliderChanged)) txt_handIconDist = pm.textField( editable=True, changeCommand=pm.Callback(txt_handDistanceChanged), text=sld_handIconDistance.getValue()) pm.setParent("..") pm.rowLayout(numberOfColumns=3, columnWidth=([1, 150], [2, 200], [3, 150])) pm.text(label="Hand icon radius") sld_handIconRadius = pm.floatSlider( min=0, max=5.0, value=1.0, width=200, changeCommand=pm.Callback(sliderRadiusChanged)) txt_handIconRadius = pm.textField( editable=True, changeCommand=pm.Callback(txt_handRadiusChanged), text=sld_handIconRadius.getValue()) pm.setParent("..") pm.setParent("..") pm.rowLayout(numberOfColumns=3, columnWidth=([1, 150], [3, 150])) pm.text(label="") pm.button(label="Generate Hand", width=150, command=pm.Callback(fkik_generateStuff)) pm.text(label="") pm.setParent("..") pm.setParent("..")
def uiCreate(self): self.onCloseClicked() self.window = pm.window( WIN_NAME, title='PyMel Window', maximizeButton=False ) with self.window: with pm.formLayout() as uiLAY_mainForm: with pm.scrollLayout('uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll: with pm.columnLayout(adjustableColumn=True): with self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') as self.uiLAY_frameCheckBoxes: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiCHK_test1 = pm.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = pm.checkBox('uiCHK_test2', label='test2') with self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') as self.uiLAY_frameCheckBoxGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCHKGRP_test1 = pm.checkBoxGrp( 'uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1' ) self.uiCHKGRP_test2 = pm.checkBoxGrp( 'uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2') ) self.uiCHKGRP_test3 = pm.checkBoxGrp( 'uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiCHKGRP_test4 = pm.checkBoxGrp( 'uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) with self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') as self.uiLAY_frameColorSliders: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCLRGRP_test1 = pm.colorSliderGrp( 'uiCLRGRP_test1', label='test1' ) self.uiCLRGRP_test2 = pm.colorSliderGrp( 'uiCLRGRP_test2', label='test2' ) with self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') as self.uiLAY_frameFloatFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiFLF_test1 = pm.floatField('uiFLF_test1') self.uiFLF_test2 = pm.floatField('uiFLF_test2') with self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') as self.uiLAY_frameFloatFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLFGRP_test1 = pm.floatFieldGrp( 'uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1' ) self.uiFLFGRP_test2 = pm.floatFieldGrp( 'uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2' ) self.uiFLFGRP_test3 = pm.floatFieldGrp( 'uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3' ) self.uiFLFGRP_test4 = pm.floatFieldGrp( 'uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4' ) with self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') as self.uiLAY_frameFloatScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLSCRL_test1 = pm.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = pm.floatScrollBar('uiFLSCRL_test2') with self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') as self.uiLAY_frameFloatSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLTSLD_test1 = pm.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = pm.floatSlider('uiFLTSLD_test2') with self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') as self.uiLAY_frameFloatSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLSGRP_test1 = pm.floatSliderGrp( 'uiFLSGRP_test1', label='test1', field=True ) self.uiFLSGRP_test2 = pm.floatSliderGrp( 'uiFLSGRP_test2', label='test2', field=True ) with self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') as self.uiLAY_frameIconTextCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITCHK_test1 = pm.iconTextCheckBox( 'uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITCHK_test2 = pm.iconTextCheckBox( 'uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) with self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') as self.uiLAY_frameIconTextRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.iconTextRadioCollection() self.uiITRAD_test1 = pm.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITRAD_test2 = pm.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) self.uiITRAD_test3 = pm.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus' ) with self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') as self.uiLAY_frameIconTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITSLST_test1 = pm.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiITSLST_test2 = pm.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') as self.uiLAY_frameIntFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiINF_test1 = pm.intField('uiINF_test1') self.uiINF_test2 = pm.intField('uiINF_test2') with self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') as self.uiLAY_frameIntFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINFGRP_test1 = pm.intFieldGrp( 'uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1' ) self.uiINFGRP_test2 = pm.intFieldGrp( 'uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2' ) self.uiINFGRP_test3 = pm.intFieldGrp( 'uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3' ) self.uiINFGRP_test4 = pm.intFieldGrp( 'uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4' ) with self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') as self.uiLAY_frameIntScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINSCRL_test1 = pm.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = pm.intScrollBar('uiINSCRL_test2') with self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') as self.uiLAY_frameIntSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINTSLD_test1 = pm.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = pm.intSlider('uiINTSLD_test2') with self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') as self.uiLAY_frameIntSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINSGRP_test1 = pm.intSliderGrp( 'uiINSGRP_test1', label='test1', field=True ) self.uiINSGRP_test2 = pm.intSliderGrp( 'uiINSGRP_test2', label='test2', field=True ) with self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') as self.uiLAY_frameOptionMenus: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=110, style='none') self.uiOPTMNU_test1 = pm.optionMenu('uiOPTMNU_test1', label='test1') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPTMNU_test2 = pm.optionMenu('uiOPTMNU_test2', label='test2') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') as self.uiLAY_frameOptionMenuGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiOPMGRP_test1 = pm.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPMGRP_test2 = pm.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') as self.uiLAY_frameRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.radioCollection() self.uiRAD_test1 = pm.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = pm.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = pm.radioButton('uiRAD_test3', label='test3') with self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') as self.uiLAY_frameRadioButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiRADGRP_test1 = pm.radioButtonGrp( 'uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1' ) self.uiRADGRP_test2 = pm.radioButtonGrp( 'uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2') ) self.uiRADGRP_test3 = pm.radioButtonGrp( 'uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiRADGRP_test4 = pm.radioButtonGrp( 'uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) with self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') as self.uiLAY_frameSymbolCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSYMCHK_test1 = pm.symbolCheckBox( 'uiSYMCHK_test1', image='polyCube' ) self.uiSYMCHK_test2 = pm.symbolCheckBox( 'uiSYMCHK_test2', image='polyCone' ) with self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') as self.uiLAY_frameScriptTables: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRTBL_test1 = pm.scriptTable( 'uiSCRTBL_test1', selectionMode=3, rows=4, columns=2 ) self.uiSCRTBL_test2 = pm.scriptTable( 'uiSCRTBL_test2', selectionMode=3, rows=4, columns=2 ) with self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') as self.uiLAY_frameScrollField: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRFLD_test1 = pm.scrollField( 'uiSCRFLD_test1', wordWrap=True ) self.uiSCRFLD_test2 = pm.scrollField( 'uiSCRFLD_test2', wordWrap=True ) with self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') as self.uiLAY_frameShelfTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.shelfTabLayout('uiSHLTAB_test1') as self.uiSHLTAB_test1: with pm.shelfLayout('test1'): pass with pm.shelfLayout('test2'): pass with pm.shelfLayout('test3'): pass with pm.shelfTabLayout('uiSHLTAB_test2') as self.uiSHLTAB_test2: with pm.shelfLayout('test4'): pass with pm.shelfLayout('test5'): pass with pm.shelfLayout('test6'): pass with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') as self.uiLAY_frameTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.tabLayout('uiTAB_test1') as self.uiTAB_test1: with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow1: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow2: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow3: pass pm.tabLayout( self.uiTAB_test1, edit=True, tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),) ) with pm.tabLayout('uiTAB_test2') as self.uiTAB_test2: with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow4: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow5: pass with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow6: pass pm.tabLayout( self.uiTAB_test2, edit=True, tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),) ) with self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') as self.uiLAY_frameTextFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiTXT_test1 = pm.textField('uiTXT_test1') self.uiTXT_test2 = pm.textField('uiTXT_test2') with self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') as self.uiLAY_frameTextFieldButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXBTGR_test1 = pm.textFieldButtonGrp( 'uiTXBTGR_test1', label='test1', buttonLabel='button1' ) self.uiTXBTGR_test2 = pm.textFieldButtonGrp( 'uiTXBTGR_test2', label='test2', buttonLabel='button2' ) with self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') as self.uiLAY_frameTextFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXTGRP_test1 = pm.textFieldGrp( 'uiTXTGRP_test1', label='test1' ) self.uiTXTGRP_test2 = pm.textFieldGrp( 'uiTXTGRP_test2', label='test2' ) with self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') as self.uiLAY_frameTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiTXTLST_test1 = pm.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiTXTLST_test2 = pm.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiBTN_savePrefs = pm.button( label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked ) self.uiBTN_loadPrefs = pm.button( label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked ) self.uiBTN_resetPrefs = pm.button( label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked ) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2) uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs) uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top') uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2) uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33) uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33) uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2) self.window.setTitle(self.window.__class__)
def sliderChangeCommand(*Args): pValue = pm.floatSlider("SoftSelectSlider", query=True, value=True) pm.softSelect(softSelectDistance=pValue) print(pValue)
def lcRetopoBasicUI(dockable=False, asChildLayout=False, *args, **kwargs): """ """ global lct_cfg global prefix ci = 0 # color index iterator windowName = 'lcRetopoBasic' shelfCommand = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI()'.format( windowName, prefix) commandString = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI(asChildLayout=True)'.format( windowName, prefix) icon = os.path.join(basePath, 'lcRetopoBasic.png') winWidth = 205 winHeight = height if pm.window(windowName, ex=True): pm.deleteUI(windowName) if not asChildLayout: lcUI.UI.lcToolbox_child_popout(prefix + '_columnLayout_main', windowName, height, commandString, iconPath, lct_cfg) mainWindow = lcUI.lcWindow(prefix=prefix, windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() pm.columnLayout(prefix + '_columnLayout_main') # SETUP pm.button(l='Setup for Retopo', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Setup a high res mesh for retopology', command=lambda *args: rtb_setup_live_mesh(highresListDropdown)) ci += 1 # List pm.rowColumnLayout(nc=3, cw=([1, 25], [2, 150], [3, 25])) pm.symbolButton( h=25, image=os.path.join(iconPath, 'reloadMeshList.png'), annotation='Reload the list of high res meshes', command=lambda *args: rtb_highres_list_populate(highresListDropdown)) highresListDropdown = pm.optionMenu( prefix + '_optionMenu_highres_list', w=150, h=23, bgc=[0.5, 0.5, 0.5], annotation='List of high res meshes in the scene') highresListDropdown.changeCommand( lambda *args: rtb_choose_active(highresListDropdown)) remove_mesh_button = pm.symbolButton( h=25, image=os.path.join(iconPath, 'removeMeshFromList.png'), annotation= 'Remove current high res mesh from the list and return it to a normal state', command=lambda *args: rtb_remove(highresListDropdown)) popup_remove_mesh = pm.popupMenu(parent=remove_mesh_button) pm.menuItem(l='Remove all live meshes', parent=popup_remove_mesh, command=lambda *args: rtb_remove_all(highresListDropdown)) pm.setParent(prefix + '_columnLayout_main') # Scale pm.rowColumnLayout(nc=4, cw=([1, 50], [2, 100], [3, 25], [4, 25])) pm.picture(prefix + '_picture_layer_mesh', image=os.path.join(iconPath, 'meshLayering.png'), annotation='Drag slider to change mesh layering') pm.floatSlider( prefix + '_floatSlider_layer_mesh', h=25, step=0.01, min=0, max=1, v=lct_cfg.get('lcRetopoBasicLayering'), dragCommand=lambda *args: rtb_scale_layer_mesh(highresListDropdown)) button_xray = pm.symbolButton( prefix + '_symbolButton_xray', h=25, image=os.path.join(iconPath, 'toggleXray.png'), bgc=[0.27, 0.27, 0.27], annotation='Toggle Mesh X-Ray', command=lambda *args: rtb_toggle_xray(highresListDropdown, 'active')) popup_xray = pm.popupMenu(parent=button_xray) pm.menuItem(l='xRay on/off all', parent=popup_xray, command=lambda *args: rtb_toggle_xray(highresListDropdown)) button_hide = pm.symbolButton( prefix + '_symbolButton_hide', h=25, image=os.path.join(iconPath, 'hideMesh.png'), bgc=[0.27, 0.27, 0.27], annotation='Hide/Show Current High-Res', command=lambda *args: rtb_toggle_hide(highresListDropdown, 'active')) popup_hide = pm.popupMenu(parent=button_hide) pm.menuItem( l='Hide/Show all', parent=popup_hide, command=lambda *args: rtb_toggle_hide(highresListDropdown, 'all')) pm.menuItem( l='Hide/Show others', parent=popup_hide, command=lambda *args: rtb_toggle_hide(highresListDropdown, 'others')) pm.setParent(prefix + '_columnLayout_main') # Shader pm.rowColumnLayout(nc=3, cw=([1, 50], [2, 100], [3, 50])) pm.picture(image=os.path.join(iconPath, 'shaderOpacity.png'), enable=False, annotation='Drag slider to change shader transparency') pm.floatSlider(prefix + '_floatSlider_topo_trans', h=25, step=0.1, min=0, max=1, v=lct_cfg.get('lcRetopoBasicShader'), dragCommand=lambda *args: rtb_update_topo_transparency()) pm.symbolButton( h=25, image=os.path.join(iconPath, 'assignShader.png'), bgc=[0.27, 0.27, 0.27], annotation= 'Create and/or assign a semi-transparent shader to selected low res mesh', command=lambda *args: rtb_create_retopo_shader()) pm.setParent(prefix + '_columnLayout_main') pm.separator(style='in', h=5) # Relax and Shrinkwrap pm.rowColumnLayout(nc=2) pm.button( l='Relax', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Relax selected verts and shrink-wrap them to the live mesh', command=lambda *args: rtb_vert_ops(highresListDropdown, operation='relax')) ci += 1 pm.button(l='Shrink-Wrap', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Shrink-wrap selected verts to the live mesh', command=lambda *args: rtb_vert_ops(highresListDropdown, operation='shrink')) ci += 1 pm.setParent(prefix + '_columnLayout_main') # PROG Bar pm.progressBar(prefix + '_progress_control', en=False, w=202, isInterruptable=True) pm.separator(style='in', h=5) # Tool List pm.gridLayout(nrc=[1, 5], cwh=[40, 40]) ##1 pm.symbolButton(prefix + '_symbolButton_select_mode', image='selectByComponent.png', c=lambda *args: rtb_toggle_select_mode(), annotation='Toggle Object/Component Modes') ##2 create_mesh = pm.symbolButton( image='polyCylinder.png', c=lambda *args: pm.polyCylinder( r=1, h=2, sx=8, sy=1, sz=1, ax=(0, 1, 0), rcp=0, cuv=3, ch=1), annotation='Create Poly Cylinder') popup_create_mesh = pm.popupMenu(parent=create_mesh) pm.menuItem(l='polyPlane', parent=popup_create_mesh, command=lambda *args: pm.polyPlane( w=2, h=2, sx=1, sy=1, ax=(0, 1, 0), cuv=2, ch=1)) pm.menuItem(l='polyCube', parent=popup_create_mesh, command=lambda *args: pm.polyCube( w=2, h=2, d=2, sx=1, sy=1, ax=(0, 1, 0), cuv=2, ch=1)) ##3 pm.symbolButton(image='polyUnite.png', command=lambda *args: lcGeometry.Geometry.merge_and_weld(), annotation='Combine and Weld') ##4 button_zeroX = pm.symbolButton(image=os.path.join(iconPath, 'zeroX.png'), command=lambda *args: rtb_zero('x'), annotation='Zero to world axis') popup_zeroX = pm.popupMenu(parent=button_zeroX) pm.menuItem(l='Zero X', parent=popup_zeroX, command=lambda *args: rtb_zero('x')) pm.menuItem(l='Zero Y', parent=popup_zeroX, command=lambda *args: rtb_zero('y')) pm.menuItem(l='Zero Z', parent=popup_zeroX, command=lambda *args: rtb_zero('z')) ##5 pm.symbolButton(image='modelToolkit.png', c=lambda *args: pm.mel.eval('ToggleModelingToolkit'), annotation='Modeling Toolkit') # if not asChildLayout: mainWindow.show() pm.window(mainWindow.mainWindow, edit=True, h=winHeight, w=winWidth) else: pm.setParent('..') pm.setParent('..') # edit menus optionsMenu, helpMenu = lcUI.UI.lcToolbox_child_menu_edit( asChildLayout, windowName) pm.menuItem(parent=optionsMenu, divider=True, dividerLabel=windowName) pm.menuItem(parent=optionsMenu, l='Remove all live meshes', command=lambda *args: rtb_remove_all(highresListDropdown)) # populate drowpdowns rtb_highres_list_populate(highresListDropdown) # restore interface selections highresListDropdown.setSelect(lct_cfg.get('lcRetopoBasicListItem')) rtb_choose_active(highresListDropdown) # vertex animation cache in viewport 2.0 must be disabled or the mesh will not update properly if pm.objExists('hardwareRenderingGlobals'): pm.PyNode('hardwareRenderingGlobals').vertexAnimationCache.set(0) rtb_init_select_mode() if not pm.scriptJob(ex=lct_cfg.get('lcRetopoBasicScriptJob') ) or lct_cfg.get('lcRetopoBasicScriptJob') == 0: jobNum = pm.scriptJob( e=["SelectModeChanged", lambda *args: rtb_init_select_mode()], protected=True) lct_cfg.set('lcRetopoBasicScriptJob', jobNum)
def locator_placement_gui(): window = 'locator_placement_prompt' window_title = 'ecFaceSetup' window_size = (337, 245) button_width = 130 if py.window(window, exists=True): py.deleteUI(window, window=True) if py.window('guide_gui', exists=True): py.deleteUI('guide_gui', window=True) if py.window('offset_gui', exists=True): py.deleteUI('offset_gui', window=True) window_obj = py.window(window, title=window_title, widthHeight=window_size, menuBar=True, sizeable=False) menu = py.menu('File', p=window_obj) py.menuItem('Reset All', p=menu, command=py.Callback(reset_locators, 'all')) py.menuItem(divider=True, p=menu) mirror = py.menuItem('Mirroring', p=menu, subMenu=True) py.menuItem('Mirror All', p=mirror, command=py.Callback(mirror_locators, filename='all')) py.menuItem(divider=True, p=menu) py.menuItem('Mirror Upper Eyes', p=mirror, command=py.Callback(mirror_locators, filename='up_eye')) py.menuItem('Mirror Lower Eyes', p=mirror, command=py.Callback(mirror_locators, filename='low_eye')) py.menuItem('Mirror Cheek', p=mirror, command=py.Callback(mirror_locators, filename='cheek')) py.menuItem('Mirror Upper Lip', p=mirror, command=py.Callback(mirror_locators, filename='up_mouth')) py.menuItem('Mirror Lower Lip', p=mirror, command=py.Callback(mirror_locators, filename='low_mouth')) py.menuItem('Remove Mirroring', p=mirror, command=py.Callback(mirror_locators, unmirror=True)) py.menuItem(divider=True, p=menu) py.menuItem('Delete Everything', p=menu, command=py.Callback(delete_locators)) py.menuItem(divider=True, p=menu) py.columnLayout('god_column', p=window) py.rowLayout('master_row', numberOfColumns=5, p='god_column') py.columnLayout('master_column', p='master_row', cat=('left', 0)) py.rowLayout('jaw_row', p='master_column', numberOfColumns=3) jaw_btn = py.button('jaw_btn', label='Place Head Locators', w=button_width, p='jaw_row', command=(py.Callback(show_group, 'head_locator_grp'))) jaw_menu = py.popupMenu('jaw_menu', p=jaw_btn, ctl=False, button=3) py.menuItem('Reset Locators', p=jaw_menu, command=py.Callback(reset_locators, 'head_locator_grp')) py.button('jaw_guide_button', label='Guide', p='jaw_row', command=py.Callback(guide_gui, 'jaw_head.png', full=True)) py.rowLayout('u_eye_row', p='master_column', numberOfColumns=3) u_eye_btn = py.button('u_eye_btn', label='Place Upper Eye Locators', w=button_width, p='u_eye_row', command=(py.Callback(show_group, 'up_eye_locator_grp'))) u_eye_menu = py.popupMenu('u_eye_menu', p=u_eye_btn, ctl=False, button=3) py.menuItem('Reset Locators', p=u_eye_menu, command=py.Callback(reset_locators, 'up_eye_locator_grp')) py.button('u_eye_guide_button', label='Guide', p='u_eye_row', command=py.Callback(guide_gui, 'upeye.png', full=True)) py.rowLayout('l_eye_row', p='master_column', numberOfColumns=3) l_eye_btn = py.button('l_eye_btn', label='Place Lower Eye Locators', w=button_width, p='l_eye_row', command=(py.Callback(show_group, 'low_eye_locator_grp'))) l_eye_menu = py.popupMenu('l_eye_menu', p=l_eye_btn, ctl=False, button=3) py.menuItem('Reset Locators', p=l_eye_menu, command=py.Callback(reset_locators, 'low_eye_locator_grp')) py.button('l_eye_guide_button', label='Guide', p='l_eye_row', command=py.Callback(guide_gui, 'loweye.png', full=True)) py.rowLayout('cheek_row', p='master_column', numberOfColumns=3) cheek_btn = py.button('cheek_btn', label='Place Cheek Locators', w=button_width, p='cheek_row', command=(py.Callback(show_group, 'cheek_locator_grp'))) cheek_menu = py.popupMenu('cheek_menu', p=cheek_btn, ctl=False, button=3) py.menuItem('Reset Locators', p=cheek_menu, command=py.Callback(reset_locators, 'cheek_locator_grp')) py.button('cheek_guide_button', label='Guide', p='cheek_row', command=py.Callback(guide_gui, 'cheek.png', full=True)) py.rowLayout('u_lip_row', p='master_column', numberOfColumns=3) u_lip_btn = py.button('u_lip_btn', label='Place Upper Lip Locators', w=button_width, p='u_lip_row', command=(py.Callback(show_group, 'up_lip_locator_grp'))) u_lip_menu = py.popupMenu('u_lip_menu', p=u_lip_btn, ctl=False, button=3) py.menuItem('Reset Locators', p=u_lip_menu, command=py.Callback(reset_locators, 'up_lip_locator_grp')) py.button('u_guide_btn', label='Guide', p='u_lip_row', command=py.Callback(guide_gui, 'upmouth.png', full=True)) py.rowLayout('l_lip_row', p='master_column', numberOfColumns=3) l_lip_btn = py.button('l_lip_btn', label='Place Lower Lip Locators', w=button_width, p='l_lip_row', command=(py.Callback(show_group, 'low_lip_locator_grp'))) l_lip_menu = py.popupMenu('l_lip_menu', p=l_lip_btn, ctl=False, button=3) py.menuItem('Reset Locators', p=l_lip_menu, command=py.Callback(reset_locators, 'low_lip_locator_grp')) py.button('l_guide_button', label='Guide', p='l_lip_row', command=py.Callback(guide_gui, 'lowmouth.png', full=True)) py.rowLayout('slider_row', p='master_column', numberOfColumns=3) py.text('Locator Scale ', p='slider_row') py.floatSlider('locator_scale', min=.5, max=50, value=1, step=1, p='slider_row') py.frameLayout('image_frame', label='Guide Preview', p='master_row') py.image("guide", p='image_frame', w=150, h=150, dgc=(py.Callback(guide_gui, 'open'))) py.rowColumnLayout('final_row', p='god_column') py.button('show_all_button', label='Show All', p='final_row', width=window_size[0]-5, command=py.Callback(show_group, 'all')) py.button('confirm_button', label='Confirm', p='final_row', width=window_size[0]-5, command=py.Callback(joint_creation)) con.connect_locators() py.showWindow(window)
def prompt_ui(): """Displays the Gamma Correction UI.""" win = pm.window(title="Gamma Correct Attribute", width=200) layout = pm.formLayout(parent=win) shader_options = pm.optionMenu(label="Shader") refresh_button = pm.button(label="R", enable=True) attribute_options = pm.optionMenu(label="Attribute") ok_button = pm.button(label="Insert", enable=False) _attach_form(layout, shader_options, ["top", "left"], 5) _attach_form(layout, refresh_button, ["top", "right"], 5) layout.attachControl(shader_options, "right", 5, refresh_button) _attach_form(layout, attribute_options, ["left", "right"], 5) layout.attachControl(attribute_options, "top", 5, shader_options) gamma_slider = pm.floatSlider(min=0.1, max=3.0, step=0.1, value=2.2) gamma_lbl = pm.text(label="2.2") _attach_form(layout, gamma_slider, ["top", "left"], 5) layout.attachControl(gamma_slider, "top", 5, attribute_options) layout.attachControl(gamma_slider, "right", 5, gamma_lbl) _attach_form(layout, gamma_lbl, ["right"], 5) layout.attachControl(gamma_lbl, "top", 5, attribute_options) info_lbl = pm.text(label="Select a node...") _attach_form(layout, info_lbl, ["left", "right"], 5) layout.attachControl(info_lbl, "top", 5, gamma_slider) _attach_form(layout, ok_button, ["bottom", "left", "right"], 5) layout.attachControl(ok_button, "top", 5, info_lbl) # CALLBACKS. def _refresh(*args): shader_options.clear() for m in list_materials(): pm.uitypes.MenuItem(label=m, p=shader_options) refresh_button.setCommand(_refresh) def _on_shader_changed(*args): if len(args) == 0: return ok_button.setEnable(True) attribute_options.clear() # Select all "color" attributes. for a in list_attributes(args[0], typ="float3"): pm.uitypes.MenuItem(label=a, p=attribute_options) shader_options.changeCommand(_on_shader_changed) def _on_attribute_changed(*args): node = shader_options.getValue() info_lbl.setLabel("%s's input is: %s" % (args[0], get_connection(node + "." + args[0]))) attribute_options.changeCommand(_on_attribute_changed) def _gamma_on_change(*args): gamma_lbl.setLabel("%.2f" % gamma_slider.getValue()) gamma_slider.dragCommand(_gamma_on_change) def _on_insert(*args): plug = "%s.%s" % (shader_options.getValue(), attribute_options.getValue()) correct(plug, gamma=gamma_slider.getValue()) ok_button.setCommand(_on_insert) _refresh() win.show()
def lcUVToolsUI(dockable=False, asChildLayout=False, *args, **kwargs): ''' ''' global lct_cfg global prefix global height windowName = 'lcUVTools' shelfCommand = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI()'.format( windowName, prefix) commandString = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI(asChildLayout=True)'.format( windowName, prefix) icon = os.path.join(basePath, 'lcUVTools.png') if pm.window(windowName, ex=True): pm.deleteUI(windowName) if not asChildLayout: lcUI.UI.lcToolbox_child_popout(prefix + '_columnLayout_main', windowName, height, commandString, iconPath, lct_cfg) mainWindow = lcUI.lcWindow(prefix=prefix, windowName=windowName, width=width, height=height, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() # column for the uv tool bar pm.columnLayout(prefix + '_columnLayout_main') # build ui in parts # Row 1 - basic pm.rowColumnLayout(nc=4, cw=[(1, 95), (2, 35), (3, 35), (4, 35)]) pm.columnLayout() pm.checkBox( prefix + '_checkBox_shell', l=' Shell Mode', v=False, changeCommand=lambda *args: lct_cfg.set( 'lcUVToolsShell', pm.checkBox(prefix + '_checkBox_shell', query=True, v=True))) pm.button(l='Grab Shell', bgc=colorWheel.getNext(), h=20, w=93, command=lambda *args: lcGeometry.UV().grabShell()) pm.setParent('..') pm.symbolButton(image=os.path.join(srcPath, 'icons', 'temp.png'), enable=False, visible=False) button_snapshot = pm.symbolButton(image='polyUVSnapshot.png', annotation='Take UV Snapshot', command=lambda *args: uvmp_uv_snapshot()) popup_snapshot = pm.popupMenu(parent=button_snapshot) pm.menuItem( prefix + '_checkBox_antiAlias', l='Antialias', checkBox=False, parent=popup_snapshot, command=lambda *args: lct_cfg.set( 'lcUVToolsAntialias', pm.menuItem( prefix + '_checkBox_antiAlias', query=True, checkBox=True))) pm.menuItem( prefix + '_checkBox_openPS', l='Auto Open PS', checkBox=True, parent=popup_snapshot, command=lambda *args: lct_cfg.set( 'lcUVToolsOpenPS', pm.menuItem(prefix + '_checkBox_openPS', query=True, checkBox=True) )) pm.symbolButton(image='textureEditor.png', annotation='Open the UV Editor', command=lambda *args: pm.mel.eval('TextureViewWindow')) # pm.text(l='') pm.setParent(prefix + '_columnLayout_main') # Row 2 pm.separator(style='in', h=10, w=200) row2 = pm.rowColumnLayout(nc=3, cw=[(1, 66), (2, 66), (3, 66)]) ##MOVE pm.columnLayout() pm.text(l='Move', w=66, align='center') pm.separator(style='none', h=9) bgc = colorWheel.getNext() pm.rowColumnLayout(nc=3, cw=[(1, 15), (2, 34), (3, 15)]) pm.text(l='') pm.button( l='^', h=15, bgc=bgc, command=lambda *args: uvmp_move( [0, 1 * pm.floatField(prefix + '_move_value', q=True, v=True)])) pm.text(l='') pm.button( l='<', bgc=bgc, command=lambda *args: uvmp_move( [-1 * pm.floatField(prefix + '_move_value', q=True, v=True), 0])) pm.floatField(prefix + '_move_value', h=34, v=1.00, pre=2) pm.button( l='>', bgc=bgc, command=lambda *args: uvmp_move( [1 * pm.floatField(prefix + '_move_value', q=True, v=True), 0])) pm.text(l='') pm.button( l='v', h=15, bgc=bgc, command=lambda *args: uvmp_move( [0, -1 * pm.floatField(prefix + '_move_value', q=True, v=True)])) pm.text(l='') pm.setParent(row2) ##SCALE pm.columnLayout() pm.text(l='Scale', w=66, align='center') pm.separator(style='none', h=4) bgc = colorWheel.getNext() pm.rowColumnLayout(nc=3, cw=[(1, 25), (2, 14), (3, 25)]) pm.button('U+', bgc=bgc, c=lambda *args: uvmp_scale( [pm.floatField(prefix + '_scale_value', q=True, v=True), 1])) pm.button('+', bgc=bgc, c=lambda *args: uvmp_scale([ pm.floatField(prefix + '_scale_value', q=True, v=True), pm.floatField(prefix + '_scale_value', q=True, v=True) ])) pm.button( 'V+', bgc=bgc, c=lambda *args: uvmp_scale( [1, pm.floatField(prefix + '_scale_value', q=True, v=True)])) pm.setParent('..') pm.rowColumnLayout(nc=3, cw=[(1, 13), (2, 38), (3, 13)]) pm.text(l='') pm.floatField(prefix + '_scale_value', v=2.00, min=1.0, pre=2, h=25) pm.text(l='') pm.setParent('..') pm.rowColumnLayout(nc=3, cw=[(1, 25), (2, 14), (3, 25)]) pm.button( 'U-', bgc=bgc, c=lambda *args: uvmp_scale([ pm.floatField(prefix + '_scale_value', q=True, v=True) / pow( pm.floatField(prefix + '_scale_value', q=True, v=True), 2), 1 ])) # x/(x^2) pm.button( '-', bgc=bgc, c=lambda *args: uvmp_scale([ pm.floatField(prefix + '_scale_value', q=True, v=True) / pow( pm.floatField(prefix + '_scale_value', q=True, v=True), 2), pm.floatField(prefix + '_scale_value', q=True, v=True) / pow( pm.floatField(prefix + '_scale_value', q=True, v=True), 2) ])) # x/(x^2) pm.button( 'V-', bgc=bgc, c=lambda *args: uvmp_scale([ 1, pm.floatField(prefix + '_scale_value', q=True, v=True) / pow( pm.floatField(prefix + '_scale_value', q=True, v=True), 2) ])) # x/(x^2) pm.setParent(row2) ##ROTATE pm.columnLayout() pm.text(l='Rotate', w=66, align='center') pm.separator(h=2) bgc = colorWheel.getNext() pm.rowColumnLayout(nc=2, cw=[(1, 16), (2, 48)]) pm.columnLayout() pm.button(prefix + '_clockwise', l='>', bgc=bgc, w=15, h=20, c=lambda *args: uvmp_rotate(-pm.floatField( prefix + '_rotate_value', q=True, v=True))) pm.button(prefix + '_counter_clockwise', l='<', bgc=bgc, w=15, h=20, c=lambda *args: uvmp_rotate( pm.floatField(prefix + '_rotate_value', q=True, v=True))) pm.setParent('..') pm.floatField(prefix + '_rotate_value', v=45.00, pre=2, h=40) pm.setParent('..') pm.floatSlider(prefix + '_rotate_free', min=-1, max=1, v=0, w=64, dc=uvmp_rotate_interactive, cc=uvmp_reset_slider) pm.button(l='align', bgc=bgc, w=65, h=20, command=lambda *args: uvmp_align_cardinal()) pm.setParent(prefix + '_columnLayout_main') # Row 3 pm.separator(style='in', h=10, w=200) row3 = pm.rowColumnLayout(nc=2, cw=[(1, 100), (2, 100)]) uvmp_texture_range_UI() pm.setParent(row3) ##TOOLS pm.gridLayout(nrc=[2, 2], cwh=[48, 48]) pm.symbolButton(image='expandContainer.png', bgc=(0.25, 0.5, 0.25), command=lambda *args: uvmp_split_edges_at_UVs(), annotation='Enter UV Unfold') pm.symbolButton(image='collapseContainer.png', bgc=(0.5, 0.25, 0.25), command=lambda *args: uvmp_merge_special(), annotation='Exit UV Unfold') pm.symbolButton(image='polyMapCut.png', command=lambda *args: uvmp_cut_edge(), annotation='Cut UV Edge') pm.symbolButton(image='textureEditorUnfoldUVsLarge.png', command=lambda *args: uvmp_auto_layout(), annotation='Auto UV Layout') pm.setParent(prefix + '_columnLayout_main') # #Row 4 # pm.separator(style='in', h=10, w=200) # pm.rowColumnLayout(nc=2, cw=[(1,100), (2,100)]) # pm.setParent(prefix+'_columnLayout_main') # if not asChildLayout: mainWindow.show() pm.window(mainWindow.mainWindow, edit=True, h=height, w=width) else: pm.setParent('..') pm.setParent('..') # edit menus optionsMenu, helpMenu = lcUI.UI.lcToolbox_child_menu_edit( asChildLayout, windowName) # restore interface selections pm.checkBox(prefix + '_checkBox_shell', edit=True, value=lct_cfg.get('lcUVToolsShell')) # extra stuff pm.setFocus( prefix + '_move_value' ) # set cursor focus on move value, otherwise it sets to first available ui element lcPlugin.Plugin.reload_plugin(plugin='Unfold3D', autoload=True)
def slider_drag_command(self): blend = pm.floatSlider ( self.widgets['weight_slider'], q=True, value=True) self.blend_current_pose(blend)
def uiCreate(self): self.onCloseClicked() self.window = pm.window(WIN_NAME, title='PyMel Window', maximizeButton=False) with self.window: with pm.formLayout() as uiLAY_mainForm: with pm.scrollLayout( 'uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll: with pm.columnLayout(adjustableColumn=True): with self.uiCreateFrame( 'uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)' ) as self.uiLAY_frameCheckBoxes: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiCHK_test1 = pm.checkBox( 'uiCHK_test1', label='test1') self.uiCHK_test2 = pm.checkBox( 'uiCHK_test2', label='test2') with self.uiCreateFrame( 'uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)' ) as self.uiLAY_frameCheckBoxGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCHKGRP_test1 = pm.checkBoxGrp( 'uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1') self.uiCHKGRP_test2 = pm.checkBoxGrp( 'uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2')) self.uiCHKGRP_test3 = pm.checkBoxGrp( 'uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3')) self.uiCHKGRP_test4 = pm.checkBoxGrp( 'uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4')) with self.uiCreateFrame( 'uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)' ) as self.uiLAY_frameColorSliders: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiCLRGRP_test1 = pm.colorSliderGrp( 'uiCLRGRP_test1', label='test1') self.uiCLRGRP_test2 = pm.colorSliderGrp( 'uiCLRGRP_test2', label='test2') with self.uiCreateFrame( 'uiLAY_frameFloatFields', 'Float Fields (PMFloatField)' ) as self.uiLAY_frameFloatFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiFLF_test1 = pm.floatField( 'uiFLF_test1') self.uiFLF_test2 = pm.floatField( 'uiFLF_test2') with self.uiCreateFrame( 'uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)' ) as self.uiLAY_frameFloatFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLFGRP_test1 = pm.floatFieldGrp( 'uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1') self.uiFLFGRP_test2 = pm.floatFieldGrp( 'uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2') self.uiFLFGRP_test3 = pm.floatFieldGrp( 'uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3') self.uiFLFGRP_test4 = pm.floatFieldGrp( 'uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4') with self.uiCreateFrame( 'uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)' ) as self.uiLAY_frameFloatScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLSCRL_test1 = pm.floatScrollBar( 'uiFLSCRL_test1') self.uiFLSCRL_test2 = pm.floatScrollBar( 'uiFLSCRL_test2') with self.uiCreateFrame( 'uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)' ) as self.uiLAY_frameFloatSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiFLTSLD_test1 = pm.floatSlider( 'uiFLTSLD_test1') self.uiFLTSLD_test2 = pm.floatSlider( 'uiFLTSLD_test2') with self.uiCreateFrame( 'uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)' ) as self.uiLAY_frameFloatSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiFLSGRP_test1 = pm.floatSliderGrp( 'uiFLSGRP_test1', label='test1', field=True) self.uiFLSGRP_test2 = pm.floatSliderGrp( 'uiFLSGRP_test2', label='test2', field=True) with self.uiCreateFrame( 'uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)' ) as self.uiLAY_frameIconTextCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITCHK_test1 = pm.iconTextCheckBox( 'uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube') self.uiITCHK_test2 = pm.iconTextCheckBox( 'uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone') with self.uiCreateFrame( 'uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)' ) as self.uiLAY_frameIconTextRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.iconTextRadioCollection() self.uiITRAD_test1 = pm.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube') self.uiITRAD_test2 = pm.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone') self.uiITRAD_test3 = pm.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus') with self.uiCreateFrame( 'uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)' ) as self.uiLAY_frameIconTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiITSLST_test1 = pm.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) self.uiITSLST_test2 = pm.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)' ) as self.uiLAY_frameIntFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiINF_test1 = pm.intField( 'uiINF_test1') self.uiINF_test2 = pm.intField( 'uiINF_test2') with self.uiCreateFrame( 'uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)' ) as self.uiLAY_frameIntFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINFGRP_test1 = pm.intFieldGrp( 'uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1') self.uiINFGRP_test2 = pm.intFieldGrp( 'uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2') self.uiINFGRP_test3 = pm.intFieldGrp( 'uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3') self.uiINFGRP_test4 = pm.intFieldGrp( 'uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4') with self.uiCreateFrame( 'uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)' ) as self.uiLAY_frameIntScrollBars: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINSCRL_test1 = pm.intScrollBar( 'uiINSCRL_test1') self.uiINSCRL_test2 = pm.intScrollBar( 'uiINSCRL_test2') with self.uiCreateFrame( 'uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)' ) as self.uiLAY_frameIntSliders: with pm.columnLayout(adjustableColumn=True): pm.separator(style='none', height=2) self.uiINTSLD_test1 = pm.intSlider( 'uiINTSLD_test1') self.uiINTSLD_test2 = pm.intSlider( 'uiINTSLD_test2') with self.uiCreateFrame( 'uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)' ) as self.uiLAY_frameIntSliderGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiINSGRP_test1 = pm.intSliderGrp( 'uiINSGRP_test1', label='test1', field=True) self.uiINSGRP_test2 = pm.intSliderGrp( 'uiINSGRP_test2', label='test2', field=True) with self.uiCreateFrame( 'uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)' ) as self.uiLAY_frameOptionMenus: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=110, style='none') self.uiOPTMNU_test1 = pm.optionMenu( 'uiOPTMNU_test1', label='test1') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPTMNU_test2 = pm.optionMenu( 'uiOPTMNU_test2', label='test2') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame( 'uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)' ) as self.uiLAY_frameOptionMenuGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiOPMGRP_test1 = pm.optionMenuGrp( 'uiOPMGRP_test1', label='test1', extraLabel='extraLabel') pm.menuItem(label='one') pm.menuItem(label='two') pm.menuItem(label='three') self.uiOPMGRP_test2 = pm.optionMenuGrp( 'uiOPMGRP_test2', label='test2', extraLabel='extraLabel') pm.menuItem(label='four') pm.menuItem(label='five') pm.menuItem(label='six') with self.uiCreateFrame( 'uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)' ) as self.uiLAY_frameRadioButtons: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=4): pm.separator(style='none', width=140) pm.radioCollection() self.uiRAD_test1 = pm.radioButton( 'uiRAD_test1', label='test1') self.uiRAD_test2 = pm.radioButton( 'uiRAD_test2', label='test2') self.uiRAD_test3 = pm.radioButton( 'uiRAD_test3', label='test3') with self.uiCreateFrame( 'uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)' ) as self.uiLAY_frameRadioButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiRADGRP_test1 = pm.radioButtonGrp( 'uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1') self.uiRADGRP_test2 = pm.radioButtonGrp( 'uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2')) self.uiRADGRP_test3 = pm.radioButtonGrp( 'uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3')) self.uiRADGRP_test4 = pm.radioButtonGrp( 'uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4')) with self.uiCreateFrame( 'uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)' ) as self.uiLAY_frameSymbolCheckBoxes: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSYMCHK_test1 = pm.symbolCheckBox( 'uiSYMCHK_test1', image='polyCube') self.uiSYMCHK_test2 = pm.symbolCheckBox( 'uiSYMCHK_test2', image='polyCone') with self.uiCreateFrame( 'uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)' ) as self.uiLAY_frameScriptTables: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRTBL_test1 = pm.scriptTable( 'uiSCRTBL_test1', selectionMode=3, rows=4, columns=2) self.uiSCRTBL_test2 = pm.scriptTable( 'uiSCRTBL_test2', selectionMode=3, rows=4, columns=2) with self.uiCreateFrame( 'uiLAY_frameScrollField', 'Scroll Field (PMScrollField)' ) as self.uiLAY_frameScrollField: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiSCRFLD_test1 = pm.scrollField( 'uiSCRFLD_test1', wordWrap=True) self.uiSCRFLD_test2 = pm.scrollField( 'uiSCRFLD_test2', wordWrap=True) with self.uiCreateFrame( 'uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)' ) as self.uiLAY_frameShelfTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.shelfTabLayout( 'uiSHLTAB_test1' ) as self.uiSHLTAB_test1: with pm.shelfLayout('test1'): pass with pm.shelfLayout('test2'): pass with pm.shelfLayout('test3'): pass with pm.shelfTabLayout( 'uiSHLTAB_test2' ) as self.uiSHLTAB_test2: with pm.shelfLayout('test4'): pass with pm.shelfLayout('test5'): pass with pm.shelfLayout('test6'): pass with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)' ) as self.uiLAY_frameTabLayout: with pm.columnLayout(adjustableColumn=True): with pm.tabLayout( 'uiTAB_test1') as self.uiTAB_test1: with pm.rowLayout(numberOfColumns=1 ) as uiLAY_tabRow1: pass with pm.rowLayout(numberOfColumns=1 ) as uiLAY_tabRow2: pass with pm.rowLayout(numberOfColumns=1 ) as uiLAY_tabRow3: pass pm.tabLayout(self.uiTAB_test1, edit=True, tabLabel=( (uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'), )) with pm.tabLayout( 'uiTAB_test2') as self.uiTAB_test2: with pm.rowLayout(numberOfColumns=1 ) as uiLAY_tabRow4: pass with pm.rowLayout(numberOfColumns=1 ) as uiLAY_tabRow5: pass with pm.rowLayout(numberOfColumns=1 ) as uiLAY_tabRow6: pass pm.tabLayout(self.uiTAB_test2, edit=True, tabLabel=( (uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'), )) with self.uiCreateFrame( 'uiLAY_frameTextFields', 'Text Fields (PMTextField)' ) as self.uiLAY_frameTextFields: with pm.columnLayout(): pm.separator(style='none', height=2) with pm.rowLayout(numberOfColumns=3): pm.separator(width=140, style='none') self.uiTXT_test1 = pm.textField( 'uiTXT_test1') self.uiTXT_test2 = pm.textField( 'uiTXT_test2') with self.uiCreateFrame( 'uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)' ) as self.uiLAY_frameTextFieldButtonGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXBTGR_test1 = pm.textFieldButtonGrp( 'uiTXBTGR_test1', label='test1', buttonLabel='button1') self.uiTXBTGR_test2 = pm.textFieldButtonGrp( 'uiTXBTGR_test2', label='test2', buttonLabel='button2') with self.uiCreateFrame( 'uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)' ) as self.uiLAY_frameTextFieldGroups: with pm.columnLayout(): pm.separator(style='none', height=2) self.uiTXTGRP_test1 = pm.textFieldGrp( 'uiTXTGRP_test1', label='test1') self.uiTXTGRP_test2 = pm.textFieldGrp( 'uiTXTGRP_test2', label='test2') with self.uiCreateFrame( 'uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)' ) as self.uiLAY_frameTextScrollLists: with pm.columnLayout(): with pm.rowLayout(numberOfColumns=3): pm.separator(style='none', width=140) self.uiTXTLST_test1 = pm.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) self.uiTXTLST_test2 = pm.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')) self.uiBTN_savePrefs = pm.button( label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked) self.uiBTN_loadPrefs = pm.button( label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked) self.uiBTN_resetPrefs = pm.button( label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2) uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2) uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs) uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top') uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2) uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33) uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33) uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2) uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top') uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2) uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2) self.window.setTitle(self.window.__class__)