27#include "CAnimationTimeline.h"
28#include "CAnimationTransformData.h"
29#include "Entity/CEntityPrefab.h"
30#include "Animation/CAnimationClip.h"
49 class SKYLICHT_API CSkeleton
116 virtual ~CSkeleton();
202 void getJoints(
const char* name, std::vector<CAnimationTransformData*>& joints);
222 inline std::vector<CAnimationTransformData*>&
getJoints()
Represents an animation clip containing multiple animation tracks for different entities.
Definition CAnimationClip.h:41
Manages the playback state of an animation (current time, speed, loop state).
Definition CAnimationTimeline.h:45
This object class is created to store data in an array of multiple CEntities.
Definition CEntityPrefab.h:38
void setTarget(CSkeleton *skeleton)
Sets the target skeleton that this skeleton will blend into.
EAnimationType m_animationType
Current operating mode.
Definition CSkeleton.h:97
void doAddtive(CSkeleton *skeleton, bool first)
Performs additive blending from a source layer.
void getBoneIdMap(std::map< std::string, int > &bones)
Builds a map from bone names to bone IDs.
bool m_enable
Whether this skeleton is enabled.
Definition CSkeleton.h:88
CEntityPrefab m_entities
Collection of entities (bones) in this skeleton.
Definition CSkeleton.h:73
EAnimationLayerType
Blending algorithms for layers.
Definition CSkeleton.h:65
@ Replace
Normal linear blending.
Definition CSkeleton.h:67
@ Addtive
Overrides previous layers.
Definition CSkeleton.h:68
CSkeleton * getTarget()
Gets the target skeleton.
Definition CSkeleton.h:326
bool m_needUpdateActivateEntities
Flag to trigger update of activated entities.
Definition CSkeleton.h:91
core::array< CAnimationTransformData * > m_entitiesActivated
List of bones that are currently active (weight > 0).
Definition CSkeleton.h:79
int simulateTransform(float timeSecond, core::matrix4 origin, core::matrix4 *transforms, int numTransform)
Simulates the skeleton at a specific time and returns world matrices.
void notifyUpdateActivateEntities()
Manually notifies the skeleton to refresh its active joint list.
Definition CSkeleton.h:311
CAnimationTimeline & getTimeline()
Gets the animation timeline for this skeleton.
Definition CSkeleton.h:267
void doBlending(CSkeleton *skeleton, bool first)
Performs standard linear blending from a source layer.
void drawDebugDefaultSkeleton(const core::matrix4 &transform, const SColor &c)
Draws the default pose of the skeleton.
CAnimationClip * getCurrentAnimation()
Gets the currently assigned animation clip.
Definition CSkeleton.h:231
int m_id
Unique ID of the skeleton.
Definition CSkeleton.h:85
void setAnimationData()
Internal helper to set up keyframe data for each joint from the current clip.
void setAnimation(CAnimationClip *clip, bool loop, bool pause=false)
Sets an animation clip to play on this skeleton.
EAnimationType getAnimationType()
Gets the current operating mode.
Definition CSkeleton.h:285
void drawDebug(const core::matrix4 &transform, const SColor &c)
Draws the skeleton hierarchy for debugging.
CAnimationTransformData * m_root
Pointer to the root bone data.
Definition CSkeleton.h:82
void getJoints(const char *name, std::vector< CAnimationTransformData * > &joints)
Gets a list of joint data pointers starting from a named joint.
bool isEnable()
Checks if the skeleton is enabled.
Definition CSkeleton.h:249
std::vector< CAnimationTransformData * > m_entitiesData
List of internal animation data for each bone.
Definition CSkeleton.h:76
void setJointWeights(std::vector< CAnimationTransformData * > &joints, float weight)
Sets blending weights for a provided list of joints.
CSkeleton * m_target
For blending: the skeleton that this layer blends into.
Definition CSkeleton.h:108
void applyTransform()
Applies calculated local PRS to the relative matrices of bones.
CAnimationTransformData * getJoint(const char *name)
Gets the joint data for a specific bone name.
void setEnable(bool b)
Sets whether the skeleton is enabled.
Definition CSkeleton.h:258
void initSkeleton(core::array< CEntity * > &entities)
Initializes the skeleton hierarchy from a list of world entities.
void addBlending(CSkeleton *skeleton)
Adds a layer to blend into this skeleton.
CAnimationClip * m_clip
Currently assigned animation clip.
Definition CSkeleton.h:100
void doReplace(CSkeleton *skeleton, bool first)
Performs override (replace) blending from a source layer.
EAnimationType
Operating modes for the skeleton.
Definition CSkeleton.h:56
@ Blending
Standard mode: plays a single animation clip.
Definition CSkeleton.h:58
EAnimationLayerType getLayerType()
Gets the layer blending type.
Definition CSkeleton.h:303
int getID()
Gets the skeleton ID.
Definition CSkeleton.h:240
std::vector< CSkeleton * > & getBlending()
Gets the list of layers (sub-skeletons) blending into this skeleton.
Definition CSkeleton.h:335
void setJointWeights(const char *name, float weight, bool includeChild=true)
Sets the blending weight for a specific joint and its children.
void removeBlending(CSkeleton *skeleton)
Removes a blended layer.
void syncAnimationByTimeScale()
Synchronizes time across multiple blended layers based on the highest weight.
std::vector< CAnimationTransformData * > & getJoints()
Gets the list of all joint data in the skeleton.
Definition CSkeleton.h:222
void setLayerType(EAnimationLayerType type)
Sets the blending algorithm (Replace, Addtive, etc.) for this skeleton layer.
Definition CSkeleton.h:294
std::vector< CSkeleton * > m_blending
List of sub-skeletons (layers) that blend into this skeleton.
Definition CSkeleton.h:111
void updateBlending()
Orchestrates the blending of all attached layers.
void releaseAllEntities()
Releases all bone entities.
void updateTrackKeyFrame()
Evaluates current keyframes and interpolates PRS data for all active joints.
void setAnimation(CAnimationClip *clip, bool loop, float from, float duration, bool pause=false)
Sets an animation clip with a specific range.
CAnimationTimeline m_timeline
Playback state for this skeleton.
Definition CSkeleton.h:94
void setJointWeights(float weight)
Sets the blending weight for ALL joints in the skeleton.
void setAnimationType(EAnimationType type)
Sets the operating mode of the skeleton.
Definition CSkeleton.h:276
void update()
Updates the animation state.
void updateActivateEntities()
Filters and caches bones that are currently contributing to the animation.
EAnimationLayerType m_layerType
Blending type for this skeleton (when used as a layer).
Definition CSkeleton.h:103
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.h:23
Class representing a 32 bit ARGB color.
Definition SColor.h:285
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
CMatrix4< f32 > matrix4
Typedef for f32 matrix.
Definition matrix4.h:2241