def get_invalid(cls, context): from maya import cmds invalid = list() for node in cmds.ls(type="unknown"): plugin = cmds.unknownNode(node, query=True, plugin=True) if plugin == "AtomsMaya": invalid.append(node) return invalid
def deleteUnknownPluginNodes(plugin): """Delete nodes related to a specific unknown plugin Maya 2015 SP6 and up only """ unknownNodes = cmds.ls(type='unknown') for node in unknownNodes: plug = cmds.unknownNode(node, query=True, plugin=True) if plug == plugin: cmds.lockNode(node, lock=0) cmds.delete(node) logger.debug('Deleted node: {0}'.format(node))
def remove_unknown_plugin_nodes(plugin): '''Remove unknown nodes provided by a plugin''' from maya import cmds nodes = cmds.ls(type='unknown') for node in nodes: provider = cmds.unknownNode(node, query=True, plugin=True) if plugin == provider: _log.debug('Deleting unknownNode %s' % node) cmds.lockNode(node, lock=False) cmds.delete(node) cmds.flushUndo()
def renderer_clean(check='Mayatomr', clean=False): """ Hattip: https://forums.autodesk.com/t5/maya-shading-lighting-and/maya-2017-scene-error-warning-about-mental-ray-nodes/td-p/6627874 """ d_rendererNodes = { 'turtle': [ 'TurtleRenderOptions', 'TurtleUIOptions', 'TurtleBakeLayerManager', 'TurtleDefaultBakeLayer' ] } _str_func = 'renderer_clean' log.debug("|{0}| >> [{1}] | clean: {2}...".format(_str_func, check, clean)) if check in ['Mayatomr']: l = mc.ls(type='unknown') log.debug("|{0}| >> unknown nodes: {1}".format(_str_func, len(l))) for n in l: try: _test = mc.unknownNode(n, q=True, p=1) if _test == check: log.debug("|{0}| >> matches: {1}".format(_str_func, n)) if clean: mc.delete(n) except: pass if check in mc.unknownPlugin(q=1, list=1): log.debug("|{0}| >> Found: {1}".format(_str_func, check)) if clean: log.debug("|{0}| >> Removing: {1}".format(_str_func, check)) mc.unknownPlugin(check, remove=1) else: l = d_rendererNodes.get(check.lower()) for n in l: if mc.objExists(n): log.debug("|{0}| >> matches: {1}".format(_str_func, n)) if clean: try: mc.delete(n) except Exception, err: log.debug("|{0}| >> Failed: {1} | {2}".format( _str_func, n, err)) """