Message 1 of 3
Save Character Animation from python.
Not applicable
06-01-2015
12:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to batch the "Save character Animation" menu action from python.
My Script is opening a list of files one after another and saving the character animation into a file.
I am using
FBApplication().SaveCharacterRigAndAnimation(animPath, character, lFbxSaveOptions)
to save the animation. However, for some files, animation is not saving at all.
If I try to save animation from the file manually, it worked!
My code is something like below:
for process in animFile:
#Open animation file
lFbxOptions = FBFbxOptions(False)
FBApplication().FileOpen(process,False,lFbxOptions)
lFbxSaveOptions = FBFbxOptions(False)
lFbxSaveOptions.EmbedMedia = False
lFbxSaveOptions.SaveCharacter = True
lFbxSaveOptions.SaveControlSet = True
lFbxSaveOptions.SaveCharacterExtension = True
lFbxSaveOptions.FileFormatAndVersion =
FBFileFormatAndVersion.kFBFBX2011
CharCounter = 0
for character in FBSystem().Scene.Characters:
CharCounter = CharCounter + 1
postFix = "_a_" + str(CharCounter) + ".fbx"
animPath = intermediate + os.path.basename(process)
animPath = animPath.replace(".fbx", postFix)
FBApplication().SaveCharacterRigAndAnimation
(animPath, character, lFbxSaveOptions)
Can anyone give me any idea, what is the correct way to do it?