Emergency 20 Dokumentation  4.2.0
PlayAnimationAction.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
19 
20 
21 //[-------------------------------------------------------]
22 //[ Namespace ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Public definitions ]
41  //[-------------------------------------------------------]
42  public:
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public methods ]
48  //[-------------------------------------------------------]
49  public:
55 
60  virtual ~PlayAnimationAction();
61 
66  void init(const std::string& animationPath, bool waitForFinish = false, bool loopAnimation = false, bool reverse = false, qsf::Time blendTime = qsf::Time::ZERO, const boost::optional<qsf::Time> maxPlayTime = boost::optional<qsf::Time>());
67 
68  // Just clear the person animation (which enforces that it will check for a new animation state)
69  void initClearPersonAnimation();
70 
71  void initWithAnimationRetargeting(const std::string& animationPath, qsf::MeshAnimationComponent::BoneRetargeting boneTranslationRetargeting = qsf::MeshAnimationComponent::ANIMATION_BONE_SCALE_RETARGETING, bool waitForFinish = false, bool loopAnimation = false, bool reverse = false);
72 
77  void setAnimationOffsetRange(float startOffset, float endOffset);
78 
79  void setMaskedAnimation(const std::string& maskAnimationPath, const std::string& boneMask);
80 
81  void setEnforceGraphicsSynchronization(bool value);
82 
83 
84  //[-------------------------------------------------------]
85  //[ Public virtual qsf::Actions methods ]
86  //[-------------------------------------------------------]
87  public:
88  virtual void serialize(qsf::BinarySerializer& serializer) override;
89 
90 
91  //[-------------------------------------------------------]
92  //[ Protected virtual qsf::Action methods ]
93  //[-------------------------------------------------------]
94  protected:
95  virtual bool onStartup() override;
96  virtual void onShutdown() override;
97  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
98 
99 
100  //[-------------------------------------------------------]
101  //[ Private methods ]
102  //[-------------------------------------------------------]
103  private:
104  bool startAnimation();
105 
106 
107  //[-------------------------------------------------------]
108  //[ Private data ]
109  //[-------------------------------------------------------]
110  private:
111  qsf::WeakPtr<qsf::MeshAnimationChannel> mMeshAnimationChannel;
112  qsf::AssetProxy mAnimationAssetProxy;
113  bool mWaitForFinish;
114  bool mLoopAnimation;
115  bool mReverse;
116  qsf::Time mBlendTime;
117  boost::optional<qsf::Time> mMaxPlayTime;
118  boost::optional<float> mStartOffset;
119  boost::optional<float> mEndOffset;
120  qsf::MeshAnimationComponent::BoneRetargeting mBoneTranslationRetargeting;
121  bool mClearPersonAnimation;
122  bool mPreventUpdateAnimations;
123 
124  // For masked animations
125  qsf::AssetProxy mMaskAnimationAssetProxy;
126  std::string mBoneMask;
127 
128  // Fix for animation outside of the screen
129  bool mEnforceGraphicsSynchronization;
130 
131 
132  //[-------------------------------------------------------]
133  //[ CAMP reflection system ]
134  //[-------------------------------------------------------]
135  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
136 
137 
138  };
139 
140 
141 //[-------------------------------------------------------]
142 //[ Namespace ]
143 //[-------------------------------------------------------]
144 } // em5
145 
146 
147 //[-------------------------------------------------------]
148 //[ CAMP reflection system ]
149 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 play animation action.
Definition: PlayAnimationAction.h:35
BoneRetargeting
Bone retargeting.
Definition: MeshAnimationComponent.h:93
static const Time ZERO
A zero value for time.
Definition: Time.h:40
static const qsf::NamedIdentifier ACTION_ID
"em5::PlayAnimationAction" unique action identifier
Definition: PlayAnimationAction.h:43
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Scale the bone translation from the animation skeleton keyframes so it matches the target mesh skelet...
Definition: MeshAnimationComponent.h:96
Asset proxy class.
Definition: AssetProxy.h:57
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32