MEL Script - Create Reference with -ignoreVersion



I need a little help please :sad:

First let me explain my problem. I need to create a reference on Maya 2009, however the reference that I want to use was saved on Maya 2010. After some research I checked that Maya 2009 and 2010 have a option in Open File, that you can ignore the version and therefore open a file saved on Maya 2009 even if we use Maya 2010.

Then I tried to do the same with the reference.

Adding these flags

-options "v=0"  -ignoreVersion


file -r -type "mayaBinary" -gl -loadReferenceDepth "all" -namespace "hello" "//BACKUP/Example/hello.mb";

I was able to create a reference of a file saved on Maya 2011 in Maya 2010.

But I have a lot references to do this, so I needed to create a simple UI interface or script to using this flag



global proc int importReference( string $filename, string $fileType )
    file -r -options "v=0" -ignoreVersion -type "mayaBinary" -gl -loadReferenceDepth "all" $filename;
    return 1;

fileBrowserDialog -m 0 -fc "importReference" -ft "mayaBinary" -an "Import_Refernce" -om "Reference";

But a I have a little problem :cry:

This script only works if I already have open a file. Let me explain, if I open Maya and then run this script, he don’t work, but if I open Maya and open a file and then for example create a New Scene and run the script he works.

Can anyone please give me a clue how can I overcome this situation?


I also tried to load it in userSetup.mel. Didn’t work. Any tip?


Another update: I also tried to set the workspace

string $workspace = `workspace -q -dir`;
string $myPath = "//Backup/Example";
workspace -dir $myPath;

global proc int importReference( string $filename, string $fileType )
file -r -options "v=0" -ignoreVersion -type "mayaBinary" -gl -loadReferenceDepth "all" $filename; return 1;

fileBrowserDialog -m 0 -fc "importReference" -ft "mayaBinary" -an "Import_Refernce" -om "Reference";

When I do this the correct project is open, but the error persists. :frowning:


Got it :thumbsup:


Hi everyone.

I finally finish this script very useful where I work. Basically, this script allows you to create a reference using a file which is a version higher than the one we are using. Tested on Maya 2010 and 2009.

On last thing. Its very important that in Open Scene click on the little box and check the option that says --> Ignore Version.


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.