Samples/HUD/Timeline.py

# Copyright 2012 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 script is to demonstrate usage of the HUD Timeline.
# It sets attributes for the Head, Cut, Tail regions (e.g., color, duration),
# and plays transport control in loop mode.
# ...
#
# Topic: FBHUD, FBHUDTimelineElement, FBPlayerControl
#

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

lTimeline = lHud.CreateElement(FBHUD.eTimeline, "HUD Timeline")

# Set color and duration for Head region
lTimeline.HeadActiveColor = FBColorAndAlpha(0.3, 0.5, 0.8, 1.0)
lTimeline.HeadIdleColor = FBColorAndAlpha(0.15, 0.25, 0.4, 0.3)
lTimeline.HeadDuration = FBTime(0,0,0,30)   # 30 frames

# Set color for Cut region
lTimeline.CutActiveColor = FBColorAndAlpha(1, 0.2, 0.5, 1.0)
lTimeline.CutIdleColor = FBColorAndAlpha(0.5, 0.1, 0.25, 0.3)

# Set color and duration for Tail region
lTimeline.TailActiveColor = FBColorAndAlpha(0.7, 1.0, 0.7, 1.0)
lTimeline.TailIdleColor = FBColorAndAlpha(0.35, 0.5, 0.35, 0.3)
lTimeline.TailDuration = FBTime(0,0,1,0)   # 1 sec

# Play
gPlayer = FBPlayerControl()
gPlayer.LoopActive = True
gPlayer.Play()