Let a chain stage be switched off without taking it apart
Trying a stage out meant removing it and building it again from scratch, settings and all, to see what the picture looked like without it. A stage now carries an `enabled` flag and can simply be switched off: it keeps its place in the chain and everything it was set to. `enabledStages` is the one place that reads the flag, and renderChain, chainNeedsSources, chainTitle and chainSlug all go through it. A disabled stage is skipped whole — handed no image and drawing nothing from the shared rng — so switching one off renders byte for byte what the chain rendered before that stage was added, which is the only thing that makes the switch worth anything while comparing. Whichever stage runs first is the one handed the sources, so disabling a leading scanlines lets blur lead and the chain needs no images at all. The status line and the generated file name follow too: they name what was rendered, not what sits in the sidebar. A chain with every stage disabled throws rather than quietly rendering nothing. In the interface it is a check on the chain row: the row dims, the params heading says "(off)" and the settings stay editable — a stage being worked on is not the same as one being deleted. On the command line it is `--disable NAME`, which picks its stage by effect name exactly as the params do. A project writes `"enabled": false` only for a stage that is off, so existing project files are unchanged and an ordinary one stays uncluttered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -73,10 +73,20 @@ the whole of the cascade — an effect neither knows nor cares whether its input
|
||||
came from disk. All stages share one `Rng` and run strictly in sequence, so a
|
||||
seed still reproduces the cascade byte for byte.
|
||||
|
||||
A stage carries a `ChainStage::enabled` flag, and `enabledStages`
|
||||
(`src/core/chain.cpp`) is the one place that reads it: a disabled stage is
|
||||
skipped whole — handed no image and drawing nothing from the shared rng — so
|
||||
switching one off renders exactly what the chain rendered before it was added.
|
||||
`renderChain`, `chainNeedsSources`, `chainTitle` and `chainSlug` all go through
|
||||
it, which is why the status line and the file name never mention a stage that
|
||||
did not run. A chain with every stage disabled throws rather than rendering
|
||||
nothing.
|
||||
|
||||
The interface builds the chain in the sidebar ("Effect chain": add from the
|
||||
menu, reorder, remove, one stage selected at a time with its params below), the
|
||||
CLI builds it from repeated `-e`: `-e scanlines --strip-height 6 -e blur
|
||||
--radius 5`. Flags share one namespace across all effects, so `buildChain`
|
||||
menu, reorder, remove, switch off with the check on the row, one stage selected
|
||||
at a time with its params below), the CLI builds it from repeated `-e`:
|
||||
`-e scanlines --strip-height 6 -e blur --radius 5`, with `--disable NAME`
|
||||
leaving a stage in place but skipping it. Flags share one namespace across all effects, so `buildChain`
|
||||
(`src/cli/options.cpp`) hands each flag to the stage whose effect declares it —
|
||||
two effects must not declare the same param key.
|
||||
|
||||
@@ -94,7 +104,8 @@ pixels, so a project saved as A4 reopens as A4.
|
||||
### Projects are plain JSON
|
||||
|
||||
`src/core/project.cpp` reads and writes the whole setup — source paths, the
|
||||
chain with its params, canvas and seed — as a small JSON file, with its own
|
||||
chain with its params (and its `"enabled": false`, written only for a stage
|
||||
that is switched off), canvas and seed — as a small JSON file, with its own
|
||||
minimal reader rather than a JSON dependency. Writing is driven by the effects'
|
||||
`ParamSpec`s, not by whatever happens to sit in a stage's `ParamValues`, so a
|
||||
key an effect does not declare is never written and never read back: an old
|
||||
|
||||
Reference in New Issue
Block a user