Samples/HUD/Timeline.py

Samples/HUD/Timeline.py
1 # Copyright 2012 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 script is to demonstrate usage of the HUD Timeline.
7 # It sets attributes for the Head, Cut, Tail regions (e.g., color, duration),
8 # and plays transport control in loop mode.
9 # ...
10 #
11 # Topic: FBHUD, FBHUDTimelineElement, FBPlayerControl
12 #
13 
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 lTimeline = lHud.CreateElement(FBHUD.eTimeline, "HUD Timeline")
24 
25 # Set color and duration for Head region
26 lTimeline.HeadActiveColor = FBColorAndAlpha(0.3, 0.5, 0.8, 1.0)
27 lTimeline.HeadIdleColor = FBColorAndAlpha(0.15, 0.25, 0.4, 0.3)
28 lTimeline.HeadDuration = FBTime(0,0,0,30) # 30 frames
29 
30 # Set color for Cut region
31 lTimeline.CutActiveColor = FBColorAndAlpha(1, 0.2, 0.5, 1.0)
32 lTimeline.CutIdleColor = FBColorAndAlpha(0.5, 0.1, 0.25, 0.3)
33 
34 # Set color and duration for Tail region
35 lTimeline.TailActiveColor = FBColorAndAlpha(0.7, 1.0, 0.7, 1.0)
36 lTimeline.TailIdleColor = FBColorAndAlpha(0.35, 0.5, 0.35, 0.3)
37 lTimeline.TailDuration = FBTime(0,0,1,0) # 1 sec
38 
39 # Play
40 gPlayer = FBPlayerControl()
41 gPlayer.LoopActive = True
42 gPlayer.Play()