Switch the tagged list values and layer internals onto leveled wires

This commit is contained in:
Dennis Kobert
2026-08-22 12:47:31 +00:00
parent 887dbaca2c
commit 46220ac268
4 changed files with 102 additions and 108 deletions

View File

@@ -174,12 +174,8 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
// Stamp each item of the content with the parent layer's NodeId via the `editor:layer_path` attribute,
// so editor tools (e.g. selection, click target routing) can trace data back to its owning layer.
DocumentNode {
inputs: vec![
NodeInput::node(NodeId(1), 0),
NodeInput::value(TaggedValue::String(graphene_std::ATTR_EDITOR_LAYER_PATH.to_string()), false),
NodeInput::node(NodeId(2), 0),
],
implementation: DocumentNodeImplementation::ProtoNode(graphic::write_attribute::IDENTIFIER),
inputs: vec![NodeInput::node(NodeId(1), 0), NodeInput::node(NodeId(2), 0)],
implementation: DocumentNodeImplementation::ProtoNode(graphic::stamp_layer_path::IDENTIFIER),
..Default::default()
},
// The monitor node is used to display a thumbnail in the UI
@@ -236,7 +232,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
},
..Default::default()
},
// 3: write_attribute
// 3: stamp_layer_path
DocumentNodeMetadata {
persistent_metadata: DocumentNodePersistentMetadata {
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(-14, -1)),
@@ -304,12 +300,8 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
// Stamp each item of the content with the parent layer's NodeId via the `editor:layer_path` attribute,
// so editor tools (e.g. selection, click target routing) can trace data back to its owning layer.
DocumentNode {
inputs: vec![
NodeInput::node(NodeId(0), 0),
NodeInput::value(TaggedValue::String(graphene_std::ATTR_EDITOR_LAYER_PATH.to_string()), false),
NodeInput::node(NodeId(1), 0),
],
implementation: DocumentNodeImplementation::ProtoNode(graphic::write_attribute::IDENTIFIER),
inputs: vec![NodeInput::node(NodeId(0), 0), NodeInput::node(NodeId(1), 0)],
implementation: DocumentNodeImplementation::ProtoNode(graphic::stamp_layer_path::IDENTIFIER),
..Default::default()
},
// The monitor node is used to display a thumbnail in the UI.
@@ -395,7 +387,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
},
..Default::default()
},
// 2: write_attribute
// 2: stamp_layer_path
DocumentNodeMetadata {
persistent_metadata: DocumentNodePersistentMetadata {
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(-14, -3)),

View File

@@ -1024,11 +1024,10 @@ fn replace_optional_f64_null(input: &str) -> String {
result
}
/// Serialized proto identifiers of the Merge and Artboard layer internals that the
/// leveled-records flip retires. When the flip lands, `document_migration_reset_node_definition`
/// starts matching these, so every pre-flip document rebuilds its layer definitions through the
/// same reset mechanism as the `SourceNodeIdNode` entry there. A test pins each marker to the
/// live identifier so a pre-flip rename cannot silently invalidate the staged strings.
/// Serialized proto identifiers of the pre-flip Merge and Artboard layer internals.
/// A document containing any of them predates the leveled-records flip and rebuilds its
/// layer definitions through the same reset mechanism as the `SourceNodeIdNode` entry in
/// `document_migration_reset_node_definition`.
pub const FLIP_RESET_NODE_MARKERS: &[&str] = &["graphic_nodes::graphic::WriteAttributeNode"];
pub fn document_migration_reset_node_definition(document_serialized_content: &str) -> bool {
@@ -1052,6 +1051,12 @@ pub fn document_migration_reset_node_definition(document_serialized_content: &st
return true;
}
// The leveled-records flip replaced the layer internals; documents from before it rebuild
// their layer definitions.
if FLIP_RESET_NODE_MARKERS.iter().any(|marker| document_serialized_content.contains(marker)) {
return true;
}
false
}