Samples/HUD/RecordLight.py
 
 
 
Samples/HUD/RecordLight.py
# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
# ...
# This scipt is to demonstrate/test the usage of the record light and story track recording.
# ...
#
# Topic: FBPlayerControl, FBHUD, FBStory, FBStoryTrack
#

# for directory access
import os
from pyfbsdk import *

FBApplication().FileNew()

lHud = FBHUD("MyHUD 1")
lHud.Visibility = True
FBSystem().Scene.ConnectSrc(lHud)          # Connect the HUD to the scene
FBSystem().Scene.Cameras[0].ConnectSrc(lHud) # Connect to Perspective camera

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