FBModel Class Reference


Detailed Description

Model class.

In the MotionBuilder UI, a model can be any object in a scene, created using geometry. Models can represent simple objects like cubes, or complex objects like characters.

FBModel is a base class which is not used so much directly, but is the parent of well-used classes like FBCamera, FBLight, and FBModelMarker.

It also implements a number of widely-implemented functions and attributes, such as:

  1. Clone(), FBDelete()

  2. UI attributes such as Show, Pickable, and Visibility

  3. Positional atributes such as Rotation, Scaling, and Translation The following Python snippet shows how to create, show, rotate, and delete a cube

        from pyfbsdk import *
        myCube = FBModelCube("cube")
        myCube.Show = True
        myCube.Rotation = FBVector3d(45, 45, 45)
        myCube.FBDelete()
    

There is a few ways to get a handle on existing models in a scene:

  1. FBFindObjectsByName and FBFindObjectsByNamespace return a list of objects matching a pattern (can contain *). For usage, see: FindObjectsWithWildcard.py

  2. If you know the name of the model, use FBFindModelByName, as demonstrated in FBComponent.py.

  3. FBGetSelectedModels can get a handle to an object which is derived from FBModel. It searches the scene for a model, based on the model's unique name and returns a list of all the selected things in the scene.

  4. FBSelectObjectsByNamespace selects (or deselects) objects in the current scene.

Examples
Tasks/ResetLocalTranslationRotation.py
Inheritance diagram for FBModel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  __init__ (str pName, object pObject=None)
  Constructor.
  FBDelete ()
  Open Reality deletion function.
  IQuery_Declare (Implementation)
  ICallback_Declare (Implementation)
FBModel  Clone ()
  Clone the model.
  SetMatrix (FBMatrix pMatrix, int pWhat=kModelTransformation, bool pGlobalInfo=True, bool pPushUndo=False, HFBEvaluateInfo pEvaluateInfo=None)
  Set a matrix for the model.
  GetMatrix (FBMatrix pMatrix, int pWhat=kModelTransformation, bool pGlobalInfo=True, HFBEvaluateInfo pEvaluateInfo=None)
  Get a matrix from the model.
  SetVector (FBVector3 pVector, int pWhat=kModelTranslation, bool pGlobalInfo=True, bool pPushUndo=False, HFBEvaluateInfo pEvaluateInfo=None)
  Set a vector for the model.
  GetVector (FBVector3 pVector, int pWhat=kModelTranslation, bool pGlobalInfo=True, HFBEvaluateInfo pEvaluateInfo=None)
  Get a vector from the model.
  SetSchematicPosition (int pX, int pY)
  Set the position in the schematic view for the model.
  SetSchematicPosition (FBVector2 pVector2d)
  Set the position in the schematic view for the model.
FBVector2  GetSchematicPosition ()
  Get the position in the schematic view for the model.
  GetBoundingBox (FBVector3 pMin, FBVector3 pMax)
  Get the bounding box of the model.
int  NoFrustumCullingRequire ()
  Acquire no frustum culling request.
int  NoFrustumCullingRelease ()
  Release no frustum culling request.
bool  UseFrustumCulling ()
  Get the current Frustum Culling Status.
bool  HasCustomDisplay ()
  Function to overload to handle custom display.
  CustomModelDisplay (FBCamera pCamera, FBModelShadingMode pShadingMode, FBModelRenderPass pRenderPass, float pPickingAreaWidth, float pPickingAreaHeight)
  Custom display function called when HasCustomDisplay returns true;.
bool  CustomModelPicking (int pNbHits, int pSelectBuffer, FBCamera pCamera, int pMouseX, int pMouseY, FBVector4 pLocalRaySrc, FBVector4 pLocalRayDir, FBVector4 pWorldRaySrc, FBVector4 pWorldRayDir, FBMatrix pGlobalInverseMatrix, FBVector4 pOutPickedPoint)
  Custom picking for selection.
str  GetSelectedPoints ()
  Get the list of the points selection state.
int  GetSelectedPointsCount ()
  Get the number of selected points in the model.
bool  FbxStore (HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat)
  Store and Retrieve function that can be overloaded.
bool  FbxRetrieve (HFBFbxObject pFbxObject, kFbxObjectStore pStoreWhat)
  SetupPropertiesForShapes ()
  Setup Shape Properties.
str  FbxGetObjectType ()
  Returns the class type inherited by the class of an object, for example: 'Model'.
str  FbxGetObjectSubType ()
  Returns the class sub type inherited by the class of an object, for example: 'Default', 'Mesh'.

Public Attributes

FBPropertyListModel  Children
  List: Children for model.
FBPropertyListShader  Shaders
  List: Shaders for model.
FBPropertyListMaterial  Materials
  List: Materials for model.
FBPropertyListTexture  Textures
  List: Textures with Special UseType (Other than "Color" which should connect to materials).
FBPropertyListDeformer  Deformers
  List: Deformers (Skeleton Deformer or Point Cache Deformer).
FBPropertyBase  Icon3D
  Read Write Property: Is model a 3D icon?.
FBPropertyBase  SoftSelected
  Read Write Property: Is model Soft selected?.
FBPropertyBase  IsDeformable
  Read Only Property: Is model deformable?.
FBPropertyBase  IsConstrained
  Read Only Property: Is model constrained?.
FBPropertyBase  SkeletonDeformable
  Read Write Property: Model skeleton deformable.
FBPropertyBase  BlendShapeDeformable
  Read Write Property: Model blendshape deformable.
FBPropertyBase  ConstrainDeformable
  Read Write Property: Model constraint deformable.
FBPropertyBase  PointCacheDeformable
  Read Write Property: Model point cache deformable.
FBPropertyBase  PointCacheRecord
  Read Write Property: Record Point Cache for model? Not Savable.
FBPropertyModel  Parent
  Read Write Property: Parent model.
FBPropertyModel  LookAt
  Read Write Property: Look at model (interest point).
FBPropertyModel  UpVector
  Read Write Property: UpVector model.
FBPropertyGeometry  Geometry
  Read Write Property: Geometry for the model.
FBPropertyMesh  TessellatedMesh
  Read Only Property: Tessellated Mesh for the model.
FBPropertyModelVertexData  ModelVertexData
  Read Only Property: ModelVertexData for the model.
FBPropertyCluster  Cluster
  Read Only Property: Link Cluster for the model.
FBPropertyScene  Scene
  Read Only Property: Scene containing the model.
FBPropertyModelShadingMode  ShadingMode
  Read Write Property: Shading mode for the model.
FBPropertyAnimationNode  AnimationNode
  Read Only Property: Animation node of the model.
FBPropertyModelRotationOrder  RotationOrder
  Read Write Property: Rotation order.
FBPropertyBase  RotationSpaceForLimitOnly
  Read Write Property: Apply Post Rotation Matrix only for Limits?.
FBPropertyBase  RotationActive
  Read Write Property: Is model using Rotation Limits?.
FBPropertyBase  PreRotation
  Read Write Property: Pre Rotation (considered if RotationActive is true).
FBPropertyBase  PostRotation
  Read Write Property: Post Rotation (considered if RotationActive is true).
FBPropertyBase  RotationMin
  Read Write Property: Min Rotation Limit (considered if RotationActive is true).
FBPropertyBase  RotationMax
  Read Write Property: Max Rotation Limit (considered if RotationActive is true).
FBPropertyBase  RotationMinX
  Read Write Property: Is model using Minimum Rotation Limits On X?.
FBPropertyBase  RotationMinY
  Read Write Property: Is model using Minimum Rotation Limits On Y?.
FBPropertyBase  RotationMinZ
  Read Write Property: Is model using Minimum Rotation Limits On Z?.
FBPropertyBase  RotationMaxX
  Read Write Property: Is model using Maximum Rotation Limits On X?.
FBPropertyBase  RotationMaxY
  Read Write Property: Is model using Maximum Rotation Limits On Y?.
FBPropertyBase  RotationMaxZ
  Read Write Property: Is model using Maximum Rotation Limits On Z?.
FBPropertyBaseAnimatable  Visibility
  Read Write Property: Visibility of model.
FBPropertyBase  VisibilityInheritance
  Read Write Property: //!< When this value is set to True the Visibility of this model is also applied to all its descendants.
FBPropertyBaseAnimatable  Translation
  Read Write Property: Lcl translation.
FBPropertyBaseAnimatable  Rotation
  Read Write Property: Lcl rotation.
FBPropertyBaseAnimatable  Scaling
  Read Write Property: Lcl scaling.
FBPropertyBase  GeometricTranslation
  Read Write Property: Geometric translation.
FBPropertyBase  GeometricRotation
  Read Write Property: Geometric rotation.
FBPropertyBase  GeometricScaling
  Read Write Property: Geometric scaling.
FBPropertyBase  QuaternionInterpolate
  Read Write Property: Use quaternion interpolation.
FBPropertyBase  Show
  Read Write Property: Indicate if the viewer should show the object, according to its visibility value.
FBPropertyBase  Pickable
  Read Write Property: Indicate if a model can be picked in the viewer.

Member Function Documentation

__init__ ( str  pName,
object  pObject = None 
)

Constructor.

Parameters:
pName Name of model.
pObject For internal use only(default=NULL).
Examples
Tasks/ResetLocalTranslationRotation.py

Reimplemented from FBBox.

Reimplemented in FBCamera, FBCameraStereo, FBLight, FBModelCube, FBModelMarker, FBModelNull, FBModelOptical, FBModelPath3D, FBModelPlane, FBModelRoot, and FBModelSkeleton.

FBDelete ( )

Open Reality deletion function.

Examples
Tasks/DeleteHierarchy.py

Reimplemented from FBComponent.

IQuery_Declare ( Implementation  )
ICallback_Declare ( Implementation  )
FBModel Clone ( )

Clone the model.

This will duplicate the current model.

Returns:
Newly created model.
SetMatrix ( FBMatrix  pMatrix,
int  pWhat = kModelTransformation,
bool  pGlobalInfo = True,
bool  pPushUndo = False,
HFBEvaluateInfo  pEvaluateInfo = None 
)

Set a matrix for the model.

Parameters:
pMatrix Information to use to set the model's matrix.
pWhat Type of matrix to set (default=transformation).
pGlobalInfo true if it is GlobalInfo, false if Local (default=true).
pPushUndo true if this operation is undoable, don't push undo in non UI thread.
pEvaluateInfo EvaluateInfo, Take Display if none specified
GetMatrix ( FBMatrix  pMatrix,
int  pWhat = kModelTransformation,
bool  pGlobalInfo = True,
HFBEvaluateInfo  pEvaluateInfo = None 
)

Get a matrix from the model.

Parameters:
pWhat Type of information requested (default=transformation).
pGlobalInfo true if it is GlobalInfo, false if Local (default=true).
Return values:
pMatrix Matrix to fill with requested information.
Parameters:
pEvaluateInfo EvaluateInfo, Take Display if none specified.
SetVector ( FBVector3  pVector,
int  pWhat = kModelTranslation,
bool  pGlobalInfo = True,
bool  pPushUndo = False,
HFBEvaluateInfo  pEvaluateInfo = None 
)

Set a vector for the model.

Parameters:
pVector Vector to use to set values.
pWhat Type of information to set (default=translation, inverses not supported).
pGlobalInfo true if it is GlobalInfo, false if Local (default=true).
pPushUndo true if this operation is undoable, don't push undo in non UI thread.
pEvaluateInfo EvaluateInfo, Take Display if none specified
GetVector ( FBVector3  pVector,
int  pWhat = kModelTranslation,
bool  pGlobalInfo = True,
HFBEvaluateInfo  pEvaluateInfo = None 
)

Get a vector from the model.

Parameters:
pWhat Type of information requested (default=translation, inverses not supported).
pGlobalInfo true if it is GlobalInfo, false if Local (default=true).
Return values:
pVector Vector to fill with requested values.
Parameters:
pEvaluateInfo EvaluateInfo, Take Display if none specified
SetSchematicPosition ( int  pX,
int  pY 
)

Set the position in the schematic view for the model.

Parameters:
pX X position to set.
pY Y position to set.
SetSchematicPosition ( FBVector2  pVector2d )

Set the position in the schematic view for the model.

Parameters:
pVector2d Position to set.
FBVector2 GetSchematicPosition ( )

Get the position in the schematic view for the model.

Returns:
Current position for the model.
GetBoundingBox ( FBVector3  pMin,
FBVector3  pMax 
)

Get the bounding box of the model.

Return values:
pMin Minimum value of the bounding box.
pMax Maximum value of the bounding box.
int NoFrustumCullingRequire ( )

Acquire no frustum culling request.

Returns:
Current no frustum culling request count after function call.
int NoFrustumCullingRelease ( )

Release no frustum culling request.

Returns:
Current no frustum culling request count after function call.
bool UseFrustumCulling ( )

Get the current Frustum Culling Status.

Returns:
True if model don't use frustum culling currently.
bool HasCustomDisplay ( )

Function to overload to handle custom display.

Returns:
True is this model class has custom display function ModelDisplay
CustomModelDisplay ( FBCamera  pCamera,
FBModelShadingMode  pShadingMode,
FBModelRenderPass  pRenderPass,
float  pPickingAreaWidth,
float  pPickingAreaHeight 
)

Custom display function called when HasCustomDisplay returns true;.

Parameters:
pCamera Current camera for display.
pShadingMode Shading mode to render see FBModelShadingMode.
pRenderPass Actual rendering pass, see FBModelRenderPass.
pPickingAreaWidth Width of picking area.
pPickingAreaHeight Height of picking area.
bool CustomModelPicking ( int  pNbHits,
int  pSelectBuffer,
FBCamera  pCamera,
int  pMouseX,
int  pMouseY,
FBVector4  pLocalRaySrc,
FBVector4  pLocalRayDir,
FBVector4  pWorldRaySrc,
FBVector4  pWorldRayDir,
FBMatrix  pGlobalInverseMatrix,
FBVector4  pOutPickedPoint 
)

Custom picking for selection.

Parameters:
pNbHits Number of hits.
pSelectBuffer OpenGL hit buffer.
pCamera Current camera for rendering.
pMouseX Mouse X position.
pMouseY Mouse Y position.
pLocalRaySrc Local picking ray source.
pLocalRayDir Local picking ray direction.
pWorldRaySrc World coordinate picking ray source.
pWorldRayDir World coordinate picking ray direction.
pGlobalInverseMatrix Inverse transformation matrix of the model.
pOutPickedPoint Picked position.
str GetSelectedPoints ( )

Get the list of the points selection state.

Returns:
Pointer to the list of the points selection state.
int GetSelectedPointsCount ( )

Get the number of selected points in the model.

Returns:
Number of selected points.
bool FbxStore ( HFBFbxObject  pFbxObject,
kFbxObjectStore  pStoreWhat 
)

Store and Retrieve function that can be overloaded.

Parameters:
pFbxObject FBX Object that is used to communicate I/O operations.
pStoreWhat Which attributes are currently stored/retrieved.

Reimplemented from FBBox.

bool FbxRetrieve ( HFBFbxObject  pFbxObject,
kFbxObjectStore  pStoreWhat 
)

Reimplemented from FBBox.

SetupPropertiesForShapes ( )

Setup Shape Properties.

Normally this function is called automatically at the next global synchronization point after the geometry has been updated. However you must call it explicitly to access the shape properties immediately after shapes adding/removing before next global synchronization point.

str FbxGetObjectType ( )

Returns the class type inherited by the class of an object, for example: 'Model'.

Reimplemented from FBBox.

str FbxGetObjectSubType ( )

Returns the class sub type inherited by the class of an object, for example: 'Default', 'Mesh'.

Reimplemented from FBBox.


Member Data Documentation

List: Textures with Special UseType (Other than "Color" which should connect to materials).

List: Deformers (Skeleton Deformer or Point Cache Deformer).

FBPropertyBase Icon3D

Read Write Property: Is model a 3D icon?.

FBPropertyBase SoftSelected

Read Write Property: Is model Soft selected?.

FBPropertyBase IsDeformable

Read Only Property: Is model deformable?.

FBPropertyBase IsConstrained

Read Only Property: Is model constrained?.

FBPropertyBase SkeletonDeformable

Read Write Property: Model skeleton deformable.

Not Savable

FBPropertyBase BlendShapeDeformable

Read Write Property: Model blendshape deformable.

Not Savable

FBPropertyBase ConstrainDeformable

Read Write Property: Model constraint deformable.

Not Savable

FBPropertyBase PointCacheDeformable

Read Write Property: Model point cache deformable.

Not Savable

FBPropertyBase PointCacheRecord

Read Write Property: Record Point Cache for model? Not Savable.

FBPropertyModel Parent

Read Write Property: Parent model.

FBPropertyModel LookAt

Read Write Property: Look at model (interest point).

FBPropertyModel UpVector

Read Write Property: UpVector model.

FBPropertyGeometry Geometry

Read Write Property: Geometry for the model.

FBPropertyMesh TessellatedMesh

Read Only Property: Tessellated Mesh for the model.

FBPropertyModelVertexData ModelVertexData

Read Only Property: ModelVertexData for the model.

FBPropertyCluster Cluster

Read Only Property: Link Cluster for the model.

FBPropertyScene Scene

Read Only Property: Scene containing the model.

FBPropertyModelShadingMode ShadingMode

Read Write Property: Shading mode for the model.

FBPropertyAnimationNode AnimationNode

Read Only Property: Animation node of the model.

FBPropertyModelRotationOrder RotationOrder

Read Write Property: Rotation order.

Read Write Property: Apply Post Rotation Matrix only for Limits?.

FBPropertyBase RotationActive

Read Write Property: Is model using Rotation Limits?.

FBPropertyBase PreRotation

Read Write Property: Pre Rotation (considered if RotationActive is true).

FBPropertyBase PostRotation

Read Write Property: Post Rotation (considered if RotationActive is true).

FBPropertyBase RotationMin

Read Write Property: Min Rotation Limit (considered if RotationActive is true).

FBPropertyBase RotationMax

Read Write Property: Max Rotation Limit (considered if RotationActive is true).

FBPropertyBase RotationMinX

Read Write Property: Is model using Minimum Rotation Limits On X?.

FBPropertyBase RotationMinY

Read Write Property: Is model using Minimum Rotation Limits On Y?.

FBPropertyBase RotationMinZ

Read Write Property: Is model using Minimum Rotation Limits On Z?.

FBPropertyBase RotationMaxX

Read Write Property: Is model using Maximum Rotation Limits On X?.

FBPropertyBase RotationMaxY

Read Write Property: Is model using Maximum Rotation Limits On Y?.

FBPropertyBase RotationMaxZ

Read Write Property: Is model using Maximum Rotation Limits On Z?.

FBPropertyBaseAnimatable Visibility

Read Write Property: Visibility of model.

This can be overriden by the 'Show' property.

FBPropertyBase VisibilityInheritance

Read Write Property: //!< When this value is set to True the Visibility of this model is also applied to all its descendants.

FBPropertyBaseAnimatable Translation

Read Write Property: Lcl translation.

FBPropertyBaseAnimatable Rotation

Read Write Property: Lcl rotation.

FBPropertyBaseAnimatable Scaling

Read Write Property: Lcl scaling.

FBPropertyBase GeometricTranslation

Read Write Property: Geometric translation.

FBPropertyBase GeometricRotation

Read Write Property: Geometric rotation.

FBPropertyBase GeometricScaling

Read Write Property: Geometric scaling.

FBPropertyBase QuaternionInterpolate

Read Write Property: Use quaternion interpolation.

FBPropertyBase Show

Read Write Property: Indicate if the viewer should show the object, according to its visibility value.

This has a default value of 'false'.

FBPropertyBase Pickable

Read Write Property: Indicate if a model can be picked in the viewer.

This has a default value of 'true'.


FBModel FBModel FBModel FBModel FBModel FBModel FBModel FBModel FBModel FBModel
FBModel FBModel FBModel FBModel FBModel FBModel FBModel FBModel FBModel FBModel