def outliner(self): self.duplicatecFrameLayout = mc.frameLayout(label="duplicate", collapsable=True, borderStyle="etchedIn", w=300, h=550, en=1) mc.frameLayout(labelVisible=False) panel = mc.outlinerPanel() outliner = mc.outlinerPanel(panel, query=True, outlinerEditor=True) mc.outlinerEditor(outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showNamespace=True, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter') mc.setParent('..') mc.setParent('..') mc.setParent('..')
def kmOutliner(self): # Create a new regular outliner in its own window mc.window(title="Outliner", toolbox=True) mc.frameLayout(labelVisible=False, width=300, height=500) panel = mc.outlinerPanel() outliner = mc.outlinerPanel(panel, query=True, outlinerEditor=True) mc.outlinerEditor(outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showReferenceNodes=False, showReferenceMembers=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showNamespace=True, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter') mc.showWindow()
def outlinerWin(self): if mel.window('autoProOutliner', exists=1): mel.deleteUI('autoProOutliner', window=1) mel.window('autoProOutliner', title="autoPro Outliner", iconName="autoProOut") mel.frameLayout(labelVisible=False) panel = mel.outlinerPanel() outliner = mel.outlinerPanel(panel, query=True, outlinerEditor=True) mel.outlinerEditor(outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter') mel.showWindow('autoProOutliner')
def copyMap(self): ws = self.wb[self.wb.sheetnames[0]] count = 0 for row in ws.values: if row[0] is None: #file end break count += 1 self.ProgressDialog = QProgressDialog("Copying Map", "Cancel", 0, count) self.ProgressDialog.setWindowTitle("Copy Progress") table = tuple(ws.values) for i in range(0, count): if self.ProgressDialog.wasCanceled(): #copy canceled break #generate authorStr authorStr = table[i][0] + table[i][1] # 1.add author to attribute # #create author node and set hidden # authorNode = mc.group(em = 1, name = "AuthorNode") # mc.setAttr("AuthorNode.hiddenInOutliner", True) # #add attr and lock it # mc.addAttr("AuthorNode", longName = "Author", dataType = "string") # mc.setAttr("AuthorNode.Author", authorStr, type = "string") # mc.setAttr("AuthorNode.Author", lock = 1) # 2.add author(number) to group name # create author node and set hidden groupName = "Author_" + table[i][0] print groupName authorNode = mc.group(em = 1, name = groupName) mc.setAttr(groupName + ".hiddenInOutliner", True) #lock node mc.lockNode(authorNode, lock = 1) #fresh outliner mc.outlinerEditor("outlinerPanel1", edit = 1, refresh = 1) #save and copy map mel.eval("file -save") originMapName = "origin.mb" targetMapName = authorStr originMap = workRootDir + "scenes/" + originMapName targetMap = workRootDir + "scenes/" + targetMapName + ".mb" shutil.copy(originMap, targetMap) #unlock and delete node mc.lockNode(authorNode, lock = 0) mc.delete(authorNode) count += 1 # set progress self.ProgressDialog.setValue(count) self.copyCount = str(count) self.copyDone()
def getGraphSelection(panel='graphEditor1', useSelectedCurves=True): '''A robust method of finding the selected objects/attributes in the graph editor. If nothing is selected, all objects in the graph outliner will be returned. If a one or more curves are selected, those curves take precedence over any other selection. Always returns a list.''' # First see if there are any curves selected if useSelectedCurves: selection = getSelectedCurves() if selection: return selection else: selection = [] # Get the graph outliner ui name. outliner = getEditorFromPanel(panel, cmd.outlinerEditor) if outliner is not None: # Find selected attributes sc = cmd.outlinerEditor(outliner, q=1, selectionConnection=1) selection = cmd.selectionConnection(sc, q=1, object=1) # If nothing is selected, find objects present in outliner. if not selection: sc = cmd.outlinerEditor(outliner, q=1, mainListConnection=1) selection = cmd.selectionConnection(sc, q=1, object=1) if not selection: selection = [] return selection
def selected(*args): curves = mc.keyframe(query=True, selected=True, name=True) if not curves: return try: mc.delete(ATTR_FILTER_NAME) except: pass try: mc.delete(OBJ_FILTER_NAME) except: pass filters = list() for c in curves: plug = mc.listConnections(c, plugs=True, source=False, destination=True)[0] print plug filters.append(mc.itemFilter(byName=plug, classification='user')) print filters selectedFilter = mc.itemFilter(union=filters) #mc.delete(filters) print selectedFilter mc.outlinerEditor('graphEditor1OutlineEd', edit=True, attrFilter=selectedFilter)
def __init__(self, editorName=DEFUALT_GE_OUTLINER_NAME): self._name = editorName self._mainSC = cmds.outlinerEditor(editorName, q=True, mainListConnection=True) self._selectedSC = cmds.outlinerEditor(editorName, q=True, selectionConnection=True)
def outliner_focus(): outliner = [i for i in cmds.lsUI(editors=1) if 'outliner' in i] if outliner: outliner = outliner[0] else: return cmds.outlinerEditor(outliner, edit=1, showSelected=1) cmds.setFocus(outliner)
def updateOutliner(self): inputList = cmds.selectionConnection(worldList=True) fromEditor = cmds.selectionConnection(activeList=True) CBcurrText = self.filtersCB.currentText() filterItem = cmds.itemFilter(byType = str(CBcurrText)) cmds.outlinerEditor(self.outlinerName, edit=True, mainListConnection=inputList, filter=filterItem) cmds.outlinerEditor(self.outlinerName, edit=True, selectionConnection=fromEditor)
def outlinerWindow(): if cmds.window('outlinerWindow', exists = True): cmds.deleteUI('outlinerWindow', window = True) else: cmds.window('outlinerWindow') cmds.frameLayout( labelVisible=False ) panel = cmds.outlinerPanel() outliner = cmds.outlinerPanel(panel, query=True,outlinerEditor=True) cmds.outlinerEditor( outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showNamespace=True, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter' ) cmds.showWindow()
def SCENE_remove_functionSelCom_selection_error(): ''' removes selCom error from newer maya version edited file into older ones ''' msg = 'function SelCom not found' for _editor in cmds.lsUI(editors=True): if not cmds.outlinerEditor(_editor, query=True, exists=True): continue _sel_cmd = cmds.outlinerEditor(_editor, query=True, selectCommand=True) if not _sel_cmd or not _sel_cmd.startswith('<function selCom at '): continue cmds.outlinerEditor(_editor, edit=True, selectCommand='print("")') msg = 'SelCom Function removed' return msg, 1
def filterChannels(channels): try: mc.delete(ATTR_FILTER_NAME) except:pass try: mc.delete(OBJ_FILTER_NAME) except:pass channels = list(set(channels)) channelFilter = mc.itemFilterAttr(ATTR_FILTER_NAME, byNameString=channels, classification='user') mc.outlinerEditor('graphEditor1OutlineEd', edit=True, attrFilter=channelFilter)
def getGraphEditor(graphInfo, expandObjects=True, useSelectedCurves=True, animatableOnly=True, usePartialCurveSelection=True): ''' Get attributes selected in the graph editor. If expandObjects is true, attributes are saved in the format object.attribute and a lack of selection or an entire object selected will expand to that object's keyable nodes. Otherwise, the list will be a mix of object.attribute and object. Objects will not have their attributes expanded. ''' selection = [] # Check for curves first, we may use those exclusively if useSelectedCurves: selection = getSelectedCurves( usePartialCurveSelection=usePartialCurveSelection) if selection: return selection # Get the graph outliner ui name. outliner = getEditorFromPanel(graphInfo.panelName, cmd.outlinerEditor) if outliner is not None: # Find attributes selected in the graph editor's outliner sc = cmd.outlinerEditor(outliner, q=1, selectionConnection=1) selection = cmd.selectionConnection(sc, q=1, object=1) # If nothing is selected, find objects present in outliner. if not selection: sc = cmd.outlinerEditor(outliner, q=1, mainListConnection=1) selection = cmd.selectionConnection(sc, q=1, object=1) if not selection: selection = [] attributes = [] if selection: # This is rare, but eliminate underworld paths. removeUnderworldFromPath(selection) attributes = filterSelectedToAttributes(selection, expandObjects, animatableOnly) return attributes
def toggleExpand(): gs = ac.GraphSelection() cmds.select(clear=True) cmds.refresh(f=True) ui = ds.GraphEditorButtonNames() panel = ds.findControlParent(control=ui.fil, split=5) panel = panel.split('|') panel = panel[len(panel) - 1] geOut = panel + 'OutlineEd' state = cmds.outlinerEditor(geOut, q=1, xc=1) cmds.outlinerEditor(geOut, e=1, xc=(not state)) if state: message('expand connections OFF -- reselect to see changes') else: message('expand connections ON -- reselect to see changes') gs.reselect()
def doInMain(self, i): number = self.table[i][0] name = self.table[i][1] authorStr = number + name # 1.add author to attribute # #create author node and set hidden # authorNode = mc.group(em = 1, name = "AuthorNode") # mc.setAttr("AuthorNode.hiddenInOutliner", True) # #add attr and lock it # mc.addAttr("AuthorNode", longName = "Author", dataType = "string") # mc.setAttr("AuthorNode.Author", authorStr, type = "string") # mc.setAttr("AuthorNode.Author", lock = 1) # 2.add author(number) to group name # create author node ,get uuid and set hidden groupName = "Author_" + number authorNode = mc.group(em=1, name=groupName) uuid = mc.ls(authorNode, uuid=1) mc.setAttr(authorNode + ".hiddenInOutliner", True) #add origin uuid to attribute mc.addAttr(authorNode, longName="signUUID", dataType="string") mc.setAttr(authorNode + ".signUUID", uuid[0], type="string") #lock node mc.lockNode(authorNode, lock=1) #fresh outliner mc.outlinerEditor("outlinerPanel1", edit=1, refresh=1) #save and copy map mel.eval("file -save") #originMapName = "origin.mb" #originMap = workRootDir + "scenes/" + originMapName originMap = mc.file(q=1, sn=1) targetMapName = authorStr targetMap = targetDir + targetMapName + ".mb" print originMap print targetMap shutil.copy(originMap, targetMap) #unlock and delete node mc.lockNode(authorNode, lock=0) mc.delete(authorNode) #uuid as result return uuid
def graphFilterCore(attr='', panel=''): '''\n adds/clears filters for the default graphEditor ''' # check for any filters currently being used c = cmds.outlinerEditor(panel + 'OutlineEd', q=True, af=True) cf = '' # if attrs arg is not empty execute, else delete filters reset filter to None if attr != '': # make new filter f = cmds.itemFilterAttr(bn=attr) # if a filter is already being used merge new/current #else use new filter if c != '0': # unify new/current filter cf = cmds.itemFilterAttr(un=[c, f]) cmds.delete(c) # set unified filter cmds.outlinerEditor(panel + 'OutlineEd', e=True, af=cf) else: # set new filter cmds.outlinerEditor(panel + 'OutlineEd', e=True, af=f) else: if c != '0': # clear all user filters cmds.delete(c) # reset filters to None cmds.outlinerEditor(panel + 'OutlineEd', e=True, af=0)
def filterChannels(channels): try: mc.delete(ATTR_FILTER_NAME) except: pass try: mc.delete(OBJ_FILTER_NAME) except: pass channels = list(set(channels)) channelFilter = mc.itemFilterAttr(ATTR_FILTER_NAME, byNameString=channels, classification='user') mc.outlinerEditor('graphEditor1OutlineEd', edit=True, attrFilter=channelFilter)
def selectionConnectionFromPanel(panel): '''A more robust way of determining the selection connection of a graph editor given its panel Returns None if nothing is found.''' outliner = getEditorFromPanel(panel, cmd.outlinerEditor) if outliner is not None: return cmd.outlinerEditor(outliner, q=1, selectionConnection=1) return None
def getSelectionConnection(panel='graphEditor1'): '''A more robust way of determining the selection connection of a graph editor given its panel Returns None if nothing is found.''' outliner = getEditorFromPanel(panel, cmd.outlinerEditor) if outliner is not None: return cmd.outlinerEditor(outliner, q=1, selectionConnection=1) return None
def setFilter(nameFilter=''): m2nType = cmds.optionVar(q='m2nType') types = [] try: for i in m2nType: type = i.lower() types.append(type) filter = cmds.itemFilter(byType=types) except: filter = cmds.itemFilter(byType=['unknown']) if not nameFilter: nameFilter = cmds.textField('filterText', q=1, tx=1) if nameFilter: name = '*%s*' % nameFilter nFilter = cmds.itemFilter(byName=name) filter = cmds.itemFilter(intersect=(nFilter, filter)) cmds.outlinerEditor('dirList', e=1, filter=filter)
def cmd_txsnm_chk_bt(self): #check 贴图命名 u""" >>check 贴图命名 : 项目缩写为 前缀, 使用 数字 0-9 字母a-zA-Z 下划线 _ 点. 贴图文件命名及路径中 回避 中文 贴图文件命名及路径中 不能有 空格 - () 等 特殊字符 """ chk_labels = { 'noExists': u'贴图不存在', 'iffyName': u'贴图命名 应由 (字母/数字/_/.) 组成', 'seqIffyName': u'序列贴图序号存在异常 正常为 ***.0001.jpg', 'prefIffyName': u'贴图前缀与当前任务不匹配' } res = self.chk_txf_name() if not res: return olnps = [ ea for ea in pm.lsUI(panels=True) if ea.type() == 'ToutlinerEditor' ] if olnps: mc.outlinerEditor(olnps[0].name(), showSetMembers=True, e=True) res_str = u'>>>请检查列出的file节点 贴图命名 所描述的错误{}'.format(os.linesep) ck_cnt = 0 res_total_sets = None if pm.objExists('Check_Error_information_Sets'): res_total_sets = pm.PyNode('Check_Error_information_Sets') [ pm.delete(ea_sets) for ea_sets in res_total_sets.listConnections() ] res_total_sets = pm.sets(name='Check_Error_information_Sets', em=True) for ea_ck_lb in chk_labels: if res[ea_ck_lb]: res_sets = pm.sets(name="CheckRes_{}".format(ea_ck_lb)) res_total_sets.add(res_sets.name()) res_str += u'\t{}{}'.format(chk_labels[ea_ck_lb], os.linesep) for ea_fn in res[ea_ck_lb]: res_sets.add(ea_fn.name()) res_str += u"\t\t>>>File Node >> {:<32}\t>>>Texture File>> {:<120}\t 异常部分: {}{}".format( ea_fn.name(), res[ea_ck_lb][ea_fn].keys()[0], res[ea_ck_lb][ea_fn].values()[0], os.linesep) ck_cnt += 1 if ck_cnt: print res_str else: print(u">>>没有贴图节点被check")
def currentSet2(): ge = 'graphEditor1OutlineEd' sel = cmds.ls(sl=1) cmds.select(cl=1) # shows selectionConnection object, populates ge geL = cmds.outlinerEditor(ge, q=1, mlc=1) # active sets result = cmds.selectionConnection(geL, q=1, obj=1) if sel: cmds.select(sel) return result
def _outliner_hide_set_member(): """Set outliner default display options Turn off `showSetMembers` for avoiding long wait on a big objectSet that being accidentally selected. """ options = { "showShapes": False, "showSetMembers": False, "showReferenceMembers": False, "showDagOnly": True, } avalon.logger.info("Disabling outliner set member display..") for outliner_pan in cmds.getPanel(type="outlinerPanel") or []: outliner = cmds.outlinerPanel(outliner_pan, query=True, outlinerEditor=True) # Set options cmds.outlinerEditor(outliner, edit=True, **options)
def main(): # NOTE 修复 Maya2017 大纲视图显示多余 set 的 Bug for outliner in cmds.getPanel(type="outlinerPanel"): cmds.outlinerEditor(outliner, e=1, sf="defaultSetFilter") # NOTE 四视图切换 mel.eval('setNamedPanelLayout "Four View"; ') # NOTE 禁用骨骼和模型选择 mel.eval(""" setObjectPickMask "Joint" false; setObjectPickMask "Surface" false; """) # NOTE 只显示曲线和模型 for mp in cmds.getPanel(type="modelPanel"): # NOTE 删除自定义的视窗窗口 if cmds.modelPanel(mp, q=1, tearOff=1): mayaToQT(mp).window().close() continue # NOTE 隐藏所有 cmds.modelEditor(mp, e=1, allObjects=0) cmds.modelEditor(mp, e=1, nurbsCurves=1, locators=1, polymeshes=1, hud=0, grid=0, da="smoothShaded", displayTextures=1) cmds.viewFit(cmds.modelEditor(mp, q=1, cam=1), all=True) createExtraPanel(panel_width=0, panel_height=0, gap=[30, 0], margin=0, pos="top")
def selected(*args): curves = mc.keyframe(query=True, selected=True, name=True) if not curves: return try: mc.delete(ATTR_FILTER_NAME) except:pass try: mc.delete(OBJ_FILTER_NAME) except:pass filters = list() for c in curves: plug = mc.listConnections(c, plugs=True, source=False, destination=True)[0] print plug filters.append(mc.itemFilter(byName=plug, classification='user')) print filters selectedFilter = mc.itemFilter(union=filters) #mc.delete(filters) print selectedFilter mc.outlinerEditor('graphEditor1OutlineEd', edit=True, attrFilter=selectedFilter)
def eliminate_outliner_callback(client_data): # Get Info all_panels = mc.getPanel(type="outlinerPanel") or [] detachedPanels = [] for curPanel in all_panels: sc = mc.outlinerEditor(curPanel, q=True, selectCommand=True) if sc is not None: # if there are selectCommand set ... detachedPanels.append(curPanel) # Fix Error for curPanel in detachedPanels: mc.outlinerPanel(curPanel, e=True, unParent=True) # remove infected panel mc.file(uiConfiguration=False ) # mark as do not save ui info within scene file if (mc.optionVar(exists="useScenePanelConfig") and mc.optionVar(q="useScenePanelConfig") == 0): mel.eval("$gOutlinerPanelNeedsInit = 1;") # flag to restore later # Output if detachedPanels: msg = 'The outliner error is detected so.\nthe deducted outliner is removed.' mc.confirmDialog(title='Confirm', message=msg, button=['Okay']) mel.eval("initOutlinerPanel ();") # restore outliner if flagged
def __init__( self, editorName=DEFUALT_GE_OUTLINER_NAME ): self._name = editorName self._mainSC = cmds.outlinerEditor( editorName, q=True, mainListConnection=True ) self._selectedSC = cmds.outlinerEditor( editorName, q=True, selectionConnection=True )
def maya2nuke(): window = "maya2nuke" if cmds.window(window, ex=1): cmds.deleteUI(window) cmds.window(window, menuBar=1) cmds.menu(tearOff=1, l='Edit') cmds.menuItem(l='Calculate Maya Data', c=getAllCamera) cmds.menuItem(divider=1) cmds.menuItem(l='Generator Nuke Script', c=generator) cmds.menuItem(l='Show Nuke Script', c=m2nShowText) cmds.menuItem(l='Save Nuke Script As', c=saveNukeScript) cmds.menuItem(divider=1) cmds.menuItem(l='Rest Setings', c=restSetings) cmds.menuItem(l='Exit', c='cmds.deleteUI("maya2nuke")') cmds.menu(tearOff=1, l='Type') cmds.menuItem('typeAll', l='All', checkBox=1, c=adjOption) cmds.menuItem(divider=1) cmds.menuItem('typeCamera', l='Camera', checkBox=1, c=setOption) cmds.menuItem('typeMesh', l='Mesh', checkBox=1, c=setOption) cmds.menu(tearOff=1, l='Animation') cmds.menuItem('animAll', l='All', checkBox=1, c=adjOption) cmds.menuItem(divider=1) cmds.menuItem('animCamera', l='Camera', checkBox=1, c=setOption) cmds.menuItem('animMesh', l='Mesh', checkBox=0, c=setOption) cmds.menu(tearOff=1, l='Networks') cmds.radioMenuItemCollection() cmds.menuItem('netNone', l='None', radioButton=0, c=setOption) cmds.menuItem('netBace', l='Bace', radioButton=1, c=setOption) cmds.menuItem('netContactSheet', l='ContactSheet', radioButton=0, c=setOption) cmds.menu(l='Help') cmds.menuItem(l='Help', c='m2nShowText("help")') cmds.menuItem(l='About', c=aboutThis) mianLayout = cmds.formLayout(nd=1000) b1 = cmds.outlinerEditor('dirList') cmds.outlinerEditor( 'dirList', e=1, mainListConnection="worldList", selectionConnection="modelList", showShapes=0, showAttributes=0, showConnected=0, showAnimCurvesOnly=0, autoExpand=0, showDagOnly=1, ignoreDagHierarchy=0, expandConnections=0, showNamespace=1, showCompounds=1, showNumericAttrsOnly=0, highlightActive=1, autoSelectNewObjects=0, doNotSelectNewObjects=0, transmitFilters=0, showSetMembers=1, ## setFilter="DefaultAllLightsFilter" ) cmds.cmdScrollFieldExecuter('copytext', vis=0) b2 = cmds.textField('filterText', cc=setFilterName, ec=setFilterName) b3 = cmds.button(l="Generator", c=generator) cmds.formLayout(mianLayout, e=1, attachControl=[(b1, "top", 3, b2), (b1, "bottom", 3, b3)], attachForm=[ (b1, "left", 3), (b1, "right", 3), (b2, "top", 3), (b2, "left", 3), (b2, "right", 3), (b3, "bottom", 3), (b3, "left", 3), (b3, "right", 3), ], attachNone=[(b2, "bottom"), (b3, "top")]) cmds.window(window, e=1, t="maya2nuke", widthHeight=(300, 700)) cmds.showWindow(window) getOption()
def ui_update(self): self.prefsSave() m.symbolCheckBox(self.ui_BTN_searchCase, e=True, value=self.state.searchCase) m.symbolCheckBox(self.ui_BTN_searchRegEx, e=True, value=self.state.searchRegex) m.symbolCheckBox(self.ui_BTN_searchType, e=True, value=self.state.searchType) m.symbolCheckBox(self.ui_BTN_searchSelect, e=True, value=self.state.searchSelect) m.symbolCheckBox(self.ui_BTN_searchShape, e=True, value=self.state.searchShape) ov = self.state.currentView m.button(self.ui_BTN_modeDropDown, edit=True, label=ov.name) m.outlinerEditor(self.ui_EDT_outliner, edit=True, mainListConnection=ov.mainListConnection) m.outlinerEditor(self.ui_EDT_outliner, edit=True, selectionConnection=ov.selectionConnection) m.outlinerEditor(self.ui_EDT_outliner, edit=True, filter=ov.filter) m.outlinerEditor(self.ui_EDT_outliner, edit=True, setFilter=ov.setFilter) m.outlinerEditor(self.ui_EDT_outliner, edit=True, showShapes=ov.showShapes) m.outlinerEditor(self.ui_EDT_outliner, edit=True, showSetMembers=ov.showSetMembers) m.outlinerEditor(self.ui_EDT_outliner, edit=True, showDagOnly=ov.showDagOnly) m.outlinerEditor(self.ui_EDT_outliner, edit=True, expandObjects=ov.expandObjects) m.outlinerEditor(self.ui_EDT_outliner, edit=True, selectCommand=(ov.selectCommand if ov.selectCommand else dummyFunc)) m.symbolCheckBox(self.ui_BTN_showShapes, e=True, enable=ov.showShapesEnable, value=ov.showShapes) m.symbolCheckBox(self.ui_BTN_showSetMembers, e=True, enable=ov.showSetMembersEnable, value=ov.showSetMembers) m.symbolCheckBox(self.ui_BTN_selectSetMembers, e=True, enable=ov.selectSetMembersEnable, value=ov.selectSetMembers)
def __init__(self, parent=getMayaWindow()): super(SoftModToolBox, self).__init__(parent) # Window infos self.setObjectName("SoftModToolBoxTiti") self.setWindowTitle("Sliding SoftMod UI") # PanelLayout for outliner paneLayoutName = cmds.paneLayout() ptr = mui.MQtUtil.findControl(paneLayoutName) # Find a pointer to the paneLayout that we just created paneLayout = sip.wrapinstance(long(ptr), QtCore.QObject) # Wrap the pointer into a python QObject # Widgets # ComboBox filtersCBTitle = QtGui.QLabel("Filters :") self.filtersCB = QtGui.QComboBox(parent=self) self.filtersCB.addItems(["softMod", "joint", "mesh", "light", "objectSet", ""]) # Outliner self.outlinerName = cmds.outlinerEditor(panel=paneLayoutName, showShapes = True, showDagOnly = False) ptr = mui.MQtUtil.findControl(self.outlinerName) outliner = sip.wrapinstance(long(ptr), QtCore.QObject) self.updateOutliner() # Buttons bpmBtn = QtGui.QPushButton("Make BPM Deformer", parent=self) slideBtn = QtGui.QPushButton("Make Sliding SoftMod", parent=self) closeBtn = QtGui.QPushButton("Close UI", parent=self) # Widgets size self.filtersCB.setMaximumWidth(1000) bpmBtn.setMaximumWidth(1000) slideBtn.setMaximumWidth(1000) closeBtn.setFixedHeight(25) # Widgets position grid = QtGui.QGridLayout() grid.setSpacing(10) grid.addWidget(filtersCBTitle, 1, 0) grid.addWidget(self.filtersCB, 1, 1, 1, 9) grid.addWidget(outliner, 2, 0, 5, 0) grid.addWidget(bpmBtn, 7, 5, 1, 5) grid.addWidget(slideBtn, 8, 5, 1, 5) grid.addWidget(closeBtn, 7, 0, 2, 5) #grid.addWidget(bpmBtn, 7, 0, 1, 5) #grid.addWidget(slideBtn, 8, 0, 1, 5) #grid.addWidget(closeBtn, 7, 5, 2, 5) self.setLayout(grid) self.setGeometry(250, 350, 250, 350) # Signals connection self.filtersCB.currentIndexChanged.connect(self.updateOutliner) bpmBtn.clicked.connect(smtbUtils.do_softModBpm) #self.connect(bpmBtn, QtCore.SIGNAL("clicked()"), do_softModBpm) slideBtn.clicked.connect(smtbUtils.do_softModCtrl) #self.connect(slideBtn, QtCore.SIGNAL("clicked()"), do_softModCtrl) #closeBtn.clicked.connect(self.close) closeBtn.clicked.connect(self.close)
def set_curve_filter(kind=Outliner_Filter.all, *args, **kwargs): return cmds.outlinerEditor(UI.graph_editor_outliner, e=True, attrFilter=kind)
def test(): #################### # # # CleanUp # # # #################### if cmds.window(WINDOW_NAME, exists=True): cmds.deleteUI(WINDOW_NAME) for pan in cmds.lsUI(panels=True): if cmds.panel(pan, q=True, label=True).startswith("vuRenderTree_"): print "Delte: " + pan cmds.deleteUI(pan, panel=True) cmds.window(WINDOW_NAME) main = cmds.paneLayout(configuration='vertical3') #################### # # # Frame Left # # # #################### paneLeft = cmds.paneLayout(configuration='horizontal2', p=main) cmds.frameLayout(label="ShadingNodes:", li=3, borderVisible=False, p=paneLeft) cmds.nodeTreeLister('theTreeLister', expandToDepth=1, addItem=shaders) # Textures cmds.frameLayout(label="Textures:", li=3, borderVisible=False, p=paneLeft) panel = cmds.outlinerPanel(label="vuRenderTree_Outliner", menuBarVisible=False) outlinerEditor = cmds.outlinerPanel(panel, query=True,outlinerEditor=True) filterTextures = cmds.createNode("objectRenderFilter") cmds.setAttr(filterTextures + ".textures", True) cmds.outlinerEditor( outlinerEditor, edit=True, showDagOnly=False, filter=filterTextures) # # ToDo Later: # ######################################################################### # # # # # filterKeyable = cmds.createNode("objectAttrFilter") # # cmds.setAttr(filterKeyable + ".attrType ", 3) # # # # # ######################################################################### # # # #################### # # # Node Editor # # # #################### # formNodes = cmds.formLayout(p=main) # nEdit = cmds.scriptedPanel(type="nodeEditorPanel", label="Node Editor") # #cmds.formLayout(formNodes, e=True, af=[(centershelf,s,0) for s in ("top","left","right")]) # cmds.formLayout(formNodes, e=True, af=[(nEdit,s,0) for s in ("top", "bottom","left","right")]) formNodes = cmds.formLayout(p=main) nEdit = cmds.scriptedPanel(type="nodeEditorPanel", label="vuRenderTree_NodeEditor") centershelf = cmds.shelfLayout("vuRenderUtils", p=formNodes) #cmds.formLayout(formNodes, e=True, af=[(centershelf,s,0) for s in ("top","left","right")]) #cmds.formLayout(formNodes, e=True, af=[(nEdit,s,0) for s in ("bottom","left","right")]) cmds.formLayout(formNodes, e=True, attachForm=[ (centershelf,"top",0), (centershelf,"left",0), (centershelf,"right",0), (nEdit,"bottom",0), (nEdit,"left",0), (nEdit,"right",0) ], attachControl=[ (nEdit, "top", 0, centershelf) ]) #################### # # # Frame Right # # # #################### paneRight = cmds.paneLayout( configuration='horizontal3', p=main) # Shading Groups #rightTabs = cmds.tabLayout() cmds.frameLayout(label="ShadingGroups:", li=3, borderVisible=False, p=paneRight) outlinerShadingGroups = cmds.outlinerPanel(label="vuRenderTree_Outliner", menuBarVisible=False) outlinerEditor = cmds.outlinerPanel(outlinerShadingGroups, query=True,outlinerEditor=True) filterShadingGroups = cmds.createNode("objectTypeFilter") cmds.setAttr(filterShadingGroups + ".typeName", "shadingEngine", type="string") cmds.outlinerEditor( outlinerEditor, edit=True, showDagOnly=False, filter=filterShadingGroups) # Shaders cmds.frameLayout(label="Shaders:", li=3, borderVisible=False, p=paneRight) outlinerShaders = cmds.outlinerPanel(label="vuRenderTree_Outliner", menuBarVisible=False) outlinerEditor = cmds.outlinerPanel(outlinerShaders, query=True,outlinerEditor=True) filterShaders = cmds.createNode("objectRenderFilter") cmds.setAttr(filterShaders + ".shaders", True) cmds.outlinerEditor( outlinerEditor, edit=True, showDagOnly=False, filter=filterShaders) #cmds.tabLayout( rightTabs, edit=True, tabLabel=((outlinerShadingGroups, 'ShadingGroups'), (outlinerShaders, 'Shaders'))) # Outliner cmds.frameLayout(label="Outliner:", li=3, borderVisible=False, p=paneRight) cmds.outlinerPanel(label="vuRenderTree_Outliner", menuBarVisible=True) cmds.showWindow()
def UI(): # check the dock existing if cmds.dockControl("tTDock", q=True, exists=True): cmds.deleteUI("tTDock") # create window if cmds.window('takToolWin', exists=True): cmds.deleteUI('takToolWin') cmds.window('takToolWin', title='Tak Tools', menuBar=True, mnb=False, mxb=False) # Menu cmds.menu('fileMenu', label='File', p='takToolWin') cmds.menuItem(label='Save Tools', c=saveTools, p='fileMenu') cmds.menu('editMenu', label='Edit', p='takToolWin') cmds.menuItem(label='Add Tool', c=addToolUi, p='editMenu') cmds.paneLayout('mainPaneLo', configuration='horizontal2', paneSize=[(2, 63, 37)]) cmds.formLayout('mainFormLo', p='mainPaneLo') # Common Tools section Start cmds.tabLayout('cmnToolTabLo', tv=False, p='mainFormLo') cmds.shelfLayout('Common', h=(36.5 * 4), parent='cmnToolTabLo') cmds.shelfButton(annotation='History', width=35, height=35, imageOverlayLabel='Hist', image1='menuIconEdit.png', command='DeleteHistory', sourceType='mel') # Common Tools Section End cmds.separator('mainSep', h=10, style='in', p='mainFormLo') # task tools section # # create tab cmds.tabLayout('taskTabLo', p='mainFormLo') riggingTab = cmds.formLayout('RiggingFormLo', w=21 * 21, p='taskTabLo') aniTab = cmds.formLayout('AnimationFormLo', w=21 * 21, p='taskTabLo') modelTab = cmds.formLayout('ModelingFormLo', w=21 * 21, p='taskTabLo') miscTab = cmds.formLayout('MiscFormLo', w=21 * 21, p='taskTabLo') cmds.tabLayout('taskTabLo', e=True, tabLabel=[(riggingTab, 'Rigging'), (aniTab, 'Animation'), (modelTab, 'Modeling'), (miscTab, 'Misc')]) # Editing main layout cmds.formLayout('mainFormLo', e=True, attachForm=[('cmnToolTabLo', 'top', 0), ('cmnToolTabLo', 'left', 0), ('cmnToolTabLo', 'right', 0), ('mainSep', 'left', 0), ('mainSep', 'right', 0), ('taskTabLo', 'left', 0), ('taskTabLo', 'right', 0), ('taskTabLo', 'bottom', 0)], attachControl=[('mainSep', 'top', 5, 'cmnToolTabLo'), ('taskTabLo', 'top', 5, 'mainSep')]) # rigging tab cmds.scrollLayout('riggingScrLo', childResizable=True, p='RiggingFormLo') cmds.formLayout('RiggingFormLo', e=True, attachForm=[('riggingScrLo', 'top', 0), ('riggingScrLo', 'bottom', 0), ('riggingScrLo', 'left', 0), ('riggingScrLo', 'right', 0)]) cmds.frameLayout('riggingDisplayFrameLo', label='Display', collapse=False, collapsable=True, p='riggingScrLo') # Rigging_Display Shelf Start cmds.shelfLayout('Rigging_Display', h=(41 * 1), p='riggingDisplayFrameLo') cmds.shelfButton(annotation='', width=35, height=35, imageOverlayLabel='Hist', image1='menuIconEdit.png', command='DeleteHistory', sourceType='mel') # Rigging_Display Shelf End cmds.frameLayout('riggingEditMdlFrameLo', label='Edit Model', collapse=False, collapsable=True, p='riggingScrLo') cmds.shelfLayout('Rigging_Edit_Model', h=(38 * 2), p='riggingEditMdlFrameLo') cmds.shelfButton(annotation='', width=35, height=35, imageOverlayLabel='Hist', image1='menuIconEdit.png', command='DeleteHistory', sourceType='mel') cmds.frameLayout('riggingBuildFrameLo', label='Build', collapse=False, collapsable=True, p='riggingScrLo') cmds.shelfLayout('Rigging_Build', h=(36.5 * 5), p='riggingBuildFrameLo') cmds.shelfButton(annotation='', width=35, height=35, imageOverlayLabel='Hist', image1='menuIconEdit.png', command='DeleteHistory', sourceType='mel') cmds.frameLayout('riggingSkinFrameLo', label='Skin Weights', collapse=False, collapsable=True, p='riggingScrLo') cmds.shelfLayout('Rigging_Skin_Weights', h=(40 * 2), p='riggingSkinFrameLo') cmds.frameLayout('riggingExtraFrameLo', label='Extra Tools', collapse=False, collapsable=True, p='riggingScrLo') cmds.shelfLayout('Rigging_Extra_Tools', h=(40 * 2), p='riggingExtraFrameLo') # animation tab cmds.scrollLayout('aniScrLo', childResizable=True, p='AnimationFormLo') cmds.formLayout('AnimationFormLo', e=True, attachForm=[('aniScrLo', 'top', 0), ('aniScrLo', 'bottom', 0), ('aniScrLo', 'left', 0), ('aniScrLo', 'right', 0)]) cmds.frameLayout('aniCtrlSelFrameLo', label='Control Select', collapse=False, collapsable=True, p='aniScrLo') cmds.shelfLayout('Animation_Control_Select', h=41, p='aniCtrlSelFrameLo') cmds.frameLayout('aniDisplayFrameLo', label='Display', collapse=False, collapsable=True, p='aniScrLo') cmds.shelfLayout('Animation_Display', h=41, p='aniDisplayFrameLo') cmds.frameLayout('aniCrvFrameLo', label='Animation Curve', collapse=False, collapsable=True, p='aniScrLo') cmds.shelfLayout('Animation_Animation_Curve', h=41, p='aniCrvFrameLo') cmds.frameLayout('aniPoseFrameLo', label='Pose', collapse=False, collapsable=True, p='aniScrLo') cmds.shelfLayout('Animation_Pose', h=41, p='aniPoseFrameLo') cmds.frameLayout('aniRefineShapeFrameLo', label='Refine Shape', collapse=False, collapsable=True, p='aniScrLo') cmds.shelfLayout('Animation_Refine_Shape', h=41, p='aniRefineShapeFrameLo') cmds.frameLayout('aniExtraFrameLo', label='Extra Tools', collapse=False, collapsable=True, p='aniScrLo') cmds.shelfLayout('Animation_Extra_Tools', h=41, p='aniExtraFrameLo') # modeling tab cmds.scrollLayout('mdlScrLo', childResizable=True, p='ModelingFormLo') cmds.formLayout('ModelingFormLo', e=True, attachForm=[('mdlScrLo', 'top', 0), ('mdlScrLo', 'bottom', 0), ('mdlScrLo', 'left', 0), ('mdlScrLo', 'right', 0)]) cmds.frameLayout('mdlDisplayFrameLo', label='Display', collapse=False, collapsable=True, p='mdlScrLo') cmds.shelfLayout('Modeling_Display', h=(41 * 1), p='mdlDisplayFrameLo') cmds.frameLayout('mdlSelFrameLo', label='Selection', collapse=False, collapsable=True, p='mdlScrLo') cmds.shelfLayout('Modeling_Selection', h=41, p='mdlSelFrameLo') cmds.frameLayout('mdlEditCpntFrameLo', label='Edit Component', collapse=False, collapsable=True, p='mdlScrLo') cmds.shelfLayout('Modeling_Edit_Component', h=(38 * 2), p='mdlEditCpntFrameLo') cmds.frameLayout('mdlEditGeoFrameLo', label='Edit Mesh', collapse=False, collapsable=True, p='mdlScrLo') cmds.shelfLayout('Modeling_Edit_Mesh', h=(38 * 3), p='mdlEditGeoFrameLo') cmds.frameLayout('mdlMatFrameLo', label='Material', collapse=False, collapsable=True, p='mdlScrLo') cmds.shelfLayout('Modeling_Material', h=41, p='mdlMatFrameLo') cmds.frameLayout('mdlAppFrameLo', label='Extra Tools', collapse=False, collapsable=True, p='mdlScrLo') cmds.shelfLayout('Modeling_Extra_Tools', h=(38 * 2), p='mdlAppFrameLo') # misc tab cmds.scrollLayout('miscScrLo', childResizable=True, p='MiscFormLo') cmds.formLayout('MiscFormLo', e=True, attachForm=[('miscScrLo', 'top', 0), ('miscScrLo', 'bottom', 0), ('miscScrLo', 'left', 0), ('miscScrLo', 'right', 0)]) cmds.frameLayout('miscFrameLo', label='Misc', collapsable=True, p='miscScrLo') cmds.shelfLayout('Misc_Misc', h=(41 * 2), p='miscFrameLo') cmds.frameLayout('tempFrameLo', label='Temp', collapsable=True, p='miscScrLo') cmds.shelfLayout('Misc_Temp', h=(41 * 2), p='tempFrameLo') # Ouliner cmds.frameLayout('olFrameLo', labelVisible=False, p='mainPaneLo') panel = cmds.outlinerPanel() outliner = cmds.outlinerPanel(panel, query=True, outlinerEditor=True) cmds.outlinerEditor(outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showReferenceNodes=True, showReferenceMembers=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter') # make dockable allowedAreas = ['right', 'left'] cmds.dockControl('tTDock', label="Tak Tools", area='left', content='takToolWin', allowedArea=allowedAreas)
def set_default_outliner(): out_liners = mc.getPanel(type="outlinerPanel") for out_liner in out_liners: mc.outlinerEditor(out_liner, e=1, setFilter="defaultSetFilter")
selectionList = mc.ls(\"*Shape*\") for item in selectionList: if mc.objExists(item + \".rmanCCs\"): mc.deleteAttr( item + \".rmanCCs\") attributList = mc.listAttr(item, string=\"*rman*\") if attributList: for itemAttr in attributList: mc.deleteAttr( item + \".\" + itemAttr )" # Create a new regular outliner in its own window mc.window(title="Outliner", toolbox=True) mc.frameLayout( labelVisible=False, width=300, height=500 ) panel = mc.outlinerPanel(tearOff=False) outliner = mc.outlinerPanel(panel, query=True, outlinerEditor=True) myOutliner = mc.outlinerEditor( outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showReferenceNodes=False, showReferenceMembers=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showNamespace=True, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter') myOutliner = mc.outlinerPanel(tearOff=True, outlinerEditor=False) print ">> ", myOutliner print mc.outlinerPanel(myOutliner, parent=True, q=True) ## mc.select("c_*") selectionList = mc.ls(sl=True, type="transform") mc.select(selectionList) if selectionList: for item in selectionList: #nc = item.split("|") print item for axe in ["X", "Y", "Z"]:
def buildObjectTree(self): panel = mc.outlinerPanel(menuBarVisible=False) outliner = mc.outlinerPanel(panel, query=True, outlinerEditor=True) mc.outlinerEditor( outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, filter= self.lightType )
def script(self): #------------------------------------------------------------------------------- # PANEL LAYOUT VERTICAL #------------------------------------------------------------------------------- verticalPanel = cmds.paneLayout(configuration='horizontal2') #--------------------------- # Tabs #--------------------------- cmds.tabLayout("edToolsTabs") self.edArnoldLayout() # Arnold Tab self.edCssLayout() # CSS Tab self.edFixLayout() # FIX Tab cmds.setParent("..") # Tabs cmds.tabLayout("edToolsTabs", edit=True, tabLabel=["edArnoldLayout", 'Arnold']) cmds.tabLayout("edToolsTabs", edit=True, tabLabel=["edCssLayout", 'CSS']) cmds.tabLayout("edToolsTabs", edit=True, tabLabel=["edFixLayout", 'Fixing']) #--------------------------- # Outliner #--------------------------- outlinerPanel = cmds.outlinerPanel() outliner = cmds.outlinerPanel(outlinerPanel, query=True, outlinerEditor=True) cmds.outlinerEditor(outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter') cmds.setParent("..") # outlinerPanel cmds.setParent("..") # panelVertical