Make extra sure cache is emptied when objects get altered.

See the (new) cachePerInstance decorator in UM/Decorators, and the accompanying CachedMemberFunction handler-class.

part of CURA-11761
This commit is contained in:
Remco Burema 2024-09-03 18:23:41 +02:00
parent f8aa923ce0
commit d0252554c4
3 changed files with 10 additions and 2 deletions

View file

@ -5,7 +5,7 @@ from typing import Any, Dict, TYPE_CHECKING, Optional
from PyQt6.QtCore import pyqtProperty, pyqtSignal
from UM.Decorators import override
from UM.Decorators import CachedMemberFunctions, override
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
from UM.Settings.ContainerStack import ContainerStack
from UM.Settings.ContainerRegistry import ContainerRegistry
@ -86,6 +86,7 @@ class ExtruderStack(CuraContainerStack):
def setCompatibleMaterialDiameter(self, value: float) -> None:
old_approximate_diameter = self.getApproximateMaterialDiameter()
if self.getCompatibleMaterialDiameter() != value:
CachedMemberFunctions.clearInstanceCache(self)
self.definitionChanges.setProperty("material_diameter", "value", value)
self.compatibleMaterialDiameterChanged.emit()