Esempio n. 1
0
def remove_unused_plugins():
    """Remove unused plugin from scene

    This will prevent Maya from saving redundant requires into scene file.

    (Copied from Maya support page)
    Maya is not cleaning up requires statements for unused plugins:

    Issue:
        When a plugin is used in Maya 2016, it puts a 'requires' statement
        into the header of the Maya File, akin to: requires "XZY" "1.30"
        When the plugin is subsequently deleted out of the Maya file and
        the Maya file is saved, the requires statement is left in the file.

    Causes:
        It creates extra lines of garbage code which makes the file larger
        and more clutter when files are being diagnosed

    Solution:
        Autodesk introduced one new command unknownPlugin which could be used
        to remove the "requires" line from the file if the plug-in is unknown
        to Maya 2016.

    """
    for plugin in cmds.unknownPlugin(query=True, list=True) or []:
        cmds.unknownPlugin(plugin, remove=True)
Esempio n. 2
0
def J_deleteUnknownNode():
    cmds.delete(cmds.ls(type="unknown"))
    cmds.delete(cmds.ls(type="unknownDag"))
    if not cmds.unknownPlugin(q=True, l=True) == None:
        for item in cmds.unknownPlugin(q=True, l=True):
            print item
            cmds.unknownPlugin(item, r=True)
Esempio n. 3
0
def cleanUp(look):
    allPanels = cmds.getPanel(type='modelPanel')
    for p in allPanels:
        cmds.modelEditor(p, edit=True, displayAppearance=look)

    for up in cmds.unknownPlugin(q=True, list=True) or list():
        cmds.unknownPlugin(up, remove=True)
Esempio n. 4
0
 def removeUnknownPlugin():
     plugins = cmds.unknownPlugin(q=1, list=1)
     if not plugins: plugins = []
     for plugin in plugins:
         try:
             cmds.unknownPlugin(plugin, remove=1)
         except:
             pass
Esempio n. 5
0
 def auto_solve(self):
     unknown_plugins = self.get_unknown_plugins()
     for plugin in unknown_plugins:
         try:
             mc.unknownPlugin(plugin, remove=True)
         except:
             pass
     self.pass_check("unknown plugins has been deleted.")
Esempio n. 6
0
def deleteUnknownPlugins():
    """Delete all and unknown plugins referenced and their related nodes
    Maya 2015 SP6 and up only!
    """
    unknownPlugins = cmds.unknownPlugin(query=True, list=True) or []
    for plugin in unknownPlugins:
        deleteUnknownPluginNodes(plugin)
        cmds.unknownPlugin(plugin, remove=True)
        logger.debug('Removed the plugin: {0}'.format(plugin))
Esempio n. 7
0
def deleteUnknownPlugins():
    """Delete all and unknown plugins referenced and their related nodes
    Maya 2015 SP6 and up only!
    """
    unknownPlugins = cmds.unknownPlugin(query=True, list=True) or []
    for plugin in unknownPlugins:
        deleteUnknownPluginNodes(plugin)
        cmds.unknownPlugin(plugin, remove=True)
        logger.debug('Removed the plugin: {0}'.format(plugin))
Esempio n. 8
0
def remove_unknown_plugins():
    for node in mc.ls(type='unknown'):
        mc.lockNode(node, lock=False)
        print('Deleting unknown node "%s"' % node)
        mc.delete(node)

    for plugin in mc.unknownPlugin(query=True, list=True):
        print('Removing unknown plugin "%s"' % plugin)
        mc.unknownPlugin(plugin, remove=True)
Esempio n. 9
0
def SCENE_remove_unknown_plugins():
    ''' removes missing plugins from ma file '''
    if cmds.unknownPlugin(query=1, list=1):
        for plug in cmds.unknownPlugin(query=1, list=1):
            try:
                cmds.unknownPlugin(plug, remove=1)
            except RuntimeError as e:
                return 'Error Removing {}'.format(plug) + '\n' + str(e), 0
    return 'Unknown Plugins removed', 1
Esempio n. 10
0
def delete_unknown_plugins():
    """
    Delete all the unknown plugins present in the scene file
    :return:
    """
    plugins_list = cmds.unknownPlugin(q=True, l=True)
    if plugins_list:
        for plugin in plugins_list:
            print(plugin)
            cmds.unknownPlugin(plugin, r=True)
Esempio n. 11
0
def remove_plugins(): 
    unknownPlugins = mc.unknownPlugin(q=True, list=True)

    if unknownPlugins: 
        for unknownPlugin in unknownPlugins: 
            mc.unknownPlugin(unknownPlugin, remove=True)

        logger.info('Remove %s unknownPlugins' % len(unknownPlugins))
        return 
    logger.info('No unknownPlugins')
Esempio n. 12
0
def unknown_plugins():
    """ clear unknown plugins
    """
    oldplugins = cmds.unknownPlugin(q=True, list=True)
    if not oldplugins:
        return
    for plugin in oldplugins:
        try:
            cmds.unknownPlugin(plugin, remove=True)
        except:
            pass
Esempio n. 13
0
def del_unknown_plugins():
    """Delete Unknown Plugins"""
    unknown_plugins = cmds.unknownPlugin(q=True, list=True)
    print "Unknown Plugins Found :", unknown_plugins
    deleted_plugs = []
    if unknown_plugins:
        for plugin in unknown_plugins:
            try:
                cmds.unknownPlugin(plugin, remove=True)
                deleted_plugs.append(plugin)
            except Exception, e:
                print '\nEXCEPTION occured:', e
                continue
Esempio n. 14
0
def remove_unknown_plugins():
    '''Danger...Forcefully removes all unknown plugins from your scene'''

    from maya import cmds

    unknown_plugins = cmds.unknownPlugin(query=True, list=True)
    if not unknown_plugins:
        _log.debug('No unknown plugins found.')
        return

    for plugin in unknown_plugins:
        _log.debug('Removing unknown plugin %s.' % plugin)
        remove_plugin_nodes(plugin)
        remove_unknown_plugin_nodes(plugin)
        cmds.unknownPlugin(plugin, remove=True)
Esempio n. 15
0
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))
        """
Esempio n. 16
0
def removeUnknownPlugin():
    try:
        oldPlugins = mc.unknownPlugin(q=True, list=True)
        removes = []
        if oldPlugins:
            for plugin in oldPlugins:
                mc.unknownPlugin(plugin, remove=True)
                removes.append(plugin)

        if not removes:
            logger.info('Remove 0 plugin')

        if removes:
            logger.info('Remove %s plugins' % len(removes))
            logger.debug(removes)

            return removes

    except Exception as e:
        logger.debug(e)
Esempio n. 17
0
    def ui_details(self):
        self.setObjectName("UnloadPlugin_Window")
        self.setWindowTitle(u'插件卸载器')
        self.loadedPlugin_L.setText(u"已加载插件")
        self.unknownPlugin_L.setText(u"未知插件")
        self.renderPlugin_L.setText(u'渲染插件')
        self.loadedPlugin_PB.setText(u'全选')
        self.unknownPlugin_PB.setText(u'')
        self.renderPlugin_PB.setText(u'全选')
        self.run_B.setText(u'卸载')
        self.cancel_B.setText(u'取消')

        allPluginList = mc.pluginInfo(q=True, ls=True)
        self.loadedPluginList = self.pluginFilter.getRulesList(allPluginList)
        self.renderPluginList = self.pluginFilter.getRenderPlugin(
            allPluginList)
        self.unknownPluginList = mc.unknownPlugin(q=True, l=True)
        #if not self.unknownPluginList:
        #    self.unknownPluginList = []

        self.loadedPlugin_LW.itemClicked.connect(self.itemClicked)
        self.unknownPlugin_LW.itemClicked.connect(self.itemClicked)
        self.renderPlugin_LW.itemClicked.connect(self.itemClicked)

        otherList = list(
            set(self.loadedPluginList) - set(self.noUsePluginName))
        self.loadedPlugin_PB.clicked.connect(lambda: self.selectAllItem(
            self.loadedPlugin_LW, self.loadedPlugin_PB, otherList))
        #self.unknownPlugin_PB.clicked.connect(lambda:self.selectAllItem(self.unknownPlugin_LW, self.unknownPlugin_PB, self.unknownPluginList))
        self.renderPlugin_PB.clicked.connect(lambda: self.selectAllItem(
            self.renderPlugin_LW, self.renderPlugin_PB, self.renderPluginList))

        self.run_B.clicked.connect(self.run_Button)
        self.cancel_B.clicked.connect(self.close)

        self.loadedPlugin_Item()
        self.unknownPlugin_Item()
        self.renderPlugin_Item()
Esempio n. 18
0
def get_unknown_plugin():
    return mc.unknownPlugin(q=True, l=True)
Esempio n. 19
0
# © 2020 AnD CGI This work is licensed under a Creative Commons
# Attribution-ShareAlike 4.0 International License.
'''Clean Unknown Plugins
This Script Will Delete Any Unknown Plugins From Maya Scene
The List of Deleted Plugins Can Be Seen On Maya Script Editor
'''
import maya.cmds as cmds
cmds.delete(cmds.ls(type="unknown"))
plg_ls = cmds.unknownPlugin(q=True, l=True)
if plg_ls:
    for plugin in plg_ls:
        print(plugin)
        cmds.unknownPlugin(plugin, r=True)
'''
A Pre-maya 6.5 File That Contains References Is Converted To A Later Version
Maya File, A Reference Node Named "_unknown_ref_node_" May Be Created And/or
A Special "_unknown_ref_node_" Entry May Be Added To Existing Reference Nodes.
This Node Type Was Used To Store Any Edits That Were Made Prior To 6.5
Until Those Edits Could Be Applied.
Once All References In The Scene Have Been Loaded, All Edits Should Be Applied
And The _unknown_ref_node_ Areas And Nodes Should Disappear. If There Are Any
Edits Which Can Not Be Applied (for Example, Nodes In The Original Reference
File That Were Renamed Or Deleted), The _unknown_ref_node_ Will Remain In The
File.
If You Need To Remove These Reference Nodes, You Can Do So By Querying For
The _unknown_ref_node_ And Deleting It. That Is, This Specific Node Type
Cannot Be Deleted Using The Reference Editor.
'''
# Use The Bottom Line Only If You Have "_UNKNOWN_REF_NODE_"
cmds.delete("_UNKNOWN_REF_NODE_")
Esempio n. 20
0
"""
Clean Maya File
How to delete old unwanted Missing Maya Plug ins?
"""
import maya.cmds as cmds

# delete unknown nodes
cmds.delete(cmds.ls(type="unknown"))

# delete unknown plugins
plugins_list = cmds.unknownPlugin(q=True, l=True)
if plugins_list:
    for plugin in plugins_list:
        print(plugin)
        cmds.unknownPlugin(plugin, r=True)
Esempio n. 21
0
 def unknown_remove(self):
     if self.__pluginName:
         mc.unknownPlugin(self.__pluginName, r=True)
Esempio n. 22
0
def k_check_unPlugin():
    k_unknownPlugins = unknownPlugin(q=1, l=1)
    if k_unknownPlugins != None:
        for k_unknownPlugin in k_unknownPlugins:
            unknownPlugin(k_unknownPlugin, r=1)
    return k_unknownPlugins
Esempio n. 23
0
from maya import cmds
plugins = cmds.unknownPlugin(q=1, list=1)
if not plugins: plugins = []
for plugin in plugins:
    cmds.unknownPlugin(plugin, remove=1)
Esempio n. 24
0
targets = pymel.core.ls( type='nodeGraphEditorInfo' )
pymel.core.delete( targets )

from maya import mel
mel.eval( 'hyperShadePanelMenuCommand("hyperShadePanel1", "deleteUnusedNodes");' )

import pymel.core
nsList = pymel.core.namespaceInfo( lon=1 )

for ns in nsList:
    nodes = pymel.core.ls( ns + ':*' )
    if not len( nodes ): continue
    for node in nodes:
        node.rename( node.replace( ns + ':', '' ) )
    pymel.core.namespace( rm=ns )

sels = pymel.core.ls( 'Ctl_*', type='transform' )

for sel in sels:
    if not sel.getShape(): continue
    sgCmds.lockParent( sel )
    sgCmds.renameShape( sel )
    if not sel.getParent().nodeName()[:3] == 'Ctl':
        sgCmds.renameParent( sel )

from maya import cmds
plugins = cmds.unknownPlugin( q=1, list=1 )
if not plugins: plugins = []
for plugin in plugins:
    cmds.unknownPlugin( plugin, remove=1 )
Esempio n. 25
0
# Data-Centric rigging 2020 Sample Data
# www.studioanima.co.jp

from pprint import pprint

import maya.cmds as mc

unknownPlugins = mc.unknownPlugin(q=True, list=True) or []
for pl in unknownPlugins:
    # force removal of plugins
    mc.unknownPlugin(pl, remove=True)

print "The following unknown plugins removed!"
pprint(unknownPlugins)
Esempio n. 26
0
    def cmd(self):
        for up in cmds.unknownPlugin(q=True, list=True) or list():
            cmds.unknownPlugin(up, remove=True)

        self.cont = u'清理完成。'
        return 1