1
2
3
4
5
6
7
8
9from pyfbsdk import FBMessageBox, FBApplication, FBVideoGrabber, FBVideoRenderDepth, FBVideoRenderDepth, FBVideoCodecManager, FBVideoCodecMode, FBAudioFmt_AppendFormat
10import sys, os
11from os import environ, listdir
12
13
14try:
15
16
17 lRenderSrcFolder = None
18 if 'RENDER_SRC_FOLDER' in environ:
19 lRenderSrcFolder = environ['RENDER_SRC_FOLDER']
20 else:
21
22
23 FBMessageBox(
"ERROR",
"The environment variable 'RENDER_SRC_FOLDER' is not defined... Cannot proceed.",
"OK",
None,
None )
25
26
27
28 lRenderDstFolder = None
29 if 'RENDER_DST_FOLDER' in environ:
30 lRenderDstFolder = environ['RENDER_DST_FOLDER']
31 else:
32
33
34 FBMessageBox(
"ERROR",
"The environment variable 'RENDER_DST_FOLDER' is not defined... Cannot proceed",
"OK",
None,
None )
36
37
38 lRenderFileFormat = None
39 if 'RENDER_FILE_FORMAT' in environ:
40 lRenderFileFormat = environ['RENDER_FILE_FORMAT']
41 else:
42
43
44 FBMessageBox(
"ERROR",
"The environment variable 'RENDER_FILE_FORMAT' is not defined... Cannot proceed",
"OK",
None,
None )
46
47
48 if lRenderSrcFolder and lRenderDstFolder and lRenderFileFormat:
49
50
51
52 listdir( lRenderDstFolder )
53
54
55 lFileList = listdir( lRenderSrcFolder )
56
57
58 lFileList.sort()
59
60
61 for lFileName in lFileList:
62
63
64 if lFileName.endswith('.fbx'):
65
66
68
69
70 lSrcFileName = os.path.join(lRenderSrcFolder, lFileName)
71
72
73 lDstFileName = os.path.join(lRenderDstFolder, lFileName.replace( 'fbx', lRenderFileFormat ))
74
75
76 lApp.FileOpen( lSrcFileName )
77
78
80
81
83 VideoManager.VideoCodecMode = FBVideoCodecMode.FBVideoCodecUncompressed
84
85
86 lOptions.OutputFileName = lDstFileName
87
88
89 lOptions.RenderAudio = True
91
92
93 if lRenderFileFormat == '.mov' and os.name != 'nt':
94 lOptions.BitsPerPixel = FBVideoRenderDepth.FBVideoRender32Bits
95
96
97 lApp.FileRender( lOptions )
98
99
100 lApp.FileNew()
101
102except Exception as e:
103
104 FBMessageBox(
"ERROR",
"Unknown error encountered. Aborting! " +
str(e),
"OK",
None,
None )
105
106
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Video Codec manager class.
Definition: pyfbsdk_generated.h:20805
Video Grabber class.
Definition: pyfbsdk_generated.h:20875
Python built-in string class.
Definition: pyfbsdk.h:77
FBAudioFmt FBAudioFmt_AppendFormat(FBAudioFmt pFormat, int pChannels, int pBits, int pRate)
Append the rendering audio format using the specified settings.
int FBMessageBox(str pBoxTitle, str pMessage, str pButton1Str, str pButton2Str=None, str pButton3Str=None, int pDefaultButton=0, int pScrolledMessage=0)
Dialog popup box.