Skip to content

Commit

Permalink
Remove the checks if layer is already present in graph to allow multi…
Browse files Browse the repository at this point in the history
…ple instances
  • Loading branch information
mTvare6 committed Jan 23, 2025
1 parent ad68b1e commit 1ac3c33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl LayerNodeIdentifier {

/// Add a child towards the bottom of the Layers panel
pub fn push_child(self, metadata: &mut DocumentMetadata, new: LayerNodeIdentifier) {
assert!(!metadata.structure.contains_key(&new), "Cannot add already existing layer");
//assert!(!metadata.structure.contains_key(&new), "Cannot add already existing layer");
let parent = metadata.get_structure_mut(self);
let old_last_child = parent.last_child.replace(new);
parent.first_child.get_or_insert(new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3042,28 +3042,24 @@ impl NodeNetworkInterface {
for current_node_id in horizontal_flow_iter {
if self.is_layer(&current_node_id, &[]) {
let current_layer_node = LayerNodeIdentifier::new(current_node_id, self, &[]);
if !self.document_metadata.structure.contains_key(&current_layer_node) {
if current_node_id == first_root_layer.to_node() {
awaiting_primary_flow.push((current_node_id, LayerNodeIdentifier::ROOT_PARENT));
children.push((LayerNodeIdentifier::ROOT_PARENT, current_layer_node));
} else {
awaiting_primary_flow.push((current_node_id, parent_layer_node));
children.push((parent_layer_node, current_layer_node));
}
parent_layer_node = current_layer_node;
if current_node_id == first_root_layer.to_node() {
awaiting_primary_flow.push((current_node_id, LayerNodeIdentifier::ROOT_PARENT));
children.push((LayerNodeIdentifier::ROOT_PARENT, current_layer_node));
} else {
awaiting_primary_flow.push((current_node_id, parent_layer_node));
children.push((parent_layer_node, current_layer_node));
}
parent_layer_node = current_layer_node;
}
}
} else {
// Skip the horizontal_root_node_id node
for current_node_id in horizontal_flow_iter.skip(1) {
if self.is_layer(&current_node_id, &[]) {
let current_layer_node = LayerNodeIdentifier::new(current_node_id, self, &[]);
if !self.document_metadata.structure.contains_key(&current_layer_node) {
awaiting_primary_flow.push((current_node_id, parent_layer_node));
children.push((parent_layer_node, current_layer_node));
parent_layer_node = current_layer_node;
}
awaiting_primary_flow.push((current_node_id, parent_layer_node));
children.push((parent_layer_node, current_layer_node));
parent_layer_node = current_layer_node;
}
}
}
Expand All @@ -3080,12 +3076,10 @@ impl NodeNetworkInterface {
if self.is_layer(&current_node_id, &[]) {
// Create a new layer for the top of each stack, and add it as a child to the previous parent
let current_layer_node = LayerNodeIdentifier::new(current_node_id, self, &[]);
if !self.document_metadata.structure.contains_key(&current_layer_node) {
children.push(current_layer_node);
children.push(current_layer_node);

// The layer nodes for the horizontal flow is itself
awaiting_horizontal_flow.push((current_node_id, current_layer_node));
}
// The layer nodes for the horizontal flow is itself
awaiting_horizontal_flow.push((current_node_id, current_layer_node));
}
}
for child in children {
Expand Down

0 comments on commit 1ac3c33

Please sign in to comment.