Nodes/ComfyUI-curved_weight_schedule/Redistribute Keyframe Percents ๐Ÿ”„
ComfyUI Node

Redistribute Keyframe Percents ๐Ÿ”„

The fix for the single most annoying temporal masking bug

By diffussy69ยทCreated 11 months agoยทUpdated 9 months agoยท 2
Redistribute Keyframe Percents ๐Ÿ”„
  • timestep_keyframes
  • timestep_kf
  • info
โ—„start_percent0.00โ–บ
โ—„end_percent1.00โ–บ
โ—„distributionlinearโ–บ
โ—„print_scheduletrueโ–บ

This node exists because of a specific, reproducible, infuriating behavior: you build a nice multi-keyframe schedule, and every single keyframe lands at start_percent = 0.0 - meaning they're all active from the very first step, the temporal idea collapses, and you spend an evening convinced the whole approach is broken. This node is the fix. It takes your keyframes and redistributes their start_percent values evenly across the timeline, preserving everything else - curves, strengths, masks, images - so a pile of keyframes all stuck at 0% becomes a proper 0%, 25%, 50%, 75%, 100% sequence.

How it works

You feed it a timestep_keyframes group and it rewrites the timing: start_percent and end_percent define the range to distribute across (default the full 0โ€“1), and distribution picks how the spacing is packed - linear for even spacing (the recommended default), ease_in to cluster keyframes early, ease_out to cluster them late. Under the hood it clones the keyframes and only touches their start_percent values, which is why the curves and mask data survive untouched. It even wraps Advanced ControlNet's keyframe containers in a compatible interface so it works regardless of which version of the dependency you're on.

Outputs are timestep_kf (the fixed keyframes, back into the pipeline) and info (a before/after summary). print_schedule dumps the redistribution to the console when you want to verify.

Where it sits in the workflow

Dead center of the temporal masking pipeline, right after the scheduler that generates the keyframes:

Multi-Mask Combiner (Batch) โ†’ Advanced Curved ControlNet Scheduler
  โ†’ Redistribute Keyframe Percents โ†’ Batch Images to Timestep Keyframes
  โ†’ Apply CN Extras Masks โ†’ Apply Advanced ControlNet

The README's own troubleshooting for "keyframes not switching during generation" leads here - it's not a workaround, it's the intended step.

Installing it

Same pack:

cd ComfyUI/custom_nodes
git clone https://github.com/diffussy69/comfyui-curved_weight_schedule
pip install matplotlib pillow numpy torch scipy

It needs Advanced ControlNet present (the TimestepKeyframe import), and for full temporal masking the modified fork with per-keyframe image support.

Where people get burned

The temptation is to skip it because it feels like plumbing. Don't - it's the difference between "masks change over time" and "every mask fights for the whole generation." Two setup notes: if your scheduler already produces sensible staggered percentages (some do), running this through will re-space them, so only use it when keyframes actually arrive clumped at 0%. And if the Could not import TimestepKeyframe error shows up, that's the missing Advanced ControlNet dependency, not this node's doing.

CategoryControlNet/Keyframing

Inputs (5)

NameTypeDefaultDescription
timestep_keyframesTIMESTEP_KEYFRAMEโ€”
start_percentFLOAT0.000โ€“1โ€”
end_percentFLOAT1.000โ€“1โ€”
distributionoptCOMBOlinear3 options: linear, ease_in, ease_out
print_scheduleoptBOOLEANtrueโ€”

Outputs (2)

NameTypeDescription
timestep_kfTIMESTEP_KEYFRAMEโ€”
infoSTRINGโ€”