MFileIO open

MFileIO open

Anonymous
Not applicable
813 Views
6 Replies
Message 1 of 7

MFileIO open

Anonymous
Not applicable

On Maya 2017 on macOS -- I have a .ma file which standalone Maya opens just fine, but if I try to open it in my custom exporter I get kFailure from MFileIO::open. How do I troubleshoot this problem? Note, other Maya files work just fine, and this one is super simple (it just has a polyPlane in it) yet it fails.

0 Likes
814 Views
6 Replies
Replies (6)
Message 2 of 7

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

I am afraid there is no way to troubleshot it directly. But MFileIO::open actually uses file command to open a file, so I suggest you test with file command.

 

BTW: It would be better to use force flag with MFileIO::open, because if the scene is not saved, it will fail.

 

Yours,

Li

 

0 Likes
Message 3 of 7

Anonymous
Not applicable
I am using "force". Plus, after much troubleshooting it turns out that from
FileIO::open I can't even open an empty .ma file, and of course in Maya if
I go File/Open it works fine. Could there be something in the .ma file
format itself that breaks it? Any help greatly appreciated.
0 Likes
Message 4 of 7

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

There shouldn't be any problem for .ma file.

 

If MFileIO couldn't work for you, please try to use MGlobal::executeCommand with file command, it is same as MFileIO.

 

Yours,

Li

0 Likes
Message 5 of 7

Anonymous
Not applicable

Thank you very much for your reply. Can you please post the exact script command I should pass to executeCommand?

0 Likes
Message 6 of 7

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

Should be 

 

file -open "filename.ma" - force;

 

You can find more details in this document.

 

Yours,

Li

0 Likes
Message 7 of 7

Anonymous
Not applicable

This almost worked, the correct command is:

 

file -open -force "filename.ma"

 

Anyway, perhaps this should be filed as a bug, MFileIO::open should work identical to the command.

 

Thanks!

Emil

 

 

 

0 Likes