VariantDraft¶
Namespace Nfty.Core.Editing in assembly Nfty.Core.
An editable variant: identity + weight + its pixels, in one or both of the two forms a variant can be authored in.
Remarks¶
A variant carries a grayscale VariantDraft.Map always, and a full-color VariantDraft.Color once it has been painted or imported in color mode. Which one is authoritative is decided by the owning IngredientDraft.Kind and never by which happens to be non-null: a Custom ingredient exports its VariantDraft.Color, everything else exports its VariantDraft.Map.
Both are kept rather than one replacing the other because that is precisely what the non-destructive save needs. Painting a Dynamic layer in color leaves its value-map untouched — so the original ingredient stays byte-identical on disk — while the color map becomes a new Custom ingredient beside it.
Constructors¶
VariantDraft(string, string, double, ValueMap, ColorMap?)¶
Creates a variant being edited.
Parameters
id(string) - Stable identifier.name(string) - Display name.weight(double) - Roll weight.map(ValueMap) - Its grayscale pixels.color(ColorMap?) - Its full-color pixels, or null for a variant not authored in color.
Properties¶
Color¶
The editable full-color pixels, or null while this variant has only ever been a value-map. Set when color mode is entered, and the only thing a Custom layer exports.
Id¶
Stable identifier, unique within the draft.
Map¶
The editable grayscale pixels — what a Dynamic or Static layer is authored in.
Name¶
Display name.
Weight¶
Roll weight; zero shelves the variant.
Methods¶
EnsureColor()¶
The variant's color pixels, widening its value-map on first use so entering color mode shows the drawing that is already there rather than a blank canvas. Idempotent: once a color map exists it is returned untouched, so re-entering color mode never discards paint.
Returns. This variant's color map.