mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-26 09:28:36 -07:00
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.
This commit is contained in:
parent
749d81c4d9
commit
f5a9cb2f65
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue