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 __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 main(self): win = pm.window("SelectionFilter#", tlb=1) lay = pm.formLayout() tf = pm.iconTextScrollList("ITMFILTERLIST", ams=1, dcc=self.select) lay1 = pm.rowColumnLayout(nc=5) okbt = pm.iconTextButton("OKBTN", l="Reload", i1="cube", c=self.update) addbt = pm.iconTextButton("ADDBTN", l="Add", i1="addDivision24", c=self.append) selbt = pm.iconTextButton("SELBTN", l="Select", st="iconAndTextCentered", i1="aselect", # i1="menuIconSelect", c=self.select, dcc=pm.Callback(self.select, add=1)) cbt = pm.button("Close", c=pm.Callback(pm.deleteUI, win)) aebt = pm.iconTextButton("TOAE", l="Show in AE", i1="attributes", c=self.showInAE) lay.attachForm(tf, "top", 2) lay.attachForm(tf, "left", 2) lay.attachForm(tf, "right", 2) lay.attachControl(tf, "bottom", 2, lay1) lay.attachForm(lay1, "left", 2) lay.attachForm(lay1, "right", 2) lay.attachForm(lay1, "bottom", 5) self.tf = tf self.update() win.show()
def createImageButtons(groupName=''): myNames = getImageNames(groupName=groupName) index = 0 neutralColor = (0.266, 0.266, 0.266) selectedColor = (0.93, 0.854, 0.0) print('xxx startingIndex = %s, globalEyeIndex = %s' % (index, globalEyeIndex)) for item in myNames: if index == globalEyeIndex: print('createImageButtons active index: %s' % (index)) pm.iconTextButton("%s" % (myNames[index]), imageOverlayLabel=myNames[index], command=functools.partial( loadIconButton, groupName, index), backgroundColor=selectedColor, image='icons/EqualReality/%s_%s.iff' % (myNames[index], globalGender[0]), width=88, height=88) else: print('createImageButtons inactive index: %s' % (index)) pm.iconTextButton("%s" % (myNames[index]), imageOverlayLabel=myNames[index], command=functools.partial( loadIconButton, groupName, index), backgroundColor=neutralColor, image='icons/EqualReality/%s_%s.iff' % (myNames[index], globalGender[0]), width=88, height=88) index = index + 1
def addToLayout(self, option): if option == 1: self.widgetName = pm.rowLayout(self.name, p=self.parentWidget.widgetName, backgroundColor=self.color, nc=2, w=140, h=70, dragCallback=self.dragCallback) pm.iconTextButton(image=self.imgPath, style='iconOnly', command=self.clickCallBack, doubleClickCommand=self.dClickCallBack, h=70, w=70) pm.columnLayout() pm.text(label=self.label, font="smallPlainLabelFont") pm.separator(h=2) pm.text(label=self.itemName, font="smallBoldLabelFont") pm.separator(h=2, st='in') pm.text(label='code:%s' % self.code, font="smallPlainLabelFont") pm.text(label='user: non', font="smallPlainLabelFont") pm.text(label=self.status, font = "smallObliqueLabelFont") self.addMenus() elif option == 2: self.widgetName = pm.rowLayout(self.name, p=self.parentWidget.widgetName, backgroundColor=self.color, nc=2, w=100, h=40, dragCallback=self.dragCallback) pm.iconTextButton(image=self.imgPath, style='iconOnly', command=self.clickCallBack, doubleClickCommand=self.dClickCallBack,h=40,w=40) pm.columnLayout() pm.text(label=self.label, font="smallPlainLabelFont") pm.separator(h=3) pm.text(label=self.itemName, font="smallBoldLabelFont") self.addMenus()
def populate_selection_layout(self): pm.setParent(self.widgets['selectionSet_vertical']) self.widgets['selectionSet_vertical'].clear() treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) if not treeViewSelected: return pm.scrollLayout(cr=True) path = os.path.abspath(treeViewSelected[0]) set_paths = [] for dir in os.listdir(path): if dir.find(self.library_objects_suffix[2]) != -1: #.set set_paths.append(os.path.abspath(os.path.join(path, dir))) for set_path in set_paths: print "create button" set_obj = Set(set_path) infos = set_obj.get_info() label = infos['name'].split('.')[0] pm.iconTextButton(style='textOnly',label=label, c=pm.Callback(self.selection_set_button_load, set_obj)) pm.popupMenu() pm.menuItem(label='Save Pose', c=pm.Callback(self.selection_set_button_save, set_obj)) pm.menuItem(label='Load Pose', c=pm.Callback(self.selection_set_button_load, set_obj)) self.widgets["selectionSet_vertical"].redistribute()
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 tagGuerilla(*arg): mesh_List = pm.ls(sl=1) slectionChild_List = pm.listRelatives(mesh_List, ad=1) if mesh_List: tagName = tagGuerillaText.getText() for mesh in slectionChild_List: parentMesh = mesh.getParent() if mesh.nodeType() == 'mesh' or mesh.nodeType() == 'camera': if pm.iconTextButton(addMoreTagButton, q=1, l=1) == 'off': if pm.attributeQuery('GuerillaTags', node=parentMesh, exists=1) == 1: pm.setAttr(parentMesh.GuerillaTags, tagName, type="string") elif pm.attributeQuery('GuerillaTags', node=parentMesh, exists=1) == 0: pm.addAttr(parentMesh, ln="GuerillaTags", dt="string") pm.setAttr(parentMesh.GuerillaTags, tagName, type="string") elif pm.iconTextButton(addMoreTagButton, q=1, l=1) == 'on': if pm.attributeQuery('GuerillaTags', node=parentMesh, exists=1): currentAttr = parentMesh.name() + '.GuerillaTags' currentTag = pm.getAttr(currentAttr) currentSplit = currentTag.split(',') checker_if_tag_in = 'no' for tag in currentSplit: if tag == tagName: checker_if_tag_in = 'yes' if checker_if_tag_in == 'no': totalName = currentTag + ',' + tagName pm.setAttr(parentMesh.GuerillaTags, totalName, type="string") elif pm.attributeQuery('GuerillaTags', node=parentMesh, exists=1) == 0: pm.addAttr(parentMesh, ln="GuerillaTags", dt="string") pm.setAttr(parentMesh.GuerillaTags, tagName, type="string") else: pm.warning('Select object to assign Guerilla Tags')
def lcCameraToolsUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcCameraTools' shelfCommand = 'import lct.src.lcCameraTools.lcCameraTools as lcCam\nreload(lcCam)\nlcCam.lcCameraToolsUI()' icon = basePath+'lcCameraTools.png' winWidth = 204 winHeight = 209 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() pm.menu(l='Options', helpMenu=True) pm.menuItem(l='Reset Gradient Colors', command=lambda *args: cam_set_default_colors() ) # pm.columnLayout(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,50], [2,150]) ) pm.text(l='Edit:', al='right') cameraListDropdown = pm.optionMenu(prefix+'_optionMenu_camera_list', bgc=colorWheel.getColorRGB(ci), w=150, h=25 ) ci+=1 cameraListDropdown.changeCommand(lambda *args: cam_get_cam_attrs(cameraListDropdown) ) pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,125], [2,75]) ) pm.text(l='Focal Length:', al='right') pm.floatField(prefix+'_floatField_focal_length', min=0.0, v=0.0, pre=1, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) ) pm.text(l='Near Clip Plane:', al='right') pm.floatField(prefix+'_floatField_near_clip_plane', min=0.0, v=0.0, pre=4, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) ) pm.text(l='Far Clip Plane:', al='right') pm.floatField(prefix+'_floatField_far_clip_plane', min=0.0, v=0.0, pre=0, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) ) pm.text(l='Overscan:', al='right') pm.floatField(prefix+'_floatField_overscan', min=0.0, v=0.0, pre=3, w=75, changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown), receiveFocusCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) ) pm.text(l='Background Color:', al='right') pm.colorSliderGrp(prefix+'_colorSliderGrp_background_color', cw1=50, rgb=(0.0,0.0,0.0), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) ) pm.text(l='Gradient Top:', al='right') pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_top', cw1=50, rgb=(0.54,0.62,0.70), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) ) pm.text(l='Gradient Bottom:', al='right') pm.colorSliderGrp(prefix+'_colorSliderGrp_gradient_bottom', cw1=50, rgb=(0.1,0.1,0.1), changeCommand=lambda *args: cam_set_cam_attrs(cameraListDropdown) ) pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,175], [2,25]) ) pm.button(prefix+'_button_toggle_bkgd', l='Toggle Background', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Toggle between flat color and gradient background', command=lambda *args: camera.toggleBackground() ) ci+=1 pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Toggle Camera Background', 'from lct.src.core.lcUtility import Camera as camera\ncamera.toggleBackground()', iconBasePath+'toggleBackground.png', "Toggle Camera's Viewport Background") ) # mainWindow.show() cam_populate_camera_list(cameraListDropdown) cam_get_cam_attrs(cameraListDropdown)
def _versionSelected(self, versionNum): if self._currentSelected != None: _pmCore.iconTextButton(self._uiWidget[self._versionBtnName(self._currentSelected)], edit=True, backgroundColor=self._defaultColor) _pmCore.iconTextButton(self._uiWidget[self._versionBtnName(versionNum)], edit=True, backgroundColor=self._highlightColor) _pmCore.setParent(self._uiWidget['commentLayout']) for commentInfo in _Database.getCommentListByVersion(self._fileID, versionNum): _, _, user, date, content = commentInfo _pmCore.text(label="{0} @ {1}:".format(user, date), align='left') _pmCore.text(label=content, wordWrap=True, align='left') _pmCore.separator(style='singleDash', height=10) self._currentSelected = versionNum
def buildUI(self): # Make sure there are no duplicated UI if pc.window(self.windowName, exists=True): pc.deleteUI(self.windowName) if pc.dockControl(self.windowName+'_dock', exists=True): pc.deleteUI(self.windowName+'_dock') # Dock window self.uiWidgets['window'] = pc.window(self.windowName, title=self.windowName, h=self.windowHeight, w=self.windowWidth, mnb=False, mxb=False, sizeable=False) # Layout and dock self.uiWidgets['layout'] = pc.columnLayout(p=self.uiWidgets['window']) pc.dockControl(self.windowName+'_dock', label=self.windowName, area='right', content=self.uiWidgets['window']) #### Tabs and buttons creation # Categories list categories = {} # Check for file that has to be ignored ignoreFile = open(pc.internalVar(upd=True)+'scripts/'+self.scanFolder+'/ignore.txt') ignoredFiles = [] for line in ignoreFile: ignoredFiles.append(line.replace('\n','')) # Check for existing *.py files in the script/self.scanFolder folder for pyscript in os.listdir(pc.internalVar(upd=True)+'scripts/'+self.scanFolder): if fnmatch.fnmatch(pyscript, '*.py') and pyscript not in ignoredFiles: # Get the category for later use category = pyscript.partition('_')[0] # If category is not empty if category != '': if category not in categories.keys(): categories[category] = [] # Append the icon path associated to the script print "Adding script '%s' to shelf." % pyscript categories[category].append(pyscript.partition('.')[0]+'.png') print categories for category in categories.keys(): self.uiWidgets[category+'_frameLayout'] = pc.frameLayout(label=category.capitalize(), borderStyle='etchedIn', cll=True, w=self.windowWidth, parent=self.uiWidgets['layout']) self.uiWidgets[category+'_rcLayout']= pc.rowColumnLayout(nc=3, p=self.uiWidgets[category+'_frameLayout']) for icon in categories[category]: iconPath = pc.internalVar(upd=True)+'icons/'+self.scanFolder+'/'+icon # If icon exists, we use it if os.path.exists(iconPath): pc.iconTextButton(w=35, h=35, i1=iconPath,c=partial(self.loadScript, icon.partition('.')[0])) else: pc.iconTextButton(iol=icon.partition('.')[0].partition('_')[2], w=35, h=35, i1=pc.internalVar(upd=True)+'icons/'+self.scanFolder+'/missing.png',c=partial(self.loadScript, icon.partition('.')[0]))
def randomizer_createUserInterface(): """-------------------------------------------------------------------------- Create User Interface Procedure --------------------------------------------------------------------------""" pm.window('randomizer_window', s=0, rtf=0, t="randomizer", wh=(300, 700)) # Create UI elements pm.columnLayout('mainColumnLayout', h=900, w=248, columnAlign="center", adjustableColumn=1) pm.separator('selectedTransformObjectsSeparator', h=10, w=240, st="none") pm.text('selectedTransformObjectsText', fn="boldLabelFont", h=24, l="selected transform Objects", w=240, al="center") pm.textScrollList('selectedTransformObjectsTextScrollList', h=80, w=240) pm.button('loadObjectsButton', h=28, c=lambda *args: randomizer_loadSelection(0), l="load transform Objects", w=240) pm.separator('selectedMaterialsSeparator', h=10, w=240, st="none") pm.text('selectedMaterialsText', fn="boldLabelFont", h=24, l="selected Materials", w=240, al="center") pm.textScrollList('selectedMaterialsTextScrollList', h=80, w=240) pm.button('loadMaterialsButton', h=28, c=lambda *args: randomizer_loadSelection(1), l="load Materials", w=240) pm.separator('transformAttributesSeparator', h=10, w=240, st="none") pm.text('randomizeAttributesText', fn="boldLabelFont", h=24, l="randomize Attributes", w=240, al="center") pm.checkBoxGrp('randomizeAttributesCheckBoxGrp', h=24, l4="Material", l2="Rotate", l3="Scale", w=240, l1="Translate", ncb=4, cw=[(1, 67), (2, 57), (3, 50), (4, 57)]) pm.separator('translateAttributesSeparator', h=10, w=240, st="none") pm.text('translateText', fn="boldLabelFont", h=24, l="Translate", w=240, al="center") pm.floatFieldGrp('minMaxXtranslateFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxYtranslateFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxZtranslateFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.separator('rotateAttributesSeparator', h=10, w=240, st="none") pm.text('rotateText', fn="boldLabelFont", h=24, l="Rotate", w=240, al="center") pm.floatFieldGrp('minMaxXrotateFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxYrotateFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxZrotateFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.separator('scaleAttributesSeparator', h=10, w=240, st="none") pm.text('scaleText', fn="boldLabelFont", h=24, l="Scale", w=240, al="center") pm.floatFieldGrp('minMaxXscaleFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxYscaleFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.floatFieldGrp('minMaxZscaleFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.separator('randomizeSelectionSeparator', h=10, w=240, st="none") pm.button('randomizeAbsoluteButton', h=28, c=lambda *args: randomizer_randomizeSelection(), l="randomize Abolute", w=240) pm.button('randomizeRelativeButton', h=28, c=lambda *args: randomizer_randomizeSelection(relative=True), l="randomize Relative", w=240) pm.separator('timeAttributesSeparator', h=10, w=240, st="none") pm.text('timeText', fn="boldLabelFont", h=24, l="Time", w=240, al="center") pm.intFieldGrp('minMaxTimeIntFieldGrp', el="max", bgc=(0, 0, 0), h=24, l="min", nf=2, v1=-1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)]) pm.button('setUniformKeyframe', h=28, c=lambda *args: rand_Keyframe(objects=None, attribute="all", axis=["X", "Y", "Z"], uniform=True, min=-10, max=10, step=1), l="Set Keyframes uniform", w=240) pm.button('setRandomKeyframe', h=28, c=lambda *args: rand_Keyframe(objects=None, attribute="all", axis=["X", "Y", "Z"], uniform=False, min=-10, max=10, step=1), l="Set Keyframes random", w=240) pm.separator('undoSeparator', h=10, w=240, st="none") pm.button('undoButton', h=28, c=lambda *args: pm.undo(), l="undo", w=240) pm.iconTextButton('staschiIconTextButton', h=28, c=lambda *args: randomizer_loadHelpWebsite(), l="www.staschi.com", w=240, st="textOnly") pm.setParent('..') pm.setParent('..') # Display UI pm.showWindow('randomizer_window')
def __init__(self, par): ToolsUI.__init__(self, par) with pm.columnLayout() as self.layout: with pm.rowLayout(nc=4): pm.floatField('uvEntryFieldU', precision=3, ed=True, width=46, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kEnterValueTotransformInUAnnot'), cc=lambda *args: pm.mel.textureWindowUVEntryCommand(1)) pm.floatField('uvEntryFieldV', precision=3, ed=True, width=46, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kEnterValueTotransformInVAnnot'), cc=lambda *args: pm.mel.textureWindowEntryCommand(0)) pm.iconTextButton(image1='uv_update.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kRefreshUVValuesAnnot'), c=self.uv_update, commandRepeatable=True) pm.iconTextCheckBox('uvEntryTransformModeButton', image1='uvEntryToggle.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kUVTransformationEntryAnnot'), value=pm.melGlobals['gUVEntryTransformMode'], onc=lambda *args: pm.mel.uvEntryTransformModeCommand(), ofc=lambda *args: pm.mel.uvEntryTransformModeCommand()) with pm.rowLayout(nc=6): copyuv = pm.iconTextButton('copyUVButton', image1='copyUV.png', ann=pm.mel.getRunTimeCommandAnnotation('PolygonCopy'), c=lambda *args: pm.mel.PolygonCopy()) pm.popupMenu('copyUVButtonPopup', button=3, p=copyuv, pmc=lambda *args: pm.mel.PolygonCopyOptions()) pasteuv = pm.iconTextButton('pasteUVButton', image1='pasteUV.png', ann=pm.mel.getRunTimeCommandAnnotation('PolygonPaste'), c=lambda *args: pm.mel.PolygonPaste()) pm.popupMenu('pasteUVButtonPopup', button=3, p=pasteuv, pmc=lambda *args: pm.mel.PolygonPasteOptions()) pm.iconTextButton('pasteUButton', image1='pasteUDisabled.png', en=False, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPasteUValueAnnot'), c=lambda *args: pm.mel.textureWindowCreateToolBar_uvPaste(1, 0)) pm.iconTextButton('pasteVButton', image1='pasteVDisabled.png', en=False, ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kPasteVValueAnnot'), c=lambda *args: pm.mel.textureWindowCreateToolBar_uvPaste(0, 1)) pm.iconTextCheckBox(image1='copyUVMode.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kToggleCopyPasteAnnot'), onc=lambda *args: pm.mel.textureWindowCreateToolBar_copyPasteMode(1), ofc=lambda *args: pm.mel.textureWindowCreateToolBar_copyPasteMode(0)) pm.iconTextButton(image1='cycleUVs.png', ann=pm.mel.uiRes('m_textureWindowCreateToolBar.kCycleUVsCounterClockwiseAnnot'), c=lambda *args: pm.mel.polyRotateUVsByVertex(), 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='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=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 lcObjToolsUI(dockable=False, *args, **kwargs): ''' ''' global prefix ci = 0 #color index iterator windowName = 'lcObjTools' shelfCommand = 'import lct.src.lcObjTools.lcObjTools as lcObj\nreload(lcObj)\nlcObj.lcObjToolsUI()' icon = basePath+'lcObjTools.png' winWidth = 204 winHeight = 158 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.rowColumnLayout(nc=2, cw=([1,150], [2,50]) ) pm.textField(prefix+'_textField_export_path', w=150) pm.button(prefix+'_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose an export directory', w=50, command=lambda *args: path.browsePathTextField(prefix+'_textField_export_path', "Wavefront Obj (*.obj)", 'Obj Export Location') ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.checkBox(prefix+'_checkBox_export_indi', l='Export Individual', v=False) pm.checkBox(prefix+'_checkBox_use_smooth', l='Use Smooth Preview', v=True) # pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) ) pm.textField(prefix+'_textField_prefix', w=100) pm.text(l=' Prefix_', al='left') pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,169], [2,31]) ) pm.columnLayout(w=169) pm.button(prefix+'_button_export', l='Export OBJ', bgc=colorWheel.getColorRGB(ci), annotation='Export the selected geometry', w=168, h=30, command=lambda *args: lcObj_exportObjs() ) ci+=1 pm.button(prefix+'_button_Import', l='Import Multiple OBJs', bgc=colorWheel.getColorRGB(ci), annotation='Clean import more than one obj', w=168, h=20, command=lambda *args: lcObj_importMultiple() ) ci+=1 pm.setParent('..') pm.columnLayout(w=31) pm.iconTextButton(prefix+'_button_open_folder', style='iconOnly', image=iconBasePath+'folder_30x50.png', annotation='Open the export folder', w=30, h=50, command=lambda *args: path.openFilePath(pm.textField(prefix+'_textField_export_path', query=True, text=True) ) ) ci+=1 # mainWindow.show() plugin.reloadPlugin(plugin='objExport', autoload=True)
def _updateAssetClicked(self): if self._currentSelectedAsset == None: raise RuntimeError('Nothing selected.') sceneName = _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.sceneNameTextField], query=True, text=True) filePath = _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.filePathTextField], query=True, text=True) category = _pmCore.optionMenuGrp(self._uiWidget[_UiWidgetEnum.categoryCombox], query=True, value=True) description = _pmCore.scrollField(self._uiWidget[_UiWidgetEnum.descriptionTextField], query=True, text=True) _Database.setFileCategory(self._currentSelectedAsset, category) _Database.setFileDescription(self._currentSelectedAsset, description) _Database.setFilename(self._currentSelectedAsset, sceneName) _Database.setFilePath(self._currentSelectedAsset, filePath) _pmCore.iconTextButton(self._uiWidget[_UiWidgetEnum.assetBtnList][self._assetBtnName(self._currentSelectedAsset)], edit=True, label=sceneName) self._refreshAssetButtonView()
def runFix(self, fix, id): x = fix() if x == 'ok': pm.iconTextButton( self.checksWidgets[id], e=True, image1='D:JOBS/PIPELINE/pipeExemple/scenes/icons/valid.png', label=self.checksDict[id]['label'] + ' Ok') elif x == 'skip': pm.iconTextButton( self.checksWidgets[id], e=True, image1='D:JOBS/PIPELINE/pipeExemple/scenes/icons/skip.png', label=self.checksDict[id]['label'] + ' skipped')
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 heading_area(): heading_layout = pm.rowColumnLayout(nc=3) image_btn = pm.iconTextButton(style='iconOnly', ann='www.hustonpetty3d.com', w=255, h=30, image1=get_icon_path('tool_brand_icon.png'), c=fun.partial(open_page, 'http://www.hustonpetty3d.com')) pm.text(l='', w=53) # GUI SPACER pm.button(l='How To Use?', c=fun.partial(open_page, 'https://youtu.be/v0lNec7dnTE'), w=80, h=1, bgc=primary_componentColor, ann='Go to "How To Use" video') # NOT CONNECTED pm.setParent(main_layout)
def lightCreation_area(): pm.text(l='Light Creation', al='center') buttons_layout = pm.rowColumnLayout(nc=5) pm.iconTextButton(style='iconOnly', w=windowWidth/5, h=50, c=fun.partial(createLight, 'area'), ann='Create a Mental Ray area light', image1=get_icon_path('arealight_icon.png')) pm.iconTextButton(style='iconOnly', w=windowWidth/5, h=50, c=fun.partial(createLight, 'spot'), ann='Create a spot light', image1=get_icon_path('spotlight_icon.png')) pm.iconTextButton(style='iconOnly', w=windowWidth/5, h=50, c=fun.partial(createLight, 'directional'), ann='Create a directional light', image1=get_icon_path('directionallight_icon.png')) pm.iconTextButton(style='iconOnly', w=windowWidth/5, h=50, c=fun.partial(createLight, 'point'), ann='Create a point light', image1=get_icon_path('pointlight_icon.png')) global ibl_btn ibl_btn = pm.iconTextButton(style='iconOnly', w=windowWidth/5, h=50, c=IBL_button, ann='Create an IBL', image1=get_icon_path('IBL_icon.png')) if ibl_list != []: ibl_btn.setImage1(get_icon_path('deleteIBL_icon.png')) pm.setParent(main_layout)
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 switchGuerillatagOption(*arg): if pm.iconTextButton(addMoreTagButton, q=1, l=1) == 'off': pm.iconTextButton(addMoreTagButton, e=1, l='on', image1='addClip.png') pm.textField(tagGuerillaText, e=1, bgc=(0.16862745098039217, 0.16862745098039217, 0.16862745098039217), placeholderText='add one more tag') else: pm.iconTextButton(addMoreTagButton, e=1, l='off', image1='UVTkDeleteInvalidSet.png') pm.textField(tagGuerillaText, e=1, bgc=(0.3, 0.2, 0.2), placeholderText='replace Tags')
def iconItem(self, l='', i=None, c=None, ann=None, bgc=None, en=True, mw=2, mh=2, bs='etchedIn', st='iconAndTextHorizontal'): """Create an icon button with a frame layout""" with pm.frameLayout(lv=False, mw=mw, mh=mh, bs=bs) as frame: btn = pm.iconTextButton(l=l, st=st, en=en) if bgc != None: btn.setBackgroundColor(bgc) if c != None: btn.setCommand(c) if i != None: btn.setImage(i) if ann != None: btn.setAnnotation(ann) return frame, btn
def _assetSelected(self, fileID): # Update background color for buttons. if self._currentSelectedAsset != None: _pmCore.iconTextButton(self._uiWidget[_UiWidgetEnum.assetBtnList][self._assetBtnName(self._currentSelectedAsset)], edit=True, backgroundColor=self._defaultColor) btnName = self._assetBtnName(fileID) button = self._uiWidget[_UiWidgetEnum.assetBtnList].get(btnName) _pmCore.iconTextButton(button, edit=True, backgroundColor=self._highlightColor) # Get file info from database. fileInfo = _Database.getFileInfo(fileID) _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.sceneNameTextField], edit=True, text=fileInfo[1]) _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.filePathTextField], edit=True, text=fileInfo[2]) _pmCore.scrollField(self._uiWidget[_UiWidgetEnum.descriptionTextField], edit=True, text=fileInfo[4]) _pmCore.optionMenuGrp(self._uiWidget[_UiWidgetEnum.categoryCombox], edit=True, value=fileInfo[5]) # Update version text. versionNum = _Database.getCurrentVersion(fileID) _pmCore.text(self._uiWidget[_UiWidgetEnum.versionNumText], edit=True, label=str(versionNum)) self._currentSelectedAsset = fileID
def _addAssetButton(self, fileID, sceneName, versionID): thumbnailPath = _Database.getThumbnailPath(fileID, versionID) if not _os.path.exists(thumbnailPath): thumbnailPath = "cube.png" buttonName = self._assetBtnName(fileID) button = _pmCore.iconTextButton(buttonName, style='iconAndTextVertical', image1=thumbnailPath, label=sceneName, command=_pmCore.Callback(self._assetSelected, fileID)) self._uiWidget.setdefault(_UiWidgetEnum.assetBtnList, {})[buttonName] = button _pmCore.popupMenu() _pmCore.menuItem(label='Open', command=_pmCore.Callback(_functools.partial(_MayaFunctions.openScene, _Database.getFilePath(fileID)))) _pmCore.menuItem(label='Import', command=_pmCore.Callback(_functools.partial(_MayaFunctions.importScene, _Database.getFilePath(fileID)))) _pmCore.menuItem(label='Reference', command=_pmCore.Callback(_functools.partial(_MayaFunctions.referenceScene, _Database.getFilePath(fileID)))) _pmCore.menuItem(label='Versions/Comments', command=_pmCore.Callback(_functools.partial(_AssetVersionDialog, fileID)))
def build(self): '''builds ui objects for tab''' self.widgets['mainRow'] = pm.rowLayout(parent = self.parent.widgets['scrollLayout'], numberOfColumns = 6, h = 50, adjustableColumn = 3, bgc = self.bgc) self.widgets['frontSpacer'] = pm.separator(style = 'none', w = 12) self.widgets['renderable'] = pm.checkBox(parent = self.widgets['mainRow'], value = self.layer.renderable.get(), w = 50, label = "", cc = pm.Callback(self.updateRenderable)) self.widgets['cameraName'] = pm.text(parent = self.widgets['mainRow'], label = self.camera.getParent().stripNamespace(), w = 140) self.widgets['layerName'] = pm.iconTextButton(parent = self.widgets['mainRow'], label = self.layer.name(), w = 220, style = 'textOnly', c = pm.Callback(self.layer.setCurrent), dcc = pm.Callback(self.updateLayerName)) self.widgets['frameRange'] = pm.textFieldGrp(parent = self.widgets['mainRow'], text = '%d - %d' % (self.parent.startFrame, self.parent.endFrame)) self.widgets['backSpacer'] = pm.separator(style = 'none', w = 1) if not self.layer.renderable.get(): self.updateRenderable()
def UI_refreshIcons(self): """Refresh connection state icons Keyword arguments: none Return: none """ # Given specific attributes, we look for their state for attribute in ('color', 'KsColor', 'specularRoughness', 'normalCamera'): # Connection state connectionState = pc.shadingConnection(self.selectedShader + '.' + attribute, q=True, cs=True) # If the connection is OK, we display the correct icon to disable it if (connectionState): pc.iconTextButton(self.dynamicButtons[attribute + 'Toggle'], edit=True, image="disableForRendering.png") else: pc.iconTextButton(self.dynamicButtons[attribute + 'Toggle'], edit=True, image="enableForRendering.png")
def lcMoveImagePlaneUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcMoveImagePlane' shelfCommand = 'import lct.src.lcMoveImagePlane.lcMoveImagePlane as lcMIP\nreload(lcMIP)\nlcMIP.lcMoveImagePlaneUI()' icon = basePath+'lcMoveImagePlane.png' winWidth = 204 winHeight = 103 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.rowColumnLayout(nc=3, cw=([1,66], [2,66], [3,66] ) ) pm.button(l='Front', bgc=colorWheel.getColorRGB(ci), w=66, h=25, annotation='Create an image plane for the front camera', command=lambda *args: mip_make_image_plane('front', imageListDropdown) ) ci+=1 pm.button(l='Side', bgc=colorWheel.getColorRGB(ci), w=66, h=25, annotation='Create an image plane for the side camera', command=lambda *args: mip_make_image_plane('side', imageListDropdown) ) ci+=1 pm.button(l='Top', bgc=colorWheel.getColorRGB(ci), w=66, h=25, annotation='Create an image plane for the top camera', command=lambda *args: mip_make_image_plane('top', imageListDropdown) ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,25], [2,175]) ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'reloadList.png', annotation='Reload the image planes list', command=lambda *args: mip_populate_image_list(imageListDropdown) ) imageListDropdown = pm.optionMenu(prefix+'_optionMenu_image_plane_list', w=175, h=25, annotation='List of orthographic image planes' ) pm.setParent(prefix+'_columLayout_main') # pm.button(l='Make Image Plane Move Control', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Create control curve for image plane from drop down list', command=lambda *args: mip_make_ctrl(imageListDropdown) ) ci+=1 # mainWindow.show() mip_populate_image_list(imageListDropdown)
def __init__(self, iconPath): self.name = "Control_Creation_UI" self.title = "Create Controls" if (pm.window(self.name, q=1, exists=1)): pm.deleteUI(self.name) self.window = pm.window(self.title, widthHeight=(300, 300), resizeToFitChildren=1, menuBar=True) self.iconPath = iconPath icons = [f for f in os.listdir(self.iconPath) if f.endswith('.png')] #menu pm.menu( label='UI', helpMenu=True ) pm.menuItem( label='Create Icons', command = pm.Callback(self.createIcons)) form = pm.formLayout() tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) pm.formLayout( form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0))) child1 = pm.rowColumnLayout(numberOfColumns=3) for style in SimpleCurves.STYLES: if icons and "%s.png"%(style) in icons: iPath = os.path.join(self.iconPath, "%s.png"%(style)) pm.iconTextButton(label=style, style='iconAndTextVertical', image1=iPath, command = pm.Callback(self.simpleCurve, style)) else: pm.button(label=style, command = pm.Callback(self.simpleCurve, style)) pm.setParent( '..' ) child2 = pm.rowColumnLayout(numberOfColumns=2) pm.button() pm.setParent( '..' ) child3 = pm.rowColumnLayout(numberOfColumns=2) pm.button() pm.button() pm.button() pm.setParent( '..' ) pm.tabLayout( tabs, edit=True, tabLabel=((child1, 'Simple Curves'), (child2, 'Combo Controls'), (child3, 'Facial Controls')) ) pm.showWindow(self.window)
def populate_library_layout(self): pm.setParent(self.widgets['library_vertical']) self.widgets['library_vertical'].clear() treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) if not treeViewSelected: return pm.scrollLayout(cr=True) pm.rowColumnLayout(numberOfColumns=4) path = os.path.abspath(treeViewSelected[0]) pose_paths = [] for dir in os.listdir(path): if dir.find(self.library_objects_suffix[0]) != -1: #.pose pose_paths.append(os.path.abspath(os.path.join(path, dir))) for pose_path in pose_paths: pose_obj = Pose(pose_path) infos = pose_obj.get_info() label = infos['name'].split('.')[0] image = pose_obj.thumbnail_path pm.columnLayout(adj=True) pm.iconTextButton( w=80, h=80, style='iconOnly', image=image, label=label, c=pm.Callback(self.library_button_load_pose, pose_obj)) pm.popupMenu() pm.menuItem(label='Save Pose', c=pm.Callback(self.library_button_save_pose, pose_obj)) pm.menuItem(label='Load Pose', c=pm.Callback(self.library_button_load_pose, pose_obj)) pm.text(label, bgc=[0.1,0.1,0.1]) pm.setParent('..') self.widgets["library_vertical"].redistribute()
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')
def runChecks(self, *args): sucess = True order = self.checksDict.keys() order.sort() for id in order: result = self.checksDict[id]['check']() if result: sucess = False pm.iconTextButton( self.checksWidgets[id], e=True, image1='D:JOBS/PIPELINE/pipeExemple/scenes/icons/fix.png', label=self.checksDict[id]['label'] + ' failled') if not self.checksDict[id]['fix']: continue popup = pm.popupMenu(p=self.checksWidgets[id]) for fix in self.checksDict[id]['fix']: pm.menuItem(p=popup, l=fix.__name__, c=lambda x, y=fix, z=id: self.runFix(y, z)) else: pm.iconTextButton( self.checksWidgets[id], e=True, image1='D:JOBS/PIPELINE/pipeExemple/scenes/icons/valid.png', label=self.checksDict[id]['label'] + ' Ok') if sucess: print 'item valid!' pm.button(self.btn, e=True, l='PUBLISH', c=self.publishFile)
def load_symetry_data(self): if not pm.selected(): self.targetGeo = pm.PyNode(str( self.edge).split('.e')[0]).getTransform() else: if str(type(pm.selected() [0])) == "<class 'pymel.core.general.MeshEdge'>": self.edge = str(pm.selected()[0]) self.targetGeo = pm.PyNode(str( self.edge).split('.e')[0]).getTransform() try: self.symetry_data = adbTopo.getSymmetry(self.edge) or [] if self.symetry_data: pm.iconTextButton(self.symetry_status, edit=1, i=ICONS_FOLDER + 'green_status') pm.textField(self.targetGeoInput, edit=1, text=self.edge) except adbTopo.SymmetryError, e: pm.iconTextButton(self.symetry_status, edit=1, i=ICONS_FOLDER + 'red_status') pm.warning('Topology is invalid')
def createWin(self): if (pm.window('publishTest', exists=True)): pm.deleteUI('publishTest', window=True) self.win = pm.window('publishTest', w=200, h=300) self.parentCol = pm.columnLayout() self.col = pm.columnLayout() self.btn = pm.button(p=self.parentCol, l='VALIDATE', w=200, h=50, c=self.runChecks) pm.showWindow(self.win) order = self.checksDict.keys() order.sort() for id in order: self.checksWidgets[id] = pm.iconTextButton( p=self.col, style='iconAndTextHorizontal', image1='D:JOBS/PIPELINE/pipeExemple/scenes/icons/empty.png', label=self.checksDict[id]['label'])
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 __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 lcTextureToolsUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcTextureTools' shelfCommand = 'import lct.src.lcTextureTools.lcTextureTools as lcTxT\nreload(lcTxT)\nlcTxT.lcTextureToolsUI()' icon = basePath+'lcTextureTools.png' winWidth = 204 winHeight = 174 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.rowColumnLayout(nc=1, cw=([1,201]) ) pm.iconTextButton(w=200, h=25, style='iconOnly', image=iconBasePath+'renameNodes.png', annotation='Renames all file nodes based on the attached file name with a tx_ suffix', command=lambda *args: texture.renameAllTextureNodes() ) pm.setParent('..') pm.separator(style='in', h=5) # pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) ) pm.rowColumnLayout(nc=2, cw=([1,75], [2,25]) ) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'reloadAll.png', annotation='Reloads all the file texture nodes', command=lambda *args: texture.reloadTextures() ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Reload Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadTextures()', iconBasePath+'reloadAllTextures.png', 'Reload All Textures') ) pm.setParent('..') pm.rowColumnLayout(nc=2, cw=([1,75], [2,25]) ) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'reloadChanged.png', annotation='Reloads only the changed file texture nodes based on timestamp', command=lambda *args: texture().reloadChangedTextures() ) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Reload Changed Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadChangedTextures()', iconBasePath+'reloadChangedTextures.png', 'Reload Changed Textures') ) pm.setParent('..') pm.setParent(prefix+'_columLayout_main') pm.separator(style='in', h=5) # pm.rowColumnLayout(nc=2, cw=([1,150], [2,50]) ) pm.textField(prefix+'_textField_new_path', w=150) pm.button(prefix+'_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose a new directory', w=50, command=lambda *args: path.browsePathTextField(prefix+'_textField_new_path', '', 'Browse New Texture Directory') ) ci+=1 pm.setParent(prefix+'_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) ) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'pathAll.png', annotation='Repath all file texture nodes', command=lambda *args: lcTxT_repath_all() ) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'pathSelected.png', annotation='Repath selected file texture nodes', command=lambda *args: lcTxT_repath_selected() ) pm.setParent(prefix+'_columLayout_main') pm.separator(style='in', h=5) # pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) ) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'openAll.png', annotation='Open all file texture nodes in default associated program', command=lambda *args: lcTxT_open_all() ) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'openSelected.png', annotation='Open selected file texture nodes in default associated program', command=lambda *args: lcTxT_open_selected() ) pm.setParent(prefix+'_columLayout_main') pm.separator(style='in', h=5) # mainWindow.show()
MiscSc = pm.scrollLayout('Misc',p='Tabs') cmdShll = cmds.cmdShell(p='MelCmd',w=290,h=260 , bgc = [(.17),(.18),(.19)]) clearBtn = pm.symbolButton('minusBtn',p = 'MelCmd',i = 'clearAll.png',w = 285,h=43,ebg =1 , bgc = [(.1),(.11),(.11)],en = 1,command=('cmds.cmdShell(\"' + cmdShll + '\", edit=True, clear=True)' )) ControlsForm = pm.formLayout( 'ControlsForm',p='Controls') ToolsForm = pm.formLayout('ToolkitForm',p='Tools') SkinForm = pm.formLayout('SkinForm',p='Skin') MiscForm = pm.formLayout('MiscForm',p='Misc') GlobalName = pm.textField('Globalfield', w = 270 , h=25 ,pht = 'Name for Ctrls or Attrs',p = 'ControlsForm',bgc = [(.17),(.18),(.19)]) BaseCtlBtn = pm.iconTextButton('ControlBase',style='iconAndTextHorizontal', image1='polyColorSetEditor.png', label='Control Class',p = 'ControlsForm',w=130,h=40, bgc = [(.3),(.5),(.5)]) BaseCtlShapeBtn = pm.iconTextButton('ControlShape',style='iconAndTextHorizontal', image1='fluidCreate3D.png', label='Control Shape',p = 'ControlsForm',w=130,h=40, bgc = [(.3),(.5),(.5)]) Border01Btn = pm.button('Border01',l = '',p = 'ControlsForm',w= 260,h = 60,en=0) CtrlSizeText = pm.iconTextButton('Sizetxt',style='iconAndTextHorizontal',image1='StandinShelf.png',l = 'SHAPE SIZE',p = 'ControlsForm',w = 105,h=40, bgc = [(.2),(.3),(.3)],en = 1) intensityTxtFld = pm.floatField('intenTxf',min = .10,p = 'ControlsForm',v=.10,w= 45,h =40,bgc = [(.17),(.18),(.19)] ) plusBtn = pm.symbolButton('plusBtn',p = 'ControlsForm',i = 'UVTBAdd.png',w = 40,h=40,ebg =1 , bgc = [(.2),(.3),(.3)],en = 1) minusBtn = pm.symbolButton('minusBtn',p = 'ControlsForm',i = 'UVTBRemove.png',w = 40,h=40,ebg =1 , bgc = [(.2),(.3),(.3)],en = 1) attrsBtn = pm.button('atrBtn',l= 'Attributes',p = 'ControlsForm',w = 270,h=19, bgc = [(.2),(.2),(.2)],hlc = [(.9),(.2),(.2)],en =1) lockatBtn = pm.symbolButton('lockatrBtn',p = 'ControlsForm',i = 'Lock_ON.png',w = 63,h=25,ebg =1 , bgc = [(.3),(.2),(.2)],en = 1) unlockatBtn = pm.symbolButton('unlockatrBtn',p = 'ControlsForm',i = 'Lock_OFF.png',w = 63,h=25,ebg =1 , bgc = [(.3),(.2),(.2)],en = 1)
def createUI(): #Window and tab layout window0 = pm.window(title="DMX Export") rowColumnLayout0 = pm.rowColumnLayout() tabs = cmds.tabLayout(p=rowColumnLayout0) exportTab = pm.columnLayout(p=tabs) settingsTab = pm.columnLayout(p=tabs) cmds.tabLayout(tabs, edit=True, tabLabel=((exportTab, 'Export'), (settingsTab, 'Settings'))) #DMX path row DMXFolderSpacer = pm.text(label="", h=8, p=exportTab, align="left") dmxFilePathRow = pm.rowLayout(nc=2, p=exportTab, h=30) def dmxPathBrowse(): basicFilter = "*.fbx" dmxPath = cmds.fileDialog2(fm=0, ff=basicFilter, dialogStyle=2) dmxFilePath = cmds.textField("dmxFilePath", edit=True, text=str(dmxPath[0])) cmds.optionVar(sv=('dmxdmxFilePath', str(dmxPath[0]))) return dmxFilePath dmxFilePath = dmxPathBrowse if cmds.optionVar(exists='dmxdmxFilePath'): dmxFilePath = cmds.optionVar(q='dmxdmxFilePath') qcFilePathField = pm.textField("dmxFilePath", w=270, p=dmxFilePathRow, text=dmxFilePath) else: qcFilePathField = pm.textField("dmxFilePath", w=270, p=dmxFilePathRow) dmxPathIcon = pm.iconTextButton(style="iconAndTextVertical", image1="openLoadGeneric.png", w=30, h=30, p=dmxFilePathRow, c=dmxPathBrowse) #Export button row def selectedFunc(exportAllVar): exportAllVar = 0 fbx2dmxFunc() def allFunc(exportAllVar): exportAllVar = 1 fbx2dmxFunc() exportRow = pm.rowLayout(nc=2, p=exportTab, h=50) exportSelectedBox = pm.button("exportSelectedBox", label="Export Selected", w=150, h=50, p=exportRow, c=selectedFunc) exportallButton = pm.button("exportallButton", label="Export All", w=150, h=50, p=exportRow, c=allFunc) #Checkboxes checkboxRow = pm.rowLayout(nc=3, p=exportTab, h=30) triangulateBox = pm.checkBox("triangulateBox", label="Triangulate", p=checkboxRow, w=100) animationBox = pm.checkBox("animationBox", label="Animation", p=checkboxRow, w=100) compileBox = pm.checkBox("compileBox", label="Compile QC", p=checkboxRow, w=100) #QC Row qcRow = pm.rowLayout(nc=3, p=exportTab, h=50) qcFolderText = pm.text(label="QC path ", p=qcRow, align="left") def qcPathBrowse(): basicFilter = "*.qc" qcPath = cmds.fileDialog2(fm=1, ff=basicFilter, dialogStyle=2) qcFilePath = cmds.textField("qcFilePath", edit=True, text=str(qcPath[0])) cmds.optionVar(sv=('dmxqcFilePath', str(qcPath[0]))) return qcFilePath qcFilePath = qcPathBrowse if cmds.optionVar(exists='dmxqcFilePath'): qcFilePath = cmds.optionVar(q='dmxqcFilePath') qcFilePathField = pm.textField("qcFilePath", w=220, p=qcRow, text=qcFilePath) else: qcFilePathField = pm.textField("qcFilePath", w=220, p=qcRow) qcPathIcon = pm.iconTextButton(style="iconAndTextVertical", image1="openLoadGeneric.png", w=30, h=30, p=qcRow, c=qcPathBrowse) #HlMV Row hlmvRow = pm.rowLayout(nc=2, p=exportTab, h=35) hlmvButton = pm.button(label="Open in HLMV", w=150, h=35, p=hlmvRow, c=hlmvFunc) compileButton = pm.button(label="Compile", w=150, h=35, p=hlmvRow, c=compileFunc) #Bin folder path binFolderSpacer = pm.text(label="", h=8, p=settingsTab, align="left") binFolderText = pm.text(label="Bin folder path", w=300, p=settingsTab, align="left") binPathRow = pm.rowLayout(nc=2, p=settingsTab) def binPathBrowse(): binPath = cmds.fileDialog2(fm=3, dialogStyle=2, okCaption='Accept') binFilePath = cmds.textField("binFilePath", edit=True, text=str(binPath[0])) cmds.optionVar(sv=('dmxBinFilePath', str(binPath[0]))) return binFilePath binFilePath = binPathBrowse if cmds.optionVar(exists='dmxBinFilePath'): dmxBinFilePath = cmds.optionVar(q='dmxBinFilePath') binPathField = pm.textField("binFilePath", w=270, p=binPathRow, text=dmxBinFilePath) else: binPathField = pm.textField("binFilePath", w=270, p=binPathRow) binPathIcon = pm.iconTextButton(style="iconAndTextVertical", image1="openLoadGeneric.png", w=30, p=binPathRow, c=binPathBrowse) #Gameinfo folder path gameinfoFolderText = pm.text(label="Gameinfo.txt folder path", p=settingsTab, align="left") gameinfoFolderRow = pm.rowLayout(nc=2, p=settingsTab) def gameinfoPathBrowse(): basicFilter = "*.txt" gameinfoPath = cmds.fileDialog2(fm=3, ff=basicFilter, dialogStyle=2, okCaption='Accept') gameinfoFilePath = cmds.textField("gameinfoFilePath", edit=True, text=str(gameinfoPath[0])) cmds.optionVar(sv=('dmxGameinfoFilePath', str(gameinfoPath[0]))) return gameinfoFilePath gameinfoFilePath = gameinfoPathBrowse if cmds.optionVar(exists='dmxGameinfoFilePath'): gameinfoFilePath = cmds.optionVar(q='dmxGameinfoFilePath') gameinfoPathField = pm.textField("gameinfoFilePath", w=270, p=gameinfoFolderRow, text=gameinfoFilePath) else: binPathField = pm.textField("gameinfoFilePath", w=270, p=gameinfoFolderRow) gameinfoPathIcon = pm.iconTextButton(style="iconAndTextVertical", image1="openLoadGeneric.png", w=30, p=gameinfoFolderRow, c=gameinfoPathBrowse) shelfRow = pm.rowLayout(nc=1, p=settingsTab) shelfButton = pm.button(label="Add to Shelf", w=300, h=25, p=shelfRow, c=dmxExportButton) pm.showWindow(window0)
def showUI(self): """doc""" if pm.window(self.uiName, q=1, ex=1): pm.deleteUI(self.uiName) # make window pm.window(self.uiName, t=__uititle__, s=0, mxb=0, mnb=0, cc=self.saveLastStatus) # main column self.col_main = pm.columnLayout(adj=1) # top banner # main pm.columnLayout(adj=1, bgc=[.22, .22, .22]) pm.text(l='', h=3) self.txt_ban1 = pm.text(l='XGen Hub') QBannerTxt1 = mqt.convert(self.txt_ban1) QBannerTxt1.setStyleSheet('QObject {font: bold 12px; color: #121212;}') pm.text(l='', h=3) pm.setParent('..') # sub pm.rowLayout(nc=5, adj=3) pm.text(l='', w=8) self.btn_prev = pm.iconTextButton(i='SP_FileDialogBack_Disabled.png', c=partial(self.switchMode, False)) pm.columnLayout(adj=1, h=33) self.txt_ban2 = pm.text(l=self.MODE) QBannerTxt2 = mqt.convert(self.txt_ban2) QBannerTxt2.setStyleSheet('QObject {font: bold 22px; color: #666666;}') pm.setParent('..') self.btn_next = pm.iconTextButton( i='SP_FileDialogForward_Disabled.png', c=partial(self.switchMode, True)) pm.text(l='', w=8) pm.setParent('..') # ---------- pm.text(l='', h=4) pm.separator() pm.text(l='', h=2) # XGenHub Repository Root pm.columnLayout(adj=1, cal='left') pm.text(l=' - XGenHub Repository Root', h=22) pm.rowLayout(nc=2, adj=1) self.txf_repo = pm.textField(text=self.projPath, ed=False) self.btn_link = pm.iconTextButton(i='syncOn.png', w=20, h=20, c=self.linkRepoDir) pm.setParent('..') # Action Mode self.col_acts = pm.columnLayout(w=257, h=57) pm.setParent('..') # ---------- pm.text(l='', h=6) pm.separator() pm.text(l='', h=4) # operation panel self.col_oper = pm.columnLayout(w=257, h=92) pm.setParent('..') # snapshot panel pm.columnLayout(adj=1, cal='center') pm.text(l=' [ Snapshots ] ', h=20) pm.columnLayout(adj=1, h=142, cal='center') self.img_snap = pm.image(i=self.snapNull) pm.setParent('..') pm.text(l='', h=2) pm.rowLayout(nc=5) for i in range(5): pm.button(self.snapBtnn + str(i + 1), l=str(i + 1), w=49) pm.setParent('..') pm.setParent('..') pm.setParent('..') # ---------- pm.text(l='', h=4) pm.separator() pm.text(l='', h=2) # execute button pm.columnLayout(adj=1) self.proc_btn = pm.button(l='P R O C E E D', h=45, bgc=[0.25, 0.46, 0.49]) pm.setParent('..') # main column END pm.setParent('..') self.initMode() pm.window(self.uiName, e=1, w=self.uiWidth, h=self.uiHeight) pm.showWindow(self.uiName)
pm.window('guerillaTagsWindow', t='Guerilla Tags', sizeable=False, mxb=0, mnb=0) pm.frameLayout(l='Guerilla Tags Tool', mw=5, mh=5) pm.columnLayout(adj=True) pm.separator(style='none', h=5) pm.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 20), (2, 200), (3, 19)]) pm.iconTextButton(style='iconAndTextVertical', height=19, width=19, noBackground=True, image1='mGuerilla.png', command=tagGuerillaAuto, annotation='AutoTags your selection for guerilla') tagGuerillaText = pm.textField(aie=1, ec=tagGuerilla, placeholderText='add one more tag', bgc=(0.16862745098039217, 0.16862745098039217, 0.16862745098039217)) addMoreTagButton = pm.iconTextButton( l='on', style='iconOnly', image1='addClip.png', height=19, width=19,
def UI(): # kill window if it already exists if pm.window('varFkUI', exists=True): pm.deleteUI('varFkUI') # build window varFkWindow = pm.window('varFkUI', title='Variable Fk Rigger', widthHeight=(365.0, 340.0), sizeable=False, minimizeButton=True, maximizeButton=False) # create tabLayout tabs = pm.tabLayout(imw=5, imh=5) # create tabs form = pm.formLayout(numberOfDivisions=100, w=365, h=340, parent=tabs) pm.tabLayout(tabs, edit=True, tabLabel=(form, 'VarFk Rigger')) info = pm.formLayout(numberOfDivisions=100, w=365, h=340, parent=tabs) pm.tabLayout(tabs, edit=True, tabLabel=(info, 'Help')) # fill info tab pm.setParent(info) # Creating Element scrollField_info infotext = 'Variable FK Autorigger \nVersion: 1.00 \nby Julian "fleity" Oberbeck. \n\nBasic variable FK concept by Jeff Brodsky (https://vimeo.com/72424469). \n\n\nVariable FK Rigs allow moving a FK-control along a joint chain, their influence being based on the distance to the joints. \n\n How to use: \n 1. Insert the name of the input curve. \n 2. Enter a name for the rig. \n 3. Choose number of controls. \n 4. Press "Build."' # Creating Element scrollField_infotext scrollField_infotext = pm.scrollField(text=infotext, w=340, h=295, editable=False, wordWrap=True) pm.formLayout(info, edit=True, attachForm=[(scrollField_infotext, 'top', 10), (scrollField_infotext, 'left', 10)]) # fill main utility tab pm.setParent(form) # Creating Element img_banner imagePath = pm.internalVar(upd=True) + '/icons/varFk.png' img_banner = pm.image(w=365, h=110, image=imagePath) pm.formLayout(form, edit=True, attachForm=[(img_banner, 'top', 0), (img_banner, 'left', -5)]) # ========================================= # Creating Element layout_curve_tools shelfLayout_curveTools = pm.shelfTabLayout('shelfCurves', w=225, h=50, tabsVisible=False) pm.setParent(shelfLayout_curveTools) pm.formLayout(form, edit=True, attachForm=[(shelfLayout_curveTools, 'top', 97), (shelfLayout_curveTools, 'left', 70)]) rowLayout_curveTools = pm.rowLayout('rowLayout_curveTools', w=200, h=45, numberOfColumns=4, cw4=[40, 40, 40, 40], ct4=['left', 'left', 'left', 'left'], co4=[10, 10, 10, 10]) pm.setParent(rowLayout_curveTools) # ========================================= # Creating Elements curve tool buttons button_CVCurveTool = pm.iconTextButton( 'button_CVCurveTool', w=40, h=40, mw=2, mh=2, image='curveCV.png', command=pm.Callback(pm.runtime.CVCurveTool, ), doubleClickCommand=pm.Callback(pm.runtime.CVCurveToolOptions, )) button_EPCurveTool = pm.iconTextButton( 'button_EPCurveTool', w=40, h=40, mw=2, mh=2, image='curveEP.png', command=pm.Callback(pm.runtime.EPCurveTool, ), doubleClickCommand=pm.Callback(pm.runtime.EPCurveToolOptions, )) button_PencilCurveTool = pm.iconTextButton( 'button_PencilCurveTool', w=40, h=40, mw=2, mh=2, image='pencil.png', command=pm.Callback(pm.runtime.PencilCurveTool, ), doubleClickCommand=pm.Callback(pm.runtime.PencilCurveToolOptions, )) button_BezierCurveTool = pm.iconTextButton( 'button_BezierCurveTool', w=40, h=40, mw=2, mh=2, image='curveBezier.png', command=pm.Callback(pm.runtime.CreateBezierCurveTool, ), doubleClickCommand=pm.Callback( pm.runtime.CreateBezierCurveToolOptions, )) # ========================================= pm.setParent(form) # ========================================= # Creating Element button_insertSelectedCurve button_insertSelectedCurve = pm.button(label='>', w=35, h=25, command=pm.Callback( insertFirstSelected, )) pm.formLayout(form, edit=True, attachForm=[(button_insertSelectedCurve, 'top', 155), (button_insertSelectedCurve, 'left', 55)]) # ========================================= # Creating Element input_inputCurve input_inputCurve = pm.textField('input_inputCurve', text='Draw a curve, 1 Joint per CV.', w=250, h=25) pm.formLayout(form, edit=True, attachForm=[(input_inputCurve, 'top', 155), (input_inputCurve, 'left', 100)]) # ========================================= # Creating Element text_IdName text_IdName = pm.text(label='Prefix Name:', align='right', recomputeSize=True, w=80, h=25) pm.formLayout(form, edit=True, attachForm=[(text_IdName, 'top', 190), (text_IdName, 'left', 10)]) # ========================================= # Creating Element input_IdName input_IdName = pm.textField('input_IdName', text='varFk', w=250, h=25) pm.formLayout(form, edit=True, attachForm=[(input_IdName, 'top', 190), (input_IdName, 'left', 100)]) # ========================================= # Creating Element text_numOfCtrls text_numOfCtrls = pm.text(label='# of Controls:', align='right', recomputeSize=True, w=80, h=25) pm.formLayout(form, edit=True, attachForm=[(text_numOfCtrls, 'top', 225), (text_numOfCtrls, 'left', 10)]) # ========================================= # Creating Element slider_numOfCtrls slider_numOfCtrls = pm.intSliderGrp('slider_numOfCtrls', f=True, min=1, max=10, fieldMinValue=1, fieldMaxValue=999, value=3, ann='Number of Controls', w=255, h=25) pm.formLayout(form, edit=True, attachForm=[(slider_numOfCtrls, 'top', 225), (slider_numOfCtrls, 'left', 100)]) # ========================================= # Creating Element button_build button_build = pm.button(label='Build', w=340, h=40, command=pm.Callback(buildVarFkFromUI, )) pm.formLayout(form, edit=True, attachForm=[(button_build, 'top', 265), (button_build, 'left', 10)]) # ========================================= pm.setParent('..') # show window varFkWindow.show()
def lcBatchBakeUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcBatchBake' shelfCommand = 'import lct.src.lcBatchBake.lcBatchBake as lcBake\nreload(lcBake)\nlcBake.lcBatchBakeUI()' icon = basePath + 'lcBatchBake.png' winWidth = 204 winHeight = 218 mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True) mainWindow.create() pm.menu(l='Options', helpMenu=True) pm.menuItem( l='Delete All bake sets', command=lambda *args: lcBake_delete_all_bake_sets(bakeSetListDropdown)) # pm.columnLayout(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.button(l='Make Texture', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Create a Texture bake set', command=lambda *args: lcBake_make_new_bake_set( bakeSetListDropdown, 'texture')) ci += 1 pm.button(l='Make Vertex', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Create a Texture bake set', command=lambda *args: lcBake_make_new_bake_set( bakeSetListDropdown, 'vertex')) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=3, cw=([1, 25], [2, 150], [3, 25])) pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath + 'reloadList.png', annotation='Reload the bake set list', command=lambda *args: lcBake_populate_bake_set_list( bakeSetListDropdown)) bakeSetListDropdown = pm.optionMenu(prefix + '_optionMenu_bake_set_list', w=150, h=25, annotation='List of bake sets') pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath + 'deleteItem.png', annotation='Delete this bake set', command=lambda *args: lcBake_delete_current_bake_set( bakeSetListDropdown)) pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) #nc=3, cw=([1,50], [2,50], [3,100] ) ) pm.button(l='+ Add', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Add geometry to bake set', command=lambda *args: lcBake_add_to_current_bake_set( bakeSetListDropdown)) ci += 1 # pm.button(l='- Rem', bgc=colorWheel.getColorRGB(ci), w=50, h=25, annotation='Remove geometry from bake set', command=lambda *args: lcBake_fake_command() ) # ci+=1 pm.button( l='Edit Options', bgc=colorWheel.getColorRGB(ci), w=100, h=25, annotation='Edit the bake set options', command=lambda *args: lcBake_show_bake_set_attrs(bakeSetListDropdown)) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 75], [2, 125])) pm.text(l='Bake Camera: ', al='right') cameraListDropdown = pm.optionMenu(prefix + '_optionMenu_camera_list', w=125, h=25, annotation='List of cameras') pm.text(l='') pm.checkBox(prefix + '_checkBox_shadows', w=125, h=25, value=True, label='Shadows and AO?', annotation='Turn on to bake shadows and ambient occlusion') pm.setParent(prefix + '_columLayout_main') # pm.separator(style='none', h=10) pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50])) pm.textField(prefix + '_textField_texture_path', text='texture output directory', annotation='Output directory path', w=150) pm.button( prefix + '_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose a directory', w=50, command=lambda *args: path.browsePathTextField( prefix + '_textField_texture_path', '', 'Browse a Directory')) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50])) pm.button(l='Bake It !!', bgc=colorWheel.getColorRGB(ci), w=150, h=25, annotation='Bake to texture or vertex', command=lambda *args: lcBake_convert_lightmap( bakeSetListDropdown, cameraListDropdown)) ci += 1 pm.button(l='Open Dir', bgc=colorWheel.getColorRGB(ci), w=50, h=25, annotation='Open the output directory', command=lambda *args: lcBake_open_lightmap_folder()) ci += 1 # mainWindow.show() plugin.reloadPlugin(plugin='Mayatomr', autoload=True) lcBake_populate_bake_set_list(bakeSetListDropdown) lcBake_populate_camera_list(cameraListDropdown)
def lcObjToolsUI(dockable=False, *args, **kwargs): ''' ''' global prefix ci = 0 #color index iterator windowName = 'lcObjTools' shelfCommand = 'import lct.src.lcObjTools.lcObjTools as lcObj\nreload(lcObj)\nlcObj.lcObjToolsUI()' icon = basePath + 'lcObjTools.png' winWidth = 204 winHeight = 158 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.rowColumnLayout(nc=2, cw=([1, 150], [2, 50])) pm.textField(prefix + '_textField_export_path', w=150) pm.button(prefix + '_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose an export directory', w=50, command=lambda *args: path.browsePathTextField( prefix + '_textField_export_path', "Wavefront Obj (*.obj)", 'Obj Export Location')) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.checkBox(prefix + '_checkBox_export_indi', l='Export Individual', v=False) pm.checkBox(prefix + '_checkBox_use_smooth', l='Use Smooth Preview', v=True) # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.textField(prefix + '_textField_prefix', w=100) pm.text(l=' Prefix_', al='left') pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 169], [2, 31])) pm.columnLayout(w=169) pm.button(prefix + '_button_export', l='Export OBJ', bgc=colorWheel.getColorRGB(ci), annotation='Export the selected geometry', w=168, h=30, command=lambda *args: lcObj_exportObjs()) ci += 1 pm.button(prefix + '_button_Import', l='Import Multiple OBJs', bgc=colorWheel.getColorRGB(ci), annotation='Clean import more than one obj', w=168, h=20, command=lambda *args: lcObj_importMultiple()) ci += 1 pm.setParent('..') pm.columnLayout(w=31) pm.iconTextButton( prefix + '_button_open_folder', style='iconOnly', image=iconBasePath + 'folder_30x50.png', annotation='Open the export folder', w=30, h=50, command=lambda *args: path.openFilePath( pm.textField( prefix + '_textField_export_path', query=True, text=True))) ci += 1 # mainWindow.show() plugin.reloadPlugin(plugin='objExport', autoload=True)
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()
ToolsForm = pm.formLayout('ToolkitForm', p='Tools') SkinForm = pm.formLayout('SkinForm', p='Skin') MiscForm = pm.formLayout('MiscForm', p='Misc') GlobalName = pm.textField('Globalfield', w=270, h=25, pht='Name for Ctrls or Attrs', p='ControlsForm', bgc=[(.17), (.18), (.19)]) BaseCtlBtn = pm.iconTextButton('ControlBase', style='iconAndTextHorizontal', image1='polyColorSetEditor.png', label='Control Class', p='ControlsForm', w=130, h=40, bgc=[(.3), (.5), (.5)]) BaseCtlShapeBtn = pm.iconTextButton('ControlShape', style='iconAndTextHorizontal', image1='fluidCreate3D.png', label='Control Shape', p='ControlsForm', w=130, h=40, bgc=[(.3), (.5), (.5)]) Border01Btn = pm.button('Border01', l='', p='ControlsForm', w=260, h=60, en=0) CtrlSizeText = pm.iconTextButton('Sizetxt', style='iconAndTextHorizontal',
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 lcTextureToolsUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcTextureTools' shelfCommand = 'import lct.src.lcTextureTools.lcTextureTools as lcTxT\nreload(lcTxT)\nlcTxT.lcTextureToolsUI()' icon = basePath + 'lcTextureTools.png' winWidth = 204 winHeight = 174 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.rowColumnLayout(nc=1, cw=([1, 201])) pm.iconTextButton( w=200, h=25, style='iconOnly', image=iconBasePath + 'renameNodes.png', annotation= 'Renames all file nodes based on the attached file name with a tx_ suffix', command=lambda *args: texture.renameAllTextureNodes()) pm.setParent('..') pm.separator(style='in', h=5) # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.rowColumnLayout(nc=2, cw=([1, 75], [2, 25])) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath + 'reloadAll.png', annotation='Reloads all the file texture nodes', command=lambda *args: texture.reloadTextures()) pm.iconTextButton( w=25, h=25, style='iconOnly', image=iconBasePath + 'addToShelf.png', highlightImage=iconBasePath + 'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton( 'Reload Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadTextures()', iconBasePath + 'reloadAllTextures.png', 'Reload All Textures')) pm.setParent('..') pm.rowColumnLayout(nc=2, cw=([1, 75], [2, 25])) pm.iconTextButton( w=100, h=25, style='iconOnly', image=iconBasePath + 'reloadChanged.png', annotation= 'Reloads only the changed file texture nodes based on timestamp', command=lambda *args: texture().reloadChangedTextures()) pm.iconTextButton( w=25, h=25, style='iconOnly', image=iconBasePath + 'addToShelf.png', highlightImage=iconBasePath + 'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton( 'Reload Changed Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadChangedTextures()', iconBasePath + 'reloadChangedTextures.png', 'Reload Changed Textures')) pm.setParent('..') pm.setParent(prefix + '_columLayout_main') pm.separator(style='in', h=5) # pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50])) pm.textField(prefix + '_textField_new_path', w=150) pm.button(prefix + '_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose a new directory', w=50, command=lambda *args: path.browsePathTextField( prefix + '_textField_new_path', '', 'Browse New Texture Directory')) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath + 'pathAll.png', annotation='Repath all file texture nodes', command=lambda *args: lcTxT_repath_all()) pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath + 'pathSelected.png', annotation='Repath selected file texture nodes', command=lambda *args: lcTxT_repath_selected()) pm.setParent(prefix + '_columLayout_main') pm.separator(style='in', h=5) # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.iconTextButton( w=100, h=25, style='iconOnly', image=iconBasePath + 'openAll.png', annotation='Open all file texture nodes in default associated program', command=lambda *args: lcTxT_open_all()) pm.iconTextButton( w=100, h=25, style='iconOnly', image=iconBasePath + 'openSelected.png', annotation= 'Open selected file texture nodes in default associated program', command=lambda *args: lcTxT_open_selected()) pm.setParent(prefix + '_columLayout_main') pm.separator(style='in', h=5) # mainWindow.show()
def ui(self): template = pm.uiTemplate('ExampleTemplate', force=True) template.define(pm.button, w=60, height=25) template.define(pm.frameLayout, borderVisible=False, labelVisible=False) if pm.window(self.object, q=1, ex=1): pm.deleteUI(self.object) with pm.window(self.object, t=self.name, s=True, tlb=False, mnb=True) as win: with template: with pm.columnLayout(adj=True, rs=1): pm.text('MESH') with pm.rowLayout(adj=True, numberOfColumns=4): pm.separator(w=2, vis=0) self.symetry_status = pm.iconTextButton( h=20, w=20, i=ICONS_FOLDER + 'red_status') pm.button(label="Load Symetry Data", w=200, backgroundColor=colordic['grey1'], c=pm.Callback(self.load_symetry_data)) with pm.columnLayout(adj=True, rs=4): self.targetGeoInput = pm.textField(pht='Target Geo', w=60, ed=0, bgc=(0.15, 0.15, 0.15), tx=str(self.edge)) pm.popupMenu() pm.menuItem(l='Select Mesh', c=pm.Callback(self.selectTargetMesh)) pm.menuItem(l='Clear', c=pm.Callback(self.clearAB, 'target')) with pm.frameLayout(cll=True, bgc=(0.15, 0.15, 0.15), labelVisible=True, cl=True, label=" BLENDSHAPE"): with pm.columnLayout(adj=True, rs=4): pm.button(label="Delete History", backgroundColor=colordic['grey1'], c=mc.DeleteHistory) pm.button(label="Add BlendShape", w=110, backgroundColor=colordic['grey1'], c=pm.Callback(self.addBlendshapeAB)) with pm.rowLayout(adj=True, numberOfColumns=4): pm.iconTextButton(h=20, w=20, i='refresh', c=pm.Callback( self.refreshBlsMenu)) self.bls_node = pm.optionMenu('bls_node', w=130) all_bls = self.getAllBLS() if all_bls != []: for node in all_bls: pm.menuItem( label="{}".format(node.bs_node)) else: pm.menuItem(label='None') pm.separator(w=2) pm.button(label="Add Target", backgroundColor=colordic['grey1'], c=pm.Callback(self.addTargetAB)) with pm.columnLayout(adj=True, rs=4): pm.button(label="Mirror Blendshape Map", backgroundColor=colordic['green3'], c=pm.Callback( self.mirrorBlsWeightsMapAB)) with pm.frameLayout(cll=True, bgc=[0.15, 0.15, 0.15], labelVisible=True, cl=False, label=" RESET"): with pm.rowLayout(adj=True, numberOfColumns=2): self.baseGeoInput = pm.textField( pht='Base Geo', w=50, ed=0, bgc=(0.15, 0.15, 0.15), tx=str(self.baseGeo)) pm.popupMenu() pm.menuItem(l='Select Mesh', c=pm.Callback(self.selectBaseMesh)) pm.menuItem(l='Clear', c=pm.Callback(self.clearAB, 'base')) pm.button('<<<', w=40, c=pm.Callback(self.addBaseGeo)) with pm.rowLayout(numberOfColumns=4): pm.text(' RESET : ') self.inputXchbx = pm.checkBox(l='X', w=40, v=1) self.inputYchbx = pm.checkBox(l='Y', w=40, v=1) self.inputZchbx = pm.checkBox(l='Z', w=40, v=1) with pm.rowLayout(numberOfColumns=4): pm.separator(w=25, vis=0) pm.radioCollection() pm.separator(vis=0, w=30) self.posInput = pm.radioButton( label="Pos", sl=0, ) self.negInput = pm.radioButton(label="Neg", sl=1, w=80) with pm.columnLayout(adj=True, rs=4): self.percentageSlider = pm.intSliderGrp( field=True, minValue=1, maxValue=100, fieldMinValue=0, fieldMaxValue=100, value=100, cw2=(40, 100), ann="percentage of modification on your mesh") pm.popupMenu() pm.menuItem( l='20', c=lambda *args: pm.intSliderGrp( self.percentageSlider, e=1, value=20)) pm.menuItem( l='50', c=lambda *args: pm.intSliderGrp( self.percentageSlider, e=1, value=50)) pm.menuItem( l='75', c=lambda *args: pm.intSliderGrp( self.percentageSlider, e=1, value=75)) pm.button('Reset Mesh', w=40, backgroundColor=colordic['green3'], c=pm.Callback(self.resetMeshAB)) with pm.frameLayout(cll=True, bgc=[0.15, 0.15, 0.15], labelVisible=True, cl=False, label=" SELECTION"): with pm.rowLayout(adj=True, numberOfColumns=3): pm.button( label="Invert", backgroundColor=colordic['grey1'], w=110, c=lambda *args: mel.eval('InvertSelection')) pm.button(label="Match", backgroundColor=colordic['grey1'], w=110, c=pm.Callback(self.MatchSelection)) with pm.rowLayout(adj=True, numberOfColumns=4): pm.button(label="R", backgroundColor=colordic['grey1'], w=70, c=pm.Callback(self.select_right_edge)) pm.button(label="C", backgroundColor=colordic['grey1'], w=70, c=pm.Callback(self.select_center_edge)) pm.button(label="L", backgroundColor=colordic['grey1'], w=70, c=pm.Callback(self.select_left_edge)) with pm.rowLayout(adj=True, numberOfColumns=2): pm.button(label="Mirror Selection", backgroundColor=colordic['grey1'], c=pm.Callback(self.selectMirrorVtxAB)) with pm.frameLayout(cll=True, bgc=[0.15, 0.15, 0.15], labelVisible=True, cl=False, label=" MODIFY"): pm.text('MIRRORING', h=20) with pm.rowLayout(adj=True, numberOfColumns=3): pm.radioCollection() self.leftInput = pm.radioButton( label="Left > Right", sl=1) self.rightInput = pm.radioButton( label="Right > Left", sl=0) with pm.columnLayout(adj=True, rs=4): pm.button(label="Mirror Position", backgroundColor=colordic['grey1'], c=pm.Callback(self.mirrorAB)) pm.button(label="Flip", backgroundColor=colordic['grey1'], c=pm.Callback(self.flipMeshAB)) pm.separator(h=10) self.outputWin = pm.textScrollList(h=20, w=200)
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 ui(self): template = uiTemplate('ExampleTemplate', force = True ) template.define( button, width=250, height = 25) template.define( frameLayout, borderVisible = False, labelVisible = False) with template: with formLayout(): pm.dockControl("adb_AutoRig", content=self.win, a="right") with columnLayout(adj=True, rs = 4): with rowLayout(numberOfColumns=2): text(label='Name: ') self.namespace_txt = textField(pht = 'Untilted', w=215) button(l='Add Namespace', bgc = colordic['grey'], c = pm.Callback(self.createNamespace)) button(l='Namespace Editor', bgc = colordic['grey'], c = pm.Callback(mc.NamespaceEditor)) with rowLayout(adj=True, numberOfColumns = 3): separator(w=5, vis=True, bgc = colordic['grey4'], h = 1) text(label=' NUMBER OF JOINTS : ', fn = 'boldLabelFont') separator(w=90, vis=True, bgc = colordic['grey4'], h = 1) with rowLayout( numberOfColumns=4): text(label="Spine") self.spine_float = floatField(v = 5, precision=1, showTrailingZeros=0) text(label=" Neck ") self.neck_float = floatField(v = 4, precision=2, showTrailingZeros=0) with rowLayout(adj=True, numberOfColumns = 3): separator(w=5, vis=True, bgc = colordic['grey4'], h = 1) text(label=' CREATE GUIDE : ', fn = 'boldLabelFont') separator(w=120, vis=True, bgc = colordic['grey4'], h = 1) with columnLayout(rs=5): button(l='BUILD GUIDE', bgc = colordic['green'], c = pm.Callback(self.build_guide)) with rowLayout(adj=True, numberOfColumns = 3): separator(w=5, vis=True, bgc = colordic['grey4'], h = 1) text(label=' CREATE RIG : ', fn = 'boldLabelFont') separator(w=120, vis=True, bgc = colordic['grey4'], h = 1) with columnLayout(rs=5): button(l='BUILD ALL RIG', bgc = colordic['green3'], c = pm.Callback(self.build_all_rig)) with frameLayout( cll = True, nbg=False, bgc=colordic['grey1'], labelVisible=True , cl = True, label = " BY PART"): # with frameLayout( cll = True, nbg=False, labelVisible=True , cl = True, label = "LEG"): # with rowLayout(numberOfColumns=2): # checkBox("leg_cbx", l = "leg", h = 20) # checkBox("foot_cbx", l = "foot", h = 20) # with frameLayout( cll = True, nbg=False, labelVisible=True , cl = True, label = "ARM"): # with rowLayout(numberOfColumns=2): # checkBox("arm_cbx", l = "arm", h = 20) # checkBox("hand_cbx", l = "hand", h = 20) # with frameLayout( cll = True, nbg=False, labelVisible=True , cl = True, label = "SPINE"): # with rowLayout(adj=True, numberOfColumns=3): # button(l='Guide', w = 50) # with frameLayout( cll = True, nbg=False, labelVisible=True , cl = True, label = "NECK"): # with rowLayout(adj=True, numberOfColumns=3): # button(l='Guide', w = 50) button(l='GUIDE CUSTOM RIG', bgc = colordic['green']) with rowLayout(adj=True, numberOfColumns = 3): separator(w=5, vis=True, bgc = colordic['grey4'], h = 1) text(label=' RIG OPTIONS : ', fn = 'boldLabelFont') separator(w=120, vis=True, bgc = colordic['grey4'], h = 1) with columnLayout(rs=5): button(l='Show / Hide Feet Locators', bgc = colordic['grey'], c = pm.Callback(self.show_hide_foot_locs)) button(l='Show / Hide Proxy Plane', bgc = colordic['grey'], c = pm.Callback(self.show_hide_proxy_planes)) with frameLayout( cll = True, bgc=colordic['grey1'], labelVisible=True , cl = False, label = "CONTROLS OPTIONS"): with columnLayout(rs=5): text(label=' Control size : ') with rowLayout( numberOfColumns = 3): button(l='Reduce Size', bgc = colordic['grey'], w=124, c = pm.Callback(self.ScaleVertex,'-')) button(l='Increase Size', bgc = colordic['grey'], w=124, c = pm.Callback(self.ScaleVertex,'+')) with columnLayout(rs=5): text(label=' Control axis : ') with rowLayout( numberOfColumns = 3): button(l='Rotate X', bgc = colordic['grey'], w=82, c = pm.Callback(self.RotateVertex,'x')) button(l='Rotate Y', bgc = colordic['grey'], w=82, c = pm.Callback(self.RotateVertex,'y')) button(l='Rotate Z', bgc = colordic['grey'], w=82, c = pm.Callback(self.RotateVertex,'z')) with columnLayout(rs=5): text(label=' Control Shape : ') with rowLayout(adj=True, numberOfColumns = 4): pm.checkBox('myChBxX', l = "X", h = 20, v = True, cc = pm.Callback(self.cCommand_axis,'x')) pm.checkBox('myChBxY', l = "Y", h = 20, cc = pm.Callback(self.cCommand_axis,'y')) pm.checkBox('myChBxZ', l = "Z", h = 20,cc = pm.Callback(self.cCommand_axis,'z')) pm.optionMenu(w=220, cc = self.createctrl) pm.menuItem( "- Choose Shape -") pm.menuItem(label = "Circle") pm.menuItem(label = "Square") pm.menuItem(label = "Cube") pm.menuItem(label = "Ball") pm.menuItem(label = "Diamond") pm.menuItem(label = "Double_Pin") pm.menuItem(label = "Pin") pm.menuItem(label = "Cylinder") pm.menuItem(label = "Circle_Cross") pm.menuItem(label = "Cog") pm.menuItem(label = "Arrow") pm.menuItem(label = "Main") pm.menuItem(label = "Double_fleches_ctrl") pm.menuItem(label = "Arc_fleches_ctrl") pm.menuItem(label = "Fleches") pm.menuItem(label = "Locator_shape") with tabLayout('indexRGBTab',innerMarginWidth=5, innerMarginHeight=5) as tabs: with rowColumnLayout(numberOfColumns=2) as child1: """Index""" with gridLayout(numberOfColumns=7, cellWidthHeight=(35, 20)): pm.iconTextButton(bgc=(.000, .000, .000), command= pm.Callback(self.shapeColor,1)) pm.iconTextButton(bgc=(.247, .247, .247), command= pm.Callback(self.shapeColor,2)) pm.iconTextButton(bgc=(.498, .498, .498), command= pm.Callback(self.shapeColor,3)) pm.iconTextButton(bgc=(0.608, 0, 0.157), command= pm.Callback(self.shapeColor,4)) pm.iconTextButton( bgc=(0, 0.016, 0.373), command= pm.Callback(self.shapeColor,5)) pm.iconTextButton(bgc=(0, 0, 1), command= pm.Callback(self.shapeColor,6)) pm.iconTextButton(bgc=(0, 0.275, 0.094), command= pm.Callback(self.shapeColor,7)) pm.iconTextButton(bgc=(0.145, 0, 0.263), command= pm.Callback(self.shapeColor,8)) # pm.iconTextButton(bgc=(0.78, 0, 0.78), command= pm.Callback(self.shapeColor,9)) pm.iconTextButton(bgc=(0.537, 0.278, 0.2), command= pm.Callback(self.shapeColor,10)) pm.iconTextButton(bgc=(0.243, 0.133, 0.122), command= pm.Callback(self.shapeColor,11)) pm.iconTextButton(bgc=(0.6, 0.145, 0), command= pm.Callback(self.shapeColor,12)) # pm.iconTextButton(bgc=(1, 0, 0), command= pm.Callback(self.shapeColor,13)) pm.iconTextButton(bgc=(0, 1, 0), command= pm.Callback(self.shapeColor,14)) pm.iconTextButton(bgc=(0, 0.255, 0.6), command= pm.Callback(self.shapeColor,15)) # pm.iconTextButton(bgc=(1, 1, 1), command= pm.Callback(self.shapeColor,16)) # pm.iconTextButton(bgc=(1, 1, 0), command= pm.Callback(self.shapeColor,17)) pm.iconTextButton(bgc=(0.388, 0.863, 1), command= pm.Callback(self.shapeColor,18)) pm.iconTextButton(bgc=(0.263, 1, 0.635), command= pm.Callback(self.shapeColor,19)) # pm.iconTextButton(bgc=(1, 0.686, 0.686), command= pm.Callback(self.shapeColor,20)) pm.iconTextButton(bgc=(0.89, 0.675, 0.475), command= pm.Callback(self.shapeColor,21)) pm.iconTextButton(bgc=(1, 1, 0.384), command= pm.Callback(self.shapeColor,22)) pm.iconTextButton(bgc=(0, 0.6, 0.325), command= pm.Callback(self.shapeColor,23)) pm.iconTextButton(bgc=(0.627, 0.412, 0.188), command= pm.Callback(self.shapeColor,24)) # pm.iconTextButton(bgc=(0.62, 0.627, 0.188), command= pm.Callback(self.shapeColor,25)) pm.iconTextButton(bgc=(0.408, 0.627, 0.188), command= pm.Callback(self.shapeColor,26)) # pm.iconTextButton(bgc=(0.188, 0.627, 0.365), command= pm.Callback(self.shapeColor,27)) # pm.iconTextButton(bgc=(0.188, 0.627, 0.627), command= pm.Callback(self.shapeColor,28)) pm.iconTextButton(bgc=(0.188, 0.404, 0.627), command= pm.Callback(self.shapeColor,29)) pm.iconTextButton(bgc=(0.435, 0.188, 0.627), command= pm.Callback(self.shapeColor,30)) pm.iconTextButton(bgc=(0.507, 0.041, 0.277), command= pm.Callback(self.shapeColor,31)) """ RGB """ with frameLayout() as child2: with rowLayout(numberOfColumns=2): colorInputWidgetGrp('RGB', label='Color', rgb=(1, 0, 0), cw3=(0, 30, 162)) tabLayout( tabs, edit=True, tabLabel=((child1, 'Index'), (child2, 'RGB')) ) with rowLayout(numberOfColumns=2): pm.button(l = "Default color", w =124, backgroundColor = colordic['grey'], c = pm.Callback(self.colordefault)) pm.button(l = "Set RGB Color", w =124, backgroundColor = colordic['grey']) with frameLayout(): pm.palettePort( 'scenePalette', dim=(10, 1), h =20, ced= True, r= True, scc = 0, cc = self.cCommand)
def PrismTools_UI(): #PrismTools UI dimension winWidth = 250 winHeight = 500 # checking for duplicate windows windowID = 'PrismTools' if pm.window(windowID, exists=True): pm.deleteUI(windowID) # re-adjusting UI if UI is not correct try: if pm.windowPref(windowID, q=True, height=True) != winHeight or pm.windowPref(windowID, q=True, width=True) != winWidth: pm.windowPref(windowID, remove=True) except: pass # creating window pm.window(windowID, title=u'Prism Tools | Ver 2018 / 06 / 06', widthHeight=(winWidth, winHeight)) col = pm.columnLayout('MainColumn', width=400) # buttons for 2nd row AdvSke = pm.frameLayout(label=u'Advanced Skeleton', labelIndent=5, width=450, marginHeight=5, parent=col) ASRow = pm.rowLayout('row2', nc=5, width=450, parent = AdvSke) pm.text(label = '', width = 5, parent = ASRow) AS_button = partial(mel.eval, 'AdvancedSkeleton5') pm.iconTextButton(style = 'iconAndTextVertical', image1 = r'\\p.sv\Tool\PrismTools\AdvancedSkeleton5Files\icons\AS5.png', label = 'Adv Skeleton', parent = ASRow, command = AS_button, width = 75) picker_button = partial(mel.eval, 'source "//p.sv/Tool/PrismTools/AdvancedSkeleton5Files/Selector/biped.mel"') pm.iconTextButton(style='iconAndTextVertical', image1=r'\\p.sv\Tool\PrismTools\AdvancedSkeleton5Files\icons\asBiped.png', label=u'Picker(仮)', parent=ASRow, command = picker_button, width = 50) face_button = partial(mel.eval, 'source "//p.sv/Tool/PrismTools/AdvancedSkeleton5Files/Selector/face.mel"') pm.iconTextButton(style='iconAndTextVertical', image1=r'\\p.sv\Tool\PrismTools\AdvancedSkeleton5Files\icons\asFace.png', label=u'Picker(仮)', parent=ASRow, command = face_button, width = 50) pm.button('Prism Exporter', label = u'出力', width = 50, height = 50, backgroundColor=(0.6, 0.6, 0.6), parent = ASRow, command = Prism_AdvSkeExporter.ExporterWindow().UI_exporter) ''' animFrame = pm.frameLayout(label=u'モーションツールス', labelIndent=5, width=450, marginHeight=5, parent=col) pm.rowLayout('row3', nc=5, width=450) pm.button('SER whipmake', label=u'SER 鞭リグ作る', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command='whip = SERTools_001.whipMake_001.whipMake()') pm.button('SER fingerMirror_r', label=u'SER 指 右→左', width=75, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command=FingerCopyPasta.rightFingerToLeft) pm.button('SER fingerMirror_l', label=u'SER 指 左→右', width=75, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command=FingerCopyPasta.leftFingerToRight) pm.button('SER selectAll', label=u'SER select all', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3', command="import pymel.core as pm\npm.select('Character1_Ctrl_HeadEffector', 'Character1_Ctrl_RightShoulderEffector', 'Character1_Ctrl_LeftShoulderEffector', 'Character1_Ctrl_RightElbowEffector', 'Character1_Ctrl_LeftElbowEffector', 'Character1_Ctrl_RightKneeEffector', 'Character1_Ctrl_LeftKneeEffector', 'Character1_Ctrl_RightHipEffector', 'Character1_Ctrl_LeftHipEffector', 'Character1_Ctrl_ChestOriginEffector', 'Character1_Ctrl_ChestEndEffector', 'Character1_Ctrl_HipsEffector', 'Character1_Ctrl_Spine2', 'Character1_Ctrl_Spine1', 'Character1_Ctrl_Spine', 'Character1_Ctrl_RightUpLeg', 'Character1_Ctrl_RightLeg', 'Character1_Ctrl_LeftUpLeg', 'Character1_Ctrl_LeftLeg', 'Character1_Ctrl_RightShoulder', 'Character1_Ctrl_LeftShoulder', 'Character1_Ctrl_RightArm', 'Character1_Ctrl_RightForeArm', 'Character1_Ctrl_LeftArm', 'Character1_Ctrl_LeftForeArm', 'Character1_Ctrl_Neck', 'Character1_Ctrl_RightHandPinkyEffector', 'Character1_Ctrl_RightHandRingEffector', 'Character1_Ctrl_RightHandMiddleEffector', 'Character1_Ctrl_RightHandIndexEffector', 'Character1_Ctrl_RightHandThumbEffector', 'Character1_Ctrl_RightWristEffector', 'Character1_Ctrl_RightHandPinky3', 'Character1_Ctrl_RightHandPinky2', 'Character1_Ctrl_RightHandPinky1', 'Character1_Ctrl_RightHandRing3', 'Character1_Ctrl_RightHandRing2', 'Character1_Ctrl_RightHandRing1', 'Character1_Ctrl_RightHandMiddle3', 'Character1_Ctrl_RightHandMiddle2', 'Character1_Ctrl_RightHandMiddle1', 'Character1_Ctrl_RightHandIndex3', 'Character1_Ctrl_RightHandIndex2', 'Character1_Ctrl_RightHandIndex1', 'Character1_Ctrl_RightHandThumb3', 'Character1_Ctrl_RightHandThumb2', 'Character1_Ctrl_RightHandThumb1', 'Character1_Ctrl_RightHand', 'Character1_Ctrl_LeftHandPinkyEffector', 'Character1_Ctrl_LeftHandRingEffector', 'Character1_Ctrl_LeftHandMiddleEffector', 'Character1_Ctrl_LeftHandIndexEffector', 'Character1_Ctrl_LeftHandThumbEffector', 'Character1_Ctrl_LeftWristEffector', 'Character1_Ctrl_LeftHandPinky3', 'Character1_Ctrl_LeftHandPinky2', 'Character1_Ctrl_LeftHandPinky1', 'Character1_Ctrl_LeftHandRing3', 'Character1_Ctrl_LeftHandRing2', 'Character1_Ctrl_LeftHandRing1', 'Character1_Ctrl_LeftHandMiddle3', 'Character1_Ctrl_LeftHandMiddle2', 'Character1_Ctrl_LeftHandMiddle1', 'Character1_Ctrl_LeftHandIndex3', 'Character1_Ctrl_LeftHandIndex2', 'Character1_Ctrl_LeftHandIndex1', 'Character1_Ctrl_LeftHandThumb3', 'Character1_Ctrl_LeftHandThumb2', 'Character1_Ctrl_LeftHandThumb1', 'Character1_Ctrl_LeftHand', 'Character1_Ctrl_RightFootIndexEffector', 'Character1_Ctrl_RightAnkleEffector', 'Character1_Ctrl_RightFootIndex1', 'Character1_Ctrl_RightFoot', 'Character1_Ctrl_LeftFootIndexEffector', 'Character1_Ctrl_LeftAnkleEffector', 'Character1_Ctrl_LeftFootIndex1', 'Character1_Ctrl_LeftFoot')\npm.select('Helper_Weapon1', 'x', 'y', 'z', add = True)") pm.rowLayout('row4', nc=5, width=450, parent=animFrame) pm.button('SER WeaponRig', label=u'SER 武器リグ', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row4', command=Weapon_Rig.rigUI) ''' pm.showWindow()
def UI(): # kill window if it already exists if pm.window('varFkUI', exists = True): pm.deleteUI('varFkUI') # build window varFkWindow = pm.window('varFkUI', title = 'Variable Fk Rigger', widthHeight=(365.0, 340.0), sizeable=False, minimizeButton=True, maximizeButton=False) # create tabLayout tabs = pm.tabLayout(imw = 5, imh = 5) # create tabs form = pm.formLayout(numberOfDivisions=100, w = 365, h = 340, parent = tabs) pm.tabLayout(tabs, edit = True, tabLabel = (form, 'VarFk Rigger')) info = pm.formLayout(numberOfDivisions=100, w = 365, h = 340, parent = tabs) pm.tabLayout(tabs, edit = True, tabLabel = (info, 'Help')) # fill info tab pm.setParent ( info ) # Creating Element scrollField_info infotext = 'Variable FK Autorigger \nVersion: 1.00 \nby Julian "fleity" Oberbeck. \n\nBasic variable FK concept by Jeff Brodsky (https://vimeo.com/72424469). \n\n\nVariable FK Rigs allow moving a FK-control along a joint chain, their influence being based on the distance to the joints. \n\n How to use: \n 1. Insert the name of the input curve. \n 2. Enter a name for the rig. \n 3. Choose number of controls. \n 4. Press "Build."' # Creating Element scrollField_infotext scrollField_infotext = pm.scrollField ( text = infotext, w = 340, h = 295, editable = False, wordWrap = True ) pm.formLayout( info, edit=True, attachForm=[( scrollField_infotext, 'top', 10), ( scrollField_infotext, 'left', 10)] ) # fill main utility tab pm.setParent( form ) # Creating Element img_banner imagePath = pm.internalVar(upd = True) + '/icons/varFk.png' # old imagePath = '/'.join( __file__.split('\\')[:-1] ) + '/varFk.png' img_banner = pm.image( w = 365, h = 110, image = imagePath ) pm.formLayout( form, edit=True, attachForm=[( img_banner, 'top', 0), ( img_banner, 'left', -5)] ) # ========================================= # Creating Element layout_curve_tools shelfLayout_curveTools = pm.shelfTabLayout( 'shelfCurves', w = 225, h = 50, tabsVisible = False ) pm.setParent( shelfLayout_curveTools ) pm.formLayout( form, edit=True, attachForm=[( shelfLayout_curveTools, 'top', 97), ( shelfLayout_curveTools, 'left', 70)] ) rowLayout_curveTools = pm.rowLayout( 'rowLayout_curveTools', w = 200, h = 45, numberOfColumns = 4, cw4 = [40,40,40,40], ct4 = ['left', 'left', 'left', 'left'], co4 = [10,10,10,10] ) pm.setParent( rowLayout_curveTools ) # ========================================= # Creating Elements curve tool buttons button_CVCurveTool = pm.iconTextButton( 'button_CVCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'curveCV.png', command = pm.Callback(pm.runtime.CVCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.CVCurveToolOptions, ) ) button_EPCurveTool = pm.iconTextButton( 'button_EPCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'curveEP.png', command = pm.Callback(pm.runtime.EPCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.EPCurveToolOptions, ) ) button_PencilCurveTool = pm.iconTextButton( 'button_PencilCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'pencil.png', command = pm.Callback(pm.runtime.PencilCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.PencilCurveToolOptions, ) ) button_BezierCurveTool = pm.iconTextButton( 'button_BezierCurveTool', w = 40, h = 40, mw = 2, mh = 2, image = 'curveBezier.png', command = pm.Callback(pm.runtime.CreateBezierCurveTool, ), doubleClickCommand = pm.Callback(pm.runtime.CreateBezierCurveToolOptions, ) ) # ========================================= pm.setParent( form ) # ========================================= # Creating Element button_insertSelectedCurve button_insertSelectedCurve = pm.button( label='>', w=35, h=25, command=pm.Callback(insertFirstSelected, ) ) pm.formLayout( form, edit=True, attachForm=[( button_insertSelectedCurve, 'top', 155), ( button_insertSelectedCurve, 'left', 55)] ) # ========================================= # Creating Element input_inputCurve input_inputCurve = pm.textField('input_inputCurve', text='Draw a curve, 1 Joint per CV.', w=250, h=25) pm.formLayout( form, edit=True, attachForm=[( input_inputCurve, 'top', 155), ( input_inputCurve, 'left', 100)] ) # ========================================= # Creating Element text_IdName text_IdName = pm.text( label='Prefix Name:', align='right', recomputeSize=True, w=80, h=25) pm.formLayout( form, edit=True, attachForm=[( text_IdName, 'top', 190), ( text_IdName, 'left', 10)] ) # ========================================= # Creating Element input_IdName input_IdName = pm.textField('input_IdName', text='varFk', w=250, h=25) pm.formLayout( form, edit=True, attachForm=[( input_IdName, 'top', 190), ( input_IdName, 'left', 100)] ) # ========================================= # Creating Element text_numOfCtrls text_numOfCtrls = pm.text( label='# of Controls:', align='right', recomputeSize=True, w=80, h=25) pm.formLayout( form, edit=True, attachForm=[( text_numOfCtrls, 'top', 225), ( text_numOfCtrls, 'left', 10)] ) # ========================================= # Creating Element slider_numOfCtrls slider_numOfCtrls = pm.intSliderGrp('slider_numOfCtrls', f=True, min=1, max=10, fieldMinValue=1,fieldMaxValue=999, value=3, ann='Number of Controls', w=255, h=25) pm.formLayout( form, edit=True, attachForm=[( slider_numOfCtrls, 'top', 225), ( slider_numOfCtrls, 'left', 100)] ) # ========================================= # Creating Element button_build button_build = pm.button( label='Build', w=340, h=40, command = pm.Callback(buildVarFkFromUI, )) pm.formLayout( form, edit=True, attachForm=[( button_build, 'top', 265), ( button_build, 'left', 10)] ) # ========================================= pm.setParent( '..' ) # show window varFkWindow.show()
def lcTextureToolsUI(dockable=False, asChildLayout=False, *args, **kwargs): ''' ''' global lct_cfg global prefix global height global defaultPath global defaultPrefix ci = 0 # color index iterator windowName = 'lcTextureTools' 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, 'lcTextureTools.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') # RENAME TEXTURE NODES pm.text(l='- Rename File Texture Nodes -', font='boldLabelFont', al='center', w=200, h=20, bgc=colorWheel.darkgrey) pm.separator(style='none', h=3, w=200) pm.rowColumnLayout(nc=3, cw=([1, 40], [2, 110], [3, 50])) pm.textField(prefix + '_textField_prefix', placeholderText=defaultPrefix, changeCommand=lambda *args: lct_cfg.set('lcTextureToolsPrefix', pm.textField(prefix + '_textField_prefix', query=True, tx=True)), receiveFocusCommand=lambda *args: lcTxT_rename_focus()) pm.text(l="_'texture_file_name'") pm.button(prefix + '_button_rename', l='Rename', bgc=colorWheel.getColorRGB(ci), annotation='rename all file texture nodes', w=50, command=lambda *args: lcTxT_rename_textures(pm.textField(prefix + '_textField_prefix', q=True, tx=True))) ci += 1 pm.setParent(prefix + '_columnLayout_main') pm.separator(style='in', h=8, w=200) # REPATH TEXTURE NODES pm.text(l='- Set new path for File Textures -', font='boldLabelFont', al='center', w=200, h=25, bgc=colorWheel.darkgrey) pm.separator(style='none', h=3, w=200) lcUI.UI.lc_browse_field_button(width=200, textFieldName=prefix + '_textField_new_path', lct_cfg=lct_cfg, configAttr='lcTextureToolsRepath', placeholderText=defaultPath, annotation='Choose a new texture directory') pm.setParent(prefix + '_columnLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Repath All', flat=False, image=os.path.join(iconPath, 'repath.png'), bgc=colorWheel.getColorRGB(ci), annotation='Repath all file texture nodes to exact path given', command=lambda *args: lcTxT_repath_all()) ci += 1 pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False, image=os.path.join(iconPath, 'repath.png'), bgc=colorWheel.getColorRGB(ci), annotation='Repath selected file texture nodes to exact path given', command=lambda *args: lcTxT_repath_selected()) ci += 1 pm.setParent(prefix + '_columnLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.button(w=100, h=25, label='Intelli-All', bgc=colorWheel.getColorRGB(ci), annotation='Recursive search given path to repath all file texture nodes', command=lambda *args: lcTxT_intelligent_repath_all()) ci += 1 pm.button(w=100, h=25, label='Intelli-Selected', bgc=colorWheel.getColorRGB(ci), annotation='Recursive search given path to repath selected file texture nodes', command=lambda *args: lcTxT_intelligent_repath_selected()) ci += 1 pm.setParent(prefix + '_columnLayout_main') pm.separator(style='in', h=8, w=200) # REPATH SHADERS (dx11 only) pm.text(l='- Set new path for DX11 Shaders -', font='boldLabelFont', al='center', w=200, h=25, bgc=colorWheel.darkgrey) pm.separator(style='none', h=3, w=200) lcUI.UI.lc_browse_field_button(width=200, textFieldName=prefix + '_textField_new_shader_path', lct_cfg=lct_cfg, configAttr='lcTextureToolsShaderRepath', placeholderText=defaultPath, annotation='Choose a new shader directory') pm.setParent(prefix + '_columnLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Repath All', flat=False, image=os.path.join(iconPath, 'shader_repath.png'), bgc=colorWheel.getColorRGB(ci), annotation='Repath all dx11Shader nodes to exact path given', command=lambda *args: lcTxT_shader_repath_all()) ci += 1 pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False, image=os.path.join(iconPath, 'shader_repath.png'), bgc=colorWheel.getColorRGB(ci), annotation='Repath selected dx11Shader nodes to exact path given', command=lambda *args: lcTxT_shader_repath_selected()) ci += 1 pm.setParent(prefix + '_columnLayout_main') pm.separator(style='in', h=8, w=200) # OPEN TEXTURES # a=170 # b=200-a # pm.rowColumnLayout(nc=2, cw=([1,a], [2,b])) pm.text(l='- Open File Texture Nodes -', font='boldLabelFont', al='center', w=200, h=25, bgc=colorWheel.darkgrey) pm.separator(style='none', h=3, w=200) # pm.symbolButton(prefix+'_button_check_editors', visible=False, image=os.path.join(srcPath,'icons','hint.png'), annotation='Setup Image File Editors', command=lambda *args: lcTxT_update_maya_prefs(prefix+'_button_check_editors') ) pm.setParent(prefix + '_columnLayout_main') pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100])) pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Open All', flat=False, image=os.path.join(iconPath, 'open.png'), bgc=colorWheel.getColorRGB(ci), annotation='Open all file texture nodes in default associated program', command=lambda *args: lcTxT_open_textures('all')) ci += 1 pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False, image=os.path.join(iconPath, 'open.png'), bgc=colorWheel.getColorRGB(ci), annotation='Open selected file texture nodes in default associated program', command=lambda *args: lcTxT_open_textures('selected')) ci += 1 pm.separator(style='none', h=8, w=200) # if not asChildLayout: mainWindow.show() pm.window(mainWindow.mainWindow, edit=True, height=winHeight, width=winWidth) else: pm.setParent('..') pm.setParent('..') # edit menus optionsMenu, helpMenu = lcUI.UI.lcToolbox_child_menu_edit(asChildLayout, windowName) # restore interface selections pm.textField(prefix + '_textField_new_path', edit=True, text=lct_cfg.get('lcTextureToolsRepath')) pm.textField(prefix + '_textField_prefix', edit=True, text=lct_cfg.get('lcTextureToolsPrefix')) pm.textField(prefix + '_textField_new_shader_path', edit=True, text=lct_cfg.get('lcTextureToolsShaderRepath')) # run extra stuff pm.setFocus(prefix + '_button_rename') # validate export directory lcPath.Path.validatePathTextField(prefix + '_textField_new_path', lct_cfg, 'lcTextureToolsRepath', defaultPath) lcPath.Path.validatePathTextField(prefix + '_textField_new_shader_path', lct_cfg, 'lcTextureToolsShaderRepath', defaultPath)
def lcMoveImagePlaneUI(dockable=False, *args, **kwargs): ''' ''' ci = 0 #color index iterator windowName = 'lcMoveImagePlane' shelfCommand = 'import lct.src.lcMoveImagePlane.lcMoveImagePlane as lcMIP\nreload(lcMIP)\nlcMIP.lcMoveImagePlaneUI()' icon = basePath + 'lcMoveImagePlane.png' winWidth = 204 winHeight = 103 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.rowColumnLayout(nc=3, cw=([1, 66], [2, 66], [3, 66])) pm.button( l='Front', bgc=colorWheel.getColorRGB(ci), w=66, h=25, annotation='Create an image plane for the front camera', command=lambda *args: mip_make_image_plane('front', imageListDropdown)) ci += 1 pm.button( l='Side', bgc=colorWheel.getColorRGB(ci), w=66, h=25, annotation='Create an image plane for the side camera', command=lambda *args: mip_make_image_plane('side', imageListDropdown)) ci += 1 pm.button( l='Top', bgc=colorWheel.getColorRGB(ci), w=66, h=25, annotation='Create an image plane for the top camera', command=lambda *args: mip_make_image_plane('top', imageListDropdown)) ci += 1 pm.setParent(prefix + '_columLayout_main') # pm.rowColumnLayout(nc=2, cw=([1, 25], [2, 175])) pm.iconTextButton( w=25, h=25, style='iconOnly', image=iconBasePath + 'reloadList.png', annotation='Reload the image planes list', command=lambda *args: mip_populate_image_list(imageListDropdown)) imageListDropdown = pm.optionMenu( prefix + '_optionMenu_image_plane_list', w=175, h=25, annotation='List of orthographic image planes') pm.setParent(prefix + '_columLayout_main') # pm.button( l='Make Image Plane Move Control', bgc=colorWheel.getColorRGB(ci), w=200, h=25, annotation='Create control curve for image plane from drop down list', command=lambda *args: mip_make_ctrl(imageListDropdown)) ci += 1 # mainWindow.show() mip_populate_image_list(imageListDropdown)