-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfbxConverter.mel
59 lines (43 loc) · 2.44 KB
/
fbxConverter.mel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// How to use=:
// First load the model you want into Maya 2020
// Then update the $character == <<"CHARACTER NAME">> to be the name of the character you want to convert anims for
// Update the input path on $characterDirectory
// Run the script
string $characterDirectory = "Path to model";
string $characterList[] = `getFileList -folder $characterDirectory`;
print(size($characterList));
for( $j=0; $j<size($characterList); ++$j )
{
$character = $characterList[$j];
$characterMayaFile = $characterDirectory + "\\"+ $character + "\\"+ $character + ".ma";
string $directory = "D:\\SlippiIntegration\\Animation_Pack\\Textured_Models\\" + $character + "\\anims\\";
string $masterList[] = `getFileList -folder $directory -filespec "*.anim"`;
// UPDATE THE CHARACTER HERE
// *********************
if ($character == "Zelda"){
file -f -options "v=0;p=17;f=0" -ignoreVersion -typ "mayaAscii" -o $characterMayaFile;
print("\nProcessing: " + $character + "\n");
print(size($masterList));
$charAnimDir = "D:/Maya/" + $character;
sysFile -makeDir $charAnimDir;
$i = 0;
while($i<size($masterList))
{
$animationName = $masterList[$i];
$i = $i + 1;
print("<<<<<<<<Animation:::" + $animationName);
print($i);
file -f -options "v=0;p=17;f=0" -ignoreVersion -typ "mayaAscii" -o $characterMayaFile;
string $selected[] = `ls -type joint`;
select -r $selected;
$fileToImport = $directory + $animationName;
$baseAnimationName = basenameEx($animationName);
file -import -type "animImport" -ignoreVersion -ra true -mergeNamespacesOnClash false -namespace $baseAnimationName -options "targetTime=4;copies=1;option=replace;pictures=0;connect=0;" -pr -importTimeRange "combine" $fileToImport;
string $selected[] = `ls -type joint`;
select -r $selected;
$exportFileName = $charAnimDir + "/" + $baseAnimationName + ".fbx";
file -force -options "precision=8;intValue=17;nodeNames=1;verboseUnits=0;whichRange=1;range=0:10;options=curve;hierarchy=none;controlPoints=0;shapes=1;helpPictures=0;useChannelBox=0;copyKeyCmd=-animation objects -option curve -hierarchy none -controlPoints 0 -shape 1 " -typ "FBX export" -pr -es $exportFileName;
}
}
}
print("Finished");