Python Reference Guide
 
Loading...
Searching...
No Matches
Samples\MaterialAndTexture\LayeredTexture.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 scipt is to demonstrate the usage of material and texture.
7# ...
8#
9# Topic: FBLayeredTexture, FBVector3d, FBColor, FBMaterialTextureType, FBTextureBlendMode
10#
11
12# for directory access
13import os
14#
15from pyfbsdk import FBSystem, FBModel, FBModelPlane, FBMaterial, FBTexture, FBLayeredTexture, FBVector3d, FBColor, FBMaterialTextureType, FBTextureBlendMode
16
17# Create a plane
18lPlane = FBModelPlane("My Plane")
19lPlane.Rotation = FBVector3d(90, 0, 0)
20lPlane.Translation = FBVector3d(0, 40, 0)
21lPlane.Show = True
22lPlane.Visible = True
23
24# Create texture layers
25lTexture1 = FBTexture( os.path.abspath(os.path.join( FBSystem().ApplicationPath, "../system/material_background.tif" ) ) )
26lTexture2 = FBTexture( os.path.abspath(os.path.join( FBSystem().ApplicationPath, "../system/actor-picture.tif" )) )
27
28# Create layeredTexture and constuct its layers
29lLayeredTexture = FBLayeredTexture("layeredTexture")
30lLayeredTexture.Layers.append(lTexture2)
31lLayeredTexture.Layers.append(lTexture1)
32
33lTexture2.BlendMode = FBTextureBlendMode.kFBTextureBlendTranslucent
34
35
36# HardSelect layeredTexture to bring up its setting UI
37lLayeredTexture.HardSelect()
38
39# Create a material and connect texture to material's diffuse channel.
40lMaterial = FBMaterial("My Material")
41lMaterial.SetTexture(lLayeredTexture, FBMaterialTextureType.kFBMaterialTextureDiffuse)
42
43# Map material to plane
44lPlane.Materials.append(lMaterial)
45
LayeredTexture class.
Definition: pyfbsdk_generated.h:9869
Material class.
Definition: pyfbsdk_generated.h:10458
Plane model class.
Definition: pyfbsdk_generated.h:11944
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18771
See samples: HUDElements.py, MaterialAndTexture.py, TextureAnimation.py, VideoInput....
Definition: pyfbsdk_generated.h:19477