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 fbxanimstack.h
13#ifndef _FBXSDK_SCENE_ANIMATION_STACK_H_
14#define _FBXSDK_SCENE_ANIMATION_STACK_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/base/fbxtime.h>
19#include <fbxsdk/scene/fbxcollection.h>
20
21#include <fbxsdk/fbxsdk_nsbegin.h>
22
23// these symbols are defined for backward compatibility
24#define FBXSDK_TAKENODE_DEFAULT_NAME "Default"
25#define FBXSDK_ROOTCURVE_DEFAULT_NAME "Defaults"
26
27class FbxTakeInfo;
28class FbxThumbnail;
29class FbxAnimEvaluator;
30
31/** The Animation stack is a collection of animation layers. The Fbx document can have one or
32 * more animation stacks. Each stack can be viewed as one "take" in the previous versions of the FBX SDK.
33 * The "stack" terminology comes from the fact that the object contains 1 to n animation layers that
34 * are evaluated according to their blending modes to produce a resulting animation for a given attribute.
35 * \nosubgrouping
36 */
37class FBXSDK_DLL FbxAnimStack : public FbxCollection
38{
39 FBXSDK_OBJECT_DECLARE(FbxAnimStack, FbxCollection);
40
41public:
42 //////////////////////////////////////////////////////////////////////////
43 //
44 // Properties
45 //
46 //////////////////////////////////////////////////////////////////////////
47 /** This property stores a description string of this animation stack.
48 * This string can be used to display, in a human readable format, information
49 * relative to this animation stack object.
50 * Default value is "".
51 * \remarks The applications using the FBX SDK are not required to manipulate this information.
52 */
53 FbxPropertyT<FbxString> Description;
54
55 /** This property stores the local time span "Start" time.
56 * This "start" time should be seen as a time marker. Typically it would represent the whole animation
57 * starting time but its use (and update) is left to the calling application (with one exception occurring
58 * in the BakeLayers). The FBX SDK does not use this value internally and only guarantees that it will be stored
59 * to the FBX file and retrieved from it.
60 *
61 * Default value is 0.
62 */
63 FbxPropertyT<FbxTime> LocalStart;
64
65 /** This property stores the local time span "Stop" time.
66 * This "stop" time should be seen as a time marker. Typically it would represent the whole animation
67 * ending time but its use (and update) is left to the calling application (with one exception occurring
68 * in the BakeLayers). The FBX SDK does not use this value internally and only guarantees that it will be stored
69 * to the FBX file and retrieved from it.
70 *
71 * Default value is 0
72 */
73 FbxPropertyT<FbxTime> LocalStop;
74
75 /** This property stores the reference time span "Start" time.
76 * This reference start time is another time marker that can be used by the calling application. The FBX SDK
77 * never uses it and only guarantees that this value is stored in the FBX file and retrieved from it.
78 *
79 * Default value is 0
80 */
81 FbxPropertyT<FbxTime> ReferenceStart;
82
83 /** This property stores the reference time span "Stop" time.
84 * This reference stop time is another time marker that can be used by the calling application. The FBX SDK
85 * never uses it and only guarantees that this value is stored in the FBX file and retrieved from it.
86 *
87 * Default value is 0
88 */
89 FbxPropertyT<FbxTime> ReferenceStop;
90
91 /** Reset the object time spans either to their default values or from the pTakeInfo structure, if provided.
92 * \param pTakeInfo The take info to be used during reset.
93 */
94 void Reset(const FbxTakeInfo* pTakeInfo = NULL);
95
96 /**
97 * \name Utility functions.
98 *
99 */
100 //@{
101 /** Get the LocalStart and LocalStop time properties as a FbxTimeSpan.
102 * \return The current local time span.
103 */
104 FbxTimeSpan GetLocalTimeSpan() const;
105
106 /** Set the LocalStart and LocalStop time properties from a FbxTimeSpan.
107 * \param pTimeSpan The new local time span.
108 */
109 void SetLocalTimeSpan(FbxTimeSpan& pTimeSpan);
110
111 /** Get the ReferenceStart and ReferenceStop time properties as a FbxTimeSpan.
112 * \return The current reference time span.
113 */
114 FbxTimeSpan GetReferenceTimeSpan() const;
115
116 /** Set the ReferenceStart and ReferenceStop time properties from a FbxTimeSpan.
117 * \param pTimeSpan The new reference time span.
118 */
119 void SetReferenceTimeSpan(FbxTimeSpan& pTimeSpan);
120
121 /** Bake all the animation layers on the base layer.
122 * This function will process all the properties on every animation layer and generate a re-sampled set of
123 * animation keys (representing the layers' evaluated result) on the base layer. Once this operation is completed
124 * successfully, all the layers (except the base one) are destroyed. Properties that are only defined on the base
125 * layer will remain unaffected by the re-sampling. The stack local timespan is updated with the overall animation range.
126 *
127 * \param pEvaluator The layer evaluator. This is the engine that evaluates the overall result of any given
128 * property according to the layers flags.
129 * \param pStart The start time of the re-sampling range.
130 * \param pStop The stop time of the re-sampling range.
131 * \param pPeriod The time increment for the re-sampling.
132 * \return \c true if the operation was successful and \c false in case of errors.
133 * \remarks If this AnimStack contains only one AnimLayer, the function will return false and do nothing.
134 */
135 bool BakeLayers(FbxAnimEvaluator* pEvaluator, FbxTime pStart, FbxTime pStop, FbxTime pPeriod);
136 //@}
137
138/*****************************************************************************************************************************
139** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
140*****************************************************************************************************************************/
141#ifndef DOXYGEN_SHOULD_SKIP_THIS
142protected:
143 virtual void ConstructProperties(bool pForceSet);
144 virtual void Destruct(bool pRecursive);
145#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
146};
147
148#include <fbxsdk/fbxsdk_nsend.h>
149
150#endif /* _FBXSDK_SCENE_ANIMATION_STACK_H_ */
151