KFbxPose
#include<kfbxpose.h>

Inheritance diagram for KFbxPose:

Inheritance graph
[legend]

List of all members.

Detailed Description

This class contains the description of a Pose manager.

TheKFbxPoseobject can be setup to hold "Bind Pose" data or "Rest Pose" data.

The Bind Pose holds the transformation (translation, rotation and scaling) matrix of all the nodes implied in a link deformation. This includes the geometry being deformed, the links deforming the geometry, and recursively all the ancestors nodes of the link. The Bind Pose gives you the transformation of the nodes at the moment of the binding operation when no deformation occurs.

The Rest Pose is a snapshot of a node transformation. A Rest Pose can be used to store the position of every node of a character at a certain point in time. This pose can then be used as a reference position for animation tasks, like editing walk cycles.

One difference between the two modes is in the validation performed before adding an item and the kind of matrix stored.

In "Bind Pose" mode, the matrix is assumed to be defined in the global space, while in "Rest Pose" the type of the matrix may be specified by the caller. So local system matrices can be used. Actually, because there is one such flag for each entry (KFbxPoseInfo), it is possible to have mixed types in aKFbxPoseelements. It is therefore the responsability of the caller to check for the type of the retrieved matrix and to do the appropriate conversions if required.

The validation of the data to be added consists of the following steps:

The above test is only performed for the "Bind Pose" type. While the next one is always performed, no matter what kind of poses thisKFbxPoseobject is setup to hold.

If the Add method succeeds, it will return the index of theKFbxPoseInfostructure that as been created and held by theKFbxPoseobject.

To ensure data integrity, the stored information can only be accessed using the provided methods (read-only). If an entry needs to be modified, the caller has to remove theKFbxPoseInfoitem by calling Remove(i) and then Add a new one.

The internal list is not ordered and the search inside this is list is linear (from the first element to ... the first match or the end of the list).

Definition at line126of filekfbxpose.h.


Search Section

enum KNameComponent
int Find(KName&pNodeName, char pCompareWhat=ALL_NAME_COMPONENTS)
 Look in theKFbxPoseobject for the given node name.
int Find(KFbxNode*pNode)
 Look in theKFbxPoseobject for the given node.

Error Management

enum EError
 Error identifiers.More...
KErrorGetError()
 Retrieve error object.
EError GetLastErrorID() const
 Get last error code.
const char * GetLastErrorString() const
 Get last error string.

Utility Section

bool IsValidBindPose(KFbxNode*pRoot, double pMatrixCmpTolerance=0.0001)
 Check this bindpose and report an error if all the conditions to a valid bind pose are not met.
bool IsValidBindPoseVerbose(KFbxNode*pRoot, KArrayTemplate<KFbxNode*>&pMissingAncestors, KArrayTemplate<KFbxNode*>&pMissingDeformers, KArrayTemplate<KFbxNode*>&pMissingDeformersAncestors, KArrayTemplate<KFbxNode*>&pWrongMatrices, double pMatrixCmpTolerance=0.0001)
 Same as IsValidBindPose but slower because it will not stop as soon as a failure occurs.
bool IsValidBindPoseVerbose(KFbxNode*pRoot,KFbxUserNotification*pUserNotification, double pMatrixCmpTolerance=0.0001)
 Same as IsValidBindPose but slower because it will not stop as soon as a failure occurs.
static bool GetPosesContaining(KFbxSdkManager&pManager,KFbxNode*pNode, KArrayTemplate<KFbxPose*>&pPoseList, KArrayTemplate<int>&pIndex)
 Get the list of Poses objects that contain the node with name pNodeName.
static bool GetPosesContaining(KFbxScene*pScene,KFbxNode*pNode, KArrayTemplate<KFbxPose*>&pPoseList, KArrayTemplate<int>&pIndex)
 Get the list of Poses objects that contain the node with name pNodeName.
static bool GetBindPoseContaining(KFbxSdkManager&pManager,KFbxNode*pNode, KArrayTemplate<KFbxPose*>&pPoseList, KArrayTemplate<int>&pIndex)
 Get the list of BindPose objects that contain the node with name pNodeName.
static bool GetBindPoseContaining(KFbxScene*pScene,KFbxNode*pNode, KArrayTemplate<KFbxPose*>&pPoseList, KArrayTemplate<int>&pIndex)
 Get the list of BindPose objects that contain the node with name pNodeName.
static bool GetRestPoseContaining(KFbxSdkManager&pManager,KFbxNode*pNode, KArrayTemplate<KFbxPose*>&pPoseList, KArrayTemplate<int>&pIndex)
 Get the list of RestPose objects that contain the node with name pNodeName.
static bool GetRestPoseContaining(KFbxScene*pScene,KFbxNode*pNode, KArrayTemplate<KFbxPose*>&pPoseList, KArrayTemplate<int>&pIndex)
 Get the list of RestPose objects that contain the node with name pNodeName.

Public Member Functions

void SetIsBindPose(bool pIsBindPose)
 Set the type of pose.
bool IsBindPose() const
 Pose identifier flag.
bool IsRestPose()
 Pose identifier flag.
int GetCount() const
 Get number of stored items.
int Add(KFbxNode*pNode,KFbxMatrix&pMatrix, bool pLocalMatrix=false, bool pMultipleBindPose=true)
 Stores the pose transformation for the given node.
void Remove(int pIndex)
 Remove the pIndexth item from the Pose object.
KName GetNodeName(int pIndex) const
 Get the node name.
KFbxNodeGetNode(int pIndex) const
 Get the node.
constKFbxMatrixGetMatrix(int pIndex) const
 Get the transform matrix.
bool IsLocalMatrix(int pIndex)
 Get the type of the matrix.

Member Enumeration Documentation

enumEError

Error identifiers.

  • eERROR
  • eERROR_COUNT

Definition at line370of filekfbxpose.h.

Member Function Documentation

void SetIsBindPose(bool pIsBindPose ) 

Set the type of pose.

Parameters:
pIsBindPose If true, type will be bind pose, else rest pose.

bool IsBindPose( ) const[inline]

Pose identifier flag.

Returns:
trueif this object holds BindPose data.

Definition at line138of filekfbxpose.h.

bool IsRestPose( ) [inline]

Pose identifier flag.

Returns:
trueif this object holds RestPose data.

Definition at line143of filekfbxpose.h.

int GetCount( ) const[inline]

Get number of stored items.

Returns:
The number of items stored.

Definition at line148of filekfbxpose.h.

int Add(KFbxNodepNode,
KFbxMatrixpMatrix,
bool pLocalMatrix=false,
bool pMultipleBindPose=true 
)

Stores the pose transformation for the given node.

Parameters:
pNode pointer to the node for which the pose is stored.
pMatrix Pose transform of the node.
pLocalMatrix Flag to indicate if pMatrix is defined in Local or Global space.
pMultipleBindPose 
Returns:
-1 if the function failed or the index of the stored item.

void Remove(int pIndex ) 

Remove the pIndexth item from the Pose object.

Parameters:
pIndex Index of the item to be removed.

KNameGetNodeName(int pIndex ) const

Get the node name.

Parameters:
pIndex Index of the queried item.
Returns:
The node intial and current names.
Remarks:
If the index is invalid ann emptyKNameis returned.

KFbxNode* GetNode(int pIndex ) const

Get the node.

Parameters:
pIndex Index of the queried item.
Returns:
A pointer to the node referenced.
Remarks:
If the index is invalid or no pointer to a node is set, returns NULL. The returned pointer will become undefined if theKFbxPoseobject is destroyed.

constKFbxMatrix&GetMatrix(int pIndex ) const

Get the transform matrix.

Parameters:
pIndex Index of the queried item.
Returns:
A reference to the pose matrix.
Remarks:
If the index is invalid a reference to an identiy matrix is returned. The reference will become undefined if theKFbxPoseobject is destroyed.

bool IsLocalMatrix(int pIndex ) 

Get the type of the matrix.

Parameters:
pIndex Index of the queried item.
Returns:
trueif the matrix is defined in the Local coordinate space and false otherwise.
Remarks:
If theKFbxPoseobject is configured to hold BindPose data, this method will always returnfalse.

int Find(KNamepNodeName,
char pCompareWhat=ALL_NAME_COMPONENTS 
)

Look in theKFbxPoseobject for the given node name.

Parameters:
pNodeName Name of the node we are looking for.
pCompareWhat Bitwise or of the following flags: INTIALNAME_COMPONENT, CURRENTNAME_COMPONENT
Returns:
-1 if the node is not in the list. Otherwise, the index of the correspondingKFbxPoseInfoelement.

int Find(KFbxNodepNode ) 

Look in theKFbxPoseobject for the given node.

Parameters:
pNode the node we are looking for.
Returns:
-1 if the node is not in the list. Otherwise, the index of the correspondingKFbxPoseInfoelement.

static bool GetPosesContaining(KFbxSdkManagerpManager,
KFbxNodepNode,
KArrayTemplate<KFbxPose*>& pPoseList,
KArrayTemplate<int>& pIndex 
)[static]

Get the list of Poses objects that contain the node with name pNodeName.

This method will look in all the poses of all the scenes.

Parameters:
pManager The manager owning the poses and scenes.
pNode The node being explored.
pPoseList List of BindPoses/RestPoses that have the node.
pIndex List of indices of the nodes in the corresponding poses lists.
Returns:
trueif the node belongs to at least one Pose (either a BindPose or a RestPose).
Remarks:
The pPoseList and pIndex are filled by this method. The elements of the returned list must not be deleted since they still belong to the scene.

static bool GetPosesContaining(KFbxScenepScene,
KFbxNodepNode,
KArrayTemplate<KFbxPose*>& pPoseList,
KArrayTemplate<int>& pIndex 
)[static]

Get the list of Poses objects that contain the node with name pNodeName.

Parameters:
pScene Scene owning the poses.
pNode The node being explored.
pPoseList List of BindPoses/RestPoses that have the node.
pIndex List of indices of the nodes in the corresponding poses lists.
Returns:
trueif the node belongs to at least one Pose (either a BindPose or a RestPose).
Remarks:
The pPoseList and pIndex are filled by this method. The elements of the returned list must not be deleted since they still belong to the scene.

static bool GetBindPoseContaining(KFbxSdkManagerpManager,
KFbxNodepNode,
KArrayTemplate<KFbxPose*>& pPoseList,
KArrayTemplate<int>& pIndex 
)[static]

Get the list of BindPose objects that contain the node with name pNodeName.

This method will look in all the bind poses of all the scenes.

Parameters:
pManager The manager owning the poses.
pNode The node being explored.
pPoseList List of BindPoses that have the node.
pIndex List of indices of the nodes in the corresponding bind poses lists.
Returns:
trueif the node belongs to at least one BindPose.
Remarks:
The pPoseList and pIndex are filled by this method. The elements of the returned list must not be deleted since they still belong to the scene.

static bool GetBindPoseContaining(KFbxScenepScene,
KFbxNodepNode,
KArrayTemplate<KFbxPose*>& pPoseList,
KArrayTemplate<int>& pIndex 
)[static]

Get the list of BindPose objects that contain the node with name pNodeName.

Parameters:
pScene The scene owning the poses.
pNode The node being explored.
pPoseList List of BindPoses that have the node.
pIndex List of indices of the nodes in the corresponding bind poses lists.
Returns:
trueif the node belongs to at least one BindPose.
Remarks:
The pPoseList and pIndex are filled by this method. The elements of the returned list must not be deleted since they still belong to the scene.

static bool GetRestPoseContaining(KFbxSdkManagerpManager,
KFbxNodepNode,
KArrayTemplate<KFbxPose*>& pPoseList,
KArrayTemplate<int>& pIndex 
)[static]

Get the list of RestPose objects that contain the node with name pNodeName.

This method will look in all the bind poses of all the scenes.

Parameters:
pManager The manager owning the poses.
pNode The node being explored.
pPoseList List of RestPoses that have the node.
pIndex List of indices of the nodes in the corresponding rest poses lists.
Returns:
trueif the node belongs to at least one RestPose.
Remarks:
The pPoseList and pIndex are filled by this method. The elements of the returned list must not be deleted since they still belong to the scene.

static bool GetRestPoseContaining(KFbxScenepScene,
KFbxNodepNode,
KArrayTemplate<KFbxPose*>& pPoseList,
KArrayTemplate<int>& pIndex 
)[static]

Get the list of RestPose objects that contain the node with name pNodeName.

Parameters:
pScene The scene owning the poses.
pNode The node being explored.
pPoseList List of RestPoses that have the node.
pIndex List of indices of the nodes in the corresponding rest poses lists.
Returns:
trueif the node belongs to at least one RestPose.
Remarks:
The pPoseList and pIndex are filled by this method. The elements of the returned list must not be deleted since they still belong to the scene.

bool IsValidBindPose(KFbxNodepRoot,
double pMatrixCmpTolerance=0.0001 
)

Check this bindpose and report an error if all the conditions to a valid bind pose are not met.

The conditions are:

a) We are a BindPose. b) For every node in the bind pose, all their parent node are part of the bind pose. c) All the deforming nodes are part of the bind pose. d) All the parents of the deforming nodes are part of the bind pose. e) Each deformer relative matrix correspond to the deformer Inv(bindMatrix) * deformed Geometry bindMatrix.

Parameters:
pRoot This node is used as the stop point when visiting the parents (cannot be NULL).
pMatrixCmpTolerance Tolerance value when comparing the matrices.
Returns:
true if all the above conditions are met and false otherwise.
Remarks:
If the returned value is false, querying for the error will return the reason of the failure. As soon as one of the above conditions is not met, this method return ignoring any subsequent errors. Run the IsBindPoseVerbose if more details are needed.

bool IsValidBindPoseVerbose(KFbxNodepRoot,
KArrayTemplate<KFbxNode*>& pMissingAncestors,
KArrayTemplate<KFbxNode*>& pMissingDeformers,
KArrayTemplate<KFbxNode*>& pMissingDeformersAncestors,
KArrayTemplate<KFbxNode*>& pWrongMatrices,
double pMatrixCmpTolerance=0.0001 
)

Same as IsValidBindPose but slower because it will not stop as soon as a failure occurs.

Instead, keeps running to accumulate the faulty nodes (stored in the appropriate array). It is then up to the caller to fill the UserNotification if desired.

Parameters:
pRoot This node is used as the stop point when visiting the parents (cannot be NULL).
pMissingAncestors Each ancestor missing from the BindPose is added to this list.
pMissingDeformers Each deformer missing from the BindPose is added to this list.
pMissingDeformersAncestors Each deformer ancestors missing from the BindPose is added to this list.
pWrongMatrices Nodes that yeld to a wrong matric comparisons are added to this list.
pMatrixCmpTolerance Tolerance value when comparing the matrices.

bool IsValidBindPoseVerbose(KFbxNodepRoot,
KFbxUserNotificationpUserNotification,
double pMatrixCmpTolerance=0.0001 
)

Same as IsValidBindPose but slower because it will not stop as soon as a failure occurs.

Instead, keeps running to accumulate the faulty nodes and send them directly to the UserNotification.

Parameters:
pRoot This node is used as the stop point when visiting the parents (cannot be NULL).
pUserNotification Pointer to the user notification where the messages will be accumulated.
pMatrixCmpTolerance Tolerance value when comparing the matrices.
Remarks:
If the pUserNotification parameter is NULL, this method will call IsValidBindPose.

KError&GetError( ) 

Retrieve error object.

Returns:
Reference to error object.

EErrorGetLastErrorID( ) const

Get last error code.

Returns:
Last error code.

const char* GetLastErrorString( ) const

Get last error string.

Returns:
Textual description of the last error.