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>
45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "core/canvas.hpp"
|
|
#include "core/chain.hpp"
|
|
#include "core/params.hpp"
|
|
|
|
namespace effector {
|
|
|
|
struct Options {
|
|
std::vector<std::string> images;
|
|
std::vector<std::string> effects; // one per cascade stage, in order
|
|
// The effects named by --disable: their stages stay in the chain, in
|
|
// place, but are skipped. Named rather than numbered, exactly as the
|
|
// params are, so two stages of one effect are disabled together.
|
|
std::vector<std::string> disabled;
|
|
std::string output; // empty -> launch the interface
|
|
int width = 1920;
|
|
int height = 1080;
|
|
std::string format; // a named canvas format, empty for plain pixels
|
|
int dpi = kDefaultDpi; // only a print format is rendered at a resolution
|
|
std::optional<std::uint64_t> seed;
|
|
ParamValues params; // only the keys the user actually passed
|
|
bool listEffects = false;
|
|
bool showHelp = false;
|
|
};
|
|
|
|
// Throws EffectError on bad input. Effect flags are generated from the
|
|
// registry, so a new effect gets its flags without touching this file.
|
|
Options parseOptions(int argc, char** argv);
|
|
|
|
std::string usage(const char* programName);
|
|
|
|
// Turns the parsed names and flags into cascade stages: every flag goes to the
|
|
// stage whose effect declares it, so --strip-height and --radius can be given
|
|
// together for `-e scanlines -e blur`. A stage named by --disable is built
|
|
// with all its settings and marked to be skipped.
|
|
std::vector<ChainStage> buildChain(const Options& options);
|
|
|
|
} // namespace effector
|