From f5a9cb2f65df0fdb91127ad320feb40dfde6431d Mon Sep 17 00:00:00 2001 From: HellAholic Date: Sun, 14 Dec 2025 23:54:32 +0100 Subject: [PATCH] Fix layer heights cache to use layer_data id Updated the caching logic in SimulationView to use the id of the layer_data object instead of the node. This ensures the cache is correctly invalidated when layer_data changes, preventing potential issues when nodes are reused. --- plugins/SimulationView/SimulationView.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 0c3c3bc03a..794abfccd6 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -309,14 +309,15 @@ class SimulationView(CuraView): if not layer_data: continue - # Check if we already have cached data for this node - current_node_id = id(node) - if self._layer_heights_cache_node_id == current_node_id and self._layer_heights_cache: + # Check if we already have cached data for this layer_data object + # Use id of the layer_data itself, not the node, since node might be reused + current_layer_data_id = id(layer_data) + if self._layer_heights_cache_node_id == current_layer_data_id and self._layer_heights_cache: # Cache is still valid, no need to recalculate return # Cache is invalid or empty, recalculate self._layer_heights_cache.clear() - self._layer_heights_cache_node_id = current_node_id + self._layer_heights_cache_node_id = current_layer_data_id has_gcode_decorator = node.getDecorator(GCodeListDecorator) is not None