PDA

View Full Version : FBX Batch Import MEL


magilla
04-21-2009, 11:52 PM
Howdy all,

I'm trying to create a batch importer for maya to read in takes from an fbx file.

Has anyone got something similar that they would care to share before I reinvent the wheel?

=magilla

magilla
04-23-2009, 01:39 AM
Hacked from another script found here.

/////////////////////
string $directory = ("P:\/XXX\/3D\/Animation\/FBX" + "/");
string $outdirectory = "P:/\XXX\/3D\/Animation\/Mocap_USE_files";
$fbxfiles = `getFileList -folder $directory -filespec "*.fbx"`;
string $filelist[]=`getFileList -folder $directory -filespec "*.fbx"`;

for($f=0; $f<size($fbxfiles); $f++)
{
int $cnt = size($fbxfiles[$f]);
string $filenameroot = `substring $fbxfiles[$f] 1 ($cnt-11)`;
string $wholename=($directory + $fbxfiles[$f]);
FBXRead -f $wholename;
string $wholename=($directory + $fbxfiles[$f]);
FBXRead -f $wholename;
FBXImportMode -v exmerge;

file -f -options "v=0" -typ "mayaBinary" -o "P:/XXX/3D/Characters/Bind_USE.mb";
FBXImport -f $wholename -t 1;
print "imported";

$firstKey = `findKeyframe -which first B_pelvis`;
$lastKey = `findKeyframe -which last B_pelvis`;
playbackOptions - ast $firstKey -min $firstKey - aet $lastKey -max $lastKey;

setAttr "Bind.rotateY" 180;
setAttr "Bind.rotateX" -90;

string $fileout= ($outdirectory+ "/" + $filenameroot+".mb");
file -rename $fileout;
file -f -save -options "v=0" -type "mayaBinary";
warning ($filenameroot + " ****SAVED****" +"\n" +"\n");
}

print "************* DONE ****************";

/////////////////////

=magilla

CGTalk Moderation
04-23-2009, 01:39 AM
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.