CURA-4821 loading gcode will now delete all existing models from all build plates and delete existing layer data to be processed

This commit is contained in:
Jack Ha 2018-01-22 12:57:50 +01:00
parent 93dbf93ee0
commit 8d8fa0269a
2 changed files with 9 additions and 7 deletions

View file

@ -1040,8 +1040,9 @@ class CuraApplication(QtApplication):
Selection.add(node) Selection.add(node)
## Delete all nodes containing mesh data in the scene. ## Delete all nodes containing mesh data in the scene.
# \param only_selectable. Set this to False to delete objects from all build plates
@pyqtSlot() @pyqtSlot()
def deleteAll(self): def deleteAll(self, only_selectable = True):
Logger.log("i", "Clearing scene") Logger.log("i", "Clearing scene")
if not self.getController().getToolsEnabled(): if not self.getController().getToolsEnabled():
return return
@ -1052,7 +1053,9 @@ class CuraApplication(QtApplication):
continue continue
if (not node.getMeshData() and not node.callDecoration("getLayerData")) and not node.callDecoration("isGroup"): 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. 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. continue # Only remove nodes that are selectable.
if node.getParent() and node.getParent().callDecoration("isGroup"): if node.getParent() and node.getParent().callDecoration("isGroup"):
continue # Grouped nodes don't need resetting as their parent (the group) is resetted) 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) self._currently_loading_files.append(f)
if extension in self._non_sliceable_extensions: if extension in self._non_sliceable_extensions:
self.deleteAll() self.deleteAll(only_selectable = False)
job = ReadMeshJob(f) job = ReadMeshJob(f)
job.finished.connect(self._readMeshFinished) job.finished.connect(self._readMeshFinished)

View file

@ -426,11 +426,10 @@ class CuraEngineBackend(QObject, Backend):
if not isinstance(source, SceneNode): if not isinstance(source, SceneNode):
return return
# This case checks if the source node is a node that contains a GCode. In this case the # This case checks if the source node is a node that contains GCode. In this case the
# cached layer data is removed so the previous data is not rendered - CURA-4821 # current layer data is removed so the previous data is not rendered - CURA-4821
if source.callDecoration("isBlockSlicing") and source.callDecoration("getLayerData"): if source.callDecoration("isBlockSlicing") and source.callDecoration("getLayerData"):
if self._stored_optimized_layer_data: self._stored_optimized_layer_data = {}
del self._stored_optimized_layer_data[source.callDecoration("getBuildPlateNumber")]
build_plate_changed = set() build_plate_changed = set()
source_build_plate_number = source.callDecoration("getBuildPlateNumber") source_build_plate_number = source.callDecoration("getBuildPlateNumber")