Samples/HUD/BloopSlate.py

Samples/HUD/BloopSlate.py
1 # Copyright 2009 Autodesk, Inc. All rights reserved.
2 # Use of this software is subject to the terms of the Autodesk license agreement
3 # provided at the time of installation or download, or which otherwise accompanies
4 # this software in either electronic or hard copy form.
5 # ...
6 # This scipt is to demonstrate/test the usage of the bloop slate.
7 # The script starts recording, displays a bloop slate after 30 frames, that remains onscreen
8 # for 15 frames.
9 # ...
10 #
11 # Topic: FBPlayerControl, FBHUD, FBStory, FBStoryTrack
12 #
13 
14 # for directory access
15 import os
16 from pyfbsdk import *
17 
18 FBApplication().FileNew()
19 
20 lHud = FBHUD("MyHUD 1")
21 lHud.Visibility = True
22 FBSystem().Scene.ConnectSrc(lHud) # Connect the HUD to the scene
23 FBSystem().Scene.Cameras[0].ConnectSrc(lHud) # Connect to Perspective camera
24 
25 lBloopSlate = lHud.CreateElement(FBHUD.eBloopSlate, "Bloop Slate")
26 lBloopSlate.ShowAfterDelayOnRecordPlay = FBTime(0,0,0,30)
27 lBloopSlate.ShowDuration = FBTime(0,0,0,15)
28 #lBloopSlate.ForegroundColor = FBColorAndAlpha(0.0, 0.0, 1.0, 1.0)
29 #lBloopSlate.BackgroundColor = FBColorAndAlpha(1.0, 0.0, 0.0, 1.0)
30 
31 gPlayer = FBPlayerControl()
32 gIdleEvent = FBSystem().OnUIIdle
33 
34 G_RECORDING_DURATION = 3
35 
36 gFrame = 0
37 
38 def DoRecord():
39  gPlayer.Record(True, True)
40  gPlayer.Play()
41  gIdleEvent.Add( OnIdleEvent )
42 
43 def OnIdleEvent( pControl, pEvent ):
44  if FBSystem().LocalTime.GetSecondDouble() >= G_RECORDING_DURATION:
45  gPlayer.Record(False, False)
46  gPlayer.Stop()
47  gIdleEvent.Remove( OnIdleEvent )
48 
49 
50 
51 lStory = FBStory()
52 
53 lCube = FBModelCube("Cube")
54 lCube.Show = True
55 
56 lTrack = FBStoryTrack(FBStoryTrackType.kFBStoryTrackAnimation, lStory.RootFolder)
57 
58 lTrack.ChangeDetailsBegin()
59 lTrack.Details.append(lCube)
60 lTrack.ChangeDetailsEnd()
61 
62 lCube.Translation.SetAnimated(True)
63 
64 lTrack.RecordClipPath = "."
65 lTrack.RecordTrack = True
66 
67 DoRecord()
68 
69 
70