Python Reference Guide
 
Loading...
Searching...
No Matches
Samples\HUD\HUDElements.py
1# Copyright 2009 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 the usage of material and texture.
7# ...
8#
9# Topic: FBHUD, FBHUDFlashElement, FBHUDTextElement, FBHUDTextureElement, FBHUDRectElement, FBTexture
10#
11
12# for directory access
13import os
14from pyfbsdk import FBHUD, FBScene, FBApplication, FBSystem, FBHUDFlashElement, FBHUDTextElement, FBHUDTextureElement, FBHUDRectElement, FBTexture, FBHUDElementHAlignment
15
16FBApplication().FileNew()
17
18lHud = FBHUD("MyHUD 1")
19lHud.Visibility = True
20FBSystem().Scene.ConnectSrc(lHud) # Connect the HUD to the scene
21FBSystem().Scene.Cameras[0].ConnectSrc(lHud) # Connect to Perspective camera
22
23lRect = FBHUDRectElement("My Rect");
24lHud.ConnectSrc(lRect);
25
26# Note that if ScaleUniformly is set True (As it is by default)
27# then Height is dominant.
28
29lRect.ScaleUniformly = False
30lRect.Width = 100
31
32
33lText = FBHUDTextureElement("My Texture");
34lHud.ConnectSrc(lText);
35
36# Note that if ScaleUniformly is set True (As it is by default)
37# then Height is dominant.
38
39lText.Height = 34
40lText.Y = 50
41lText.X = 60
42
43# Modify lTextureFile according if you like to use your own texture image file.
44lTextureFile = os.path.join(FBSystem().ConfigPath, 'Scripts/Samples/HUD/hud_texture.tif')
45lTextureFile = os.path.normpath(lTextureFile)
46
47lTexture1 = FBTexture(lTextureFile)
48lText.Texture.append(lTexture1)
49
50# Modify lFlashFile according if you like to use your own flash file.
51# Also, you can find the same sample flash file for other flash versions in the folder containing this sample script.
52lFlashFile = os.path.join(FBSystem().ConfigPath, 'Scripts/Samples/HUD/hud_flash_v10.swf')
53lFlashFile = os.path.normpath(lFlashFile)
54
55lFlash = FBHUDFlashElement("My Flash");
56lHud.ConnectSrc(lFlash);
57
58lFlash.FilePath = lFlashFile;
59
60lFlash.Height = 50
61lFlash.Y = 20
62lFlash.Align = FBHUDElementHAlignment.kFBHUDRight;
63
64lRecordLight = lHud.CreateElement(FBHUD.eRecordLight, "The record light")
65
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Heads Up display.
Definition: pyfbsdk_generated.h:9250
Heads Up display.
Definition: pyfbsdk_generated.h:9143
Heads Up display.
Definition: pyfbsdk_generated.h:9275
Heads Up display.
Definition: pyfbsdk_generated.h:9323
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18837
See samples: HUDElements.py, MaterialAndTexture.py, TextureAnimation.py, VideoInput....
Definition: pyfbsdk_generated.h:19545