Remove PlugIn requirement on lots of Maya files

Hi !

(This is my first post here, I hope this will meet your requirements)

I have a huge bunch of Maya file that require certains Plug-Ins that are no longer in use in the studio where I’m working.
The thing is that maya is trying to find these Plug-ins in MAYA_PLUG_IN_PATH and this is slowing the opening of the scene files.

The incriminated Plug-ins are these ones:

requires "mayall_maya70" "0.9.1(Beta)"; #I think to is a Maxwell Render-related plugin
requires "elastikSolver" "0.991"; 
requires "RenderMan_for_Maya" "3.0.1";

I made a quick script to compare the time taken to open a scene file with and without these three lines in the Maya ASCII file.

import time
start_time = time.time()
cmds.file(r"My\Scene\Path.ma", open=True)
print("--- %s seconds ---" % (time.time() - start_time))

Result WITH the three lines:

# File read in 11 seconds. # 
# Error: file: My\Scene\Path.ma line 84: Plug-in, "mayall_maya70", was not found on MAYA_PLUG_IN_PATH.
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# RuntimeError: Plug-in, "mayall_maya70", was not found on MAYA_PLUG_IN_PATH. # 
# Error: file: My\Scene\Path.ma line 85: Plug-in, "elastikSolver", was not found on MAYA_PLUG_IN_PATH.
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# RuntimeError: Plug-in, "elastikSolver", was not found on MAYA_PLUG_IN_PATH. # 
# Error: file: My\Scene\Path.ma line 86: Plug-in, "RenderMan_for_Maya", was not found on MAYA_PLUG_IN_PATH.
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
# RuntimeError: Plug-in, "RenderMan_for_Maya", was not found on MAYA_PLUG_IN_PATH. # 
--- 11.6500000954 seconds ---

Result WITHOUT the three lines:

# File read in 0 seconds. # 
--- 0.361000061035 seconds ---

I would like to get rid of this error, IMO 11seconds + 11seconds + 11seconds … = A lot of time saved.
My main concern is the fact that I don’t know how many files are corrupted with these three lines. We also have quite a lot of Maya files on the network (approx 99% are ASCII files) and our actives projects are worth 6Tb of data. We also are stuck with maya 2014, so the solution posted on this thread is not worth considering.

What would you recommend me to do?
Is it safe to parse and remove these three lines in all the scenes?

Sincerely,
DrHaze

you have two options, depending on which version of maya you are using. in 2016, there is a new command to remove unknown plugins from a file.

http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/unknownPlugin.html

if you are using an earlier version of maya, and your files are in ASCII format, then you can open each file in python, omit the offending lines, and write the file back out. if your files are in binary format, there is nothing you can do.

1 Like

I think you can also just search for unknown nodes this way if you don’t have a newer version of Maya:

for node in cmds.ls():
    if cmds.nodeType(node).lower() == 'unknown':
        cmds.delete(node)

[QUOTE=Twiggy;29642]I think you can also just search for unknown nodes this way if you don’t have a newer version of Maya:

for node in cmds.ls():
    if cmds.nodeType(node).lower() == 'unknown':
        cmds.delete(node)

[/QUOTE]

That will remove the offending nodes, but the “requires” line will still be present. As rbert said, if they are binary, you have to save them as ascii, remove the lines and save them back as binary.

Also, it won’t remove plugin defined datatypes (unless this has been fixed?). I bumped into this trying to clean up files that were convinced they needed mental ray loaded.

if the maya file is binary and has dependancies on plugins which no longer exist, maya will not let you save them as ascii. it sucks.

and this, kids, is why we always save in .ma. drive space is IT’s problem :slight_smile:

As I said, most of our files are saved in ASCII file format :slight_smile: You’re right, drive space id IT’s problem.

I’m writing a script that will remove these “require” lines.
I’ll post it here once finished.

Thank you guys for your feedback.

in my script to remove plugins i only scan the first 30 lines of the ASCII file. You will rarely find “requires” statements past that.

in my script to remove plugins i only scan the first 30 lines of the ASCII file. You will rarely find “requires” statements past that.

I so wish this was true.

More and more often we’ve been receiving Maya files (both .ma and .mb) with 300+ require statements in the file. I think 367 was the record. With even require statements for plug-ins for maya 8.0. I really wonder how these files are produced that this insane mess ends up in those files. I’ve seen this in files coming from major animation studios and also from individual freelancers.

I wish it were trivial to remove the require statements even without opening because these files are really slow to open. Or a way to open the file yet ignore the require statements completely.

Usual instant cleanup on our end - but still wonder how this happened.

Missing Maya plug-in requirements really do spread like a virus. It’s nice having functions now that can clean scenes up after the fact, but I think a lot more could be done to address the root of the problem. Preferably plug-in dependencies would be stored at the node level.