shots: render refuses missing frames and fails on load errors; shots check errors on renders with failed loads (pitfall 93)
This commit is contained in:
parent
00756e6908
commit
88d1b58f1f
7 changed files with 78 additions and 2 deletions
|
|
@ -305,3 +305,20 @@ export function boxOutside(b: DeviceBox, W: number, H: number, tol = 1): string[
|
|||
if (b.x + b.w > W + tol) out.push(`right ${Math.round(b.x + b.w - W)} px`);
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Frame files (relative to shots.frames: <lang>/<phone|tablet|landscape>/<src>) a render of these scenes and sizes
|
||||
* loads. A missing one renders an image with no app or game content (only a 404 in the page), so `shots render`
|
||||
* refuses to start without them. Landscape layouts use each scene's first frame; the feature graphic a phone frame. */
|
||||
export function framesForRender(scenes: { frames: { src: string }[] }[], sizes: string[], langs: string[],
|
||||
shots: Pick<ShotsConfig, 'landscape'> & { feature?: { frame?: string } }): string[] {
|
||||
const out = new Set<string>();
|
||||
for (const lang of langs) for (const size of sizes) {
|
||||
const s = SIZES[size];
|
||||
if (!s) continue;
|
||||
if (s.feature) { const f = shots.feature?.frame ?? scenes[0]?.frames[0]?.src; if (f) out.add(`${lang}/phone/${f}`); continue; }
|
||||
const d = renderDims(size, shots);
|
||||
const kind = d.landscape ? 'landscape' : s.device ? 'tablet' : 'phone';
|
||||
for (const sc of scenes) for (const f of d.landscape ? sc.frames.slice(0, 1) : sc.frames) out.add(`${lang}/${kind}/${f.src}`);
|
||||
}
|
||||
return [...out].sort();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue