add per-chunk output enable toggles

This commit is contained in:
2026-10-20 16:09:28 +00:00
parent 6f8fd85405
commit d2fe5579b3
3 changed files with 48 additions and 9 deletions
+15 -5
View File
@@ -91,7 +91,7 @@ function refModDescriptorsForNode(node, inputName = "ref_mods") {
function defaultState(count, seconds) {
return { version: 1, clips: Array.from({ length: count }, () => ({
duration: seconds, slots: [{ start: 0, end: seconds, text: "" }], prompt: "",
duration: seconds, enabled: true, slots: [{ start: 0, end: seconds, text: "" }], prompt: "",
})) };
}
@@ -297,13 +297,14 @@ function configure(node) {
DURATION_OPTIONS[6]);
if (Number(secondsWidget.value) !== selectedDuration.seconds) secondsWidget.value = selectedDuration.seconds;
const chunkDuration = selectedDuration.seconds;
while (state.clips.length < count) state.clips.push({ duration: chunkDuration, slots: [] });
while (state.clips.length < count) state.clips.push({ duration: chunkDuration, enabled: true, slots: [] });
state.clips = state.clips.slice(0, count); active = Math.min(active, count - 1);
panel.replaceChildren();
const tabs = el("div"); tabs.style.cssText = "display:flex;flex-wrap:wrap;gap:4px;margin-bottom:8px;border-bottom:1px solid #444;padding-bottom:6px";
state.clips.forEach((clip, index) => {
const button = el("button", `Clip ${index + 1}`); button.type = "button"; button.disabled = index === active;
button.style.cssText = `padding:3px 10px;border:1px solid ${index === active ? "#8bc99b" : "#555"};border-radius:3px;background:${index === active ? "#4b6f55" : "#333"};color:${index === active ? "#fff" : "#bbb"};cursor:pointer`;
const enabled = clip.enabled !== false;
const button = el("button", `${enabled ? "" : "× "}Clip ${index + 1}`); button.type = "button"; button.disabled = index === active;
button.style.cssText = `padding:3px 10px;border:1px solid ${index === active ? (enabled ? "#8bc99b" : "#c98b8b") : "#555"};border-radius:3px;background:${index === active ? (enabled ? "#4b6f55" : "#6f4b4b") : "#333"};color:${index === active ? "#fff" : (enabled ? "#bbb" : "#888")};cursor:pointer`;
button.onclick = () => { active = index; render(); }; tabs.append(button);
});
panel.append(tabs);
@@ -334,7 +335,16 @@ function configure(node) {
durationControl.append(durationLabel, durationSelect);
panel.append(durationControl);
const durationRow = el("div"); durationRow.style.cssText = "display:flex;align-items:center;gap:8px;margin:4px 0 6px;color:#b7d6bf";
durationRow.append(el("strong", `Clip ${active + 1}`), el("span", `· ${selectedDuration.actual} actual frames · ${selectedDuration.latent} latent frames · ${selectedDuration.labelSeconds.toFixed(2)}s shared chunk duration`)); panel.append(durationRow);
const enabledLabel = el("label"); enabledLabel.style.cssText = "display:inline-flex;align-items:center;gap:4px;margin-left:auto;color:#c7d8cb;font-weight:normal;cursor:pointer";
const enabledToggle = document.createElement("input"); enabledToggle.type = "checkbox"; enabledToggle.checked = clip.enabled !== false; enabledToggle.title = "Include this chunk in the output sockets";
enabledToggle.onchange = () => { clip.enabled = enabledToggle.checked; persistState(); render(); };
enabledLabel.append(enabledToggle, el("span", "Enabled"));
durationRow.append(el("strong", `Clip ${active + 1}`), el("span", `· ${selectedDuration.actual} actual frames · ${selectedDuration.latent} latent frames · ${selectedDuration.labelSeconds.toFixed(2)}s shared chunk duration`), enabledLabel); panel.append(durationRow);
if (clip.enabled === false) {
const disabledNote = el("div", "This chunk is disabled and will not be sent to the output sockets.");
disabledNote.style.cssText = "padding:5px 7px;margin:0 0 6px;background:#3a2525;border:1px solid #704848;border-radius:4px;color:#e2b4b4;font:11px monospace";
panel.append(disabledNote);
}
const timeline = el("div"); timeline.style.cssText = "position:relative;height:38px;margin:8px 0 4px;background:#171717;border-radius:4px;overflow:hidden;border:1px solid #555";
const palette = ["#4b9b67", "#4d7fb1", "#a87945", "#8c5aa8", "#a44f5d", "#3f8e8a"];
let prompt = null;