#include <MotionLayerSystem.h>
Inherits EMotionFX::MotionSystem.
Public Types | |
enum | { TYPE_ID = 0x00000001 } |
Public Member Functions | |
void | Update (float timePassed, bool updateNodes) override |
MotionInstance * | FindFirstNonMixingMotionInstance () const override |
size_t | RemoveLayersBelow (MotionInstance *source) |
void | UpdateMotionTree () |
uint32 | GetType () const override |
const char * | GetTypeString () const override |
size_t | FindInsertPos (size_t priorityLevel) const |
void | RemoveAllLayerPasses (bool delFromMem=true) |
void | AddLayerPass (LayerPass *newPass) |
size_t | GetNumLayerPasses () const |
void | RemoveLayerPass (size_t nr, bool delFromMem=true) |
void | RemoveLayerPass (LayerPass *pass, bool delFromMem=true) |
void | InsertLayerPass (size_t insertPos, LayerPass *pass) |
void | RemoveRepositioningLayerPass () |
LayerPass * | GetLayerPass (size_t index) const |
Public Member Functions inherited from EMotionFX::MotionSystem | |
virtual MotionInstance * | PlayMotion (Motion *motion, class PlayBackInfo *info=nullptr) |
virtual uint32 | GetType () const =0 |
virtual const char * | GetTypeString () const =0 |
virtual void | Update (float timePassed, bool updateNodes)=0 |
void | RemoveMotion (size_t nr, bool deleteMem=true) |
void | RemoveMotion (MotionInstance *motion, bool delMem=true) |
virtual bool | RemoveMotionInstance (MotionInstance *instance) |
MotionInstance * | GetMotionInstance (size_t nr) const |
virtual MotionInstance * | FindFirstNonMixingMotionInstance () const =0 |
size_t | GetNumMotionInstances () const |
bool | CheckIfIsValidMotionInstance (MotionInstance *instance) const |
bool | GetIsPlaying () const |
bool | CheckIfIsPlayingMotion (Motion *motion, bool ignorePausedMotions=false) const |
void | SetMotionQueue (MotionQueue *motionQueue) |
void | AddMotionQueue (MotionQueue *motionQueue) |
MotionQueue * | GetMotionQueue () const |
ActorInstance * | GetActorInstance () const |
void | StopAllMotions () |
void | StopAllMotions (Motion *motion) |
void | AddMotionInstance (MotionInstance *instance) |
Public Member Functions inherited from EMotionFX::BaseObject | |
BaseObject () | |
virtual | ~BaseObject () |
Public Member Functions inherited from MCore::MemoryObject | |
MemoryObject () | |
virtual | ~MemoryObject () |
void | IncreaseReferenceCount () |
void | DecreaseReferenceCount () |
void | Destroy () |
uint32 | GetReferenceCount () const |
Static Public Member Functions | |
static MotionLayerSystem * | Create (ActorInstance *actorInstance) |
Additional Inherited Members | |
Protected Member Functions inherited from EMotionFX::MotionSystem | |
MotionSystem (ActorInstance *actorInstance) | |
virtual | ~MotionSystem () |
virtual void | StartMotion (MotionInstance *motion, PlayBackInfo *info)=0 |
void | UpdateMotionInstances (float timePassed) |
MotionInstance * | CreateMotionInstance (Motion *motion, PlayBackInfo *info) |
Protected Member Functions inherited from EMotionFX::BaseObject | |
void | Delete () override |
virtual void | Delete () |
Protected Attributes inherited from EMotionFX::MotionSystem | |
AZStd::vector< MotionInstance * > | m_motionInstances |
ActorInstance * | m_actorInstance |
MotionQueue * | m_motionQueue |
The layered motion system class. This class performs the blending, mixing and motion management for us. The system contains a set of layers, which are linked together in a hierarchy. The current implementation however manages the system on such a way that we get a stack of layers. The following diagram gives an example of the layout of layers inside this system:
FINAL OUTPUT ^ | | 75% | 25% --------------- | lay2 | run | layer 1 (root layer) --------------- \ \ \ 30% \ 70% -------------- | jump | walk | layer 2 --------------- \ \ \ \ 100% -------------- | | jump | layer 3 ---------------
As you can see a layer consists of 2 inputs and a weight factor between these two inputs. An input can either be a motion or the output of another layer. When a motion is being played we don't have to bother about the adding and removing of layers and things such as smooth transitions etc. This is all performed by this system.
void EMotionFX::MotionLayerSystem::AddLayerPass | ( | LayerPass * | newPass | ) |
Add a layer pass. This layer will be added on the back, so processed as last.
newPass | The new pass to add. |
|
static |
Creation method.
actorInstance | The actor instance where this layer belongs to. |
|
overridevirtual |
Recursively search for the first non mixing motion and return the motion instance.
Implements EMotionFX::MotionSystem.
size_t EMotionFX::MotionLayerSystem::FindInsertPos | ( | size_t | priorityLevel | ) | const |
Find the location where to insert a motion layer with a given priority level. When InvalidIndex is returned, it needs to be inserted at the bottom of the motion tree.
priorityLevel | The priority level of the motion instance you want to insert. |
LayerPass * EMotionFX::MotionLayerSystem::GetLayerPass | ( | size_t | index | ) | const |
Get the pointer to a given layer pass.
index | The layer pass number, which must be in range of [0..GetNumLayerPasses()-1]. |
size_t EMotionFX::MotionLayerSystem::GetNumLayerPasses | ( | ) | const |
Get the number of layer passes currently added to this motion layer system.
|
overridevirtual |
Get the unique motion system type ID.
Implements EMotionFX::MotionSystem.
|
overridevirtual |
Get the type identification string. This can be a description or the class name of the motion system.
Implements EMotionFX::MotionSystem.
void EMotionFX::MotionLayerSystem::InsertLayerPass | ( | size_t | insertPos, |
LayerPass * | pass | ||
) |
Insert a layer pass in the array of layer passes.
insertPos | The index position to insert the layer pass. |
pass | The layer pass to insert. |
void EMotionFX::MotionLayerSystem::RemoveAllLayerPasses | ( | bool | delFromMem = true | ) |
Remove all layer passes.
delFromMem | When set to true, the layer passes will also be deleted from memory. |
void EMotionFX::MotionLayerSystem::RemoveLayerPass | ( | LayerPass * | pass, |
bool | delFromMem = true |
||
) |
Remove a given layer pass by pointer.
pass | A pointer to the layer pass to remove. |
delFromMem | When set to true, the layer passes will also be deleted from memory. |
void EMotionFX::MotionLayerSystem::RemoveLayerPass | ( | size_t | nr, |
bool | delFromMem = true |
||
) |
Remove a given layer pass by index.
nr | The layer pass number to remove. |
delFromMem | When set to true, the layer passes will also be deleted from memory. |
size_t EMotionFX::MotionLayerSystem::RemoveLayersBelow | ( | MotionInstance * | source | ) |
Remove all motion layers below the current one.
source | The layer to remove all layers below from. So this does not remove the source layer itself. |
void EMotionFX::MotionLayerSystem::RemoveRepositioningLayerPass | ( | ) |
Deletes the motion based actor repositioning layer pass, which is always there on default. Please keep in mind that this one is actually stored outside of the array with layer passes that you can add new layers to. If you want to use your own repositioning code, you can disable the built-in one with this method, and add your own repositioning layer.
|
overridevirtual |
Update this character motions, if updateNodes is false only time values are updated. If it's true, the heavy calcs are done. NOTE: This method is automatically called by the Update method.
timePassed | The time passed since the last call. |
updateNodes | If true the nodes will be updated. |
Implements EMotionFX::MotionSystem.
void EMotionFX::MotionLayerSystem::UpdateMotionTree | ( | ) |
Update the motion tree. This removes all motion instances that faded out or get overwritten etc.