Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends

KFbxAxisSystem Class Reference

This reference page is linked to from the following overview topics: 2012.1, Supported Scene Elements, Scene Axis and Unit Conversion, List of Python FBX classes.


Search for all occurrences

Detailed Description

This class represents the coordinate system of the scene and can convert scenes to other coordinate systems.

By default the KFbxScene uses a Y-Up axis system. If the calling application wishes to change the default axis it will need to define the new axis system and call the convert method with the scene as argument. The appropriate transforms will be applied to the first level objects of the scene only (objects whose parent is the scene itself). Child objects do not need to be transformed since they inherit from their parents. The adjustment will affect the translation animation curves and the objects pivots values (the rotation transformation is applied as a pre-rotation transform therefore the rotation animation curves do not need to be transformed). Once converted, the scene will have its axis definition changed to the new system.

For example:

        KFbxScene* lScene = KFbxScene::Create(sdkmanager, "MyScene");
        ...
        // the scene is filled with objects

        int dir;
        lScene->GetGlobalSettings().GetAxisSystem().GetUpVector(dir); // this returns the equivalent of KFbxAxisSystem::YAxis

        KFbxAxisSystem max; // we desire to convert the scene from Y-Up to Z-Up
        max.ConvertScene(lScene);

        lScene->GetGlobalSettings().GetAxisSystem().GetUpVector(dir); // this will now return the equivalent of KFbxAxisSystem::ZAxis

No conversion will take place if the scene current axis system is equal to the new one.

The eUpVector specifies which axis has the up and down direction in the system (typically this is the Y or Z axis). The sign of the eUpVector is applied to represent the direction (1 is up and -1 is down relative to the observer).

The eFrontVector specifies which axis has the front and back direction in the system. It is not an independent variable, which means it depends on eUpVector. The enum values ParityEven and ParityOdd denote the first one and the second one of the remain two axes in addition to the up axis.

For example if the up axis is X, the remain two axes will be Y And Z, so the ParityEven is Y, and the ParityOdd is Z ; If the up axis is Y, the remain two axes will X And Z, so the ParityEven is X, and the ParityOdd is Z; If the up axis is Z, the remain two axes will X And Y, so the ParityEven is X, and the ParityOdd is Y.

There still needs a parameter to denote the direction of the eFrontVector just as the eUpVector. And the sign of the eFrontVector represents the direction (1 is front and -1 is back relative to observer).

If the front axis and the up axis are determined, the third axis will be automatically determined as the left one. The eCoorSystem enum is a parameter to determine the direction of the third axis just as the eUpVector sign. It determines if the axis system is right-handed or left-handed just as the enum values.

Some code for reconstructing a KFbxAxisSystem object from reference scene.

        //the reference scene
        KFbxScene* lSceneReference = KFbxScene::Create(sdkmanager, "ReferenceScene");
        ...
        // the scene is filled with objects

        KFbxAxisSystem lAxisSytemReference = lSceneReference->GetGlobalSettings().GetAxisSystem();

        int lUpVectorSign = 1;
        int lFrontVectorSign = 1;

        //get upVector and its sign.
        eUpVector lUpVector = lAxisSsytemReference.getUpVector( lUpVectorSign );

        //get FrontVector and its sign.
        eFrontVector lFrontVector = lAxisSsytemReference.getFrontVector( lFrontVectorSign );

        //get uCoorSystem. 
        eCoorSystem lCoorSystem = lAxisSsytemReference.GetCoorSystem();

        //The KFbxAxisSystem object to reconstruct back by saved parameter
        KFbxAxisSystem lAxisSytemReconstruct( lUpVectorSign * lUpVector, 
                                              lFrontVectorSign * lFrontVector,
                                              lCoorSystem);
Examples:

ViewScene/main.cxx.

Definition at line 105 of file kfbxaxissystem.h.

#include <kfbxaxissystem.h>

List of all members.

Classes

class   KFbxAxis

Public Types

enum   eUpVector { XAxis = 1, YAxis = 2, ZAxis = 3 }
 

Specifies which canonical axis represents up in the system (typically Y or Z).

More...
enum   eFrontVector { ParityEven = 1, ParityOdd = 2 }
 

Vector with origin at the screen pointing toward the camera.

More...
enum   eCoorSystem { RightHanded = 0, LeftHanded = 1 }
 

Specifies the third vector of the system.

More...
enum   ePreDefinedAxisSystem {
  eMayaZUp = 0, eMayaYUp, eMax, eMotionBuilder,
  eOpenGL, eDirectX, eLightwave
}
 

Enumeration that can be used to initialize a new instance of this class with predefined configurations (see the "Predefined axis systems" section).

More...

Public Member Functions

KFbxAxisSystem operator= (const KFbxAxisSystem &pAxisSystem)
  Assignment operation.
void  ConvertScene (KFbxScene *pScene) const
  Convert a scene to this axis system.
void  ConvertScene (KFbxScene *pScene, KFbxNode *pFbxRoot) const
  Convert a scene to this axis system by using the specified node as an Fbx_Root.
eFrontVector  GetFrontVector (int &pSign) const
  Get the eFrontVector and its sign of this axis system.
eUpVector  GetUpVector (int &pSign) const
  Get the eUpVector and its sign of this axis system.
eCoorSystem  GetCoorSystem () const
  Accessor to the eCoorSystem of this object.
void  ConvertChildren (KFbxNode *pRoot, const KFbxAxisSystem &pSrcSystem) const
  Converts the children of the given node to this axis system.

Protected Member Functions

void  ConvertTProperty (KArrayTemplate< KFbxNode * > &pNodes, const KFbxAxisSystem &pFrom) const
  Apply the axis conversion to the translation property of the nodes.
void  ConvertCurveNodes (KArrayTemplate< KFbxAnimCurveNode * > &pCurveNodes, const KFbxAxisSystem &pFrom) const
  Apply the axis conversion to the translation animation curves.
void  AdjustPreRotation (KFbxNode *pNode, const KFbxMatrix &pConversionRM) const
  Adjust the Pre rotation to orient the node and children correctly.
void  AdjustPivots (KFbxNode *pNode, const KFbxMatrix &pConversionRM) const
  Adjust the pivots of the node for the new axis system.
void  GetConversionMatrix (const KFbxAxisSystem &pFrom, KFbxMatrix &pConversionRM) const
  Computes the transformation matrix to pass from the pFrom system to this one.
void  AdjustLimits (KFbxNode *pNode, const KFbxMatrix &pConversionRM) const
  Adjust the node translation limits for the new axis system.
void  AdjustPoses (KFbxScene *pScene, const KFbxMatrix &pConversionRM) const
  Adjust all the poses in the pScene for the new axis system.
void  AdjustCamera (KFbxNode *pNode, const KFbxMatrix &pConversionRM) const
  Recompute the camera's up-vector for the new axis system.
void  AdjustCluster (KFbxNode *pNode, const KFbxMatrix &pConversionRM) const
  Adjust the node cluster's matrices for the new axis system.
void  ConvertChildren (KFbxNode *pRoot, const KFbxAxisSystem &pSrcSystem, bool pSubChildrenOnly) const
  This is the main function that will dispatch all the calls of the "Adjust" methods.

Protected Attributes

KFbxAxis  mUpVector
  The up vector (and sign) of this object.
KFbxAxis  mFrontVector
  The front vector (and sign) of this object.
KFbxAxis  mCoorSystem
  The third vector (and sign) of this object.

Friends

class  KFbxGlobalSettings

Constructor and Destructor

  KFbxAxisSystem (eUpVector pUpVector, eFrontVector pFrontVector, eCoorSystem pCoorSystem)
  Constructor!
  KFbxAxisSystem (const KFbxAxisSystem &pAxisSystem)
  Copy constructor!
  KFbxAxisSystem (const ePreDefinedAxisSystem pAxisSystem)
  Constructor!
virtual  ~KFbxAxisSystem ()
  Destructor.

Boolean operation.

bool  operator== (const KFbxAxisSystem &pAxisSystem) const
  Equivalence operator.
bool  operator!= (const KFbxAxisSystem &pAxisSystem) const
  Non-equivalence operator.

Predefined axis systems.

These static members define the axis system of the most popular applications.
static const KFbxAxisSystem  MayaZUp
  Predefined axis system: MayaZUp (UpVector = +Z, FrontVector = -Y, CoordSystem = +X (RightHanded))
static const KFbxAxisSystem  MayaYUp
  Predefined axis system: MayaYUp (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))
static const KFbxAxisSystem  Max
  Predefined axis system: Max (UpVector = +Z, FrontVector = -Y, CoordSystem = +X (RightHanded))
static const KFbxAxisSystem  Motionbuilder
  Predefined axis system: Motionbuilder (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))
static const KFbxAxisSystem  OpenGL
  Predefined axis system: OpenGL (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))
static const KFbxAxisSystem  DirectX
  Predefined axis system: DirectX (UpVector = +Y, FrontVector = +Z, CoordSystem = -X (LeftHanded))
static const KFbxAxisSystem  Lightwave
  Predefined axis system: Lightwave (UpVector = +Y, FrontVector = +Z, CoordSystem = -X (LeftHanded))

Member Enumeration Documentation

enum eUpVector

Specifies which canonical axis represents up in the system (typically Y or Z).

Enumerator:
XAxis 
YAxis 
ZAxis 

Definition at line 111 of file kfbxaxissystem.h.

                   {
        XAxis =    1,
        YAxis =    2,
        ZAxis =    3
    };

Vector with origin at the screen pointing toward the camera.

This is a subset of enum eUpVector because axis cannot be repeated. We use the system of "parity" to define this vector because its value (X,Y or Z axis) really depends on the up-vector. The ePreDefinedAxisSystem list the up-vector, parity and coordinate system values for the predefined systems.

Enumerator:
ParityEven 
ParityOdd 

Definition at line 123 of file kfbxaxissystem.h.

                      {
        ParityEven = 1,
        ParityOdd  = 2
    };

Specifies the third vector of the system.

The KFbxAxisSystem deduces the correct vector and direction based on this flag and the relationship with the up and front vectors. The ePreDefinedAxisSystem list the up-vector, parity and coordinate system values for the predefined systems.

Enumerator:
RightHanded 
LeftHanded 

Definition at line 133 of file kfbxaxissystem.h.

                     {
        RightHanded = 0,
        LeftHanded  = 1
    };

Enumeration that can be used to initialize a new instance of this class with predefined configurations (see the "Predefined axis systems" section).

Enumerator:
eMayaZUp 

UpVector = ZAxis, FrontVector = -ParityOdd, CoordSystem = RightHanded.

eMayaYUp 

UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded.

eMax 

UpVector = ZAxis, FrontVector = -ParityOdd, CoordSystem = RightHanded.

eMotionBuilder 

UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded.

eOpenGL 

UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = RightHanded.

eDirectX 

UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = LeftHanded.

eLightwave 

UpVector = YAxis, FrontVector = ParityOdd, CoordSystem = LeftHanded.

Definition at line 141 of file kfbxaxissystem.h.


Constructor & Destructor Documentation

KFbxAxisSystem ( eUpVector  pUpVector,
eFrontVector  pFrontVector,
eCoorSystem  pCoorSystem 
)

Constructor!

Parameters:
pUpVector Specify the up vector.
pFrontVector Specify the front vector.
pCoorSystem Specify RightHanded coordinate system or LeftHanded coordinate system.
KFbxAxisSystem ( const KFbxAxisSystem pAxisSystem )

Copy constructor!

Parameters:
pAxisSystem Another KFbxAxisSystem object copied to this one.
KFbxAxisSystem ( const ePreDefinedAxisSystem  pAxisSystem )

Constructor!

Parameters:
pAxisSystem Specify which predefined axis system to copy.
virtual ~KFbxAxisSystem ( ) [virtual]

Destructor.


Member Function Documentation

bool operator== ( const KFbxAxisSystem pAxisSystem ) const

Equivalence operator.

Parameters:
pAxisSystem The axis system to compare against this one.
Returns:
true if these two axis systems are equal, false otherwise.
bool operator!= ( const KFbxAxisSystem pAxisSystem ) const

Non-equivalence operator.

Parameters:
pAxisSystem The axis system to compare against this one.
Returns:
true if these two axis systems are unequal, false otherwise.
KFbxAxisSystem& operator= ( const KFbxAxisSystem pAxisSystem )

Assignment operation.

Parameters:
pAxisSystem Axis system assigned to this one.
void ConvertScene ( KFbxScene pScene ) const

Convert a scene to this axis system.

Sets the axis system of the scene to this system unit.

Parameters:
pScene The scene to convert
void ConvertScene ( KFbxScene pScene,
KFbxNode pFbxRoot 
) const

Convert a scene to this axis system by using the specified node as an Fbx_Root.

This is provided for backwards compatibility only and ConvertScene(KFbxScene* pScene) should be used instead when possible.

Parameters:
pScene The scene to convert
pFbxRoot The Fbx_Root node that will be transformed.
eFrontVector GetFrontVector ( int &  pSign ) const

Get the eFrontVector and its sign of this axis system.

Parameters:
pSign The sign of the axis, 1 for front, -1 for back (relative to observer).
Returns:
The eFrontVector of this axis system.
eUpVector GetUpVector ( int &  pSign ) const

Get the eUpVector and its sign of this axis system.

Parameters:
pSign The sign of the axis, 1 for up, -1 for down (relative to observer).
Returns:
The eUpVector of this axis system.
eCoorSystem GetCoorSystem ( ) const

Accessor to the eCoorSystem of this object.

Returns:
The current coordinate axis system of this object.
void ConvertChildren ( KFbxNode pRoot,
const KFbxAxisSystem pSrcSystem 
) const

Converts the children of the given node to this axis system.

Unlike the ConvertScene() method, this method does not set the axis system of the scene that the pRoot node belongs, nor does it adjust KFbxPoses as they are not stored under the scene, and not under a particular node.

Parameters:
pRoot The node whose children are converted.
pSrcSystem The source axis system.
void ConvertTProperty ( KArrayTemplate< KFbxNode * > &  pNodes,
const KFbxAxisSystem pFrom 
) const [protected]

Apply the axis conversion to the translation property of the nodes.

void ConvertCurveNodes ( KArrayTemplate< KFbxAnimCurveNode * > &  pCurveNodes,
const KFbxAxisSystem pFrom 
) const [protected]

Apply the axis conversion to the translation animation curves.

void AdjustPreRotation ( KFbxNode pNode,
const KFbxMatrix pConversionRM 
) const [protected]

Adjust the Pre rotation to orient the node and children correctly.

void AdjustPivots ( KFbxNode pNode,
const KFbxMatrix pConversionRM 
) const [protected]

Adjust the pivots of the node for the new axis system.

void GetConversionMatrix ( const KFbxAxisSystem pFrom,
KFbxMatrix pConversionRM 
) const [protected]

Computes the transformation matrix to pass from the pFrom system to this one.

void AdjustLimits ( KFbxNode pNode,
const KFbxMatrix pConversionRM 
) const [protected]

Adjust the node translation limits for the new axis system.

void AdjustPoses ( KFbxScene pScene,
const KFbxMatrix pConversionRM 
) const [protected]

Adjust all the poses in the pScene for the new axis system.

void AdjustCamera ( KFbxNode pNode,
const KFbxMatrix pConversionRM 
) const [protected]

Recompute the camera's up-vector for the new axis system.

void AdjustCluster ( KFbxNode pNode,
const KFbxMatrix pConversionRM 
) const [protected]

Adjust the node cluster's matrices for the new axis system.

void ConvertChildren ( KFbxNode pRoot,
const KFbxAxisSystem pSrcSystem,
bool  pSubChildrenOnly 
) const [protected]

This is the main function that will dispatch all the calls of the "Adjust" methods.


Friends And Related Function Documentation

friend class KFbxGlobalSettings [friend]

Definition at line 337 of file kfbxaxissystem.h.


Member Data Documentation

const KFbxAxisSystem MayaZUp [static]

Predefined axis system: MayaZUp (UpVector = +Z, FrontVector = -Y, CoordSystem = +X (RightHanded))

Definition at line 207 of file kfbxaxissystem.h.

const KFbxAxisSystem MayaYUp [static]

Predefined axis system: MayaYUp (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))

Definition at line 210 of file kfbxaxissystem.h.

const KFbxAxisSystem Max [static]

Predefined axis system: Max (UpVector = +Z, FrontVector = -Y, CoordSystem = +X (RightHanded))

Definition at line 213 of file kfbxaxissystem.h.

const KFbxAxisSystem Motionbuilder [static]

Predefined axis system: Motionbuilder (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))

Definition at line 216 of file kfbxaxissystem.h.

const KFbxAxisSystem OpenGL [static]

Predefined axis system: OpenGL (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))

Definition at line 219 of file kfbxaxissystem.h.

const KFbxAxisSystem DirectX [static]

Predefined axis system: DirectX (UpVector = +Y, FrontVector = +Z, CoordSystem = -X (LeftHanded))

Definition at line 222 of file kfbxaxissystem.h.

const KFbxAxisSystem Lightwave [static]

Predefined axis system: Lightwave (UpVector = +Y, FrontVector = +Z, CoordSystem = -X (LeftHanded))

Definition at line 225 of file kfbxaxissystem.h.

KFbxAxis mUpVector [protected]

The up vector (and sign) of this object.

Definition at line 295 of file kfbxaxissystem.h.

KFbxAxis mFrontVector [protected]

The front vector (and sign) of this object.

Definition at line 298 of file kfbxaxissystem.h.

KFbxAxis mCoorSystem [protected]

The third vector (and sign) of this object.

Definition at line 301 of file kfbxaxissystem.h.


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

KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem
KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem KFbxAxisSystem