diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 342f6cb91d..7b6e970a68 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1040,8 +1040,9 @@ class CuraApplication(QtApplication): Selection.add(node) ## Delete all nodes containing mesh data in the scene. + # \param only_selectable. Set this to False to delete objects from all build plates @pyqtSlot() - def deleteAll(self): + def deleteAll(self, only_selectable = True): Logger.log("i", "Clearing scene") if not self.getController().getToolsEnabled(): return @@ -1052,7 +1053,9 @@ class CuraApplication(QtApplication): continue if (not node.getMeshData() and not node.callDecoration("getLayerData")) and not node.callDecoration("isGroup"): continue # Node that doesnt have a mesh and is not a group. - if not node.isSelectable(): + if only_selectable and not node.isSelectable(): + continue + if not node.callDecoration("isSliceable"): continue # Only remove nodes that are selectable. if node.getParent() and node.getParent().callDecoration("isGroup"): continue # Grouped nodes don't need resetting as their parent (the group) is resetted) @@ -1431,7 +1434,7 @@ class CuraApplication(QtApplication): self._currently_loading_files.append(f) if extension in self._non_sliceable_extensions: - self.deleteAll() + self.deleteAll(only_selectable = False) job = ReadMeshJob(f) job.finished.connect(self._readMeshFinished) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 47f7a07b94..ea7440843e 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -426,11 +426,10 @@ class CuraEngineBackend(QObject, Backend): if not isinstance(source, SceneNode): return - # This case checks if the source node is a node that contains a GCode. In this case the - # cached layer data is removed so the previous data is not rendered - CURA-4821 + # This case checks if the source node is a node that contains GCode. In this case the + # current layer data is removed so the previous data is not rendered - CURA-4821 if source.callDecoration("isBlockSlicing") and source.callDecoration("getLayerData"): - if self._stored_optimized_layer_data: - del self._stored_optimized_layer_data[source.callDecoration("getBuildPlateNumber")] + self._stored_optimized_layer_data = {} build_plate_changed = set() source_build_plate_number = source.callDecoration("getBuildPlateNumber")