Skip to content

Commit 373cca1

Browse files
committed
Rebuild the layer tree at the end, not after each step
1 parent f02d958 commit 373cca1

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

editor/src/messages/portfolio/document/graph_operation/graph_operation_message_handler.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ fn import_usvg_node(
492492
modify_inputs.import_mode = false;
493493
modify_inputs.layer_node = Some(layer);
494494

495+
// Rebuild the layer tree once now that all wiring is complete
496+
modify_inputs.network_interface.load_structure();
497+
495498
// Set positions for all imported descendants in a single O(n) pass
496499
let parent_pos = modify_inputs.network_interface.position(&layer.to_node(), &[]).unwrap_or(IVec2::ZERO);
497500
set_import_child_positions(modify_inputs.network_interface, layer, parent_pos, &child_extents_svg_order, &group_extents_map);

editor/src/messages/portfolio/document/utility_types/network_interface.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3832,9 +3832,8 @@ impl NodeNetworkInterface {
38323832
}
38333833

38343834
/// Lightweight version of `set_input` for bulk import operations.
3835-
/// Directly sets the input without `is_acyclic` checks, position conversions, or per-node cache
3836-
/// invalidation. Only `load_structure` and outward wire invalidation are performed as they are
3837-
/// needed for correct wiring of subsequent nodes. Call `unload_all_nodes_click_targets` and
3835+
/// Directly sets the input without `is_acyclic` checks, `load_structure`, position conversions,
3836+
/// or per-node cache invalidation. Call `load_structure`, `unload_all_nodes_click_targets`, and
38383837
/// `unload_all_nodes_bounding_box` once after all import wiring is complete.
38393838
pub fn set_input_for_import(&mut self, input_connector: &InputConnector, new_input: NodeInput, network_path: &[NodeId]) {
38403839
let Some(network) = self.network_mut(network_path) else {
@@ -3865,11 +3864,6 @@ impl NodeNetworkInterface {
38653864

38663865
self.transaction_modified();
38673866
self.unload_outward_wires(network_path);
3868-
3869-
// Rebuild the layer tree structure so parent-child relationships are correct for subsequent operations
3870-
if network_path.is_empty() {
3871-
self.load_structure();
3872-
}
38733867
}
38743868

38753869
pub fn set_input(&mut self, input_connector: &InputConnector, new_input: NodeInput, network_path: &[NodeId]) {

0 commit comments

Comments
 (0)