This reference page is linked to from the following overview topics: Supported Scene Elements, List of Python FBX classes.
This class contains the description of a Pose and provide some methods to access Pose info in one FBX scene.
The KFbxPose object 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 a KFbxPose elements. It is therefore the responsibility 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 this KFbxPose object is setup to hold.
If the Add method succeeds, it will return the index of the KFbxPoseInfo structure that as been created and held by the KFbxPose object.
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 the KFbxPoseInfo item by calling Remove(i) and then Add a new one.
The internal list is not ordered and the search inside this list is linear (from the first element to ... the first match or the end of the list).
ExportScene01/main.cxx, ImportScene/DisplayPose.cxx, SwitchBinding/main.cxx, ViewScene/DrawScene.cxx, ViewScene/GetPosition.cxx, and ViewScene/GetPosition.h.
Definition at line 129 of file kfbxpose.h.
#include <kfbxpose.h>
Public Member Functions |
|
void | SetIsBindPose (bool pIsBindPose) |
Set the type of pose. |
|
bool | IsBindPose () const |
Pose identifier flag. |
|
bool | IsRestPose () const |
Pose identifier flag. |
|
int | GetCount () const |
Get number of stored items. |
|
int | Add (KFbxNode *pNode, const 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. |
|
KFbxNode * | GetNode (int pIndex) const |
Get the node. |
|
const KFbxMatrix & | GetMatrix (int pIndex) const |
Get the transform matrix. |
|
bool | IsLocalMatrix (int pIndex) const |
Get the type of the matrix. |
|
Protected Member Functions |
|
KFbxPose (KFbxSdkManager &pManager, char const *pName) | |
virtual KFbxObject & | Copy (const KFbxObject &pObject) |
Copy an object content into this object.
|
|
virtual void | Destruct (bool pRecursive, bool pDependents) |
virtual const char * | GetTypeName () const |
bool | ValidateParams (const KFbxNode *pNode, const KFbxMatrix &pMatrix, int &pPos) |
bool | LocalValidateParams (const KFbxNode *pNode, const KFbxMatrix &pMatrix, int &pPos) |
Static Protected Member Functions |
|
static bool | GetSpecificPoseContaining (int poseType, KFbxScene *pScene, KFbxNode *pNode, PoseList &pPoseList, KArrayTemplate< int > &pIndex) |
Protected Attributes |
|
KError | mError |
Search Section |
|
enum | KNameComponent { INITIALNAME_COMPONENT = 1, CURRENTNAME_COMPONENT = 2, ALL_NAME_COMPONENTS = 3 } |
This structure defines the strategy of comparing FBX node name. More... |
|
int | Find (const KName &pNodeName, char pCompareWhat=ALL_NAME_COMPONENTS) const |
Look in the
KFbxPose object for the given node name. |
|
int | Find (const KFbxNode *pNode) const |
Look in the
KFbxPose object for the given node. |
|
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, NodeList &pMissingAncestors, NodeList &pMissingDeformers, NodeList &pMissingDeformersAncestors, NodeList &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, PoseList &pPoseList, KArrayTemplate< int > &pIndex) |
Get the list of Poses objects that contain
the node with name pNodeName. |
|
static bool | GetPosesContaining (KFbxScene *pScene, KFbxNode *pNode, PoseList &pPoseList, KArrayTemplate< int > &pIndex) |
Get the list of Poses objects that contain
the node with name pNodeName. |
|
static bool | GetBindPoseContaining (KFbxSdkManager &pManager, KFbxNode *pNode, PoseList &pPoseList, KArrayTemplate< int > &pIndex) |
Get the list of BindPose objects that
contain the node with name pNodeName. |
|
static bool | GetBindPoseContaining (KFbxScene *pScene, KFbxNode *pNode, PoseList &pPoseList, KArrayTemplate< int > &pIndex) |
Get the list of BindPose objects that
contain the node with name pNodeName. |
|
static bool | GetRestPoseContaining (KFbxSdkManager &pManager, KFbxNode *pNode, PoseList &pPoseList, KArrayTemplate< int > &pIndex) |
Get the list of RestPose objects that
contain the node with name pNodeName. |
|
static bool | GetRestPoseContaining (KFbxScene *pScene, KFbxNode *pNode, PoseList &pPoseList, KArrayTemplate< int > &pIndex) |
Get the list of RestPose objects that
contain the node with name pNodeName. |
|
Error Management |
|
enum | EError
{ eERROR, eERROR_VALIDBINDPOSE_FAILURE_INVALIDOBJECT, eERROR_VALIDBINDPOSE_FAILURE_INVALIDROOT, eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_NODES, eERROR_VALIDBINDPOSE_FAILURE_NOTALLDEFORMING_NODES, eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_DEFNODES, eERROR_VALIDBINDPOSE_FAILURE_RELATIVEMATRIX, eERROR_COUNT } |
Error identifiers. More... |
|
KError & | GetError () |
Retrieve error object. |
|
EError | GetLastErrorID () const |
Get last error code. |
|
const char * | GetLastErrorString () const |
Get last error string. |
enum KNameComponent |
This structure defines the strategy of comparing FBX node name.
FBX node has an initial name and a current name (refer to KName). The structure defines which name to use when compare two nodes.
INITIALNAME_COMPONENT | |
CURRENTNAME_COMPONENT |
use initial name when compare two nodes |
ALL_NAME_COMPONENTS |
use current name when compare two nodes |
Definition at line 205 of file kfbxpose.h.
{ INITIALNAME_COMPONENT = 1, CURRENTNAME_COMPONENT = 2, ALL_NAME_COMPONENTS = 3 };
enum EError |
Error identifiers.
Definition at line 352 of file kfbxpose.h.
{ eERROR, eERROR_VALIDBINDPOSE_FAILURE_INVALIDOBJECT, eERROR_VALIDBINDPOSE_FAILURE_INVALIDROOT, eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_NODES, eERROR_VALIDBINDPOSE_FAILURE_NOTALLDEFORMING_NODES, eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_DEFNODES, eERROR_VALIDBINDPOSE_FAILURE_RELATIVEMATRIX, eERROR_COUNT } EError;
KFbxPose | ( | KFbxSdkManager & | pManager, |
char const * | pName | ||
) | [protected] |
void SetIsBindPose | ( | bool | pIsBindPose | ) |
Set the type of pose.
pIsBindPose | If true, type will be bind pose, else rest pose. |
bool IsBindPose | ( | ) | const [inline] |
Pose identifier flag.
true
if this object holds BindPose data.Definition at line 142 of file kfbxpose.h.
{ return mType == 'b'; }
bool IsRestPose | ( | ) | const [inline] |
Pose identifier flag.
true
if this object holds RestPose data.Definition at line 147 of file kfbxpose.h.
{ return mType == 'r'; }
int GetCount | ( | ) | const [inline] |
Get number of stored items.
Definition at line 152 of file kfbxpose.h.
{ return mPoseInfo.GetCount(); }
int Add | ( | KFbxNode * | pNode, |
const KFbxMatrix & | pMatrix, | ||
bool | pLocalMatrix =
false , |
||
bool | pMultipleBindPose =
true |
||
) |
Stores the pose transformation for the given node.
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 | Flag to indicate if multiple bind pose exist. If this is false, all matrix for one node should be same in different bind pose. |
void Remove | ( | int | pIndex | ) |
Remove the pIndexth item from the Pose object.
pIndex | Index of the item to be removed. |
KName GetNodeName | ( | int | pIndex | ) | const |
Get the node name.
pIndex | Index of the queried item. |
KFbxNode* GetNode | ( | int | pIndex | ) | const |
Get the node.
pIndex | Index of the queried item. |
const KFbxMatrix& GetMatrix | ( | int | pIndex | ) | const |
Get the transform matrix.
pIndex | Index of the queried item. |
bool IsLocalMatrix | ( | int | pIndex | ) | const |
Get the type of the matrix.
pIndex | Index of the queried item. |
true
if the matrix is defined in the Local
coordinate space and false otherwise.false
.int Find | ( | const KName & | pNodeName, |
char | pCompareWhat =
ALL_NAME_COMPONENTS |
||
) | const |
Look in the KFbxPose object for the given node name.
pNodeName | Name of the node we are looking for. |
pCompareWhat | Bitwise or of the following flags: INTIALNAME_COMPONENT, CURRENTNAME_COMPONENT |
int Find | ( | const KFbxNode * | pNode | ) | const |
Look in the KFbxPose object for the given node.
pNode | the node we are looking for. |
static bool GetPosesContaining | ( | KFbxSdkManager & | pManager, |
KFbxNode * | pNode, | ||
PoseList & | 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.
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. |
true
if the node belongs to at least one Pose
(either a BindPose or a RestPose).static bool GetPosesContaining | ( | KFbxScene * | pScene, |
KFbxNode * | pNode, | ||
PoseList & | pPoseList, | ||
KArrayTemplate< int > & | pIndex | ||
) | [static] |
Get the list of Poses objects that contain the node with name pNodeName.
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. |
true
if the node belongs to at least one Pose
(either a BindPose or a RestPose).static bool GetBindPoseContaining | ( | KFbxSdkManager & | pManager, |
KFbxNode * | pNode, | ||
PoseList & | 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.
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. |
true
if the node belongs to at least one
BindPose.static bool GetBindPoseContaining | ( | KFbxScene * | pScene, |
KFbxNode * | pNode, | ||
PoseList & | pPoseList, | ||
KArrayTemplate< int > & | pIndex | ||
) | [static] |
Get the list of BindPose objects that contain the node with name pNodeName.
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. |
true
if the node belongs to at least one
BindPose.static bool GetRestPoseContaining | ( | KFbxSdkManager & | pManager, |
KFbxNode * | pNode, | ||
PoseList & | 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.
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. |
true
if the node belongs to at least one
RestPose.static bool GetRestPoseContaining | ( | KFbxScene * | pScene, |
KFbxNode * | pNode, | ||
PoseList & | pPoseList, | ||
KArrayTemplate< int > & | pIndex | ||
) | [static] |
Get the list of RestPose objects that contain the node with name pNodeName.
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. |
true
if the node belongs to at least one
RestPose.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.
The conditions are:
pRoot | This node is used as the stop point when visiting the parents (cannot be NULL). |
pMatrixCmpTolerance | Tolerance value when comparing the matrices. |
bool IsValidBindPoseVerbose | ( | KFbxNode * | pRoot, |
NodeList & | pMissingAncestors, | ||
NodeList & | pMissingDeformers, | ||
NodeList & | pMissingDeformersAncestors, | ||
NodeList & | 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.
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 yield to a wrong matrix comparisons are added to this list. |
pMatrixCmpTolerance | Tolerance value when comparing the matrices. |
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.
Instead, keeps running to accumulate the faulty nodes and send them directly to the UserNotification.
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. |
KError& GetError | ( | ) |
EError GetLastErrorID | ( | ) | const |
const char* GetLastErrorString | ( | ) | const |
virtual KFbxObject& Copy | ( | const KFbxObject & | pObject | ) | [protected, virtual] |
Copy an object content into this object.
pObject | The source object to copy data from. |
Reimplemented from KFbxObject.
virtual void Destruct | ( | bool | pRecursive, |
bool | pDependents | ||
) | [protected, virtual] |
Reimplemented from KFbxObject.
virtual const char* GetTypeName | ( | ) | const [protected, virtual] |
Reimplemented from KFbxObject.
bool ValidateParams | ( | const KFbxNode * | pNode, |
const KFbxMatrix & | pMatrix, | ||
int & | pPos | ||
) | [protected] |
bool LocalValidateParams | ( | const KFbxNode * | pNode, |
const KFbxMatrix & | pMatrix, | ||
int & | pPos | ||
) | [protected] |
static bool GetSpecificPoseContaining | ( | int | poseType, |
KFbxScene * | pScene, | ||
KFbxNode * | pNode, | ||
PoseList & | pPoseList, | ||
KArrayTemplate< int > & | pIndex | ||
) | [static, protected] |
Definition at line 398 of file kfbxpose.h.