FBProperty - Object Properties

Object Properties

The state and behavior of an FBComponent is controlled by its list of properties (FBProperty). To obtain an FBComponent's list of FBProperty instances, you may (1): consult the SDK's class reference documentation, or (2): iterate through the FBComponent.PropertyList to print the names of the component's properties:

for property in lComponent.PropertyList:
    # The following name can be used to obtain a property in FBComponent.PropertyList.Find(<name>)
    print property.Name

Observe that an FBModel uses instances of FBProperty to define the local translation, rotation and scaling vectors. Properties can be accessed in two ways:

Note: Classes which inherit from FBProperty are generally named to reflect the return type of FBProperty.Data. For example, FBPropertyInt.Data returns an integer (int) type, whereas FBPropertyVector3d.Data returns an FBVector3d object.

Animatable Properties

An animatable property is an instance of FBPropertyAnimatable. Many properties are animatable, such as FBModel.Translation, and FBMaterial.Diffuse. Before these properties can be animated however, they must have their animated status set to True via FBPropertyAnimatable.SetAnimated(). The following example enables the animation of a light's intensity property. For an example on how to animate a camera using key frames and animation nodes (FBAnimationNode), see

!!CONVERSION WARNING!! broken xref detectd, likely a cross-book reference. The target GUID file is GUID-3D242E6C-0A04-4BE3-84A7-C7FF923527EE.htm#SECTION_0247889C7FDB468FB6D34A0873672FAF and the target link text is FBCamera - Cameras

.

from pyfbsdk import *


###############################################################
# Main.                                                       #
###############################################################

light = FBLight('myLight')

print 'light.Intensity animation node: ' + str(light.Intensity.GetAnimationNode())

# Enable animation for the light's intensity.
# (!) This initializes the animation node for intensity.
light.Intensity.SetAnimated(True)

print 'light.Intensity animation node: ' + str(light.Intensity.GetAnimationNode())


###############################################################
# Output.                                                     #
###############################################################
'''
light.Intensity animation node: None
light.Intensity animation node: <pyfbsdk.FBAnimationNode object at 0x000000002F588828>
'''

Modifying a Component's List of Properties

By calling FBComponent.PropertyList, we are actually accessing the component's FBPropertyManager. Each instance of FBComponent has its own FBPropertyManager, which contains a list of FBProperty.

An FBProperty may be added or removed from the component using FBComponent.PropertyAdd() and FBComponent.PropertyRemove(). The index returned by FBComponent.PropertyAdd() refers to the property's position in the FBPropertyManager. Additional instances of FBProperty can be created within the FBComponent using FBComponent.PropertyCreate().

Note: The relationships between FBComponent and FBProperty can also be viewed through the use of connections. For more information, see FBPlug - Object Connection Management.