After few hours of trying out different plugins, I came back to Axtended and decided to try and modify the script so that I can enable the Export All function instead of Export Selected function.
Thanks to Eva, my trusty sister/colleague working as a Python Developer, we managed to modify the script so that we can bypass the step of selecting the root_jnt, and straightaway Export All the assets into individual FBX files.
Here's the script that we modified, shown in red (basically just comment out the pre-requisite step of selecting a joint). Start from line 2355:
// Check if exporting as FBX
if(`optionVar -q axAnim_ExportAsFBX` == 1){
//if(size(`getAttr "AxtendedData.Selection"`) == 0){
//string $message = "No joints has been defined for export!\n\n";
//$message += "Either select the root joint (to automate selection) or all specific joints and then in File menu click [Set joints for export]. This is a one time setup.";
//confirmDialog -title "No joints defined" -message $message
//-button "OK"
//-defaultButton "OK";
//}
//else{
// Remember current values
//string $selection[] = `ls -sl`;
int $startFrame = `playbackOptions -q -minTime`;
int $endFrame = `playbackOptions -q -maxTime`;
// Setup exporter and store current values
FBXExportBakeComplexAnimation -v true;
FBXExportBakeComplexStep -v 1;
FBXProperty "Export|IncludeGrp|Animation" -v true;
string $file;
if ($folder != " ")
$file = $defaultDirectory[0] + $parentFolder + $folder + "/" + $sequenceName + ".fbx";
else
$file = $defaultDirectory[0] + $parentFolder + "/" + $sequenceName + ".fbx";
// Set start time
playbackOptions -e -minTime $startTime;
FBXExportBakeComplexStart -v $startTime;
// Set end time
if(`checkBox -q -v axAnim_FrameCheckbox` == 1) $endTime = $endTime - 1;
playbackOptions -e -maxTime $endTime;
FBXExportBakeComplexEnd -v $endTime;
// Start exporting
axtendedLog(("[FBX] Exporting animation [" + $sequenceName + "] to [" + $file + "]"));
select -r `getAttr "AxtendedData.Selection"`;
FBXExport -f $file;
// Reset timeline and selection to previous values
playbackOptions -e -minTime $startFrame;
playbackOptions -e -maxTime $endFrame;
//select -r $selection;
//}
}
Axtended is very easy to use, and you'll only need to do a few steps to get your plugin up and running and start batch exporting your animations.
1. Download Axtended mel script from http://www.creativecrash.com/maya/script/axtended-animation-manager-fbx-psa
2. Open the script using any text editor, then edit the script like above, starting from line 2355.
3. Save the script, then place the script in your Maya scripts folder.
4. Open up your animation file in Maya, then Window > General Editor > Script Editor.
5. Load the axtended.mel script from the Script Editor and then click Execute.
6. Copy and paste this script below in the MEL tab of your Script Editor and Save Script to Shelf.
axtended();7. Click on the new Shelf Item you just created and the Axtended GUI window will pop up.
8. Right-click on the Animation List area and click Add/Edit Animation.
9. Type in your animation name and its start and end frames, then click on Add to add the animation to your Animation List.
10. After you had finished adding in the animations, right-click on the Animation List area again and click Export List to File to export your animation list to a text file as a backup, just in case.
11. Before you start exporting, you need to Bake your animation. Go to Window > Hypergraph: Hierarchy and select everything inside the Hierarchy window. Then go to Edit > Keys > Bake Simulation.
12. After the baking is done, you can start batch exporting your animation. To export FBX files, make sure you TOGGLE FBX to ON by going to File > TOGGLE FBX in your Axtended window. To start batch exporting, right-click on the Animation List area and click on Export All Animations.
* Depending on your game asset preparation pipeline, you might want to delete the mesh before you start batch exporting. For our game, we only want the bones and controllers, so we delete the mesh for exporting animations.*
13. And you're done! Import all the animation files and your rig/t-pose file into Unity and you should be able to see it move :)
Thanks to Denny Lindberg for the Axtended script! It really helps our studio to save a lot of time and effort when we are preparing the animation FBX files, especially for characters that have A LOT of animations.
Thanks to Dustin Nelson for the Rapid Rig: Character Kit 0.0.2 too for the example rig shown in my screenshot above!
Links:
Axtended Animation Manager: http://www.creativecrash.com/maya/script/axtended-animation-manager-fbx-psa
Rapid Rig: Character Kit 0.0.2: http://www.creativecrash.com/maya/downloads/character-rigs/c/rapid-rig-character-kit


0 comments:
Post a Comment