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:
@@ -1344,6 +1344,48 @@ fn a_correction_painted_onto_a_subject_survives_a_round_trip() {
|
||||
);
|
||||
}
|
||||
|
||||
/// TRACES: FR-DEV-19a
|
||||
/// A part left out of the build comes back left out, and the file says so
|
||||
/// under a word that cannot be confused with the layer's own switch.
|
||||
#[test]
|
||||
fn a_hidden_part_stays_hidden_across_a_round_trip() {
|
||||
let mut graph = EditGraph::default_chain();
|
||||
let mut layer = corrected("m1", Join::Subtract);
|
||||
layer.part_mut(1).expect("the correction").hidden = true;
|
||||
graph.masks_mut().push(layer);
|
||||
|
||||
let mut sidecar = Sidecar::new();
|
||||
sidecar.put(Version::from_graph("default", "Default", &graph));
|
||||
let text = sidecar.to_text();
|
||||
assert!(text.contains("hidden = 1"), "{text}");
|
||||
assert!(
|
||||
!text.contains("enabled = 0"),
|
||||
"a hidden part must not read as a disabled layer:\n{text}"
|
||||
);
|
||||
|
||||
let restored = round_trip(&graph);
|
||||
let layer = &restored.masks().layers()[0];
|
||||
assert!(layer.parts()[1].hidden, "the correction is still out");
|
||||
assert!(!layer.parts()[0].hidden, "and the base is still in");
|
||||
assert!(layer.enabled, "and the layer itself was never switched off");
|
||||
}
|
||||
|
||||
/// TRACES: FR-DEV-19a
|
||||
/// The base is a part like any other for this: it can be left out, and the
|
||||
/// key lands in the mask block since that is where the base is written.
|
||||
#[test]
|
||||
fn a_hidden_base_is_written_into_the_mask_block() {
|
||||
let mut graph = EditGraph::default_chain();
|
||||
let mut layer = corrected("m1", Join::Union);
|
||||
layer.base_mut().hidden = true;
|
||||
graph.masks_mut().push(layer);
|
||||
|
||||
let restored = round_trip(&graph);
|
||||
let layer = &restored.masks().layers()[0];
|
||||
assert!(layer.parts()[0].hidden, "the base came back hidden");
|
||||
assert!(!layer.parts()[1].hidden, "and only the base");
|
||||
}
|
||||
|
||||
/// A part carries its own edge, which is the whole reason it is a part rather
|
||||
/// than a second source on the layer: a model's soft coverage and a stroke
|
||||
/// painted where it stopped short want different boundaries.
|
||||
|
||||
Reference in New Issue
Block a user