I am working on exporting animations from the start frame to the end frame that the user can enter the input value. I use "cmds.playbackOptions( animationStartTime=startTime, animationEndTime = endTime)" to get my animation start and end time, but it only get the frame range in time slider. I still got all keyframes in my exported fbx files.
Does anyone know how to just export the frame range I want by Python?
I use this command below to export the animation fbx file:
cmds.file(fullName, force = True, options = "v = 0", type = "FBX export", preserveReferences = True, exportSelectedAnim = True)
Also, I entered start and end value in File/Export Selection to test if I could get the frame range I want, but it doesn't work. I still got all keyframes in exported fbx file, which is wired because I thought that option is for choosing the frame range.
Thank you!!!
Solved! Go to Solution.
Solved by rajasekaransurjen. Go to Solution.
Hi,
Try..... "FBXExportSplitAnimationIntoTakes".
refer
import maya.cmds as cmds
import maya.mel as mel
mel.eval("FBXExportSplitAnimationIntoTakes -clear;")
# Export Animation from frame 25 to 65
mel.eval('FBXExportSplitAnimationIntoTakes -v \"tata\" 25 65')
mel.eval('FBXExport -f "E:/_TEMP/myfile.fbx" -s')
Thank you very much for answering my question. But I got a new one related to this. Hope you could help me!
The keyframe range works well, but I am trying to bake animation, change the Up Axis to Z, disable Embed Media when exporting. Just like the setting in Game Exporter in Maya
I tried to use the code below, but they just didn't work.
Do you have any idea how to solve this? Are those the correct way? My code is like this:
mel.eval('FBXResetExport;') mel.eval('FBXExportBakeComplexAnimation -v true;') mel.eval('FBXExportEmbeddedTextures -v false;') mel.eval("FBXExportSplitAnimationIntoTakes -clear;") # Up Axis mel.eval("FBXExportUpAxis z;") # Export Animation from frame x to frame y mel.eval('FBXExportSplitAnimationIntoTakes -v \"tata\" %d %d'%(int(startTime), int(endTime)))
mel.eval('FBXExport -f "%s" -s'%(fullName ) )
I appreciate your help! Have been working on this for a long time.
Can't find what you're looking for? Ask the community or share your knowledge.