Prevent max recursion for convex hull calculation

fixes CURA-3W
This commit is contained in:
Jaime van Kessel 2020-02-28 16:31:28 +01:00
parent f4d1d5d936
commit 27c6cb4c1e
No known key found for this signature in database
GPG key ID: 3710727397403C91

View file

@ -36,8 +36,10 @@ class ConvexHullDecorator(SceneNodeDecorator):
# Make sure the timer is created on the main thread # Make sure the timer is created on the main thread
self._recompute_convex_hull_timer = None # type: Optional[QTimer] self._recompute_convex_hull_timer = None # type: Optional[QTimer]
self._timer_scheduled_to_be_created = False
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
if CuraApplication.getInstance() is not None: if CuraApplication.getInstance() is not None:
self._timer_scheduled_to_be_created = True
CuraApplication.getInstance().callLater(self.createRecomputeConvexHullTimer) CuraApplication.getInstance().callLater(self.createRecomputeConvexHullTimer)
self._raft_thickness = 0.0 self._raft_thickness = 0.0
@ -171,7 +173,12 @@ class ConvexHullDecorator(SceneNodeDecorator):
if self._recompute_convex_hull_timer is not None: if self._recompute_convex_hull_timer is not None:
self._recompute_convex_hull_timer.start() self._recompute_convex_hull_timer.start()
else: else:
self.recomputeConvexHull() from cura.CuraApplication import CuraApplication
if not self._timer_scheduled_to_be_created:
# The timer is not created and we never scheduled it. Time to create it now!
CuraApplication.getInstance().callLater(self.createRecomputeConvexHullTimer)
# Now we know for sure that the timer has been scheduled for creation, so we can try this again.
CuraApplication.getInstance().callLater(self.recomputeConvexHullDelayed)
def recomputeConvexHull(self) -> None: def recomputeConvexHull(self) -> None:
controller = Application.getInstance().getController() controller = Application.getInstance().getController()