Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CAnimationController Class Reference

Component that manages and updates animation skeletons for a GameObject. More...

#include <Animation/CAnimationController.h>

Inheritance diagram for Skylicht::CAnimationController:
Skylicht::CComponentSystem Skylicht::IActivatorObject

Public Member Functions

virtual void initComponent ()
virtual void updateComponent ()
virtual CObjectSerializablecreateSerializable ()
virtual void loadSerializable (CObjectSerializable *object)
CSkeletoncreateSkeleton ()
 Creates a new skeleton managed by this controller, using the GameObject's entities.
CSkeletoncreateSkeleton (core::array< CEntity * > &entities)
 Creates a new skeleton managed by this controller, using the provided entities.
int getNumSkeleton ()
 Gets the number of skeletons managed by this controller.
CSkeletongetSkeleton (int id)
 Gets a skeleton by index.
void releaseAllSkeleton ()
 Releases all skeletons and clears the controller.
void setOutput (CSkeleton *skeleton)
 Sets the skeleton that will be used for final transform application.
Public Member Functions inherited from Skylicht::CComponentSystem
const char * getName ()
virtual void reset ()
virtual void startComponent ()
virtual void endUpdate ()
virtual void onEnable (bool b)
virtual void onUpdateCullingLayer (u32 mask)
void setEnable (bool b)
bool isEnable ()
CGameObject * getGameObject ()
void setEnableSerializable (bool b)
bool isSerializable ()
void addLinkComponent (CComponentSystem *comp)
void removeAllLink ()
Public Member Functions inherited from Skylicht::IActivatorObject
virtual ~IActivatorObject ()
 Virtual destructor for polymorphic activator objects.

Protected Attributes

std::vector< CSkeleton * > m_skeletons
 List of skeletons managed by this controller.
CSkeletonm_output
 The output skeleton which transforms are applied from.
std::string m_animFile
 Path to the primary animation file.
bool m_loop
 Whether the default animation should loop.
Protected Attributes inherited from Skylicht::CComponentSystem
CGameObject * m_gameObject
bool m_enable
bool m_serializable
std::vector< CComponentSystem * > m_linkComponent

Additional Inherited Members

Static Public Member Functions inherited from Skylicht::CComponentSystem
static int useComponent (CComponentSystem *used)
Protected Member Functions inherited from Skylicht::CComponentSystem
void setOwner (CGameObject *obj)

Detailed Description

Component that manages and updates animation skeletons for a GameObject.

This component acts as a container for one or more CSkeleton objects. It is responsible for updating the animation state and applying transforms to the entities.

Example: Setting up animation layers

CAnimationController* animController = gameObject->addComponent<CAnimationController>();
// Create base skeleton (output)
CSkeleton* result = animController->createSkeleton();
animController->setOutput(result);
// Create a movement layer
CSkeleton* movement = animController->createSkeleton();
movement->setTarget(result);
// Create an action layer (e.g., Attack)
CSkeleton* attack = animController->createSkeleton();
attack->setTarget(result);
attack->setLayerType(CSkeleton::Replace); // Overrides movement
CSkeleton * createSkeleton()
Creates a new skeleton managed by this controller, using the GameObject's entities.
void setOutput(CSkeleton *skeleton)
Sets the skeleton that will be used for final transform application.
Definition CAnimationController.h:131
Manages a hierarchy of animated entities, handling keyframe updates and animation blending.
Definition CSkeleton.h:50
void setTarget(CSkeleton *skeleton)
Sets the target skeleton that this skeleton will blend into.
@ Replace
Normal linear blending.
Definition CSkeleton.h:67
@ Blending
Standard mode: plays a single animation clip.
Definition CSkeleton.h:58
void setLayerType(EAnimationLayerType type)
Sets the blending algorithm (Replace, Addtive, etc.) for this skeleton layer.
Definition CSkeleton.h:294
void setAnimationType(EAnimationType type)
Sets the operating mode of the skeleton.
Definition CSkeleton.h:276

Member Function Documentation

◆ createSerializable()

virtual CObjectSerializable * Skylicht::CAnimationController::createSerializable ( )
virtual

Reimplemented from Skylicht::CComponentSystem.

◆ createSkeleton() [1/2]

CSkeleton * Skylicht::CAnimationController::createSkeleton ( )

Creates a new skeleton managed by this controller, using the GameObject's entities.

Returns
Pointer to the newly created skeleton.

◆ createSkeleton() [2/2]

CSkeleton * Skylicht::CAnimationController::createSkeleton ( core::array< CEntity * > & entities)

Creates a new skeleton managed by this controller, using the provided entities.

Parameters
entitiesList of entities to initialize the skeleton with.
Returns
Pointer to the newly created skeleton.

◆ getNumSkeleton()

int Skylicht::CAnimationController::getNumSkeleton ( )
inline

Gets the number of skeletons managed by this controller.

Returns
Skeleton count.

◆ getSkeleton()

CSkeleton * Skylicht::CAnimationController::getSkeleton ( int id)
inline

Gets a skeleton by index.

Parameters
idThe skeleton index.
Returns
Pointer to the skeleton.

◆ initComponent()

virtual void Skylicht::CAnimationController::initComponent ( )
virtual

◆ loadSerializable()

virtual void Skylicht::CAnimationController::loadSerializable ( CObjectSerializable * object)
virtual

Reimplemented from Skylicht::CComponentSystem.

◆ setOutput()

void Skylicht::CAnimationController::setOutput ( CSkeleton * skeleton)
inline

Sets the skeleton that will be used for final transform application.

Parameters
skeletonPointer to the output skeleton.

◆ updateComponent()

virtual void Skylicht::CAnimationController::updateComponent ( )
virtual

The documentation for this class was generated from the following file: