Let a part be left out of a mask without being taken out of it
A layer built from parts was missing the one control a correction most often wants: seeing what it did. The question a subtracted gradient raises is whether it took only the sky, and the question a stroke raises is whether it filled the shoulder — and the only way to ask either was to remove the part and look, which answered the question and lost the part. The layer's own ring answers a different question, about the adjustment, and hiding eight layers to check one correction is not an A/B anybody performs. So a part carries `hidden`. It is an edit and a history step, as the layer's switch is, and it is folded into the render fingerprint because hiding a part changes the mask as surely as removing it does. Where the mask is built the shown parts are walked rather than the parts, which is what makes a hidden base hand the fold to the first part that is shown — and a revealed layer whose every part is hidden clears its slice rather than leaving whatever the last rasterisation put there to be read back. `covers` asks the same shown parts, so a layer whose only adding part is hidden costs no slice at all. In the sidecar the key is `hidden`, in the part's block or, for the base, in the mask block — under a word that cannot be confused with the layer's `enabled`, which has always meant the layer. Absent means shown, so no file written before the switch existed reads any differently. The row wears the same ring the layer does, one row down, because it is the same question about a smaller thing.
This commit is contained in:
@@ -1121,6 +1121,13 @@ fn write_mask(out: &mut String, version: &str, layer: &MaskLayer) {
|
||||
if !layer.enabled {
|
||||
let _ = writeln!(out, "enabled = 0");
|
||||
}
|
||||
// TRACES: FR-DEV-19a
|
||||
// The base part's own switch, under a different word from the layer's:
|
||||
// `enabled` in this block has always meant the layer, and a part that is
|
||||
// out of the build is `hidden` wherever it is written, base or not.
|
||||
if layer.base().hidden {
|
||||
let _ = writeln!(out, "hidden = 1");
|
||||
}
|
||||
write_shaping(out, layer.base());
|
||||
for (op, param, value) in layer.params() {
|
||||
let _ = writeln!(out, "{op}.{param} = {}", format_value(value));
|
||||
@@ -1148,6 +1155,9 @@ fn write_part(out: &mut String, version: &str, layer: &str, part: &MaskPart) {
|
||||
if part.invert {
|
||||
let _ = writeln!(out, "invert = 1");
|
||||
}
|
||||
if part.hidden {
|
||||
let _ = writeln!(out, "hidden = 1");
|
||||
}
|
||||
write_shaping(out, part);
|
||||
write_coverage(out, part);
|
||||
}
|
||||
@@ -1411,6 +1421,7 @@ struct PartialPart {
|
||||
/// A colour range's arc: centre and half-width, in turns.
|
||||
hue: (f32, f32),
|
||||
invert: bool,
|
||||
hidden: bool,
|
||||
/// The *part's* edge transition, distinct from the radial source's own
|
||||
/// `feather` above — different quantity, different units, different key.
|
||||
edge_feather: f32,
|
||||
@@ -1446,6 +1457,7 @@ impl PartialPart {
|
||||
band: (0.5, 1.0, crate::mask::DEFAULT_RANGE_SOFTNESS),
|
||||
hue: (0.06, 0.05),
|
||||
invert: false,
|
||||
hidden: false,
|
||||
edge_feather: DEFAULT_FEATHER,
|
||||
falloff: Falloff::default(),
|
||||
morphology: Morphology::default(),
|
||||
@@ -1510,6 +1522,9 @@ impl PartialPart {
|
||||
// and the file's line order is the order they were painted in.
|
||||
"stroke" => self.strokes.extend(parse_stroke(value)),
|
||||
"invert" => self.invert = value != "0",
|
||||
// Absent means shown, so a file from before the switch existed
|
||||
// reads back with every part in the build, as it was written.
|
||||
"hidden" => self.hidden = value != "0",
|
||||
// Clamped, not trusted: a feather wider than the frame is not a
|
||||
// mask, and a negative one is a distance field read backwards.
|
||||
"edge-feather" => {
|
||||
@@ -1611,6 +1626,7 @@ impl PartialPart {
|
||||
|
||||
let mut part = MaskPart::new(self.id, self.join, source);
|
||||
part.invert = self.invert;
|
||||
part.hidden = self.hidden;
|
||||
part.feather = self.edge_feather;
|
||||
part.falloff = self.falloff;
|
||||
part.morphology = self.morphology;
|
||||
|
||||
Reference in New Issue
Block a user