IMannequin

Main interface to the Mannequin implementation. More...

#include

Public Member Functions

virtual void UnloadAll ()=0
virtual void ReloadAll ()=0
virtual IAnimationDatabaseManager & GetAnimationDatabaseManager ()=0
virtual IActionController * CreateActionController (IEntity *pEntity, SAnimationContext &context)=0
virtual IActionController * FindActionController (const IEntity &entity)=0
virtual IMannequinEditorManager * GetMannequinEditorManager ()=0
virtual CMannequinUserParamsManager & GetMannequinUserParamsManager ()=0
virtual IProceduralClipFactory & GetProceduralClipFactory ()=0
virtual void AddMannequinGameListener (IMannequinGameListener *pListener)=0
virtual void RemoveMannequinGameListener (IMannequinGameListener *pListener)=0
virtual uint32 GetNumMannequinGameListeners ()=0
virtual IMannequinGameListener * GetMannequinGameListener (uint32 idx)=0
virtual void SetSilentPlaybackMode (bool bSilentPlaybackMode)=0
virtual bool IsSilentPlaybackMode () const =0

Detailed Description

Main interface to the Mannequin implementation.

Member Function Documentation

◆ CreateActionController()

virtual IActionController* IMannequin::CreateActionController ( IEntity * pEntity,
SAnimationContext & context
)
pure virtual

Creates an action controller for the specified entity

#include 

// Creates a Mannequin action controller for the specified entity
void CreateActionController(IEntity* pEntity)
{
    // For the sake of this example, load the controller definition from /Animations/Mannequin/MyController.xml
    const char* szControllerDefinitionPath = "Animations/Mannequin/MyController.xml";

    // Query the Mannequin interface from the game framework
    IMannequin &mannequin = gEnv->pGameFramework->GetMannequinInterface();
    IAnimationDatabaseManager& databaseManager = mannequin.GetAnimationDatabaseManager();

    // Load the controller definition from disk
    const SControllerDef *pControllerDefinition = databaseManager.LoadControllerDef(szControllerDefinitionPath);
    if (pControllerDefinition != nullptr)
    {
        // Create an animation context using the controller definition
        SAnimationContext animationContext(*pControllerDefinition);
        // Now create an action controller for the entity
        IActionController* pActionController = mannequin.CreateActionController(pEntity, animationContext);

        /* 
            pActionController can now be used, until it is released manually (see below)
            Most importantly, pActionController->Update will need to be called every frame for fragments to be played
        */

        // The action controller has to be released when we are done
        // Typically this would be when the character is being destroyed
        pActionController->Release();
    }
}