#include <ActorManager.h>
Inherits EMotionFX::BaseObject.
Public Member Functions | |
void | RegisterActor (ActorAssetData actorAsset) |
void | UnregisterAllActors () |
void | UnregisterActor (AZ::Data::AssetId actorAssetID) |
MCORE_INLINE size_t | GetNumActors () const |
Actor * | GetActor (size_t nr) const |
ActorAssetData | GetActorAsset (size_t nr) const |
Actor * | FindActorByName (const char *actorName) const |
Actor * | FindActorByFileName (const char *fileName) const |
size_t | FindActorIndex (AZ::Data::AssetId assetId) const |
size_t | FindActorIndex (const Actor *actor) const |
size_t | FindActorIndexByName (const char *actorName) const |
size_t | FindActorIndexByFileName (const char *filename) const |
void | RegisterActorInstance (ActorInstance *actorInstance) |
MCORE_INLINE size_t | GetNumActorInstances () const |
MCORE_INLINE ActorInstance * | GetActorInstance (size_t nr) const |
ActorInstance * | GetFirstEditorActorInstance () const |
const AZStd::vector< ActorInstance * > & | GetActorInstanceArray () const |
size_t | FindActorInstanceIndex (ActorInstance *actorInstance) const |
ActorInstance * | FindActorInstanceByID (uint32 id) const |
Actor * | FindActorByID (uint32 id) const |
AZ::Data::AssetId | FindAssetIdByActorId (uint32 id) const |
bool | CheckIfIsActorInstanceRegistered (ActorInstance *actorInstance) |
void | UnregisterAllActorInstances () |
void | UnregisterActorInstance (ActorInstance *instance) |
void | UnregisterActorInstance (size_t nr) |
MCORE_INLINE size_t | GetNumRootActorInstances () const |
MCORE_INLINE ActorInstance * | GetRootActorInstance (size_t nr) const |
ActorUpdateScheduler * | GetScheduler () const |
void | SetScheduler (ActorUpdateScheduler *scheduler, bool delExisting=true) |
void | UpdateActorInstanceStatus (ActorInstance *actorInstance, bool lock=true) |
void | UpdateActorInstances (float timePassedInSeconds) |
void | DestroyAllActorInstances () |
void | DestroyAllActors () |
void | LockActorInstances () |
void | UnlockActorInstances () |
void | LockActors () |
void | UnlockActors () |
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 ActorManager * | Create () |
Friends | |
class | Initializer |
class | EMotionFXManager |
Additional Inherited Members | |
Protected Member Functions inherited from EMotionFX::BaseObject | |
void | Delete () override |
virtual void | Delete () |
The actor manager. This class maintains a list of registered actors and actor instances that have been created. Also it stores a list of root actor instances, which are roots in the chains of attachments. For example if you attach a cowboy to a horse, the horse is the root actor instance.
bool EMotionFX::ActorManager::CheckIfIsActorInstanceRegistered | ( | ActorInstance * | actorInstance | ) |
Check if the given actor instance is registered.
actorInstance | A pointer to the actor instance to be checked. |
Actor * EMotionFX::ActorManager::FindActorByFileName | ( | const char * | fileName | ) | const |
Find the given actor by filename.
[in] | fileName | The filename of the actor. |
Actor * EMotionFX::ActorManager::FindActorByID | ( | uint32 | id | ) | const |
Find an actor inside the actor manager by its id.
[in] | id | The unique identification number of the actor to be searched. |
Actor * EMotionFX::ActorManager::FindActorByName | ( | const char * | actorName | ) | const |
Find the given actor by name.
[in] | actorName | The name of the actor. |
size_t EMotionFX::ActorManager::FindActorIndex | ( | AZ::Data::AssetId | assetId | ) | const |
Find the actor number for a given Actor object. This will find the actor number for the Actor object that you passed to RegisterActor before.
actor | The actor object you once passed to RegisterActor. |
size_t EMotionFX::ActorManager::FindActorIndexByFileName | ( | const char * | filename | ) | const |
Find the actor number for a given actor filename. This will find the actor number for the Actor object that you passed to RegisterActor before.
filename | The filename of the actor. |
size_t EMotionFX::ActorManager::FindActorIndexByName | ( | const char * | actorName | ) | const |
Find the actor number for a given actor name. This will find the actor number for the Actor object that you passed to RegisterActor before.
actorName | The name of the actor. |
ActorInstance * EMotionFX::ActorManager::FindActorInstanceByID | ( | uint32 | id | ) | const |
Find an actor instance inside the actor manager by its id.
[in] | id | The unique identification number of the actor instance to be searched. |
size_t EMotionFX::ActorManager::FindActorInstanceIndex | ( | ActorInstance * | actorInstance | ) | const |
Find the given actor instance inside the actor manager and return its index.
actorInstance | A pointer to the actor instance to be searched. |
Actor * EMotionFX::ActorManager::GetActor | ( | size_t | nr | ) | const |
Get a given actor. This will return a Actor object that contains an array of Actor objects. The first Actor in this array will be the actor you passed to RegisterActor. The following Actor objects in the array will be the created clones, if there are any.
nr | The actor number, which must be in range of [0..GetNumActors()-1]. |
|
inline |
Get a given registered actor instance.
nr | The actor instance number, which must be in range of [0..GetNumActorInstances()-1]. |
const AZStd::vector< ActorInstance * > & EMotionFX::ActorManager::GetActorInstanceArray | ( | ) | const |
Get the array of actor instances.
ActorInstance * EMotionFX::ActorManager::GetFirstEditorActorInstance | ( | ) | const |
Get a given registered actor instance owned by editor (not owned by runtime).
|
inline |
Get the number of actor instances that currently are registered.
|
inline |
Get the number of registered actors. This does not include the clones that have been optionally created.
|
inline |
Get the number of root actor instances. A root actor instance is an actor instance that is no attachment. So if you have a gun attached to a cowboy, where the cowboy is attached to a horse, then the horse is the root attachment instance.
|
inline |
Get a given root actor instance. A root actor instance is an actor instance that is no attachment. So if you have a gun attached to a cowboy, where the cowboy is attached to a horse, then the horse is the root attachment instance.
nr | The root actor instance number, which must be in range of [0..GetNumRootActorInstances()-1]. |
ActorUpdateScheduler * EMotionFX::ActorManager::GetScheduler | ( | ) | const |
Get the currently used actor update scheduler.
void EMotionFX::ActorManager::RegisterActor | ( | ActorAssetData | actorAsset | ) |
Register an actor.
actor | The actor to register. |
void EMotionFX::ActorManager::SetScheduler | ( | ActorUpdateScheduler * | scheduler, |
bool | delExisting = true |
||
) |
Set the scheduler to use. EMotion FX provides two different scheduler implementations: A single threaded scheduler (SingleThreadScheduler) and a multithreaded scheduler (MultiThreadScheduler, the default). The current scheduler will automatically be deleted at application shutdown. The schedulers are responsible for figuring out the update order.
scheduler | The new scheduler to use. |
delExisting | When set to true, the existing scheduler, as returned by GetScheduler() will be deleted from memory. |
void EMotionFX::ActorManager::UnregisterActor | ( | AZ::Data::AssetId | actorAssetID | ) |
Unregister a specific actor.
actor | The actor you passed to the RegisterActor function sometime before. |
void EMotionFX::ActorManager::UnregisterActorInstance | ( | ActorInstance * | instance | ) |
Unregister a specific actor instance. This does not delete the actual actor instance from memory. When you delete an actor instance, it automatically will unregister itself from the manager. So you will most likely not be calling this method, unless you have a special reason for this.
instance | The actor instance to unregister. |
void EMotionFX::ActorManager::UnregisterActorInstance | ( | size_t | nr | ) |
Unregister a given actor instance. This does not delete the actual actor instance from memory. When you delete an actor instance, it automatically will unregister itself from the manager.
nr | The actor instance number, which has to be in range of [0..GetNumActorInstances()-1]. |
void EMotionFX::ActorManager::UnregisterAllActorInstances | ( | ) |
Unregister all actor instances. Please note that this is already done automatically at application shutdown. The actor instance objects will not be deleted from memory though. When you delete an actor instance, it automatically will unregister itself from the manager.
void EMotionFX::ActorManager::UnregisterAllActors | ( | ) |
Unregister all actors. This does not release/delete the actual actor objects, but just clears the internal array of actor instances. This method is automatically called at shutdown of your application.
void EMotionFX::ActorManager::UpdateActorInstances | ( | float | timePassedInSeconds | ) |
The main method that will execute the scheduler which will on its turn updates all the actor instances.
timePassedInSeconds | The time, in seconds, since the last time you called the Update method. |
void EMotionFX::ActorManager::UpdateActorInstanceStatus | ( | ActorInstance * | actorInstance, |
bool | lock = true |
||
) |
Update the actor instance status for a given actor instance. This checks if the actor instance is still a root actor instance or not and it makes sure that it is registered internally as root actor instance when needed. So this method is being called when attachments change. This is handled automatically.
actorInstance | The actor instance to update the status for. |
lock | Set to true if you want to automatically call LockActorInstances(). |