Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@RicardoLuis0
Copy link
Contributor

@RicardoLuis0 RicardoLuis0 commented Aug 14, 2025

  • SetAnimationLayerAnimation - works just like SetAnimation, except it takes a layer and returns a layer (the layer that's passed in is what animation it should be interpolating from when setting the animation, it is allowed to be null), does not change the layer that's passed in

  • SetAnimationLayerFrameRate - returns a layer with the framerate modidified, does not change the layer that's passed in

  • CalculateAnimation - turns the animation data into a fully interpolated list of bone positions/translations/scaling, does not change the layer that's passed in

  • BlendAnimationFrames - interpolates between two frames, does not change the frames passed in

  • OffsetAnimationFrame - adds a frame as an offset to another frame, does not change the frames passed in

  • SetBones - does SetBoneRotation/Translation/Scaling for a whole frame

  • SetBonesRange - does it for a range of bones in a frame, SetBonesMask does it based on the passed in mask - if the index in the mask is true, the bone is set, if it's false, it is skipped

  • OverwriteBones - overwrites the set bones entirely, used for fully procedural per-frame animations

  • AnimateBones - is called every frame for models with decoupled anims enabled, you can set up per-frame animations here

  • CalculateAnimationFrame - lets you calculate an InterpolatedFrame into a PrecalculatedAnimationFrame

  • FindAnimationFrame/FindAnimationFrameUI/FindAnimationFrameAt - gets the state of an animation at the current (FindAnimationFrame/FindAnimationFrameUI) or at any arbitrary tic (FindAnimationFrameAt)

    • returns AnimationFrame frame1, InterpolatedFrame frame2, double inter

    • frame1 is the frame to interpolate from, it may be either a PrecalculatedAnimationFrame or a InterpolatedFrame, if inter is -1, frame1 will be null, and frame2 should be used in full instead

    • frame2 is the frame to interpolate to, always an InterpolatedFrame

    • inter is the ratio between frame1 and frame2, if the animation isn't interpolating, it will be 1 and frame 1 will be null
      frame1/2 will both be null if an invalid tic or layer are passed

    NOTE: for FindAnimationFrameAt, tic should be Level.totaltime + fractic (in the playsim, fractic should be 1, not 0)
    NOTE: while interpolating, an animation may need to perform up to 4-way blending if both frame1 and frame2 are InterpolatedFrame

AnimationLayer SetAnimationLayerAnimation(AnimationLayer layer, Name animName, double framerate = -1, int startFrame = -1, int loopFrame = -1, int endFrame = -1, int interpolateTics = -1, int flags = 0);
ui AnimationLayer SetAnimationLayerAnimationUI(AnimationLayer layer, Name animName, double framerate = -1, int startFrame = -1, int loopFrame = -1, int endFrame = -1, int interpolateTics = -1, int flags = 0);

AnimationLayer SetAnimationLayerFrameRate(AnimationLayer layer, double framerate);
ui AnimationLayer SetAnimationLayerFrameRateUI(AnimationLayer layer, double framerate);

PrecalculatedAnimationFrame CalculateAnimation(readonly<AnimationLayer> layer);
ui PrecalculatedAnimationFrame CalculateAnimationUI(readonly<AnimationLayer> layer);

static clearscope PrecalculatedAnimationFrame BlendAnimationFrames(PrecalculatedAnimationFrame a, PrecalculatedAnimationFrame b, double t);

static clearscope PrecalculatedAnimationFrame OffsetAnimationFrame(PrecalculatedAnimationFrame frame, PrecalculatedAnimationFrame offset);


clearscope PrecalculatedAnimationFrame CalculateAnimationFrame(readonly<InterpolatedFrame> frame);

static clearscope AnimationFrame, InterpolatedFrame, double FindAnimationFrameAt(readonly<AnimationLayer> layer, double tic);
clearscope AnimationFrame, InterpolatedFrame, double FindAnimationFrame(readonly<AnimationLayer> layer);
clearscope AnimationFrame, InterpolatedFrame, double FindAnimationFrameUI(readonly<AnimationLayer> layer);

void SetBones(PrecalculatedAnimationFrame bones, int mode = SB_ADD, double interpolation_duration = 1.0);
ui void SetBonesUI(PrecalculatedAnimationFrame bones, int mode = SB_ADD, double interpolation_duration = 1.0);
ui OverwriteBones(PrecalculatedAnimationFrame bones, int mode = SB_ADD); // no interpolation, faster

void SetBonesRange(PrecalculatedAnimationFrame bones, int start, int length, int mode = SB_ADD, double interpolation_duration = 1.0);
ui void SetBonesRangeUI(PrecalculatedAnimationFrame bones, int start, int length, int mode = SB_ADD, double interpolation_duration = 1.0);
ui void OverwriteBonesRange(PrecalculatedAnimationFrame bones, int start, int length, int mode = SB_ADD); // no interpolation, faster

void SetBonesMask(PrecalculatedAnimationFrame bones, Array<bool> mask, int mode = SB_ADD, double interpolation_duration = 1.0);
ui void SetBonesMaskUI(PrecalculatedAnimationFrame bones, Array<bool> mask, int mode = SB_ADD, double interpolation_duration = 1.0);
ui void OverwriteBonesMask(PrecalculatedAnimationFrame bones, Array<bool> mask, int mode = SB_ADD); // no interpolation, faster

void ForceRecalculateBones(); // slow if called often, try and keep it to at most once per tick

ui virtual void AnimateBones(double ticfrac){}

@MajorCooke
Copy link
Contributor

Hell Yes!

@NCPUser
Copy link

NCPUser commented Aug 15, 2025

yes

@RicardoLuis0 RicardoLuis0 marked this pull request as ready for review October 11, 2025 13:11
@RicardoLuis0 RicardoLuis0 merged commit 8255e2b into ZDoom:master Oct 11, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants