Files
olivv-cs-ComfyUI-FunPack/app/ui/shell/frame_grid.js
T
digital-garbageandClaude Sonnet 5.5 30d1aa14a9 MiniMax H3-Image saves a PNG picture; Length and FPS are not offered and are set to 1
A pipeline with no length or rate input hides those controls in the Project and Scene panels. A preset can carry project numbers it goes with.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 03:27:51 +02:00

28 lines
1.8 KiB
JavaScript

// The frame counts the current model can make, read from its own length input (min + step): MiniMax H3's node says
// min 5 step 17 (22, 39, 56 …), LTX's min 1 step 8 (9, 17, 25 …). No family is named here: the node is the truth.
const specs = {};
const frameInputs = (slots) => (slots || []).flatMap((s) => (s.roles || []).filter((r) => r.drives === "frames" && r.input).map((r) => ({ node: s.node, input: r.input })));
/** {step, base} of the strictest frames input, or null when none steps by more than 1 (or its node is not described yet). */
export function gridOf(slots) {
let best = null;
for (const { node, input } of frameInputs(slots)) {
const w = ((specs[node] || {}).widgets || []).find((x) => x.name === input);
const step = w && Number(w.step), min = w ? Number(w.min) || 0 : 0;
if (step > 1 && (!best || step > best.step)) best = { step, base: ((min % step) + step) % step, fps: null };
}
return best;
}
/** Asks for the length inputs' node descriptions not known yet. -> true when something new was learned. */
export async function learnGrid(api, slots) {
const missing = [...new Set(frameInputs(slots).map((f) => f.node))].filter((n) => n && !(n in specs));
if (!missing.length || !api || !api.describeNodes) return false;
try { Object.assign(specs, (await api.describeNodes(missing)).nodes || {}); } catch { missing.forEach((n) => { specs[n] = null; }); }
return true;
}
/** Whether the pipeline takes a length or a rate from the project at all. A model that makes a picture holds it for a fixed time, so
* there is nothing to set: the Length and FPS controls are not offered. A pipeline not known yet offers them. */
export const offersLength = (slots) => !(slots && slots.length) || slots.some((s) => (s.roles || []).some((r) => r.drives === "frames" || r.drives === "fps"));