Skip to content

Commit

Permalink
Autoslice could cause slicing to start before init done.
Browse files Browse the repository at this point in the history
This could cause slicing to hang forever until settings where changed. So stop too-early slicing, but keep a memo of wether we've already been requested to slice in the initialization interval, so auto-slice doesn't fail either.

CURA-11815
  • Loading branch information
rburema committed Oct 15, 2024
1 parent 6f6c000 commit 4803223
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/CuraEngineBackend/CuraEngineBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def __init__(self) -> None:
"""

super().__init__()
self._init_done = False
self._immediate_slice_after_init = False

# Find out where the engine is located, and how it is called.
# This depends on how Cura is packaged and which OS we are running on.
executable_name = "CuraEngine"
Expand Down Expand Up @@ -268,6 +271,10 @@ def initialize(self) -> None:
self._machine_error_checker = application.getMachineErrorChecker()
self._machine_error_checker.errorCheckFinished.connect(self._onStackErrorCheckFinished)

self._init_done = True
if self._immediate_slice_after_init:
self.slice()

def close(self) -> None:
"""Terminate the engine process.
Expand Down Expand Up @@ -342,6 +349,11 @@ def getLatestSnapshot(self) -> Optional[QImage]:
def slice(self) -> None:
"""Perform a slice of the scene."""

if not self._init_done:
self._immediate_slice_after_init = True
return
self._immediate_slice_after_init = False

self._createSnapshot()

self.startPlugins()
Expand Down

0 comments on commit 4803223

Please sign in to comment.