1/****************************************************************************************
2
3 Copyright (C) 2015 Autodesk, Inc.
4 All rights reserved.
5
6 Use of this software is subject to the terms of the Autodesk license agreement
7 provided at the time of installation or download, or which otherwise accompanies
8 this software in either electronic or hard copy form.
9
10****************************************************************************************/
11
12//! \file fbxcharacterpose.h
13#ifndef _FBXSDK_SCENE_CONSTRAINT_CHARACTER_POSE_H_
14#define _FBXSDK_SCENE_CONSTRAINT_CHARACTER_POSE_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/fbxobject.h>
19#include <fbxsdk/scene/constraint/fbxcharacter.h>
20#include <fbxsdk/scene/geometry/fbxnode.h>
21
22#include <fbxsdk/fbxsdk_nsbegin.h>
23
24/** \class FbxCharacterPose
25 * \nosubgrouping
26 * \brief A character pose is a character and an associated hierarchy of nodes.
27 *
28 * Only the default position of the nodes is considered, the animation data is ignored.
29 *
30 * You can access the content of a character pose, using the functions FbxCharacterPose::GetOffset(),
31 * FbxCharacterPose::GetLocalPosition(), and FbxCharacterPose::GetGlobalPosition().
32 * Their source code is provided inline as examples on how to access the character pose data.
33 *
34 * To create a character pose, You must first create a hierarchy of nodes under the root
35 * node provided by function FbxCharacterPose::GetRootNode(). Then, feed this hierarchy
36 * of nodes into the character returned by function FbxCharacterPose::GetCharacter().
37 * Offsets are set in the character links. Local positions are set using
38 * FbxNode::SetDefaultT(), FbxNode::SetDefaultR(), and FbxNode::SetDefaultS().
39 *
40 * To set local positions from global positions:
41 * -# Declare lCharacterPose as a valid pointer to a FbxCharacterPose;
42 * -# Call lCharacterPose->GetRootNode()->SetLocalStateId(0, true);
43 * -# Call lCharacterPose->GetRootNode()->SetGlobalStateId(1, true);
44 * -# Call FbxNode::SetGlobalState() for all nodes found in the hierarchy under lCharacterPose->GetRootNode();
45 * -# Call lCharacterPose->GetRootNode()->ComputeLocalState(1, true);
46 * -# Call lCharacterPose->GetRootNode()->SetCurrentTakeFromLocalState(FBXSDK_TIME_ZERO, true).
47 */
48class FBXSDK_DLL FbxCharacterPose : public FbxObject
49{
50 FBXSDK_OBJECT_DECLARE(FbxCharacterPose,FbxObject);
51
52public:
53 //! Reset to an empty character pose.
54 void Reset();
55
56 /** Get the root node.
57 * \return Pointer to the root node.
58 */
59 FbxNode* GetRootNode() const;
60
61 /** Get the character.
62 * \return Pointer to the character.
63 */
64 FbxCharacter* GetCharacter() const;
65
66 /** Get offset matrix for a given character node.
67 * \param pCharacterNodeId Character Node ID.
68 * \param pOffset Receives offset matrix.
69 * \return \c true if successful, \c false otherwise.
70 */
71 bool GetOffset(FbxCharacter::ENodeId pCharacterNodeId, FbxAMatrix& pOffset) const;
72
73 /** Get local position for a given character node.
74 * \param pCharacterNodeId Character Node ID.
75 * \param pLocalT Receives local translation vector.
76 * \param pLocalR Receives local rotation vector.
77 * \param pLocalS Receives local scaling vector.
78 * \return \c true if successful, \c false otherwise.
79 */
80 bool GetLocalPosition(FbxCharacter::ENodeId pCharacterNodeId, FbxVector4& pLocalT, FbxVector4& pLocalR, FbxVector4& pLocalS) const;
81
82 /** Get global position for a given character node.
83 * \param pCharacterNodeId Character Node ID.
84 * \param pGlobalPosition Receives global position.
85 * \return \c true if successful, \c false otherwise.
86 */
87 bool GetGlobalPosition(FbxCharacter::ENodeId pCharacterNodeId, FbxAMatrix& pGlobalPosition) const;
88
89 /** Retrieve the pose scene used by this character pose
90 * \return The pose's scene (this is a different scene than the scene the character pose is in). */
91 FbxScene* GetPoseScene() const;
92
93/*****************************************************************************************************************************
94** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
95*****************************************************************************************************************************/
96#ifndef DOXYGEN_SHOULD_SKIP_THIS
97 virtual FbxObject& Copy(const FbxObject& pObject);
98 virtual FbxObject* Clone( FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const;
99 void Clone(FbxScene* pPoseScene, FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL);
100
101protected:
102 virtual void Construct(const FbxObject* pFrom);
103 virtual void Destruct(bool pRecursive);
104
105private:
106 FbxScene* mPoseScene;
107#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
108};
109
110#include <fbxsdk/fbxsdk_nsend.h>
111
112#endif /* _FBXSDK_SCENE_CONSTRAINT_CHARACTER_POSE_H_ */
113