Python Reference Guide
 
Loading...
Searching...
No Matches
Tasks\HUD.py
1# Copyright 2011 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# Script description:
7# Creates a "static" FBHUDTextElement (at center) and a moving
8# FBHUDTextElement (scrolling up vertically).
9#
10# Topic: FBHUD, FBHUDTextElement
11#
12from pyfbsdk import *
13
14def HUDDisplay(HUD, event):
15 HUDTextElement.Y = HUDTextElement.Y + 1
16 if(HUDTextElement.Y > 100):
17 HUDTextElement.Y = 0
18
19#Init
20Scene = FBSystem().Scene
21System = FBSystem()
22Application = FBApplication()
23
24#Create HUD with Text Element
25Application.FileNew()
26
27HUD = FBHUD("MyHUD")
28HUDTextElement = FBHUDTextElement("Center Element")
29Scene.ConnectSrc(HUD) # Connect the HUD to the scene
30HUDTextElement.Content = "HUD Element in the Center of the viewer"
31HUDTextElement.X = 0
32HUDTextElement.Y = 0
33HUDTextElement.Scale = 2
34HUDTextElement.Justification = FBHUDElementHAlignment.kFBHUDCenter
35HUDTextElement.HorizontalDock = FBHUDElementHAlignment.kFBHUDCenter
36HUDTextElement.VerticalDock = FBHUDElementVAlignment.kFBHUDVCenter
37HUD.ConnectSrc(HUDTextElement) # Connect HUDTextElement to the HUD
38Scene.Cameras[0].ConnectSrc(HUD) # Connect to Perspective camera
39
40HUDTextElement = FBHUDTextElement("Top Element")
41Scene.ConnectSrc(HUD) # Connect the HUD to the scene
42HUDTextElement.Content = "Free memory : %d MB"
43HUDTextElement.X = 0
44HUDTextElement.Y = 0
45HUDTextElement.Scale = 2
46HUDTextElement.Justification = FBHUDElementHAlignment.kFBHUDCenter
47HUDTextElement.HorizontalDock = FBHUDElementHAlignment.kFBHUDCenter
48HUDTextElement.VerticalDock = FBHUDElementVAlignment.kFBHUDTop
49HUDTextElement.PropertyAddReferenceProperty(HUD.PropertyList.Find("FreeMemory"))
50HUD.ConnectSrc(HUDTextElement) # Connect HUDTextElement to the HUD
51Scene.Cameras[0].ConnectSrc(HUD) # Connect to Perspective camera
52
53# Register for HUD Display
54HUD.OnDisplay.Add(HUDDisplay)
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Heads Up display.
Definition: pyfbsdk_generated.h:9102
Heads Up display.
Definition: pyfbsdk_generated.h:9252
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18771