Tasks/SaveOneTakePerFile.py
9 from pyfbsdk
import FBSystem, FBApplication, FBFilePopup, FBFilePopupStyle, FBFbxOptions
14 d, filename = os.path.split(f)
16 return os.path.splitext(filename)[0]
23 lFileName = lApplication.FBXFileName
26 FileDlg.Style = FBFilePopupStyle.kFBFilePopupSave
27 FileDlg.Caption =
"The current filename is not valid."
28 FileDlg.FileName =
"Untitled.fbx"
31 lFileName = FileDlg.FileName
37 if lFileName.upper().endswith(
'.FBX' ):
39 lOriginalTake = lSystem.CurrentTake
42 for lTake
in lSystem.Scene.Takes:
45 lSystem.CurrentTake = lTake
49 lTakeFileName =
"%s-%s.fbx" % ( getFileName(lFileName), lTake.Name )
52 print "Saving Take '%s' to file '%s'" % ( lTake.Name, lTakeFileName )
55 lOptions.UseASCIIFormat =
True
60 for index
in range(lOptions.GetTakeCount()):
61 if lOptions.GetTakeName(index) == lTake.Name:
62 lOptions.SetTakeSelect(index,
True)
64 lOptions.SetTakeSelect(index,
False)
65 lApplication.FileSave( lTakeFileName, lOptions )
69 lSystem.CurrentTake = lOriginalTake
71 del( lOriginalTake, lOptions )
75 print 'File name does not end with ".fbx". Unable to proceed!'
79 del( lSystem, lApplication, lFileName )
82 del( FBSystem, FBApplication )