diff --git a/editor/src/messages/portfolio/document/utility_types/document_metadata.rs b/editor/src/messages/portfolio/document/utility_types/document_metadata.rs index e4e8309182..f0936459e4 100644 --- a/editor/src/messages/portfolio/document/utility_types/document_metadata.rs +++ b/editor/src/messages/portfolio/document/utility_types/document_metadata.rs @@ -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); diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface.rs b/editor/src/messages/portfolio/document/utility_types/network_interface.rs index 54add70dca..2901c02c9a 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface.rs @@ -3042,16 +3042,14 @@ impl NodeNetworkInterface { for current_node_id in horizontal_flow_iter { if self.is_layer(¤t_node_id, &[]) { let current_layer_node = LayerNodeIdentifier::new(current_node_id, self, &[]); - if !self.document_metadata.structure.contains_key(¤t_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 { @@ -3059,11 +3057,9 @@ impl NodeNetworkInterface { for current_node_id in horizontal_flow_iter.skip(1) { if self.is_layer(¤t_node_id, &[]) { let current_layer_node = LayerNodeIdentifier::new(current_node_id, self, &[]); - if !self.document_metadata.structure.contains_key(¤t_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; } } } @@ -3080,12 +3076,10 @@ impl NodeNetworkInterface { if self.is_layer(¤t_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(¤t_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 {