Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing operation stack when a new project is loaded #18883

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions cura/CuraApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -2281,8 +2281,8 @@ def appHeight(self) -> int:
return 0

@pyqtSlot()
def deleteAll(self, only_selectable: bool = True) -> None:
super().deleteAll(only_selectable = only_selectable)
def deleteAll(self, only_selectable: bool = True, clear_all:bool = False) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def deleteAll(self, only_selectable: bool = True, clear_all:bool = False) -> None:
def deleteAll(self, only_selectable: bool = True, clear_all:bool = False) -> None:

We should guard against bool traps here. You can do that by by adding a param that eats up all unnamed arguments.

super().deleteAll(only_selectable = only_selectable, clear_all = clear_all)

# Also remove nodes with LayerData
self._removeNodesWithLayerData(only_selectable = only_selectable)
Expand Down
7 changes: 7 additions & 0 deletions cura/Scene/ConvexHullDecorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ def __deepcopy__(self, memo):

return ConvexHullDecorator()

def clearDecoratorData(self):
super().clearDecoratorData()
self._global_stack = None
self._recompute_convex_hull_timer = None
self._raft_thickness = 0.0
self.recomputeConvexHull()

def getAdhesionArea(self) -> Optional[Polygon]:
"""The polygon representing the 2D adhesion area.

Expand Down
11 changes: 11 additions & 0 deletions cura/Settings/SettingOverrideDecorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ def __init__(self, *, force_update = True):
if force_update:
self._updateNextStack()

def clearDecoratorData(self) -> None:
super().clearDecoratorData()
self._stack = None
self._extruder_stack = None
self._is_non_printing_mesh = False
self._is_non_thumbnail_visible_mesh = False
self._is_support_mesh = False
self._is_cutting_mesh = False
self._is_infill_mesh = False
self._is_anti_overhang_mesh = False

def _generateUniqueName(self):
return "SettingOverrideInstanceContainer-%s" % uuid.uuid1()

Expand Down
Loading