A picture with a title, a caption and a credit meant typing the same font, size and colour into every text stage, and changing the look meant typing them all again. A project now holds named styles: a stage follows one, and editing it moves every stage that follows it at once. The front-ends learn nothing effect-specific. A ParamSpec can be marked .styled(), saying a style carries it rather than the stage, and Effect::styleKind() names the pool it comes from -- so styleSpecs(kind) is to a style what params() is to a stage, and a second text-ish effect would slot into the styles that already exist. The look is what a style carries; the words and the placement stay on the stage, which is what lets two stages share a typography in two different corners. stageValues() resolves one in a single place, and a stage keeps a full set of values of its own beside the style, so switching it to Custom, dropping the style, or opening the project in a build that does not know it renders exactly the same picture. A style moves stages together; it never holds the only copy of anything. The command line builds no styles and passes none, so it renders what it always did. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
40 lines
1.5 KiB
C++
40 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "core/params.hpp"
|
|
|
|
namespace effector {
|
|
|
|
// A named set of formatting values, shared by every stage that follows it.
|
|
//
|
|
// A style carries only the params an effect marked styled() -- the look, never
|
|
// the placement -- so several text stages can share one typography while each
|
|
// keeps its own words and its own corner of the canvas. Changing the style is
|
|
// the point: it changes every stage pointing at it at once.
|
|
struct Style {
|
|
std::string kind; // the pool, as Effect::styleKind() names it
|
|
std::string name; // unique within a kind, never empty
|
|
ParamValues values; // the styled params only
|
|
};
|
|
|
|
using StyleSet = std::vector<Style>;
|
|
|
|
// The styled specs of a kind: every registered effect answering that kind
|
|
// contributes its styled params, the first declaration of a key winning. This
|
|
// is to a style what Effect::params() is to a stage -- the only thing the
|
|
// interface and the project file know about what a style holds -- so an empty
|
|
// or unknown kind gives an empty list.
|
|
std::vector<ParamSpec> styleSpecs(const std::string& kind);
|
|
|
|
// A fresh set of values for a style of that kind: every styled param at the
|
|
// default its effect declares, the way Effect::defaults() fills a stage.
|
|
ParamValues styleDefaults(const std::string& kind);
|
|
|
|
// The style of that name in that pool, or nullptr. A stage naming a style that
|
|
// is not there simply stands on its own values.
|
|
const Style* findStyle(const StyleSet& styles, const std::string& kind, const std::string& name);
|
|
|
|
} // namespace effector
|