LDKKeyframeAnimation
typedef struct LDKKeyframeAnimation{
float duration;
LDKKeyframeTrack *tracks;
u32 track_count;
u32 track_capacity;
LDKKeyframeEvent *events;
u32 event_count;
u32 event_capacity;
}LDKKeyframeAnimation;
typedef struct LDKKeyframeAnimation{
float duration;
LDKKeyframeTrack *tracks;
u32 track_count;
u32 track_capacity;
LDKKeyframeEvent *events;
u32 event_count;
u32 event_capacity;
}LDKKeyframeAnimation;
Sample and write all nonempty tracks to the subtree of a root entity.
LDK_API bool ldk_keyframe_animation_apply(
const LDKKeyframeAnimation *clip,
LDKEntity root,
float time
);
const LDKKeyframeAnimation *clipLDKEntity rootfloat timeTrue if all tracks applied successfully; missing bindings are reported by false.
Free a clip and reset it to the initialized state.
LDK_API void ldk_keyframe_animation_clear(LDKKeyframeAnimation *clip);
LDKKeyframeAnimation *clipNothing. Invalidates pointers into tracks, keys, and events.
Deep-copy all tracks, keys, events and owned event strings.
LDK_API bool ldk_keyframe_animation_copy(
LDKKeyframeAnimation *destination,
const LDKKeyframeAnimation *source
);
LDKKeyframeAnimation *destinationconst LDKKeyframeAnimation *sourceTrue on success; otherwise destination remains unchanged.
Set duration without discarding keys or events.
LDK_API bool ldk_keyframe_animation_duration_set(
LDKKeyframeAnimation *clip,
float duration
);
LDKKeyframeAnimation *clipfloat durationFalse if invalid or any key/event would lie beyond duration.
Insert an integer event marker at the specified second.
LDK_API bool ldk_keyframe_animation_event_add_integer(
LDKKeyframeAnimation *clip,
float time,
i32 number
);
LDKKeyframeAnimation *clipfloat timei32 numberTrue on success; extends duration if needed.
Insert a string event marker, copying the supplied text.
LDK_API bool ldk_keyframe_animation_event_add_string(
LDKKeyframeAnimation *clip,
float time,
const char *text
);
LDKKeyframeAnimation *clipfloat timeconst char *textTrue on success; extends duration if needed.
Change an event timestamp while preserving event ordering.
LDK_API bool ldk_keyframe_animation_event_move(
LDKKeyframeAnimation *clip,
u32 event_index,
float new_time,
u32 *out_index
);
LDKKeyframeAnimation *clipu32 event_indexfloat new_timeu32 *out_indexTrue on success; times beyond duration are rejected.
Delete an event marker and its owned string.
LDK_API bool ldk_keyframe_animation_event_remove(
LDKKeyframeAnimation *clip,
u32 event_index
);
LDKKeyframeAnimation *clipu32 event_indexTrue if removed. Later event indices shift.
Replace an event payload with an integer.
LDK_API bool ldk_keyframe_animation_event_set_integer(
LDKKeyframeAnimation *clip,
u32 event_index,
i32 number
);
LDKKeyframeAnimation *clipu32 event_indexi32 numberTrue if the event existed.
Replace an event payload with a copied string.
LDK_API bool ldk_keyframe_animation_event_set_string(
LDKKeyframeAnimation *clip,
u32 event_index,
const char *text
);
LDKKeyframeAnimation *clipu32 event_indexconst char *textTrue on success; the old payload remains if allocation fails.
Synchronously deliver all events crossed in (previous_time, current_time].
LDK_API void ldk_keyframe_animation_events_dispatch(
const LDKKeyframeAnimation *clip,
LDKEntity root,
float previous_time,
float current_time,
LDKKeyframeEventFn fn,
void *user
);
const LDKKeyframeAnimation *clipLDKEntity rootfloat previous_timefloat current_timeLDKKeyframeEventFn fnvoid *userNothing. Event payloads are temporary snapshots valid during each callback. Note: Callbacks may mutate or destroy the source; do not keep event pointers.
Parse a version-2 TML animation into an initialized clip.
LDK_API bool ldk_keyframe_animation_from_tml(
LDKKeyframeAnimation *clip,
const char *source
);
LDKKeyframeAnimation *clipconst char *sourceTrue on success; clip remains unchanged on failure.
Initialize a clip to an empty, one-second animation.
LDK_API void ldk_keyframe_animation_init(LDKKeyframeAnimation *clip);
LDKKeyframeAnimation *clipNothing. Call before any other clip operation.
Move a keyframe in time while keeping its value and chronological order.
LDK_API bool ldk_keyframe_animation_key_move(
LDKKeyframeAnimation *clip,
u32 track,
u32 key,
float new_time,
u32 *out_index
);
LDKKeyframeAnimation *clipu32 tracku32 keyfloat new_timeu32 *out_indexTrue on success. Rejects collisions and times beyond duration.
Remove a keyframe from a track.
LDK_API bool ldk_keyframe_animation_key_remove(
LDKKeyframeAnimation *clip,
u32 track,
u32 key
);
LDKKeyframeAnimation *clipu32 tracku32 keyTrue if removed. Subsequent key indices shift.
Insert or update a typed keyframe at the specified second.
LDK_API bool ldk_keyframe_animation_key_set(
LDKKeyframeAnimation *clip,
u32 track,
float time,
LDKPropertyValue value
);
LDKKeyframeAnimation *clipu32 trackfloat timeLDKPropertyValue valueTrue on success; may extend clip duration. Requires available component metadata. Note: Reflected component metadata must be registered when authoring.
Load a clip from the configured asset source.
LDK_API bool ldk_keyframe_animation_load(
LDKKeyframeAnimation *clip,
const char *asset_path
);
LDKKeyframeAnimation *clipconst char *asset_pathTrue on success; existing clip remains unchanged on failure.
Save a clip as TML through the configured asset source.
LDK_API bool ldk_keyframe_animation_save(
const LDKKeyframeAnimation *clip,
const char *asset_path
);
const LDKKeyframeAnimation *clipconst char *asset_pathTrue if successfully serialized and written.
Serialize a structurally valid clip to TML version 2.
LDK_API bool ldk_keyframe_animation_to_tml(
const LDKKeyframeAnimation *clip,
char **out_source
);
const LDKKeyframeAnimation *clipchar **out_sourceTrue on success. Caller must free *out_source.
Validate a clip independently of the ECS and reflected metadata.
LDK_API bool ldk_keyframe_animation_validate(const LDKKeyframeAnimation *clip);
const LDKKeyframeAnimation *clipTrue if the duration, tracks, keys and events are structurally valid.
Read the current component value addressed by a track.
LDK_API bool ldk_keyframe_animation_value_from_entity(
LDKEntity entity,
const LDKKeyframeTrack *track,
LDKPropertyValue *out_value
);
LDKEntity entityconst LDKKeyframeTrack *trackLDKPropertyValue *out_valueTrue if the editable reflected field exists and can be read.