ContextRef ModeβIndexes ππ π
Pick your own reference windows
- CONTEXTREF_MODE
Mode Β· First always anchors to the very first context window. This node is the manual version: you choose which window index, or indexes, act as ContextRef's reference, instead of accepting the default.
What it does
switch_on_idxs (STRING, defaults to empty) is where you list the window indexes you want treated as reference points - something like 0,8,16, going by the field's name and how index lists tend to be written elsewhere in this pack. Leave it empty and, combined with always_include_0 (BOOLEAN, default true), you're effectively back to Mode Β· First's behavior: window 0 stays the reference. The real point of this node is turning always_include_0 off and filling in your own indexes, which lets you add or fully replace the reference point(s) partway through a long context-window render - useful when a scene, costume, or lighting setup changes and you want the back half of the video anchored to a different look than the front half.
Zero required fields, both optional - output is CONTEXTREF_MODE, wired the same way as Mode Β· First into ContextRef's contextref_mode or a Keyframe node's mode_replace.
Why you'd reach for this over the simpler mode
Any render where "the whole thing should look like frame one" isn't actually true - a scene cut, a costume swap, a location change within a single long context-window sequence. Rather than fighting one fixed anchor the whole way through, you give ContextRef fresh reference points at the moments the intended look actually shifts.
A practical way to find your indexes
Context window indexes correspond to chunks of your sliding window, not raw frame numbers - window 0 covers the first stretch of frames, window 1 the next overlapping stretch, and so on, based on whatever length and stride your Context Options node is set to. If a scene change lands roughly halfway through a video split into, say, 10 windows, start by testing an index around the midpoint rather than guessing blind, then adjust once you see where the reference actually shifts.
Installing it
Same as the rest of the family: ComfyUI Manager, search AnimateDiff Evolved by Kosinkadink, install, restart. Or git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved into custom_nodes and restart manually.
Where to be careful
This is a genuinely under-documented node - there's no public write-up of the exact index-list syntax to lean on, so treat the field as something to verify by testing rather than assuming. The safest way in: set one extra index, render a short test clip, and confirm the back half actually shifted reference before building a longer schedule around it. And remember always_include_0 is on by default - if you wanted to fully replace the reference rather than add to it, that's the flag to switch off first.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| switch_on_idxsopt | STRING | β | |
| always_include_0opt | BOOLEAN | true | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONTEXTREF_MODE | CONTEXTREF_MODE | β |