13 from pyfbsdk_additions
import *
23 def BrowseCallback(control, event):
27 lFp.Caption =
"Select the shot track definition file:"
28 lFp.Style = FBFilePopupStyle.kFBFilePopupOpen
30 if os.path.isdir(os.path.splitext(traceback.extract_stack()[-1][0])[0]):
31 lFp.Path = os.path.normpath(os.path.splitext(traceback.extract_stack()[-1][0])[0])
33 lFp.Path = os.path.normpath(os.path.dirname(traceback.extract_stack()[-1][0]))
38 eButt.Text = os.path.join(lFp.Path,lFp.FileName)
40 def SetupCallback(control, event):
42 f=open(os.path.join(lFp.Path,lFp.FileName),
'r') #Open Shot Track Definition File
43 shotInfoFile = f.readlines()
46 shotCnt = len(shotInfoFile)
48 for shotInfo
in shotInfoFile:
50 shots = shotInfo.split()
51 (shotName,shotStart,shotEnd) = shots
52 iShotStart = int(shotStart)
53 iShotEnd = int(shotEnd)
54 if shotInfoFile[0] == shotInfo:
55 completeShotStart = iShotStart
57 if shotInfoFile[shotCnt - 1] == shotInfo:
58 completeShotEnd = iShotEnd
61 lCam = FBCamera (shotName)
64 lNull = FBModelNull (shotName +
"_INT")
69 lTrackContainer =
FBStory().RootEditFolder.Tracks
72 for Track
in lTrackContainer:
73 if Track.Label ==
"Shot Track":
75 clipStart =
FBTime(0,0,0,iShotStart)
77 lClip = FBStoryClip (lCam, lTrack, clipStart)
78 lClip.Start =
FBTime(0,0,0,iShotStart)
79 lClip.Stop =
FBTime(0,0,0,iShotEnd)
80 if lastTrack<iShotEnd: lastTrack=iShotEnd
83 if backPlate.State == 1:
85 vidPath = os.path.join(lFp.Path,
"shot0"+str(counter)+
".avi")
87 vidPath = os.path.normpath(lFp.Path+
"shot" + str(counter) +
".avi")
92 lCam.BackGroundTexture = lTex
100 lPlayer.LoopStart =
FBTime(0,0,0,completeShotStart)
101 lPlayer.ZoomWindowStart =
FBTime(0,0,0,completeShotStart)
102 lPlayer.LoopStop =
FBTime(0,0,0,completeShotEnd)
103 lPlayer.ZoomWindowStop =
FBTime(0,0,0,completeShotEnd)
109 lModel.Translation =
FBVector3d(-10000, 145, 300)
115 lModel.Translation =
FBVector3d(-5000, 145, 300)
127 lModel.Translation =
FBVector3d(5000, 145, 300)
133 lModel.Translation =
FBVector3d(10000, 145, 300)
140 for lCam
in lCameras:
141 if lCam.Name ==
"Producer Perspective":
142 lCam.FarPlaneDistance = 40000
147 FBMessageBox(
"Cannot Continue",
"Unable to read the shot track definition file you selected or you have not selected one.",
"OK",
None,
None )
150 def PopulateLayout(mainLyt):
153 l.Caption =
"Select the shot track definition file to use:"
154 l.Style = FBTextStyle.kFBTextStyleBold
162 mainLyt.AddRegion(
"lab",
"lab", x, y, w, h)
163 mainLyt.SetControl(
"lab",l)
175 mainLyt.AddRegion(
"path",
"path", x2, y2, w2, h2)
176 mainLyt.SetControl(
"path",e)
180 b2.Caption =
"Browse..."
181 b2.Justify = FBTextJustify.kFBTextJustifyCenter
188 mainLyt.AddRegion(
"but",
"but", x3, y3, w3, h3)
189 mainLyt.SetControl(
"but",b2)
193 b2.OnClick.Add(BrowseCallback)
197 cb.Style = FBButtonStyle.kFBCheckbox
198 cb.Caption =
"Add backplates to each shot"
205 mainLyt.AddRegion(
"backp",
"backp",x4,y4,w4,h4)
206 mainLyt.SetControl(
"backp",cb)
213 b3.Caption =
"Setup Shots"
214 b3.Justify = FBTextJustify.kFBTextJustifyCenter
221 mainLyt.AddRegion(
"shots",
"shots", x5, y5, w5, h5)
222 mainLyt.SetControl(
"shots",b3)
223 b3.OnClick.Add(SetupCallback)