Tuesday, March 22, 2011

MEL Script for export .mxs sequences with RF meshes involved

Using Maya, sometimes you can experience issues when try to export a .mxs sequence with any sort of RealFlow meshes embedded. Looks like there's not a fix for that in the short term as there are some problems in the Maya side that scramble the code of specific plugins creating unexpected errors (you may experience this when both RealFlow and Maxwell Render plugins are set to Autoload in the Plugin Manager) and get some odd obscure results in your renders.

If you try to export a .mxs sequence and get just a .ma file instead your .mxs files, you can usethis simple script (thanks to Next Limit's Angel Tena) to automatically enforce Maya do the job via MEL.

Note in this code we´re setting a range of 100 frames (from 1 to 100) with a framepadding = 4 and a path output as: C:/Users/Username/mxs/. Don't forget to customize your own scene length, framepadding and file path for export the .mxs files:

for ($i=1;$i<=100;$i++)
{
currentTime $i;
int $padding = 4;
string $frameString = $i;
string $filePath = "C:\\Users\\Username\\mxs\\frame_";
for($j = size($frameString); $j < $padding; $j++)
{
$frameString= ("0" + $frameString);
}
$filePath += $frameString;
print $filePath;
print "\n";
file -force -options
"useActiveCam=1;animation=0;protection=0;packngo=0;" -type
"MaxwellScene" -pr -ea $filePath;
};


You also can download the script here.

No comments: