From f19c3ea88bbb3782c3141f1fdf1aae06bf3af0fd Mon Sep 17 00:00:00 2001 From: gator Date: Mon, 14 Sep 2026 19:10:56 +0000 Subject: [PATCH] create: disable shot counts an engine cannot produce --- create.html | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/create.html b/create.html index bae5de0..0328b47 100644 --- a/create.html +++ b/create.html @@ -151,6 +151,9 @@ function modelOf(id) { return null; } function shotSeconds() { return (MODEL && MODEL.shot_seconds) || 8; } +// Some engines cap total length: extension stops at 40s, so 6 shots is not +// available there. Grey it out rather than let the server silently clamp. +function maxShots() { return (MODEL && MODEL.max_shots) || 0; } (async function loadFormats() { var r = await api("camera_presets", {}); @@ -210,9 +213,25 @@ function paintModel() { var el = document.getElementById("modelnote"); el.textContent = MODEL ? (MODEL.shot_seconds + "s per shot. " + (MODEL.note || "")) : ""; var chips = document.querySelectorAll("#len .chip"); + var cap = maxShots(); for (var i = 0; i < chips.length; i++) { var nshots = parseInt(chips[i].getAttribute("data-v"), 10); - chips[i].textContent = nshots + " shots · " + (nshots * shotSeconds()) + "s"; + var over = cap && nshots > cap; + chips[i].textContent = nshots + " shots · " + (nshots * shotSeconds()) + "s" + + (over ? " — too long for this engine" : ""); + chips[i].style.opacity = over ? "0.4" : ""; + chips[i].style.pointerEvents = over ? "none" : ""; + // If the disabled one was selected, fall back to the largest that fits. + if (over && chips[i].classList.contains("on")) { + chips[i].classList.remove("on"); + for (var j = i - 1; j >= 0; j--) { + if (!chips[j].style.pointerEvents) { + chips[j].classList.add("on"); + segments = parseInt(chips[j].getAttribute("data-v"), 10); + break; + } + } + } } document.getElementById("lenhint").textContent = "The piece is written as one continuous monologue, then cut into "