Samples/HUD/BloopSlate.py
 
 
 
Samples/HUD/BloopSlate.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 bloop slate.
# The script starts recording, displays a bloop slate after 30 frames, that remains onscreen
# for 15 frames.
# ...
#
# 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

lBloopSlate = lHud.CreateElement(FBHUD.eBloopSlate, "Bloop Slate")
lBloopSlate.ShowAfterDelayOnRecordPlay = FBTime(0,0,0,30)
lBloopSlate.ShowDuration = FBTime(0,0,0,15)
#lBloopSlate.ForegroundColor = FBColorAndAlpha(0.0, 0.0, 1.0, 1.0)
#lBloopSlate.BackgroundColor = FBColorAndAlpha(1.0, 0.0, 0.0, 1.0)

gPlayer = FBPlayerControl()
gIdleEvent  = FBSystem().OnUIIdle

G_RECORDING_DURATION = 3

gFrame = 0

def DoRecord(): 
    gPlayer.Record(True, True)
    gPlayer.Play()
    gIdleEvent.Add( OnIdleEvent )

def OnIdleEvent( pControl, pEvent ):
    if FBSystem().LocalTime.GetSecondDouble() >= G_RECORDING_DURATION:
        gPlayer.Record(False, False)
        gPlayer.Stop()
        gIdleEvent.Remove( OnIdleEvent )

       

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

DoRecord()