Пример #1
0
def CleanUpMod(asset):
    pm.select(asset)
    mel.eval('SelectHierarchy;')
    for i in pm.ls(sl=1, type='mesh'):
        for j in pm.listConnections(i, c=1, p=1, s=1):
            try:
                pm.disconnectAttr(j[0], j[1])
            except:
                pass
            try:
                pm.disconnectAttr(j[1], j[0])
            except:
                pass
    for i in pm.ls(sl=1, type='transform'):
        mel.eval('CenterPivot')
    pm.hyperShade(assign='initialParticleSE')

    unknown_plugins = pm.unknownPlugin(q=True, list=True)
    if unknown_plugins:
        for p in unknown_plugins:
            try:
                pm.unknownPlugin(p, r=True)
                print 'remove', p
            except:
                pass
    print 'Clean Done'
Пример #2
0
 def removeUnknownPlugin(self):
     unPlugin = pm.unknownPlugin(q=True, l=True)
     if unPlugin:
         for i in unPlugin:
             try:
                 pm.unknownPlugin(i, remove=True)
             except:
                 pass
Пример #3
0
def deleteUnknowPlugin():
    oldplugins = pm.unknownPlugin(q=True, list=True)
    if oldplugins:
        log.info('Found {} unknown plugins'.format(len(oldplugins)))
        for plugin in oldplugins:
            try:
                pm.unknownPlugin(plugin, remove=True)
                log.info('%s removed succesfully' % plugin)
            except:
                log.info('Cannot remove %s' % plugin)
Пример #4
0
def unused_plugins(dialog=False):
    plugins = pm.unknownPlugin(query=True, list=True)
    if plugins:
        for un in plugins:
            try:
                pm.unknownPlugin(un, remove=True)
            except:
                pass
    if dialog:
        infobox('사용하지 않는 플러그인을 모두 제거하였습니다.')
def OnCleanUp(args):
    CleanUpMod()
    unknown_plugins = pm.unknownPlugin(q=True, list=True)
    if unknown_plugins:
        for p in unknown_plugins:
            try:
                pm.unknownPlugin(p, r=True)
                print 'remove', p
            except:
                pass
    op.setEnable(True)
    save_path.setEnable(True)
def delete_unknown():

    unknown = pm.ls(type='unknown')
    plugs = pm.unknownPlugin(q=True, l=True)

    if len(unknown) > 0:
        pm.lockNode(unknown, l=False)
        pm.delete(unknown)

    if plugs is not None:
        for p in plugs:
            pm.unknownPlugin(p, r=True)
Пример #7
0
def deleteUnknowPlugin():
    oldplugins = pm.unknownPlugin(q=True, list=True)
    if oldplugins:
        for plugin in oldplugins:
            print plugin
            try:
                pm.unknownPlugin(plugin, remove=True)
                print '%s removed succesfully' % plugin
            except:
                print 'Cannot remove %s' % plugin
    try:
        pm.delete("*BaseAnimation*")
    except:
        pass
    pm.unloadPlugin('Turtle')
Пример #8
0
def clean_unknown_plugins():
    """Remove all unknown plugins expect nodes that exist in scene.
    http://mayastation.typepad.com/maya-station/2015/04/how-to-prevent-maya-writing-a-requires-command-for-a-plug-in.html
    Some unknown plugins may needed in another environment.
    example: Vray plugin will not available to animator but will available to lighting artist.
    """
    unknown_nodes = set()
    for unknown_node in pm.ls(type=["unknown", "unknownDag"], editable=True):
        unknown_nodes.add(pm.unknownNode(unknown_node, q=True, plugin=True))

    for unknown_plugin in pm.unknownPlugin(query=True, list=True) or []:
        if unknown_plugin in unknown_nodes:
            pass
        else:
            try:
                pm.unknownPlugin(unknown_plugin, remove=True)
            except Exception as err:
                print(err)
Пример #9
0
def clean_unknown_node():
    """
    清理场景中的未知节点

    :return:
    """
    unknown_plugin_list = pm.unknownPlugin(query=True, list=True)
    if unknown_plugin_list:
        print(u"unknownPlugin个数为%s" % len(unknown_plugin_list))
        for plugin_name in unknown_plugin_list:
            try:
                pm.unknownPlugin(plugin_name, remove=True)
            except:
                # print e
                print(plugin_name, u"无法清理")
                # pass
        print(u"清理完成!")
    else:
        print(u"unknownPlugin个数为0,不需要清理")
Пример #10
0
def CleanShadingDelivery():
    """CheckSceneMaya"""
    """
    Clean Maya File
    Maya Plugins
    """
    import pymel.core as pm

    Delete = pm.delete(pm.ls(type="unknown"))

    plugins_list = pm.unknownPlugin(q=True, l=True)

    if plugins_list <= 0:

        print 'CleanScene'

    else:

        try:
            for plugin in plugins_list:
                print '---Delete Nodes---> ', (plugin)
                print ''
                pm.unknownPlugin(plugin, r=True)
        except:

            pass

        try:
            [
                pm.lockNode('TurtleDefaultBakeLayer', lock=False)
                for node in pm.ls()
            ]

            pm.delete('TurtleDefaultBakeLayer')

        except:
            pass

    pm.inViewMessage(msg='<hl>CleanScene</hl>.', pos='midCenter', fade=True)
Пример #11
0
def removeUnknownPlugings():
    plugins = pym.unknownPlugin(q=True, list=True) or []
    for plug in plugins:
        print "Deleting: {0}".format(plug)
        pym.unknownPlugin(plug, remove=True)