import os
from pyfbsdk import *
FBApplication().FileNew()
lHud = FBHUD("MyHUD 1")
lHud.Visibility = True
FBSystem().Scene.ConnectSrc(lHud)
FBSystem().Scene.Cameras[0].ConnectSrc(lHud)
lRecordLight = lHud.CreateElement(FBHUD.eRecordLight, "The record light")
gFrame = 0
def Test(a, b):
lControl = FBPlayerControl()
lTime = FBSystem().LocalTime
global gFrame
if gFrame != lTime.GetFrame():
gFrame = lTime.GetFrame();
print gFrame
if gFrame == 20:
print "Record on"
lControl.Record(True, True)
lHud.OnDisplay.Add(Test)
lStory = FBStory()
lCube = FBModelCube("Cube")
lCube.Show = True
lTrack = FBStoryTrack(FBStoryTrackType.kFBStoryTrackAnimation, lStory.RootFolder)
lTrack.ChangeDetailsBegin()
lTrack.Details.append(lCube)
lTrack.ChangeDetailsEnd()
lCube.Translation.SetAnimated(True)
lTrack.RecordClipPath = "."
lTrack.RecordTrack = True