Skip to content
modkitv0.2

anim_graph.h

#include <modkit/anim_graph.h>17 functions · 11 structs · 1 unions · 3 enums · 19 typedefs · 3 macros

Declarative, typed hierarchical animation state machines.

Functions

mk_anim_graph_createfunction

mk_anim_graph_t mk_anim_graph_create(const mk_anim_graph_desc *desc)

Create anim graph.

ParameterTypeDescription
descconst mk_anim_graph_desc *Configuration descriptor.

Returns The resulting handle or value.

mk_anim_graph_destroyfunction

void mk_anim_graph_destroy(mk_anim_graph_t graph)

Destroy the anim graph.

ParameterTypeDescription
graphmk_anim_graph_tValue for graph.

mk_anim_graph_load_assetfunction

mk_anim_graph_t mk_anim_graph_load_asset(const char *asset_id, mk_anim_json_error *error)

Load a loose path or mounted logical JSON asset through the asset system.

ParameterTypeDescription
asset_idconst char *Value for asset ID.
errormk_anim_json_error *Value for error.

Returns The resulting handle or value.

mk_anim_graph_load_jsonfunction

mk_anim_graph_t mk_anim_graph_load_json(const char *json, mk_anim_json_error *error)

Load JSON for the anim graph.

ParameterTypeDescription
jsonconst char *Value for JSON.
errormk_anim_json_error *Value for error.

Returns The resulting handle or value.

mk_anim_graph_validfunction

bool mk_anim_graph_valid(mk_anim_graph_t graph)

Perform the anim graph valid operation.

ParameterTypeDescription
graphmk_anim_graph_tValue for graph.

Returns True when the operation succeeds.

mk_anim_instance_createfunction

mk_anim_instance_t mk_anim_instance_create(mk_anim_world_t *world, mk_anim_graph_t graph)

Create anim instance.

ParameterTypeDescription
worldmk_anim_world_t *Value for world.
graphmk_anim_graph_tValue for graph.

Returns The resulting handle or value.

mk_anim_instance_create_resolvedfunction

mk_anim_instance_t mk_anim_instance_create_resolved(mk_anim_world_t *world, const mk_anim_instance_desc *desc)

Create resolved for the anim instance.

ParameterTypeDescription
worldmk_anim_world_t *Value for world.
descconst mk_anim_instance_desc *Configuration descriptor.

Returns The resulting handle or value.

mk_anim_instance_destroyfunction

void mk_anim_instance_destroy(mk_anim_world_t *world, mk_anim_instance_t instance)

Destroy the anim instance.

ParameterTypeDescription
worldmk_anim_world_t *Value for world.
instancemk_anim_instance_tValue for instance.

mk_anim_instance_getfunction

mk_result mk_anim_instance_get(const mk_anim_world_t *world, mk_anim_instance_t instance, const char *variable, mk_anim_value_type type, mk_anim_value *value)

Get state from the anim instance.

ParameterTypeDescription
worldconst mk_anim_world_t *Value for world.
instancemk_anim_instance_tValue for instance.
variableconst char *Value for variable.
typemk_anim_value_typeValue for type.
valuemk_anim_value *Value to use.

Returns MK_SUCCESS or an error result.

mk_anim_instance_setfunction

mk_result mk_anim_instance_set(mk_anim_world_t *world, mk_anim_instance_t instance, const char *variable, mk_anim_value_type type, mk_anim_value value)

Set state on the anim instance.

ParameterTypeDescription
worldmk_anim_world_t *Value for world.
instancemk_anim_instance_tValue for instance.
variableconst char *Value for variable.
typemk_anim_value_typeValue for type.
valuemk_anim_valueValue to use.

Returns MK_SUCCESS or an error result.

mk_anim_instance_signalfunction

mk_result mk_anim_instance_signal(mk_anim_world_t *world, mk_anim_instance_t instance, const char *signal)

Perform the anim instance signal operation.

ParameterTypeDescription
worldmk_anim_world_t *Value for world.
instancemk_anim_instance_tValue for instance.
signalconst char *Value for signal.

Returns MK_SUCCESS or an error result.

mk_anim_instance_statefunction

const char * mk_anim_instance_state(const mk_anim_world_t *world, mk_anim_instance_t instance)

Perform the anim instance state operation.

ParameterTypeDescription
worldconst mk_anim_world_t *Value for world.
instancemk_anim_instance_tValue for instance.

Returns A borrowed pointer, or NULL when unavailable.

mk_anim_instance_validfunction

bool mk_anim_instance_valid(const mk_anim_world_t *world, mk_anim_instance_t instance)

Perform the anim instance valid operation.

ParameterTypeDescription
worldconst mk_anim_world_t *Value for world.
instancemk_anim_instance_tValue for instance.

Returns True when the operation succeeds.

mk_anim_world_countfunction

uint32_t mk_anim_world_count(const mk_anim_world_t *world)

Perform the anim world count operation.

ParameterTypeDescription
worldconst mk_anim_world_t *Value for world.

Returns The resulting value.

mk_anim_world_createfunction

mk_anim_world_t * mk_anim_world_create(const mk_anim_world_desc *desc)

Create anim world.

ParameterTypeDescription
descconst mk_anim_world_desc *Configuration descriptor.

Returns A borrowed pointer, or NULL when unavailable.

mk_anim_world_destroyfunction

void mk_anim_world_destroy(mk_anim_world_t *world)

Destroy the anim world.

ParameterTypeDescription
worldmk_anim_world_t *Value for world.

mk_anim_world_stepfunction

void mk_anim_world_step(mk_anim_world_t *world, float dt)

Perform the anim world step operation.

ParameterTypeDescription
worldmk_anim_world_t *Value for world.
dtfloatValue for dt.

Structs

mk_anim_condition_descstruct

Data for anim condition desc.

FieldTypeDescription
typemk_anim_condition_typeThe type.
nameconst char *Variable or signal name.
comparisonmk_anim_compareThe comparison.
valuemk_anim_valueThe value.

mk_anim_graphstruct

Data for anim graph.

FieldTypeDescription
iduint32_tThe ID.

mk_anim_graph_descstruct

Data for anim graph desc.

FieldTypeDescription
variablesconst mk_anim_variable_desc *The variables.
variable_countuint32_tThe variable count.
statesconst mk_anim_state_desc *The states.
state_countuint32_tThe state count.
transitionsconst mk_anim_transition_desc *The transitions.
transition_countuint32_tThe transition count.
initial_stateuint32_tA leaf or root state.

mk_anim_instancestruct

Data for anim instance.

FieldTypeDescription
iduint32_tThe ID.

mk_anim_instance_descstruct

Data for anim instance desc.

FieldTypeDescription
graphmk_anim_graph_tThe graph.
callback_resolvermk_anim_callback_resolver_fnThe callback resolver.
timeline_resolvermk_anim_timeline_resolver_fnThe timeline resolver.
resolver_user_datavoid *The resolver user data.

mk_anim_json_errorstruct

Data for anim JSON error.

FieldTypeDescription
offsetsize_tThe offset.
messagecharThe message.

mk_anim_state_descstruct

Data for anim state desc.

FieldTypeDescription
nameconst char *The name.
parentuint32_tMK_ANIM_STATE_NONE for a root state.
on_entermk_anim_state_callback_fnThe on enter.
on_updatemk_anim_state_callback_fnThe on update.
on_exitmk_anim_state_callback_fnThe on exit.
user_datavoid *The user data.
timelineconst char *Optional name resolved per instance.

mk_anim_timeline_bindingstruct

Timeline states restart/play on entry and pause on exit.

Animation graphs do not step tween worlds; the application remains responsible for their clocks.

FieldTypeDescription
worldmk_tween_world_t *The world.
timelinemk_tween_tThe timeline.
destroy_with_instanceboolDestroy the timeline with its animation instance.

mk_anim_transition_descstruct

Data for anim transition desc.

FieldTypeDescription
from_stateuint32_tThe from state.
to_stateuint32_tThe to state.
priorityint32_tThe priority.
conditionsconst mk_anim_condition_desc *All conditions must pass.
condition_countuint32_tThe condition count.

mk_anim_variable_descstruct

Data for anim variable desc.

FieldTypeDescription
nameconst char *The name.
typemk_anim_value_typeThe type.
initialmk_anim_valueThe initial.

mk_anim_world_descstruct

Data for anim world desc.

FieldTypeDescription
capacityuint32_t0 selects 128.
signal_capacity_per_instanceuint32_t0 selects 32.

Unions

mk_anim_valueunion

Data for anim value.

FieldTypeDescription
booleanboolThe boolean.
integerint32_tThe integer.
numberfloatThe number.

Enums

mk_anim_compareenum

Values for anim compare.

ValueDescription
MK_ANIM_COMPARE_EQUALSelects equal.
MK_ANIM_COMPARE_NOT_EQUALSelects not equal.
MK_ANIM_COMPARE_LESSSelects less.
MK_ANIM_COMPARE_LESS_EQUALSelects less equal.
MK_ANIM_COMPARE_GREATERSelects greater.
MK_ANIM_COMPARE_GREATER_EQUALSelects greater equal.

mk_anim_condition_typeenum

Values for anim condition type.

ValueDescription
MK_ANIM_CONDITION_VARIABLESelects variable.
MK_ANIM_CONDITION_SIGNALSelects signal.

mk_anim_value_typeenum

Values for anim value type.

ValueDescription
MK_ANIM_BOOLSelects bool.
MK_ANIM_INTSelects int.
MK_ANIM_FLOATSelects float.

Typedefs

mk_anim_callback_resolver_fntypedef

typedef bool(*) mk_anim_callback_resolver_fn(void *user_data, const char *callback_name, mk_anim_state_callback_fn *out_callback, void **out_callback_user_data)

Callback used for anim callback resolver.

mk_anim_comparetypedef

typedef enum mk_anim_compare mk_anim_compare

Values for anim compare.

mk_anim_condition_desctypedef

typedef struct mk_anim_condition_desc mk_anim_condition_desc

Data for anim condition desc.

mk_anim_condition_typetypedef

typedef enum mk_anim_condition_type mk_anim_condition_type

Values for anim condition type.

mk_anim_graph_desctypedef

typedef struct mk_anim_graph_desc mk_anim_graph_desc

Data for anim graph desc.

mk_anim_graph_ttypedef

typedef struct mk_anim_graph mk_anim_graph_t

Data for anim graph.

mk_anim_instance_desctypedef

typedef struct mk_anim_instance_desc mk_anim_instance_desc

Data for anim instance desc.

mk_anim_instance_ttypedef

typedef struct mk_anim_instance mk_anim_instance_t

Data for anim instance.

mk_anim_json_errortypedef

typedef struct mk_anim_json_error mk_anim_json_error

Data for anim JSON error.

mk_anim_state_callback_fntypedef

typedef void(*) mk_anim_state_callback_fn(mk_anim_instance_t instance, const char *state, float dt, void *user_data)

Callback used for anim state callback.

mk_anim_state_desctypedef

typedef struct mk_anim_state_desc mk_anim_state_desc

Data for anim state desc.

mk_anim_timeline_bindingtypedef

typedef struct mk_anim_timeline_binding mk_anim_timeline_binding

Timeline states restart/play on entry and pause on exit.

Animation graphs do not step tween worlds; the application remains responsible for their clocks.

mk_anim_timeline_resolver_fntypedef

typedef bool(*) mk_anim_timeline_resolver_fn(void *user_data, const char *timeline_name, mk_anim_timeline_binding *out_binding)

Callback used for anim timeline resolver.

mk_anim_transition_desctypedef

typedef struct mk_anim_transition_desc mk_anim_transition_desc

Data for anim transition desc.

mk_anim_valuetypedef

typedef union mk_anim_value mk_anim_value

Data for anim value.

mk_anim_value_typetypedef

typedef enum mk_anim_value_type mk_anim_value_type

Values for anim value type.

mk_anim_variable_desctypedef

typedef struct mk_anim_variable_desc mk_anim_variable_desc

Data for anim variable desc.

mk_anim_world_desctypedef

typedef struct mk_anim_world_desc mk_anim_world_desc

Data for anim world desc.

mk_anim_world_ttypedef

typedef struct mk_anim_world mk_anim_world_t

Type used for anim world.

Macros

MK_ANIM_GRAPH_INVALIDdefine

MK_ANIM_GRAPH_INVALID

Invalid sentinel for anim graph.

MK_ANIM_INSTANCE_INVALIDdefine

MK_ANIM_INSTANCE_INVALID

Invalid sentinel for anim instance.

MK_ANIM_STATE_NONEdefine

MK_ANIM_STATE_NONE

Constant for anim state none.