ezEngine Release 26.3
Loading...
Searching...
No Matches
ezAnimGraph Class Reference

#include <AnimGraph.h>

Public Member Functions

void Clear ()
 
ezAnimGraphNodeAddNode (ezUniquePtr< ezAnimGraphNode > &&pNode)
 
void AddConnection (const ezAnimGraphNode *pSrcNode, ezStringView sSrcPinName, ezAnimGraphNode *pDstNode, ezStringView sDstPinName)
 
ezResult Serialize (ezStreamWriter &inout_stream) const
 
ezResult Deserialize (ezStreamReader &inout_stream)
 
const ezInstanceDataAllocatorGetInstanceDataAlloator () const
 
ezArrayPtr< const ezUniquePtr< ezAnimGraphNode > > GetNodes () const
 
void PrepareForUse ()
 

Friends

class ezAnimGraphInstance
 
class ezAnimGraphTriggerOutputPin
 
class ezAnimGraphNumberOutputPin
 
class ezAnimGraphBoolOutputPin
 
class ezAnimGraphBoneWeightsOutputPin
 
class ezAnimGraphLocalPoseOutputPin
 

Detailed Description

Defines the structure and logic of an animation graph as a directed acyclic graph (DAG) of nodes.

An animation graph consists of interconnected nodes that process animation data. Nodes can sample animation clips, blend poses, handle logic and math operations, react to events, and output final poses. Data flows through typed pins that connect nodes together.

Architecture

Graph Definition vs Instance:

  • ezAnimGraph is the shared definition (nodes, connections, structure)
  • ezAnimGraphInstance is per-character runtime state (playback time, blend weights, pin values)
  • One graph can be shared by hundreds of characters, each with their own instance

Node Types:

  • Pose sampling: Sample animation clips, blend spaces, sequences
  • Blending: Lerp, switch between poses, blend spaces (1D/2D)
  • Logic: Boolean operations, comparisons, state machines
  • Math: Add, multiply, clamp numbers for blend weights
  • Events: Trigger gameplay events at specific animation times
  • Bone weights: Control which bones are affected by animations
  • Root motion: Extract character movement from animations
  • Output: Final pose output to renderer

Pin Types:

  • Trigger: One-shot events (animation finished, state entered)
  • Number: Blend weights, playback speeds, parameters
  • Bool: Conditions, flags
  • BoneWeights: Masks controlling which bones are affected
  • LocalPose: Bone transforms in local space
  • ModelPose: Bone transforms in model space

Usage Pattern

Animation graphs are typically created by the editor and stored in ezAnimGraphResource. At runtime, ezAnimController is used to load a graph resource, create an ezAnimGraphInstance and updates it each frame.

Member Function Documentation

◆ PrepareForUse()

void ezAnimGraph::PrepareForUse ( )

Prepares the graph for use by sorting nodes, assigning pin indices, and allocating instance data descriptors.

Must be called after all nodes and connections have been added and before creating instances. This is automatically called when deserializing a graph or when creating instances.


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