1
2
3
4
5
6
7
8
9
10
11
12
13import os
14import re
15from pyfbsdk import FBFolderPopup, FBSystem, FBApplication, FBMessageBox, FBFbxOptions
16
17
21lScene = lSystem.Scene
22fbxList = []
23
24
25
26lFp.Caption = "Source Files: Select the folder containing the files you would like to export"
27
28
29lFp.Path = r"C:\Autodesk"
30
31
32lRes = lFp.Execute()
33
34
35if not lRes:
36 FBMessageBox(
"Warning:",
"Selection canceled, cannot continue!",
"OK" )
37
38else:
39 FBMessageBox(
"Selected Folder Path:",
"Selected folder:\n Path: '%s'" % lFp.Path,
"OK" )
40
41
42
43 fileList = os.listdir(lFp.Path)
44 print("fileList", fileList)
45
46 fbxRE = re.compile('^\w+.fbx$', re.I)
47
48
49 for fname in fileList:
50 mo = fbxRE.search(fname)
51 if mo:
52 fbxList.append(fname)
53
54 for fname in fbxList:
55
56
57 lApp.FileOpen(lFp.Path + "\\" + fname, False)
58
59
60
61
63 lOptions.SaveCharacter = False
64 lOptions.SaveControlSet = True
65 lOptions.SaveCharacterExtension = False
66 if len( lScene.Characters ) > 0:
67 lApp.SaveCharacterRigAndAnimation(lFp.Path + "\\Animation_" + fname, lScene.Characters[0], lOptions)
68
69
70 lApp.FileNew()
71
72del(lFp, FBFolderPopup, lSystem, FBSystem, lRes, lApp, FBApplication, lScene, fbxList, re, os, FBMessageBox, FBFbxOptions)
73
74
75
76
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Customize file loading and saving.
Definition: pyfbsdk_generated.h:7400
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18771
int FBMessageBox(str pBoxTitle, str pMessage, str pButton1Str, str pButton2Str=None, str pButton3Str=None, int pDefaultButton=0, int pScrolledMessage=0)
Dialog popup box.