def _buildupWindow(self): if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()): _pmCore.deleteUI(self._window, window=True) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout(adjustableColumn=True) _pmCore.scrollLayout(width=300, height=250, childResizable=True) _pmCore.gridLayout(numberOfColumns=2, cellHeight = self._iconSize, cellWidth=self._iconSize) for versionNum in _Database.getVersionList(self._fileID): versionInfo = _Database.getVersionInfo(self._fileID, versionNum) print versionInfo thumbnailPath = versionInfo[3] if not _os.path.exists(versionInfo[3]): thumbnailPath = "cube.png" button = _pmCore.iconTextButton(self._versionBtnName(versionNum), style='iconAndTextVertical', image1=thumbnailPath, label=self._versionBtnName(versionNum), command=_pmCore.Callback(self._versionSelected, versionNum)) self._uiWidget[self._versionBtnName(versionNum)] = button _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.separator(style='none', height=10) _pmCore.text(label="Comments: ", align='left') self._uiWidget['commentLayout'] = _pmCore.scrollLayout(width=300, height=120, childResizable=True) _pmCore.setParent('..') _pmCore.separator(style='none', height=10) self._uiWidget['comment'] = _pmCore.scrollField(width=300, height=80) _pmCore.button(label='Add Comment', command=_pmCore.Callback(self._commentAdded))
def UI(): """The UI """ if pm.window("selectionManagerWindow", ex=True): pm.deleteUI("selectionManagerWindow", wnd=True) selection_manager_window = pm.window( 'selectionManagerWindow', wh=(300, 200), title=("Selection Manager %s" % __version__) ) form_layout1 = pm.formLayout("selectionManager_formLayout1", nd=100) with form_layout1: button1 = pm.button(l="Add selection to List") scroll_layout1 = pm.scrollLayout("selectionManager_scrollLayout1", cr=True) with scroll_layout1: pm.gridLayout( "selectionManager_gridLayout1", nc=1, cwh=(((17 * 4) + 204), 22), aec=False, cr=False ) pm.formLayout( form_layout1, edit=True, attachForm=[ (button1, "left", 0), (button1, "right", 0), (button1, "top", 0), (scroll_layout1, "left", 0), (scroll_layout1, "right", 0), (scroll_layout1, "bottom", 0) ], attachControl=[(scroll_layout1, "top", 0, button1)], attachNone=[(button1, "bottom")]) def create_row(parent): row = SelectionRowFactory.create_row(parent) row._draw() button1.setCommand(pm.Callback(create_row, scroll_layout1)) # restore rows from Maya scene for row in SelectionRowFactory.restore_rows(scroll_layout1): row._draw() pm.showWindow(selection_manager_window)
def __init__(self, par): ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=3, cwh=[26, 26]) as self.layout: pm.iconTextButton(image1='cutUV.png', c=lambda *args: pm.polyMapCut(), commandRepeatable=True, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSeparateUVsAlongSelectedEdgesAnnot')) pm.iconTextButton(image1='polySplitUVs.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSplitSelectedUV'), c=lambda *args: pm.mel.polySplitTextureUV(), commandRepeatable=True) pm.iconTextButton(image1='tearface', ann='Tear Off Selected Face From UVs', c=self.tear_face, commandRepeatable=True) sewuv = pm.iconTextButton(image1='sew_uv.png', c=self.sew_uv, commandRepeatable=True, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSewSelectedUVsTogetherAnnot')) pm.popupMenu(button=3, p=sewuv, pmc=lambda *args: pm.mel.performPolyMergeUV(1)) movesewuv = pm.iconTextButton(image1='moveSewUV.png', c=lambda *args: pm.mel.performPolyMapSewMove(0), commandRepeatable=True, ann=pm.mel.uiRes( 'm_textureWindowCreateToolBar.kMoveAndSewSelectedEdgesAnnot')) pm.popupMenu(button=3, p=movesewuv, pmc=lambda *args: pm.mel.performPolyMapSewMove(1))
def __init__(self, par): ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=3, cwh=[26, 26]) as self.layout: pm.toolButton(dcc=lambda *args: pm.toolPropertyWindow, collection='toolCluster', tool=pm.texLatticeDeformContext(), image1='uvlattice.png', style='iconOnly', width=24, height=24) pm.toolButton(dcc=lambda *args: pm.toolPropertyWindow, collection='toolCluster', tool=pm.texMoveUVShellContext(), image1='moveUVShell.png', style='iconOnly', width=24, height=24) pm.toolButton(dcc=lambda *args: pm.toolPropertyWindow, collection='toolCluster', tool=pm.texSmoothContext(), image1='texSmooth.png', style='iconOnly', width=24, height=24) pm.toolButton(dcc=lambda *args: pm.toolPropertyWindow, collection='toolCluster', tool=pm.texSmudgeUVContext(), image1='textureEditorSmudgeUV.png', style='iconOnly', width=24, height=24) pm.toolButton(dcc=lambda *args: pm.toolPropertyWindow, collection='toolCluster', tool=pm.texSelectContext(), image1='textureEditorShortestEdgePath.png', style='iconOnly', width=24, height=24)
def __init__(self, par, editor): self.editor = editor ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout: griddisp = pm.iconTextCheckBox(image1='gridDisplay.png', value=pm.textureWindow(self.editor, q=True, toggle=True), onc=lambda *args: pm.textureWindow(self.editor, e=True, toggle=True), ofc=lambda *args: pm.textureWindow(self.editor, e=True, toggle=False), ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kViewGridAnnot')) pm.popupMenu(button=3, p=griddisp, pmc=lambda *args: pm.mel.performTextureViewGridOptions(1)) pxsnap = pm.iconTextCheckBox(image1='pixelSnap.png', value=pm.snapMode(q=True, pixelSnap=True), onc=lambda *args: pm.snapMode(pixelSnap=True), ofc=lambda *args: pm.snapMode(pixelSnap=False), ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPixelSnapAnnot')) pm.popupMenu(button=3, p=pxsnap, pmc=lambda *args: pm.mel.performPixelSnapOptions(1)) pm.iconTextButton(image1='textureEditorDisplayColor.png', c=lambda *args: pm.textureWindow(self.editor, e=True, displayStyle='color'), ann='m_textureWindowCreateToolBar.kDisplayRGBChannelsAnnot') pm.iconTextButton(image1='textureEditorDisplayAlpha.png', c=lambda *args: pm.textureWindow(self.editor, e=True, displayStyle='mask'), ann='m_textureWindowCreateToolBar.kDisplayAlphaChannelsAnnot')
def _categoryUpdated(self, add=None, rename=None, delete=None): _pmCore.setParent(self._uiWidget[_UiWidgetEnum.categoryTabLayout]) if add: # Add a tab in main asset view. childLayout = _pmCore.scrollLayout(width=300, height=200, childResizable=True) self._uiWidget[add] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize) _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], tabLabel=((childLayout, add),), edit=True) # Add a menu item in category list. From example in Maya doc optionMenuGrp. newMenuItem = _pmCore.menuItem(label=add, parent=self._uiWidget[_UiWidgetEnum.categoryCombox]+'|OptionMenu') self._uiWidget[_UiWidgetEnum.categoryMenuList].append(newMenuItem) if rename: tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True) childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True) _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], edit=True, tabLabel=((childLayoutList[tabNameList.index(rename[0])], rename[1]))) for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]: if _pmCore.menuItem(item, query=True, label=True) != rename[0]: continue _pmCore.menuItem(item, edit=True, label=rename[1]) break if delete: tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True) childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True) _pmCore.deleteUI(childLayoutList[tabNameList.index(delete)]) for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]: if _pmCore.menuItem(item, query=True, label=True) != delete: continue _pmCore.deleteUI(item) break
def __init__(self, par): ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=3, cwh=[18, 18]) as self.layout: # FIXME new icons, and annotations pm.iconTextButton(image1='NS_snapTopLeft.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('topLeft'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapTop.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('topCenter'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapTopRight.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('topRight'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapLeft.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('centerLeft'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapCenter.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('center'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapRight.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('centerRight'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapBottomLeft.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('bottomLeft'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapBottom.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('bottomCenter'), commandRepeatable=True) pm.iconTextButton(image1='NS_snapBottomRight.bmp', width=16, height=16, c=lambda *args: self.snap_uvs('bottomRight'), commandRepeatable=True)
def __init__(self, par, editor): ToolsUI.__init__(self, par) self.editor = editor with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout: swapbg = pm.iconTextCheckBox(image1='swapBG.png', value=pm.optionVar['displayEditorImage'], ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUVTextureEditorBakingAnnot'), cc=lambda *args: pm.mel.textureWindowToggleEditorImage(self.editor)) pm.popupMenu(button=3, p=swapbg, pmc=lambda *arg: pm.mel.performTextureViewBakeTextureOptions(1)) pm.iconTextButton(image1='updatePsdTextureEditor.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUpdatePSDNetworksAnnot'), c=lambda *args: pm.mel.psdUpdateTextures(), commandRepeatable=True) pm.iconTextButton(image1='bakeEditor.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kForceEditorTextureRebakeAnnot'), c=lambda *args: pm.mel.textureWindowBakeEditorImage(), commandRepeatable=True) pm.iconTextCheckBox(image1='imageRatio.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUseImageRatioAnnot'), value=pm.textureWindow(self.editor, q=True, imageRatio=True), onc=lambda *args: pm.textureWindow(self.editor, e=True, imageRatio=True), ofc=lambda *args: pm.textureWindow(self.editor, e=True, imageRatio=False))
def _build_general_frame(parent_layout): general_frame = pm.frameLayout(label="General", collapsable=True) pm.columnLayout(adj=True, columnAttach=('both', 5)) pm.separator(height=5, style='none') pm.button(label='Save Pose', command=mimic_utils.save_pose_to_shelf, annotation='Saves selected robot\'s current configuration\n' \ 'to a button on the Mimic shelf') pm.separator(height=10, style='out') pm.gridLayout(numberOfColumns=2, cellWidth=109, cellHeight=25) # Zero target button pm.button(label='Zero Tool (TCS)', command=mimic_utils.zero_target, annotation='Sets target_CTRL (or tool_CTRL if it exists)\n' 'transform to Zero') # Zero robot local controller button pm.button(label='Zero Base (LCS)', command=mimic_utils.zero_base_local, annotation='Sets local_CTRL transform to Zero') # Zero robot world controller button pm.button(label='Zero Base (WCS)', command=mimic_utils.zero_base_world, annotation='Sets world_CTRL transform to Zero') # Zero all button pm.button(label='Zero All', command=mimic_utils.zero_all, annotation='Sets local_CTRL, world_CTRL, and target_CTRL (or ' \ 'tool_CTRL if it exists)\ntransforms\' to Zero') pm.setParent('..') pm.separator(height=10, style='out') # Toggle heads up display button pm.button(label='Toggle HUD', command=mimic_utils.axis_val_hud, annotation='Toggles the visibility of Mimic\'s Heads Up Display') pm.separator(height=5, style='none') pm.setParent(parent_layout)
def _buildupWindow(self): if self._dockControl and self._dockControl.exists(self._winTitle): _pmCore.deleteUI(self._dockControl) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout() self._dockControl = _pmCore.dockControl(area='right', content=self._window, label=self._winTitle) tabLayout = _pmCore.tabLayout() self._uiWidget[_UiWidgetEnum.categoryTabLayout] = tabLayout for category in _Database.getCategoryList(): childLayout = _pmCore.scrollLayout(width=300, height=300, childResizable=True) self._uiWidget[category] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize) for assetInfo in _Database.getAssetUnderCategory(category): id, sceneName, _, versionID, _, _, _ = assetInfo self._addAssetButton(id, sceneName, versionID) _pmCore.tabLayout(tabLayout, tabLabel=((childLayout, category),), edit=True) _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.setParent('..') self._uiWidget[_UiWidgetEnum.sceneNameTextField] = _pmCore.textFieldGrp(label='Scene Name: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) self._uiWidget[_UiWidgetEnum.filePathTextField] = _pmCore.textFieldGrp(label='File Path: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) _pmCore.rowLayout(numberOfColumns=2) _pmCore.text(label="Current Version:", width=100, align='left') self._uiWidget[_UiWidgetEnum.versionNumText] = _pmCore.text(label="") _pmCore.setParent('..') self._uiWidget[_UiWidgetEnum.categoryCombox] = _pmCore.optionMenuGrp(label='Category: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195]) for category in _Database.getCategoryList(): self._uiWidget.setdefault(_UiWidgetEnum.categoryMenuList, []).append(_pmCore.menuItem(label=category)) _pmCore.text(label='Description:') self._uiWidget[_UiWidgetEnum.descriptionTextField] = _pmCore.scrollField(width=300, height=50) _pmCore.separator(style='single', horizontal=True) _pmCore.gridLayout(numberOfColumns=2, cellWidth=150) self._uiWidget[_UiWidgetEnum.updateAssetBtn] = _pmCore.button(label='Update Asset Info', command=_pmCore.Callback(self._updateAssetClicked)) self._uiWidget[_UiWidgetEnum.addCommentBtn] = _pmCore.button(label='View Version & Comment', command=_pmCore.Callback(self._viewVersionListClicked)) self._uiWidget[_UiWidgetEnum.addAssetBtn] = _pmCore.button(label='Add New Asset', command=_pmCore.Callback(self._addAssetClicked)) self._uiWidget[_UiWidgetEnum.deleteAssetBtn] = _pmCore.button(label='Delete Asset', command=_pmCore.Callback(self._deleteAssetClicked)) self._uiWidget[_UiWidgetEnum.addVersionBtn] = _pmCore.button(label='Add Version', command=_pmCore.Callback(self._addVersionClicked)) self._uiWidget[_UiWidgetEnum.manageCategoryBtn] = _pmCore.button(label='Manage Category', command=self._manageCategoryClicked) _pmCore.setParent('..')
def UI(): """The UI """ if pm.window("selectionManagerWindow", ex=True): pm.deleteUI("selectionManagerWindow", wnd=True) selection_manager_window = pm.window('selectionManagerWindow', wh=(300, 200), title=("Selection Manager %s" % __version__)) form_layout1 = pm.formLayout("selectionManager_formLayout1", nd=100) with form_layout1: button1 = pm.button(l="Add selection to List") scroll_layout1 = pm.scrollLayout("selectionManager_scrollLayout1", cr=True) with scroll_layout1: pm.gridLayout("selectionManager_gridLayout1", nc=1, cwh=(((17 * 4) + 204), 22), aec=False, cr=False) pm.formLayout(form_layout1, edit=True, attachForm=[(button1, "left", 0), (button1, "right", 0), (button1, "top", 0), (scroll_layout1, "left", 0), (scroll_layout1, "right", 0), (scroll_layout1, "bottom", 0)], attachControl=[(scroll_layout1, "top", 0, button1)], attachNone=[(button1, "bottom")]) def create_row(parent): row = SelectionRowFactory.create_row(parent) row._draw() button1.setCommand(pm.Callback(create_row, scroll_layout1)) # restore rows from Maya scene for row in SelectionRowFactory.restore_rows(scroll_layout1): row._draw() pm.showWindow(selection_manager_window)
def __init__(self): with pm.frameLayout(l='Transform:', cll=True, cl=False, bs='out'): with pm.columnLayout(): with pm.gridLayout(nc=5): pm.iconTextButton(image1='pbUV/tRot90CCW.png', c=lambda *args: self.rotate(angle=90, dir='ccw'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tRotCCW.png', c=lambda *args: self.rotate(dir='ccw'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tTranslateUp.png', c=lambda *args: self.move(v=1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tRotCW.png', c=lambda *args: self.rotate(dir='cw')) pm.iconTextButton(image1='pbUV/tRot90CW.png', c=lambda *args: self.rotate(angle=90, dir='cw'), commandRepeatable=True) flipuv = pm.iconTextButton(image1='pbUV/tFlipUV.png', c=lambda *args: self.flip(axis='u'), commandRepeatable=True) pm.popupMenu(button=3, p=flipuv, pmc=lambda *args: self.flip(axis='v')) pm.iconTextButton(image1='pbUV/tTranslateLeft.png', c=lambda *args: self.move(u=-1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tTranslateDown.png', c=lambda *args: self.move(v=-1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tTranslateRight.png', c=lambda *args: self.move(u=1), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tRot180CCW.png', c=lambda *args: self.rotate(angle=180, dir='ccw'), commandRepeatable=True) with pm.rowColumnLayout(nc=4): self.manipValue = pm.floatField(v=1.0) pm.iconTextButton(image1='pbUV/tScaleU.png', c=lambda *args: self.scale(axis='u'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tScaleV.png', c=lambda *args: self.scale(axis='v'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/tScaleUV.png', c=lambda *args: self.scale(), commandRepeatable=True) pm.separator(st='in', width=160, height=8) with pm.rowLayout(nc=2): pm.button(l='Orient Edge', c=self.orient_edge) pm.button(l='Orient Bounds', c=self.orient_bounds) pm.separator(st='in', width=160, height=8) with pm.columnLayout(cal='left'): pm.text(l='Pivot:') self.pivType = pm.radioButtonGrp(nrb=2, labelArray2=['Selection', 'Custom'], cw2=[64, 64], cc=self._piv_change, sl=1) with pm.rowLayout(nc=3, en=False) as self.pivPos: pm.text('POS:') self.pivU = pm.floatField() self.pivV = pm.floatField() self.sampleSel = pm.button(l='Sample Selection', height=18, en=False, c=self.sample_sel_cmd)
def _build_axis_limits_frame(parent_layout): limits_frame = pm.frameLayout(label="Axis Limits", collapsable=True) limits_tab_layout = pm.tabLayout('limits_tab_layout') position_limits_tab = _build_position_limits_tab(limits_tab_layout) velocity_limits_tab = _build_velocity_limits_tab(limits_tab_layout) accel_limits_tab = _build_accel_limits_tab(limits_tab_layout) jerk_limits_tab = _build_jerk_limits_tab(limits_frame) tabs = [(position_limits_tab, 'Position'), (velocity_limits_tab, 'Vel'), (accel_limits_tab, 'Accel'), (jerk_limits_tab, 'Jerk')] assign_tabs(tabs, limits_tab_layout) pm.columnLayout() pm.gridLayout(nc=2, cw=114, ch=25) pm.button(label='Get Axis Limits', command=mimic_utils.write_limits_to_ui) pm.button(label='Set Axis Limits', command=mimic_utils.set_axis_limits) pm.setParent('..') pm.button(label='Clear', width=228, command=mimic_utils.clear_limits_ui) pm.setParent(parent_layout)
def __init__(self, par): ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout: layoutbutton = pm.iconTextButton(image='layoutUV.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kSelectFacesToMoveAnnot'), c=lambda *args: pm.mel.performPolyLayoutUV(0), commandRepeatable=True) pm.popupMenu(button=3, parent=layoutbutton, pmc=lambda *args: pm.mel.performPolyLayoutUV(1)) layout_u_or_v = pm.iconTextButton(image='layoutUV.png', # FIXME new image ann='Select Faces to be moved in U or V Space', c=lambda *args: self.u_or_v(0), commandRepeatable=True) pm.popupMenu(button=3, parent=layout_u_or_v, pmc=lambda *args: self.u_or_v(1))
def CreateClothWindow(self,*args): if pm.window("cloth", exists = True): pm.deleteUI("cloth") cloth = pm.window("Create Cloth", t = "Create Cloth", w = 400, h = 600) pm.columnLayout(adj = True, cal = "center", columnAttach=('both', 25)) pm.separator(h = 30) pm.text("Cloth Simulation with PBD and exact CCD", font = "boldLabelFont") pm.separator(h = 30) pm.frameLayout(label = "Cloth Subdivisions", collapsable = True, borderStyle = "etchedIn") self.GlobalVars["SubX"] = pm.intSliderGrp(l = "Subdivision X", min = 1, max = 20, value = 10, field = True) self.GlobalVars["SubY"] = pm.intSliderGrp(l = "Subdivision Y", min = 1, max = 20, value = 10, field = True) pm.setParent("..") pm.frameLayout(label = "Position Constraints", collapsable = True, borderStyle = "etchedIn") pm.gridLayout(numberOfColumns = 2, cellWidthHeight = (180,20)) self.GlobalVars["Locator_LeftTopCorner"] = pm.checkBox(label = "Locator_LeftTopCorner") self.GlobalVars["Locator_RightTopCorner"] = pm.checkBox(label = "Locator_RightTopCorner") self.GlobalVars["Locator_RightBottomCorner"] = pm.checkBox(label = "Locator_RightBottomCorner") self.GlobalVars["Locator_LeftBottomCorner"] = pm.checkBox(label = "Locator_LeftBottomCorner") self.GlobalVars["Locator_Middle"] = pm.checkBox(label = "Locator_Middle") pm.setParent("..") pm.setParent("..") pm.frameLayout(label = "Gravity", collapsable = True, borderStyle = "etchedIn") self.GlobalVars["GraV"] = pm.floatSliderGrp(l = "Gravity", min = 0.0, max = 9.8, field = True) pm.setParent("..") pm.frameLayout(label = "Wind Force", collapsable = True, borderStyle = "etchedIn") self.GlobalVars["Wind_X"] = pm.floatSliderGrp(l = "Wind Force_X", min = -10.0, max = 10, value = 0.0, field = True) self.GlobalVars["Wind_Y"] = pm.floatSliderGrp(l = "Wind Force_Y", min = -10.0, max = 10, value = 0.0, field = True) self.GlobalVars["Wind_Z"] = pm.floatSliderGrp(l = "Wind Force_Z", min = -10.0, max = 10, value = 0.0, field = True) self.GlobalVars["Noise"] = pm.floatSliderGrp(l = "Noise", min = 0.0, max = 2, value = 0.0, field = True) pm.setParent("..") pm.separator(h = 10) self.GlobalVars["DefaultText"] = pm.checkBox(label = "Default Texture") pm.separator(h = 10) pm.button(l = "Create", c = self.CreateCloth) pm.showWindow(cloth)
def init(self): #Initializing Variables self.localProject = os.environ[ 'MAYA_PROJECT' ] self.localUser=os.environ[ 'USER' ] self.path = (localProject + "/export/GEO") self.title='aw_msvExp' self.wh = [352,542] # Make me a button! if pm.window(self.title, query=True, exists=True): pm.deleteUI(self.title) if pm.windowPref(self.title, query=True, exists=True): pm.windowPref(self.title, remove=True) # Window creation self.window = pm.window(self.title,widthHeight=self.wh,title=self.title) self.majorLayout = pm.gridLayout('aw_expLayout',numberOfColumns=1,cellWidthHeight=(self.wh[0], (self.wh[1]/18))) pm.text(bgc=(.3, .35, .4),ebg=1,al="center",fn="boldLabelFont",l=" Obj Exporter") #menu for export type pm.optionMenu('exportType',label=" FileType") pm.menuItem(label="FBX") pm.menuItem(label="OBJ") pm.menuItem(label="PROXY") #menu for model type pm.optionMenu('modelType',changeCommand=lambda *args: mel.aw_addRemCombName(),label=" ModelType") pm.menuItem(label="Combined") pm.menuItem(label="Separate") #EXPORTER pm.textField('combName',tx="Object Export Name") pm.text(al="left",l="Set directory for objects to be outputted") pm.textField('pathName',tx=path_here) pm.button('fileBrowse2',command=lambda *args: mel.fileBrowser(pathname),label="Browse") pm.button('msvExp',bgc=(0.1, .7, .145),command=lambda *args: mel.objExp(),label="Export") pm.text(l="") #IMPORTER pm.text(bgc=(.3, .3, .4),ebg=1,al="center",fn="boldLabelFont",l=" Obj importer") pm.text(al="left",l="Set directory for objects to be inputted") pm.textField('pathImpName',tx=path_here) pm.button('fileBrowse1',command=lambda *args: mel.fileBrowser(pathimpname),label="Browse") pm.button('msvList',command=lambda *args: mel.fileList(),label="List OBJ Files") pm.text(al="left",l="Type wildcard here or leave blank for all objs in the folder") pm.textField('wildName') pm.button('msvImp',bgc=(0.1, .7, .145),command=lambda *args: mel.objImp(),label="Import") pm.button('msvKillBtn',command=lambda *args: deleteUI('aw_msvExp'),label="Close Window") self.window.show()
def __init__(self, par): ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=3, cwh=[26, 26]) as self.layout: pm.iconTextButton(image1='pbUV/pushMinU.png', c=lambda *args: pm.mel.alignUV(1, 1, 0, 0), commandRepeatable=True) pm.iconTextButton(image1='pbUV/pushCenterU.png', c=lambda *args: self.push_average('u'), commandRepeatable=True) pm.iconTextButton(image1='pbUV/pushMaxU.png', c=lambda *args: pm.mel.alignUV(1, 0, 0, 0), commandRepeatable=True) pm.iconTextButton(image1='pbUV/pushMaxV.png', c=lambda *args: pm.mel.alignUV(0, 0, 1, 0), commandRepeatable=True) pm.iconTextButton(image1='pbUV/pushCenterV.png', c=lambda *args: self.push_average('v')) pm.iconTextButton(image1='pbUV/pushMaxV.png', c=lambda *args: pm.mel.alignUV(0, 0, 1, 1), commandRepeatable=True)
def __init__(self, par): ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=3, cwh=[26, 26]) as self.layout: pm.iconTextButton(image1='NS_alUVleft.bmp', c=lambda *args: self.align_shells('left'), commandRepeatable=True) pm.iconTextButton(image1='NS_alUVCenterU.bmp', c=lambda *args: self.align_shells('centerU'), commandRepeatable=True) pm.iconTextButton(image1='NS_alUVRight.bmp', c=lambda *args: self.align_shells('right'), commandRepeatable=True) pm.iconTextButton(image1='NS_alUVTop.bmp', c=lambda *args: self.align_shells('top'), commandRepeatable=True) pm.iconTextButton(image1='NS_alUVCenterV.bmp', c=lambda *args: self.align_shells('centerV'), commandRepeatable=True) pm.iconTextButton(image1='NS_alUVBottom.bmp', c=lambda *args: self.align_shells('bottom'), commandRepeatable=True)
def __init__(self, par, editor): self.editor = editor ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout: pm.iconTextCheckBox(image='uvIsolateSelect.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kToggleIsolateSelectModeAnnot'), onc=lambda *args: self.set_isolate(True), ofc=lambda *args: self.set_isolate(False)) pm.iconTextButton(image='uvIsolateSelectReset.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kRemoveAllUVsAnnot'), c=lambda *args: pm.mel.textureEditorIsolateSelect(0), commandRepeatable=True) pm.iconTextButton(image='uvIsolateSelectAdd.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kAddSelectedUVsAnnot'), c=lambda *args: pm.mel.textureEditorIsolateSelect(1), commandRepeatable=True) pm.iconTextButton(image='uvIsolateSelectRemove.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kRemoveSelectedUVsAnnot'), c=lambda *args: pm.mel.textureEditorIsolateSelect(2), commandRepeatable=True)
def __init__(self, par): ToolsUI.__init__(self, par) with pm.gridLayout(p=par, nc=2, cwh=[26, 26]) as self.layout: unfold = pm.iconTextButton(image1='textureEditorUnfoldUVs.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUnfoldAnnot'), c=lambda *args: pm.mel.performUnfold(0), commandRepeatable=True) pm.popupMenu(button=3, p=unfold, pmc=lambda *args: pm.mel.performUnfold(1)) unfoldsep = pm.iconTextButton(image1='textureEditorUnfoldUVs.png', ann='Unfold selected UVs along U or V', c=lambda *args: self.unfold_sep_cmd(2)) pm.popupMenu(button=3, p=unfoldsep, pmc=lambda *args: self.unfold_sep_cmd(1)) relaxuv = pm.iconTextButton(image1='relaxUV.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kRelaxUVsAnnot'), c=lambda *args: pm.mel.performPolyUntangleUV('relax', 0)) pm.popupMenu(button=3, p=relaxuv, pmc=lambda *args: pm.mel.performPolyUntangleUV('relax', 1)) pm.iconTextButton(image='Null', c=lambda *args: self.match_shell(0.01), # FIXME maxRange stuff commandRepeatable=True, ann='Match Selected Shell to closest Shell')
stu=1.0, etu=4800) linear_cycle(mtpMercury) linear_cycle(mtpVenus) linear_cycle(mtpEarth) linear_cycle(mtpMars) linear_cycle(mtpJupiter) linear_cycle(mtpSaturn) linear_cycle(mtpUranus) linear_cycle(mtpNeptune) linear_cycle(mtpPluto) cmds.playbackOptions(max=4800) pmc.deleteUI(win) win = pmc.window(title="Animation") gridLayout = pmc.gridLayout(nr=2, nc=1, cwh=(180, 80)) strText = 'if you want animation to be fast click on the "Fast animation" button, else if you want animation to be slower click in "Slow animation" button' ExpText = pmc.text(label=strText, align='left', ww=True, parent=gridLayout) flowLayout = pmc.flowLayout(columnSpacing=20, parent=gridLayout) btnSlow = pmc.button(label='Slow animation', parent=flowLayout, command=lambda *args: slowAnimation(win)) btnFast = pmc.button(label='Fast animation', parent=flowLayout, command=lambda *args: fastAnimation(win)) pmc.windowPref(win, wh=(180, 100), le=300, te=300) win.show()
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 UIelement(self): box = pm.rowLayout(nc=4) # the color selection slider slider = pm.colorSliderGrp(label='matte' + str(self.matte) + ' ', rgb=self.defaultColor, cw=self.columnWidths) pm.colorSliderGrp(slider, edit=True, cc=lambda *args: setMatteColor(slider, getSel())) # RGB shortcut assignment buttons tritone = pm.gridLayout(numberOfColumns=4, cellWidthHeight=(17, 17), p=box) #red r = pm.button(l='', bgc=(.7, .1, .1), c=lambda *args: updateColor(getSel(), slider, 'r'), p=tritone) pm.popupMenu() kmenR = pm.menuItem( l='select', c=lambda *args: selectByColorAttr(slider, self.matte, 'r')) #green g = pm.button(l='', bgc=(.1, .7, .1), c=lambda *args: updateColor(getSel(), slider, 'g'), p=tritone) pm.popupMenu() kmenG = pm.menuItem( l='select', c=lambda *args: selectByColorAttr(slider, self.matte, 'g')) #blue b = pm.button(l='', bgc=(.1, .1, .7), c=lambda *args: updateColor(getSel(), slider, 'b'), p=tritone) pm.popupMenu() kmenB = pm.menuItem( l='select', c=lambda *args: selectByColorAttr(slider, self.matte, 'b')) #black k = pm.button(l='', bgc=(0.1, 0.1, 0.1), c=lambda *args: updateColor( convertSel(getSel(), sh=True), slider, 'k'), p=tritone) pm.popupMenu() kmenK = pm.menuItem( l='select', c=lambda *args: selectByColorAttr(slider, self.matte, 'k')) #Get current color pm.button( label='Get', width=35, p=box, c=lambda *args: getUserColorAttr(getSel(), slider, self.matte)) pm.setParent('..') pm.setParent('..') pm.separator(style='in', h=19, parent=box) return slider
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 _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))
if len( beCut ) == 1: cutters = [] # container for re-cut or cancel. beCut = beCut[0] # get transform node. cutterBase = pm.spaceLocator( name="cutterBase" ) # create cutter base. cutterTarget = pm.spaceLocator( name="cutterTarget" ) # create cutter target. cutterTarget.rotate.set(45,0,45) # let target's look differ from base. beCutT = beCut.translate.get() cutterBase.translate.set( beCutT ) # set base position. # move target from base. cutterTarget.translate.set( beCutT + (0,(beCut.getBoundingBoxMax()[1]),0)) # aim for polyCut direction. pm.aimConstraint( cutterTarget, cutterBase, aimVector=(0,0,1) ) # UI creation window = pm.window( title='poly cutter' ) pm.gridLayout( numberOfColumns=1, cellWidthHeight=(400, 30) ) numCutsUI = pm.intSliderGrp( field=True, dragCommand=cuts, changeCommand=cuts, label='number of cuts', minValue=1, maxValue=10, value=1) pm.gridLayout( numberOfColumns=2, cellWidthHeight=(200, 30) ) pm.button( label='Apply', command=applyButton ) pm.button( label='Cancel', command=cancelButton ) pm.showWindow( window ) # first cut. cuts()
def gui(): if(pm.window(newWindow, q=True,exists=True)): pm.deleteUI(newWindow) if(pm.windowPref(newWindow, q=True, exists=True)): pm.windowPref(newWindow,r=True) myWindow = pm.window(newWindow, t='Auto Arm Rig', w=150,h=325) main_layout=pm.columnLayout('Main Header') #Naming pm.text('naiming_Text', l="Step 1: Set name options") pm.rowColumnLayout(nc=4, cw=[(1,20),(2,40),(3,40),(4,50)]) pm.text('ori_txt', label='Ori:') pm.optionMenu('Ori_Menu', cc = scriptName + '.colorChange()') pm.menuItem(label='lf_') pm.menuItem(label='rt_') pm.menuItem(label='ct_') pm.text('label_txt', label='Label:') pm.optionMenu('Label_Menu') pm.menuItem(label='Leg') pm.menuItem(label='Arm') pm.setParent(main_layout) #Rig type pm.text('rigType_text', label ="step 2: Set rig type") pm.radioButtonGrp("armType_Btn", labelArray3=('IK','FK','IKFK'),numberOfRadioButtons=3,columnWidth3=[50,50,50],select=3, cc=scriptName +'.armTypeVis()') pm.separator('rig_Sep', w=150, h=5) #Icon options pm.text('conSet_Text',l='Step 3: Set Icon properties') pm.rowColumnLayout(nc=2,cw=([1,90],[2,60])) pm.text('ikStyleText', label='IK Icon Style:') pm.optionMenu('ikIcon_Menu') pm.menuItem(label = 'Box') pm.menuItem(label = '4 Arrows') pm.menuItem(label = '4 Pin') pm.text('fkStyle_Text', label ='FK Icon Style:') pm.optionMenu('fkIcon_Menu') pm.menuItem(label='Circle') pm.menuItem('Turn Arrows') pm.text('handStyle_Text', label ='Hand Icon Style:') pm.optionMenu('handIcon_menu') pm.menuItem(label="Circle") pm.menuItem('COG') pm.text('pvStyle_Text', label ='PV Icon Style:') pm.optionMenu('pvIcon_menu') pm.menuItem(label='Diamond') pm.menuItem(label='Arrow') pm.setParent(main_layout) pm.button('testIconButton', l='Make test icon to set scale', w=150, c=scriptName + '.armIconScale()') pm.separator('style_Sep', w=150, h=5) #Icon Colour pm.text('armColour_Text', l="Step 4: Pick icon colour") pm.gridLayout(nr=1,nc=5, cellWidthHeight = [30,20]) pm.iconTextButton('darkBlue_button', bgc=[0.000,0.016,0.373]) pm.iconTextButton('lightBlue_button', bgc=[0,0,1]) pm.iconTextButton('brown_button', bgc=[0.537,0.278,0.2]) pm.iconTextButton('red_button', bgc=[1,0,0]) pm.iconTextButton('yellow_button', bgc=[1,1,0]) pm.setParent(main_layout) pm.colorIndexSliderGrp('armColor', w=150, h=20, cw2=(150,0),min=0, max=31, value = 7) pm.separator('icon_Sep', w=150, h=5) #Pole Vector pm.text('PV_text', label='Step 5: Set IK elbow options') pm.radioButtonGrp('addPVElbow_btn', labelArray2 = ('twist','Pole Vector'),numberOfRadioButtons = 2, columnWidth2=[65,85], select =2) pm.separator('pole_Sep', w=150, h=5) pm.button('final_Button', l='Finalise the arm', w=150) pm.showWindow()
mtpPluto = cmds.pathAnimation( planetPluto, orbitOfPluto, f=True, fa='x', fm=True, ua='y', stu=1.0, etu=4800 ) linear_cycle( mtpMercury ) linear_cycle( mtpVenus ) linear_cycle( mtpEarth ) linear_cycle( mtpMars ) linear_cycle( mtpJupiter ) linear_cycle( mtpSaturn ) linear_cycle( mtpUranus ) linear_cycle( mtpNeptune ) linear_cycle( mtpPluto ) cmds.playbackOptions( max=4800 ) pmc.deleteUI(win) win = pmc.window( title="Animation" ) gridLayout = pmc.gridLayout( nr=2, nc=1, cwh=(180, 80) ) strText = 'if you want animation to be fast click on the "Fast animation" button, else if you want animation to be slower click in "Slow animation" button' ExpText = pmc.text( label = strText, align='left', ww=True, parent=gridLayout ) flowLayout = pmc.flowLayout( columnSpacing=20, parent=gridLayout ) btnSlow = pmc.button( label='Slow animation', parent=flowLayout, command=lambda *args: slowAnimation(win) ) btnFast = pmc.button( label='Fast animation', parent=flowLayout, command=lambda *args: fastAnimation(win) ) pmc.windowPref( win, wh=( 180, 100) , le=300, te=300 ) win.show()
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 _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 __init__(self): self.wh = (220, 500) self.setTitle('Scene Controller') #self.setToolbox() self.setResizeToFitChildren(1) self.setSizeable(1) self.setHeight(self.wh[1]) #self.setWidth(self.wh[0]) self.element_list = [] with open(cfb.SORTING_DATABASE) as yaml_stream: self.stream = yaml.load_all(yaml_stream) for element in self.stream: self.element_list.append(element['ELEMENT']) main = pm.columnLayout() # TEAM SWITCHING LAYOUT top_frame = pm.frameLayout( l='Team Switcher', #w=self.wh[0], fn='smallBoldLabelFont', cll=True, cl=False, p=main) column = pm.formLayout(p=top_frame) matchup_tgl = pm.radioButtonGrp('matchup_toggle', label='', labelArray2=['Single Team', 'Matchup'], numberOfRadioButtons=2, cw=[(1, 0)], cl2=['left', 'left'], cc=self.toggleMatchup, p=column) matchup_tgl.setSelect(1) home_team_txt = pm.textFieldGrp('home_team_txt', l='Home Team', cw2=[78, 130], cl2=['right', 'right'], p=column) away_team_txt = pm.textFieldGrp('away_team_txt', l='Away Team', cw2=[78, 130], cl2=['right', 'right'], en=False, p=column) diagnose_tgl = pm.checkBox('diagnose_tgl') diagnose_tgl.setLabel('Diagnose') diagnose_tgl.setValue(0) switchteam_btn = pm.button('switch_team', l='L O A D T E A M', bgc=red, c=self.loadBtn, p=column) column.redistribute() # SCENE SORTING LAYOUT bot_frame = pm.frameLayout(l='Scene Sorting', w=self.wh[0], fn='smallBoldLabelFont', cll=True, cl=False, p=main) # selection box column = pm.formLayout(p=bot_frame, #width=(self.wh[0]-5), ) pm.text(label='Select elements to sort', align='left', font='tinyBoldLabelFont', p=column) self.sel_box = pm.textScrollList('sort_sel_box', p=column) pm.textScrollList('sort_sel_box', e=True, ams=True, append=self.element_list, numberOfRows=15, p=column) # buttons self.sort_btn = pm.button(l='SORT SCENE', bgc=blue, p=column, c=self.sortBtn) self.teardn_btn = pm.button(l='TEARDOWN SCENE', p=column, c=self.teardownBtn) box = pm.formLayout(p=column) grid_l = pm.gridLayout(nc=2, nr=2, cr=True, cwh=((self.wh[0] / 2) - 3, 15), p=box) self.open_btn = pm.button(l='Open Scene', c=open_ui, p=grid_l) self.save_btn = pm.button(l='Save Scene', c=save_ui, p=grid_l) self.rename_btn = pm.button(l='Rename Scene', c=rename_ui, p=grid_l) self.ref_btn = pm.button( l='Reference Editor', c=lambda *args: pm.mel.eval('ReferenceEditor;'), p=grid_l) column.redistribute(1, 15, 3, 1, 4)
def run(*args, **kwargs): """Use this function to run the calculator.""" # Locking the DMC threshold rglobals = pm.PyNode('vraySettings') try: rglobals.dmcLockThreshold.set(1) except: pass ############################# ''' MAYA INTERFACE ''' ############################# try: pm.deleteUI('vraySampleCalcWin') except: pass vraySampleCalcWin = pm.window('vraySampleCalcWin', title="V-Ray Sample Calculator", iconName='SAMP', s=False) winBox = pm.columnLayout() ################################ ### DMC SAMPLER SETTINGS ### ################################ frame = pm.frameLayout(l='Adaptive DMC Sampler Settings', w=416, fn='smallBoldLabelFont', cll=True, cl=False, p=winBox) subframe = pm.columnLayout(adjustableColumn=False, parent=frame) ################################ ### PRIMARY RAYCAST SAMPLING ### ################################ header = pm.text(l=' Primary raycast sampling', fn='smallBoldLabelFont', align='center', p=subframe) pm.separator(style='in', h=1, p=subframe) row = pm.rowLayout(parent=subframe, numberOfColumns=2, cw2=(370, 20)) box = pm.columnLayout(parent=row, cw=370) # min_subdivs_in = pm.intSliderGrp( 'min_subdivs_in', field=True, cw=(3, 140), label='DMC Min Subdivs', step=2, cc=__uiUpdate, dc=__uiUpdate, minValue=1, maxValue=64, fieldMinValue=1, fieldMaxValue=9999, value=1, ann='The number of initial eye rays cast per-pixel.', parent=box) # max_subdivs_in = pm.intSliderGrp( 'max_subdivs_in', field=True, cw=(3, 140), label='DMC Max Subdivs', step=2, cc=__uiUpdate, dc=__uiUpdate, minValue=1, maxValue=64, fieldMinValue=1, fieldMaxValue=9999, value=4, ann= 'The maximum number of eye rays that will be cast to average out\nlarge changes in value between sample returns. (See Threshold)', parent=box) # thresh_val_in = pm.floatSliderGrp( 'thresh_val_in', field=True, cw=(3, 140), label='DMC Threshold', pre=3, cc=__uiUpdate, minValue=0.001, maxValue=0.020, fieldMinValue=0.001, fieldMaxValue=0.020, value=0.010, ann= "When the current raycast changes the previous value of the pixel\nby less thanthis amount, no more primary rays will be cast.\nUsually kept between 0.005 and 0.010.", parent=box) # adapt_amt_in = pm.floatSliderGrp( 'adapt_amt_in', field=True, cw=(3, 140), label='Adaptive Amount', pre=3, cc=__uiUpdate, dc=__uiUpdate, minValue=0.001, maxValue=1, fieldMinValue=0.001, fieldMaxValue=1, value=1, ann= "Weights the total number of adaptive secondary samples available per trace.\nLower values mean more samples will be cast before becoming adaptive.", parent=box) # adapt_min_in = pm.intSliderGrp( 'adapt_min_in', field=True, cw=(3, 140), label='Adaptive Min Samples', step=2, cc=__uiUpdate, dc=__uiUpdate, minValue=2, maxValue=64, fieldMinValue=2, fieldMaxValue=100, value=8, ann= 'For any given secondary trace loop, this value is the minimum number\nof secondary rays that will be cast. These secondary rays will always\nbe deducted from your available adaptive rays. It is a VERY important setting,\nand changing it can have significant impact on render time and quality.\n\nNormal values are between 4 and 8. The smallest value used should be 2,\nbut this will produce very noisy results.', parent=box) # ########################################## ### SCENE SAMPLES SET & IMPORT BUTTONS ### ########################################## butt_box = pm.gridLayout(numberOfColumns=2, cellWidthHeight=(20, 120), parent=row) scene_samp_imp = pm.button('scene_samp_imp', l="<", c=__sceneToCalc, parent=butt_box) scene_samp_exec = pm.button('scene_samp_exec', l=">", c=__calcToScene, parent=butt_box) # ################################## ### SECONDARY RAYCAST SAMPLING ### ################################## pm.separator(style='in', h=20, p=subframe) header = pm.text(l=' Secondary raycast subdivs', fn='smallBoldLabelFont', align='center', p=subframe) pm.separator(style='in', h=5, p=subframe) box = pm.columnLayout(p=subframe) subdivs_mult_in = pm.floatFieldGrp( 'subdivs_mult_in', l="Samples Multiplier", ann= "Multiplies all secondary subdiv settings by this amount. Use this during optimization\nto find a good overall number of secondary traces for your scene.", cc=__uiUpdate, nf=1, v=(1, 0, 0, 0), el=" x", parent=box, cw3=(140, 35, 10)) row = pm.rowLayout(parent=subframe, numberOfColumns=3, cw3=(230, 158, 20)) box = pm.columnLayout(parent=row, cw=230) subdivs_in = pm.intSliderGrp( 'subdivs_in', field=True, cw=(3, 140), label='Subdivs', step=2, cc=__uiUpdate, dc=__uiUpdate, minValue=1, maxValue=128, fieldMinValue=1, fieldMaxValue=1000, value=10, ann= 'The number of subdivs set in your secondary component, such as a glossy shader or area light.', parent=box) #################### ''' RESULTS PANE ''' #################### frame = pm.frameLayout(l='Results', w=416, fn='smallBoldLabelFont', cll=True, cl=False, p=winBox) subframe = pm.columnLayout(adjustableColumn=False, parent=frame) pm.separator(style='in', h=1, p=subframe) header = pm.text( l= ' Primary Samples Secondary Samples # Adaptive Samples', fn='smallBoldLabelFont', align='center', p=subframe) pm.separator(style='in', h=5, p=subframe) result_box = pm.rowLayout(width=400, nc=3, parent=subframe, rat=([1, 'top', 0], [2, 'top', 0], [3, 'top', 0])) #################### ### PRIMARY ######## #################### cwidth = (30, 90) col1 = pm.columnLayout(width=133, p=result_box) label = pm.text(l=' Per Pixel:', fn='smallPlainLabelFont', p=col1) min_primary_box = pm.intFieldGrp('min_primary_box', l='Min: ', nf=1, v=(1, 0, 0, 0), e=False, p=col1, bgc=(0.27, 0.27, 0.27), cw2=cwidth) max_primary_box = pm.intFieldGrp('max_primary_box', l='Max: ', nf=1, v=(1, 0, 0, 0), e=False, p=col1, bgc=(0.27, 0.27, 0.27), cw2=cwidth) #################### ### SECONDARY ###### #################### col2 = pm.columnLayout(width=133, p=result_box) label = pm.text(l=' Per Pixel:', fn='smallPlainLabelFont', p=col2) min_secondary_box = pm.intFieldGrp('min_secondary_box', l='Min: ', nf=1, v=(1, 0, 0, 0), e=False, p=col2, bgc=(0.27, 0.27, 0.27), cw2=cwidth) max_secondary_box = pm.intFieldGrp('max_secondary_box', l='Max: ', nf=1, v=(1, 0, 0, 0), e=False, p=col2, bgc=(0.27, 0.27, 0.27), cw2=cwidth) pm.separator(style='in', h=3, p=col2) label = pm.text(l=' Per Trace Loop:', fn='smallPlainLabelFont', p=col2) min_secondary_pt_box = pm.intFieldGrp('min_secondary_pt_box', l='Min: ', nf=1, v=(1, 0, 0, 0), e=False, p=col2, bgc=(0.27, 0.27, 0.27), cw2=cwidth) max_secondary_pt_box = pm.intFieldGrp('max_secondary_pt_box', l='Max: ', nf=1, v=(1, 0, 0, 0), e=False, p=col2, bgc=(0.27, 0.27, 0.27), cw2=cwidth) #################### ### ADAPTIVE ####### #################### col3 = pm.columnLayout(width=133, p=result_box) label = pm.text(l='Available Per Trace Loop:', fn='smallPlainLabelFont', p=col3) avail_secondary_box = pm.intFieldGrp('avail_secondary_box', l='Amt: ', nf=1, v=(1, 0, 0, 0), e=False, p=col3, bgc=(0.27, 0.27, 0.27), cw2=cwidth) ############################### ''' V-RAY DMC PROCESS NOTES ''' ############################### frame = pm.frameLayout(l='V-Ray DMC Trace Loop Reference', w=416, fn='smallBoldLabelFont', cll=True, cl=True, p=winBox) subframe = pm.columnLayout(adjustableColumn=False, parent=frame, cal='left') pm.text(l='The Basics: ') pm.text( l='The key to optimizing the Adaptive DMC renderer is in understanding that different\ncombinations of values will produce the same number of secondary samples\nper primary trace loop of a given component. Practically speaking, this means it is a\nbalance between firing just enough PRIMARY traces for clean AA, and\njust enough SECONDARY traces for smooth gloss, shadows, or blur. ' ) pm.text(l='') pm.text( l='The best procuedure for optimizing is to balance your PRIMARY traces until clean\nedge sampling is achieved, and then turning your subdivs up or down on each\ncomponent until you\'re satisfied with the amount of noise they produce.\nThis calculator is therefore a guide to understanding the relationship between\nprimary and secondary sampling.' ) pm.text(l='') pm.text(l='Adaptive Algorithm:') pm.text(l='') pm.text( l='1. Primary samples are fired into the scene through the pixel grid. This represents\n the start of a \'trace loop\'. The number of samples per pixel is equal to the square\n of the DMC Min Subdivs value.' ) pm.text(l='') pm.text( l='2. If geometry is struck and the primary trace determines that more samples\n are needed for AA, more primary traces will be queued.' ) pm.text(l='') pm.text( l='3. If geometry is struck, the surface will be queried for secondary tracing needs.\n This includes glossy materials, area light illumination, GI, camera blurs, etc.' ) pm.text(l='') pm.text( l='4. Subloops are called for all secondary tracing. Each secondary component gets\n its own loop. The number of secondary traces automatically queued is the\n \'min secondary samples per-trace\' value. If the \'max secondary samples per-trace\'\n value is hit before the treshhold is achieved, more PRIMARY traces will be queued.' ) pm.text(l='') pm.text( l='5. For any loop, if the \'max samples per-pixel\' limit is hit, or if the threshold\n value is satisfied, no more loops are queued. Primary values take precedence\n over Secondary values in this case.' ) pm.text(l='') pm.text(l='') pm.text(l='Conditions for termination of tracing (priority order):') pm.text( l='- If the \'maximum primary samples per-pixel\' value is reached tracing will stop.' ) pm.text( l='- If the returned color value of a primary trace changes the final pixel value by less\n than the DMC threshold amount, tracing will stop.' ) pm.text( l='- If the \'max secondary samples per-pixel\' of a component is reached, tracing of\n that particular component will stop.' ) pm.text( l='- If the returned color value of a component changes the component\'s contribution to\n the pixel by less than the DMC threshold amount, tracing of that component will stop.' ) pm.showWindow('vraySampleCalcWin') __uiUpdate()
def createUI(self): self.uwindow = pm.window(t='Rig Toolkit', mnb=False, mxb=False, rtf=True, tlb=True, h=5) pm.columnLayout('mainColumn') pm.gridLayout(numberOfColumns=2, cellWidthHeight=(60, 25)) pm.button(label='Select All', command=self.selectAll) pm.button(label='Select Limb', command=self.selectLimb) pm.button(label='Key All', command=self.keyAll) pm.button(label='Key Limb', command=self.keyLimb) pm.button(label='Reset All', command=self.resetAll) pm.button(label='Reset Sel', command=self.resetSelected) pm.setParent('mainColumn') pm.frameLayout('ikFkFrame', label='IK FK Switching', collapsable=True, width=120, cc=self.updateWindowSize, cl=True) pm.gridLayout(numberOfColumns=2, cellWidthHeight=(60, 40)) pm.button(label='Switch Sel\nto IK', command=self.switchToIk) pm.button(label='Switch Sel\nto FK', command=self.switchToFk) pm.setParent('mainColumn') pm.frameLayout('mirroringFrame', label='Mirroring', collapsable=True, width=120, cc=self.updateWindowSize, cl=True) pm.gridLayout(numberOfColumns=2, cellWidthHeight=(60, 25)) pm.button(label='All L>R', command=self.mirrorAllLR) pm.button(label='All R>L', command=self.mirrorAllRL) pm.button(label='Sel L>R', command=self.mirrorSelectedLR) pm.button(label='Sel R>L', command=self.mirrorSelectedRL) pm.setParent('mainColumn') pm.frameLayout('flippingFrame', label='Flipping', collapsable=True, width=120, cc=self.updateWindowSize, cl=True) pm.gridLayout(numberOfColumns=2, cellWidthHeight=(60, 25)) pm.button(label='Flip All', command=self.flipAll) pm.button(label='Flip Sel', command=self.flipSelected) pm.setParent('mainColumn') pm.frameLayout('visibilityFrame', label='Visibility', collapsable=True, width=120, cc=self.updateWindowSize, cl=True) self.checkboxDict['leftArm'] = pm.checkBox(label='Left Arm', cc=self.setVisibilityToUI) self.checkboxDict['rightArm'] = pm.checkBox(label='Right Arm', cc=self.setVisibilityToUI) self.checkboxDict['leftLeg'] = pm.checkBox(label='Left Leg', cc=self.setVisibilityToUI) self.checkboxDict['rightLeg'] = pm.checkBox(label='Right Leg', cc=self.setVisibilityToUI) self.checkboxDict['core'] = pm.checkBox(label='Core', cc=self.setVisibilityToUI) self.updateCheckboxUI() pm.showWindow(self.uwindow)
def create_ui(): winID = 'aovUI' winWidth = 530 winHeight = 725 rowHeight = 30 if pm.window(winID, exists=True): pm.deleteUI(winID) aovWin = pm.window(winID, title='Light Group / AOV Manager', widthHeight=(winWidth, 580), sizeable=True) # Main layout refs mainCL = pm.columnLayout(adjustableColumn=False, columnAttach=('both', 5), rowSpacing=8, columnWidth=530, parent=winID) # 1st block - LG Assignment pm.frameLayout(label='Light Group Assignment') topDivide_LG = pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.rowLayout(numberOfColumns=2) # 1st row - LG L pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.text(label='Lights') pm.textScrollList('ui_light_list', numberOfRows=20, h=winHeight * .25, allowMultiSelection=True, append=lightListing(), dcc="getItemInList()") pm.setParent('..') #1st row - LG R pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.text(label='Light Groups') pm.textScrollList('ui_lightGroup_list', numberOfRows=20, h=winHeight * .25, allowMultiSelection=True, append=getLightGroups(), dcc="getItemInList()") pm.setParent('..') pm.setParent(topDivide_LG) # pm.separator() pm.gridLayout(numberOfColumns=3, cellWidthHeight=(winWidth * .33, 30)) pm.button(label='Refresh', command='refreshList()') pm.button(label='Remove', command='removeLgAov()') pm.button(label='Clear All', command='clearAllLG()') pm.setParent('..') pm.separator() pm.rowColumnLayout(numberOfRows=1, width=winWidth) pm.textField('ui_lightGroup_setName', height=30, width=310, pht='Light Group Name') pm.button(label='Create', w=winWidth * .2, command='createNewLG()') pm.button(label='Reset', w=winWidth * .2, command='resetLgNameInput()') pm.setParent('..') pm.separator() pm.gridLayout(numberOfColumns=3, cellWidthHeight=(winWidth * .5, 30)) pm.button(label='Get', command='getSingleLgAov()') pm.button(label='Set', command='applyLgAov()') pm.setParent('..') pm.separator() #2nd block - LPE assignment pm.frameLayout(label='LPE Assignment') topDivide_LPE = pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.rowLayout(numberOfColumns=2) #2nd Block aov list pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) pm.text(label='Current AOVs') pm.textScrollList('ui_aov_list', numberOfRows=20, h=winHeight / 4, allowMultiSelection=True, append=getAovs()) pm.setParent('..') pm.columnLayout(adjustableColumn=True, columnAlign='center', rowSpacing=8) #2nd block - lpe list pm.text(label='LPE Keys') pm.textScrollList('ui_lpe_list', numberOfRows=20, h=winHeight / 4, allowMultiSelection=True, append=aovKeys) pm.setParent('..') pm.setParent(topDivide_LPE) pm.rowLayout(numberOfColumns=2) pm.button(label='Clear Aovs', width=winWidth * .488, command='clearCustomAovs()') pm.button(label='Clear Keys', width=winWidth * .488, command='clearAovkeys()') pm.setParent('..') pm.separator() pm.gridLayout(numberOfColumns=2, cellWidthHeight=(winWidth * .492, 30)) pm.button(label='Refresh', command='refreshLpeBlock()') pm.button(label='Remove', command='removeItemInList()') pm.setParent('..') pm.separator() pm.rowColumnLayout(numberOfRows=1, width=winWidth, cs=(1, 13)) pm.textField('ui_aov_setName', height=30, width=winWidth * .25, pht='Aov Name') pm.textField('ui_lpe_setName', height=30, width=winWidth * .25, pht='Custom LPE') pm.button(label='Create', w=winWidth * .2, command='aovSetName()') pm.button(label='Reset', w=winWidth * .2, command='resetLpeInput()') pm.setParent('..') pm.separator() pm.gridLayout(numberOfColumns=1, cellWidthHeight=(winWidth, 45)) pm.button(label='Create Custom Aovs', width=winWidth, ann='Click the button to do the thing.', command='createAov()') pm.setParent('..') pm.showWindow(aovWin)
def _build_axis_limits_frame(parent_layout): limits_frame = pm.frameLayout(label="Axis Limits", collapsable=True) limits_frame_cols = pm.rowColumnLayout(numberOfColumns=2) # Input text field width for all axis limits cell_width = 50 # Set up primary axis limits UI pm.columnLayout(adj=True, columnAttach=('left', 5)) pm.separator(height=5, style='none') pm.text(' Position:', align='center') pm.separator(height=5, style='none') for i in range(6): # Axis 1 Limit row pm.rowLayout(numberOfColumns=3, columnAttach=(1, 'left', 0), columnWidth=[(2, cell_width), (3, cell_width)], height=20) pm.text(label='A{}: '.format(i + 1)) # Axis 1 Min limit pm.textField("t_A{}Min".format(i + 1), font=FONT, placeholderText='Min', width=cell_width, changeCommand='import pymel.core as pm; ' \ 'import mimic_utils; ' \ 'pm.setFocus("t_A{}Max"); ' \ 'mimic_utils.set_axis_limit({},"Min")' \ .format(i + 1, i + 1)) # Axis 1 Max limit set_focus_count = ((i + 1) % 6) + 1 pm.textField("t_A{}Max".format(i + 1), font=FONT, placeholderText='Max', width=cell_width, changeCommand='import pymel.core as pm; ' \ 'import mimic_utils; ' \ 'pm.setFocus("t_A{}Min"); ' \ 'mimic_utils.set_axis_limit({},"Max")' \ .format(set_focus_count, i + 1)) pm.setParent('..') pm.setParent(limits_frame_cols) # Set up primary axis velocity limts tab pm.columnLayout(adj=True, columnAttach=('right', 5)) pm.separator(height=5, style='none') pm.text('Velocity:', align='center') pm.separator(height=5, style='none') # Input text field width for all axis limits cell_width = 40 for i in range(6): # Axis 1 Limit row pm.rowLayout(numberOfColumns=2, columnAttach=(1, 'left', 3), columnWidth=[(2, 2 * cell_width)], height=20) set_focus_count = ((i + 1) % 6) + 1 # Axis 1 Min limit pm.textField("t_A{}vel".format(i + 1), font=FONT, placeholderText='deg/sec', width=2 * cell_width, enable=False, changeCommand='import pymel.core as pm; ' \ 'import mimic_utils; ' \ 'pm.setFocus("t_A{}vel"); ' \ .format(set_focus_count)) pm.setParent('..') pm.setParent(limits_frame) pm.columnLayout(adj=True, columnAttach=('both', 3)) pm.gridLayout(nc=2, cw=114, ch=25) pm.button(label='Get Axis Limits', command=mimic_utils.get_axis_limits, annotation='Gets axis limit values for selected robot and ' \ 'prints them above') pm.button(label='Set Axis Limits', command=mimic_utils.set_axis_limits, annotation='Sets selected robot\'s axis limit values to the ' \ 'input values above') pm.setParent('..') pm.button(label='Clear', width=218, command=mimic_utils.clear_limits_ui, annotation='Clears the axis limits UI above') pm.setParent(parent_layout)