Samples/HUD/RecordLight.py

Samples/HUD/RecordLight.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 record light and story track recording.
7 # ...
8 #
9 # Topic: FBPlayerControl, FBHUD, FBStory, FBStoryTrack
10 #
11 
12 # for directory access
13 import os
14 from pyfbsdk import *
15 
16 FBApplication().FileNew()
17 
18 lHud = FBHUD("MyHUD 1")
19 lHud.Visibility = True
20 FBSystem().Scene.ConnectSrc(lHud) # Connect the HUD to the scene
21 FBSystem().Scene.Cameras[0].ConnectSrc(lHud) # Connect to Perspective camera
22 
23 lRecordLight = lHud.CreateElement(FBHUD.eRecordLight, "The record light")
24 gFrame = 0
25 
26 def Test(a, b):
27  lControl = FBPlayerControl()
28  lTime = FBSystem().LocalTime
29 
30  global gFrame
31 
32  if gFrame != lTime.GetFrame():
33  gFrame = lTime.GetFrame();
34 
35  print gFrame
36 
37  if gFrame == 20:
38  print "Record on"
39  lControl.Record(True, True)
40 
41 lHud.OnDisplay.Add(Test)
42 
43 
44 
45 lStory = FBStory()
46 
47 lCube = FBModelCube("Cube")
48 lCube.Show = True
49 
50 lTrack = FBStoryTrack(FBStoryTrackType.kFBStoryTrackAnimation, lStory.RootFolder)
51 
52 lTrack.ChangeDetailsBegin()
53 lTrack.Details.append(lCube)
54 lTrack.ChangeDetailsEnd()
55 
56 lCube.Translation.SetAnimated(True)
57 
58 lTrack.RecordClipPath = "."
59 lTrack.RecordTrack = True
60