HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FBX_SceneProxy Class Reference

#include <FBX_SceneProxy.h>

Classes

struct  JointInfo
 
struct  LoadOptions
 
class  PropertyIterator
 Iterates over a node's user properties. More...
 
struct  SaveOptions
 
struct  SkinningInfo
 

Public Types

enum  NodeType {
  eUnknown, eNull, eMarker, eSkeleton,
  eMesh, eNurbs, ePatch, eCamera,
  eCameraStereo, eCameraSwitcher, eLight, eOpticalReference,
  eOpticalMarker, eNurbsCurve, eTrimNurbsSurface, eBoundary,
  eNurbsSurface, eShape, eLODGroup, eSubDiv,
  eCachedEffect, eLine
}
 
enum  SkinningType { SkinningType::eRigid, SkinningType::eLinear, SkinningType::eDualQuaternion, SkinningType::eBlend }
 
using JointInfoMap = UT_ArrayStringMap< JointInfo >
 

Public Member Functions

 FBX_SceneProxy ()
 
 ~FBX_SceneProxy ()
 
bool initNewScene (FBX_ErrorManager &errors)
 
void stampDocumentInfo (const char *orig_fbx_filename=nullptr)
 
fpreal globalFrameRate () const
 
void setGlobalFrameRate (fpreal fps)
 
void getGlobalTimeRange (fpreal &start, fpreal &stop) const
 
void setGlobalTimeRange (fpreal start, fpreal stop)
 
FBX_AxisSystem globalAxisSystem () const
 Get the scene's current axis system. More...
 
void convertAxisSystem (const FBX_AxisSystem &target)
 Convert the scene to the given axis system. More...
 
bool convertToHoudiniAxisSystem ()
 
const char * nodeName (FBX_NodeID node) const
 Return name of node. More...
 
FBX_NodeID findNode (const char *name) const
 Find first node in scene that has given name. More...
 
UT_StringHolder nodePath (FBX_NodeID node) const
 
FBX_NodeID findNodeByPath (const char *path) const
 
int nodeCount () const
 
FBX_NodeID node (int i) const
 
FBX_NodeID rootNode () const
 
FBX_NodeID parentNode (FBX_NodeID node) const
 
int childNodeCount (FBX_NodeID node) const
 
FBX_NodeID childNode (FBX_NodeID node, int i) const
 
NodeType nodeType (FBX_NodeID node) const
 
FBX_NodeID createJointNode (const char *name, bool is_root)
 Add new FbxNode with new FbxSkeleton attribute as a joint. More...
 
void nodeAddChild (FBX_NodeID parent, FBX_NodeID child)
 
bool visibility (FBX_NodeID node) const
 
FBX_GeometryID geometry (FBX_NodeID node) const
 
FBX_NodeID geometryNode (FBX_GeometryID geometry) const
 
int geometrySkinDeformerCount (FBX_GeometryID geometry) const
 
int skinDeformerCount () const
 Count of skin deformers in the file. More...
 
FBX_GeometryID skinDeformerGeometry (int i) const
 
bool convertGeometry (GU_Detail &detail, FBX_GeometryID geometry, FBX_ErrorManager &errors, bool add_unused_joints, const UT_Matrix4D *world_xform=nullptr) const
 
SkinningType geometrySkinDeformerType (FBX_GeometryID geometry, int i) const
 Returns the skinning type for the i'th skin deformer in the geometry. More...
 
int blendshapeCount (FBX_GeometryID geometry) const
 Returns the number of blend shape deformers for the geometry. More...
 
int blendshapeChannelCount (FBX_GeometryID geometry, int blendshape_idx) const
 Returns the number of channels for the i'th blend shape deformer. More...
 
UT_StringHolder blendshapeChannelName (FBX_GeometryID geometry, int blendshape_idx, int channel_idx) const
 Returns the name of the specified blendshape channel. More...
 
void blendShapeChannelTargets (FBX_GeometryID geometry, int blendshape_idx, int channel_idx, UT_Array< GU_DetailHandle > &details, UT_StringArray &names, UT_Array< fpreal > &weights, const UT_Matrix4D *world_xform=nullptr) const
 
fpreal animCurveEval (FBX_AnimCurveID curve, fpreal time_seconds) const
 Evaluate an animation curve at the given time. More...
 
int animCurveKeyCount (FBX_AnimCurveID curve) const
 Number of keys in anim curve. More...
 
void getAnimCurveTimeInterval (FBX_AnimCurveID curve, fpreal &start, fpreal &end) const
 Get the time range of the anim curve. More...
 
FBX_Property3D nodeLocalTranslate (FBX_NodeID node) const
 Local translation property of node. More...
 
FBX_Property3D nodeLocalRotate (FBX_NodeID node) const
 Local rotation property of node. More...
 
FBX_Property3D nodeLocalScale (FBX_NodeID node) const
 Local scale property of node. More...
 
FBX_Property3D nodeLocalPreRotation (FBX_NodeID node) const
 
bool nodeIsRotationActive (FBX_NodeID node) const
 
UT_XformOrder nodeTransformOrder (FBX_NodeID node) const
 
UT_Vector3D nodeRotationPivot (FBX_NodeID node) const
 
int animLayerCount (FBX_ClipID clip) const
 
FBX_AnimLayerID animLayer (FBX_ClipID clip, int i) const
 
FBX_AnimLayerID createAnimLayer (const char *name, FBX_ClipID clip=FBX_ClipID{})
 Create a new animation layer. If given clip, the layer is added to it. More...
 
void destroyAnimLayer (FBX_AnimLayerID layer, bool recurse_unused=false)
 
int animLayerSrcCount (FBX_AnimLayerID layer) const
 Return src object count of layer. More...
 
FBX_AnimCurveID propertyAnimCurve (FBX_PropertyID property, FBX_AnimLayerID layer, int component, bool create=false)
 Return animation curve attached to property. More...
 
double sceneScale () const
 
void setSceneScale (fpreal scale)
 Set the scene scale. More...
 
UT_Matrix4D nodeGlobalTransform (FBX_NodeID node, fpreal time_seconds) const
 Return a node's global transform, scaled by sceneScale() More...
 
UT_Matrix4D nodeLocalTransform (FBX_NodeID node, fpreal time_seconds) const
 
UT_Matrix4D nodeGlobalRestTransform (FBX_NodeID node) const
 Return global transform without animation, scaled by sceneScale() More...
 
bool nodeGeometricTransform (FBX_NodeID node, UT_Matrix4D &transform) const
 
void removeNodeAnimation (FBX_NodeID node)
 Remove all animation on the transform properties of given node. More...
 
double computeConversionFactor () const
 
UT_ScaleInheritanceMode nodeScaleInheritanceMode (FBX_NodeID node) const
 
void setNodeScaleInheritanceMode (FBX_NodeID node, UT_ScaleInheritanceMode inherit)
 
int clipCount () const
 
FBX_ClipID clip (int i) const
 
FBX_ClipID findClip (const char *name) const
 
const char * clipName (FBX_ClipID clip) const
 
void setActiveClip (FBX_ClipID clip)
 
FBX_ClipID activeClip () const
 
FBX_ClipID createClip (const char *name)
 
bool load (const char *path, const LoadOptions &options, FBX_ErrorManager &errors)
 
bool load (const char *path, bool convert_units, FBX_ErrorManager &errors)
 
bool save (const char *path, FBX_ErrorManager &errors, const SaveOptions &options) const
 
bool save (const char *path, FBX_ErrorManager &errors, bool binary=true, bool animation_only=false) const
 
void setGlobalAxisSystem (const FBX_AxisSystem &axis_system)
 
void setGlobalAxisSystem (OP_OrientationMode orientation_mode)
 
FBX_AnimCurveID blendshapeChannelCurve (FBX_GeometryID geometry, int blendshape_idx, int channel_idx) const
 
FBX_AnimCurveID blendshapeChannelCurve (FBX_GeometryID geometry, int blendshape_idx, int channel_idx, bool create_if_needed)
 
void addAnimLayer (FBX_ClipID clip, FBX_AnimLayerID layer)
 
void removeAnimLayer (FBX_ClipID clip, FBX_AnimLayerID layer)
 
fpreal propertyEvalFloat (FBX_PropertyID property, fpreal time_seconds)
 
UT_Vector3R propertyEvalVector (FBX_Property3D property, fpreal time_seconds)
 
void propertySetFloat (FBX_PropertyID property, fpreal value)
 
void propertySetVector (FBX_PropertyID property, const UT_Vector3R &vector)
 
UT_Matrix4D nodeLocalRestTransform (FBX_NodeID node) const
 
void setNodeLocalRestTransform (FBX_NodeID node, const UT_Matrix4D &local)
 Set a node's local transform without anim. More...
 
void getClipTimeRange (FBX_ClipID clip, fpreal &start, fpreal &stop) const
 
void setClipTimeRange (FBX_ClipID clip, fpreal start, fpreal stop)
 
bool exportGeometry (UT_Array< FBX_NodeID > &exported_nodes, const UT_Matrix4D &parent_xform, const GU_Detail &geo, const SkinningInfo *skinning_info, FBX_ErrorManager &errors)
 
bool exportGeometry (UT_Array< FBX_NodeID > &exported_nodes, fpreal time_seconds, const UT_Matrix4D &parent_xform, const GU_Detail &geo, const SkinningInfo *skinning_info, FBX_ErrorManager &errors)
 

Detailed Description

Definition at line 56 of file FBX_SceneProxy.h.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
eUnknown 
eNull 
eMarker 
eSkeleton 
eMesh 
eNurbs 
ePatch 
eCamera 
eCameraStereo 
eCameraSwitcher 
eLight 
eOpticalReference 
eOpticalMarker 
eNurbsCurve 
eTrimNurbsSurface 
eBoundary 
eNurbsSurface 
eShape 
eLODGroup 
eSubDiv 
eCachedEffect 
eLine 

Definition at line 180 of file FBX_SceneProxy.h.

Enumerator
eRigid 
eLinear 
eDualQuaternion 
eBlend 

Definition at line 240 of file FBX_SceneProxy.h.

Constructor & Destructor Documentation

FBX_SceneProxy::FBX_SceneProxy ( )

Construct wrapper around the FBX SDK

Note
By default, no scene is set up. You must still call one of load() or initInitNewScene().
FBX_SceneProxy::~FBX_SceneProxy ( )

Member Function Documentation

FBX_ClipID FBX_SceneProxy::activeClip ( ) const
void FBX_SceneProxy::addAnimLayer ( FBX_ClipID  clip,
FBX_AnimLayerID  layer 
)

Add/remove a layer to clip as a src object

fpreal FBX_SceneProxy::animCurveEval ( FBX_AnimCurveID  curve,
fpreal  time_seconds 
) const

Evaluate an animation curve at the given time.

int FBX_SceneProxy::animCurveKeyCount ( FBX_AnimCurveID  curve) const

Number of keys in anim curve.

FBX_AnimLayerID FBX_SceneProxy::animLayer ( FBX_ClipID  clip,
int  i 
) const
int FBX_SceneProxy::animLayerCount ( FBX_ClipID  clip) const
int FBX_SceneProxy::animLayerSrcCount ( FBX_AnimLayerID  layer) const

Return src object count of layer.

int FBX_SceneProxy::blendshapeChannelCount ( FBX_GeometryID  geometry,
int  blendshape_idx 
) const

Returns the number of channels for the i'th blend shape deformer.

FBX_AnimCurveID FBX_SceneProxy::blendshapeChannelCurve ( FBX_GeometryID  geometry,
int  blendshape_idx,
int  channel_idx 
) const

Returns curve for the blend shape channel's values.

Note
Result might be null for non-animated blendshapes.
FBX_AnimCurveID FBX_SceneProxy::blendshapeChannelCurve ( FBX_GeometryID  geometry,
int  blendshape_idx,
int  channel_idx,
bool  create_if_needed 
)

Returns curve for the blend shape channel's values.

Note
Result might be null for non-animated blendshapes.
UT_StringHolder FBX_SceneProxy::blendshapeChannelName ( FBX_GeometryID  geometry,
int  blendshape_idx,
int  channel_idx 
) const

Returns the name of the specified blendshape channel.

void FBX_SceneProxy::blendShapeChannelTargets ( FBX_GeometryID  geometry,
int  blendshape_idx,
int  channel_idx,
UT_Array< GU_DetailHandle > &  details,
UT_StringArray names,
UT_Array< fpreal > &  weights,
const UT_Matrix4D world_xform = nullptr 
) const

Returns the geometry, name, and weight (multiplied by 0.01) for each of the channel's target shapes. Multiple targets imply that there are in-between shapes, and the shapes are sorted by weight in ascending order.

int FBX_SceneProxy::blendshapeCount ( FBX_GeometryID  geometry) const

Returns the number of blend shape deformers for the geometry.

FBX_NodeID FBX_SceneProxy::childNode ( FBX_NodeID  node,
int  i 
) const
int FBX_SceneProxy::childNodeCount ( FBX_NodeID  node) const
FBX_ClipID FBX_SceneProxy::clip ( int  i) const
int FBX_SceneProxy::clipCount ( ) const
const char* FBX_SceneProxy::clipName ( FBX_ClipID  clip) const
double FBX_SceneProxy::computeConversionFactor ( ) const

Compute a scene scale needed convert transforms from nodeGlobalTransform() to the Houdini unit length. This will be 1.0 if the file was loaded with convert_units=true.

void FBX_SceneProxy::convertAxisSystem ( const FBX_AxisSystem target)

Convert the scene to the given axis system.

bool FBX_SceneProxy::convertGeometry ( GU_Detail detail,
FBX_GeometryID  geometry,
FBX_ErrorManager errors,
bool  add_unused_joints,
const UT_Matrix4D world_xform = nullptr 
) const

Convert geometry into GU_Detail, with skin deformers converted into a boneCapture attribute. If world_xform is given, the result including the transforms within boneCapture will have this baked into it. When add_unused_joints is true, add ancestor joints for any captured joints will also be added to the boneCapture attribute with identity transforsm.

bool FBX_SceneProxy::convertToHoudiniAxisSystem ( )

Convert the scene to match Houdini. Returns true if conversion was done, false if no conversion was needed

FBX_AnimLayerID FBX_SceneProxy::createAnimLayer ( const char *  name,
FBX_ClipID  clip = FBX_ClipID{} 
)

Create a new animation layer. If given clip, the layer is added to it.

FBX_ClipID FBX_SceneProxy::createClip ( const char *  name)
FBX_NodeID FBX_SceneProxy::createJointNode ( const char *  name,
bool  is_root 
)

Add new FbxNode with new FbxSkeleton attribute as a joint.

void FBX_SceneProxy::destroyAnimLayer ( FBX_AnimLayerID  layer,
bool  recurse_unused = false 
)

Destroy give animation layer. If recurse_unused is true, then recursively destroy all unused dst objects as a result.

bool FBX_SceneProxy::exportGeometry ( UT_Array< FBX_NodeID > &  exported_nodes,
const UT_Matrix4D parent_xform,
const GU_Detail geo,
const SkinningInfo skinning_info,
FBX_ErrorManager errors 
)

Export geometry to FBX scene, with automatic handling of shapes partitioned by name and/or path primitive attributes. If the nodes already exist, then their geometry will be destroyed and recreated. In order to export them with an identity global transform, a time is needed to evaluate its parent node. If not specified, the time at 0 seconds will be used. Currently, everything is first converted to polygons.

bool FBX_SceneProxy::exportGeometry ( UT_Array< FBX_NodeID > &  exported_nodes,
fpreal  time_seconds,
const UT_Matrix4D parent_xform,
const GU_Detail geo,
const SkinningInfo skinning_info,
FBX_ErrorManager errors 
)

Export geometry to FBX scene, with automatic handling of shapes partitioned by name and/or path primitive attributes. If the nodes already exist, then their geometry will be destroyed and recreated. In order to export them with an identity global transform, a time is needed to evaluate its parent node. If not specified, the time at 0 seconds will be used. Currently, everything is first converted to polygons.

FBX_ClipID FBX_SceneProxy::findClip ( const char *  name) const
FBX_NodeID FBX_SceneProxy::findNode ( const char *  name) const

Find first node in scene that has given name.

FBX_NodeID FBX_SceneProxy::findNodeByPath ( const char *  path) const

Find node in scene by hierarchical path from the scene root. If path does not begin with a '/' then it returns findNode(path).

FBX_GeometryID FBX_SceneProxy::geometry ( FBX_NodeID  node) const
FBX_NodeID FBX_SceneProxy::geometryNode ( FBX_GeometryID  geometry) const
int FBX_SceneProxy::geometrySkinDeformerCount ( FBX_GeometryID  geometry) const
SkinningType FBX_SceneProxy::geometrySkinDeformerType ( FBX_GeometryID  geometry,
int  i 
) const

Returns the skinning type for the i'th skin deformer in the geometry.

void FBX_SceneProxy::getAnimCurveTimeInterval ( FBX_AnimCurveID  curve,
fpreal start,
fpreal end 
) const

Get the time range of the anim curve.

void FBX_SceneProxy::getClipTimeRange ( FBX_ClipID  clip,
fpreal start,
fpreal stop 
) const

Get/set the inclusive time range for the given clip in seconds

void FBX_SceneProxy::getGlobalTimeRange ( fpreal start,
fpreal stop 
) const
FBX_AxisSystem FBX_SceneProxy::globalAxisSystem ( ) const

Get the scene's current axis system.

fpreal FBX_SceneProxy::globalFrameRate ( ) const
bool FBX_SceneProxy::initNewScene ( FBX_ErrorManager errors)

Initialize a new empty scene

Note
Resets mySceneScale/myShouldConvertMaterials to default.
bool FBX_SceneProxy::load ( const char *  path,
const LoadOptions options,
FBX_ErrorManager errors 
)

Load a new scene

bool FBX_SceneProxy::load ( const char *  path,
bool  convert_units,
FBX_ErrorManager errors 
)
inline

Load a new scene

Definition at line 104 of file FBX_SceneProxy.h.

FBX_NodeID FBX_SceneProxy::node ( int  i) const
void FBX_SceneProxy::nodeAddChild ( FBX_NodeID  parent,
FBX_NodeID  child 
)

Add child to parent. If child already has a parent, first it is removed from current parent and then added to this one.

int FBX_SceneProxy::nodeCount ( ) const
bool FBX_SceneProxy::nodeGeometricTransform ( FBX_NodeID  node,
UT_Matrix4D transform 
) const

Get a node's geometric transform. Returns false if there is none. A geometric transform is a transform that is only applied to the node's geometry and is not part of its global transform.

Note
This transform is NOT scaled by sceneScale()
UT_Matrix4D FBX_SceneProxy::nodeGlobalRestTransform ( FBX_NodeID  node) const

Return global transform without animation, scaled by sceneScale()

UT_Matrix4D FBX_SceneProxy::nodeGlobalTransform ( FBX_NodeID  node,
fpreal  time_seconds 
) const

Return a node's global transform, scaled by sceneScale()

bool FBX_SceneProxy::nodeIsRotationActive ( FBX_NodeID  node) const

When nodeIsRotationActive() is false, then these node properties are ignored from the FBX file: rotation order, pivots, pre/post rotation values, rotation limits

FBX_Property3D FBX_SceneProxy::nodeLocalPreRotation ( FBX_NodeID  node) const

Local pre-rotation property of node. Should only be used when nodeIsRotationActive() is true.

UT_Matrix4D FBX_SceneProxy::nodeLocalRestTransform ( FBX_NodeID  node) const

Access node's local transform without animation

Note
This transform is NOT scaled by sceneScale()
FBX_Property3D FBX_SceneProxy::nodeLocalRotate ( FBX_NodeID  node) const

Local rotation property of node.

FBX_Property3D FBX_SceneProxy::nodeLocalScale ( FBX_NodeID  node) const

Local scale property of node.

UT_Matrix4D FBX_SceneProxy::nodeLocalTransform ( FBX_NodeID  node,
fpreal  time_seconds 
) const

Get a node's local transform at given time.

Note
This transform is NOT scaled by sceneScale()
FBX_Property3D FBX_SceneProxy::nodeLocalTranslate ( FBX_NodeID  node) const

Local translation property of node.

const char* FBX_SceneProxy::nodeName ( FBX_NodeID  node) const

Return name of node.

UT_StringHolder FBX_SceneProxy::nodePath ( FBX_NodeID  node) const

Return "path" from scene root of node. If node == nullptr, returns empty string.

UT_Vector3D FBX_SceneProxy::nodeRotationPivot ( FBX_NodeID  node) const

Return the rotation pivot for given node.

Note
Returns a default value when !nodeIsRotationActive()
UT_ScaleInheritanceMode FBX_SceneProxy::nodeScaleInheritanceMode ( FBX_NodeID  node) const
UT_XformOrder FBX_SceneProxy::nodeTransformOrder ( FBX_NodeID  node) const

Return the transform order for given node. For FBX, we always return a transform order of SRT, so really only the rotation order is pertinent here.

Note
Returns a default value when !nodeIsRotationActive()
NodeType FBX_SceneProxy::nodeType ( FBX_NodeID  node) const
FBX_NodeID FBX_SceneProxy::parentNode ( FBX_NodeID  node) const
FBX_AnimCurveID FBX_SceneProxy::propertyAnimCurve ( FBX_PropertyID  property,
FBX_AnimLayerID  layer,
int  component,
bool  create = false 
)

Return animation curve attached to property.

fpreal FBX_SceneProxy::propertyEvalFloat ( FBX_PropertyID  property,
fpreal  time_seconds 
)

Evaluate animated value from property

UT_Vector3R FBX_SceneProxy::propertyEvalVector ( FBX_Property3D  property,
fpreal  time_seconds 
)

Evaluate animated value from property

void FBX_SceneProxy::propertySetFloat ( FBX_PropertyID  property,
fpreal  value 
)

Set non-animated value on property

void FBX_SceneProxy::propertySetVector ( FBX_PropertyID  property,
const UT_Vector3R vector 
)

Set non-animated value on property

void FBX_SceneProxy::removeAnimLayer ( FBX_ClipID  clip,
FBX_AnimLayerID  layer 
)

Add/remove a layer to clip as a src object

void FBX_SceneProxy::removeNodeAnimation ( FBX_NodeID  node)

Remove all animation on the transform properties of given node.

FBX_NodeID FBX_SceneProxy::rootNode ( ) const
bool FBX_SceneProxy::save ( const char *  path,
FBX_ErrorManager errors,
const SaveOptions options 
) const

Save current scene. One of initNewScene() or load() must have been called.

bool FBX_SceneProxy::save ( const char *  path,
FBX_ErrorManager errors,
bool  binary = true,
bool  animation_only = false 
) const
inline

Save current scene. One of initNewScene() or load() must have been called.

Definition at line 120 of file FBX_SceneProxy.h.

double FBX_SceneProxy::sceneScale ( ) const

Scene scale to convert from internal FBX scene. Determined by load() This is currently only used by nodeGlobalTransform()

void FBX_SceneProxy::setActiveClip ( FBX_ClipID  clip)
void FBX_SceneProxy::setClipTimeRange ( FBX_ClipID  clip,
fpreal  start,
fpreal  stop 
)

Get/set the inclusive time range for the given clip in seconds

void FBX_SceneProxy::setGlobalAxisSystem ( const FBX_AxisSystem axis_system)

Set the scene's current axis system

void FBX_SceneProxy::setGlobalAxisSystem ( OP_OrientationMode  orientation_mode)

Set the scene's current axis system

void FBX_SceneProxy::setGlobalFrameRate ( fpreal  fps)
void FBX_SceneProxy::setGlobalTimeRange ( fpreal  start,
fpreal  stop 
)
void FBX_SceneProxy::setNodeLocalRestTransform ( FBX_NodeID  node,
const UT_Matrix4D local 
)

Set a node's local transform without anim.

void FBX_SceneProxy::setNodeScaleInheritanceMode ( FBX_NodeID  node,
UT_ScaleInheritanceMode  inherit 
)
void FBX_SceneProxy::setSceneScale ( fpreal  scale)

Set the scene scale.

int FBX_SceneProxy::skinDeformerCount ( ) const

Count of skin deformers in the file.

FBX_GeometryID FBX_SceneProxy::skinDeformerGeometry ( int  i) const

Get geometry associated with skin deformer i

Note
There might no geometry attached and this will return nullptr
void FBX_SceneProxy::stampDocumentInfo ( const char *  orig_fbx_filename = nullptr)

Stamp FbxDocumentInfo using the current $JOB, $HIPFILE and software version.

bool FBX_SceneProxy::visibility ( FBX_NodeID  node) const

The documentation for this class was generated from the following file: