From 1f149b2821f4f52283e84397e44a53fe5c6c8f5b Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 18 May 2018 10:50:54 +0200 Subject: [PATCH] Do not show not printed models on snapshot for UFP files CURA-5373 --- cura/PreviewPass.py | 7 +++++-- cura/Snapshot.py | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cura/PreviewPass.py b/cura/PreviewPass.py index f6b963d141..662284c111 100644 --- a/cura/PreviewPass.py +++ b/cura/PreviewPass.py @@ -34,9 +34,10 @@ def prettier_color(color_list): # # This is useful to get a preview image of a scene taken from a different location as the active camera. class PreviewPass(RenderPass): - def __init__(self, width: int, height: int): + def __init__(self, width: int, height: int, skip_non_printed_objects: bool = False): super().__init__("preview", width, height, 0) + self._skip_non_printed_objects = skip_non_printed_objects self._camera = None # type: Optional[Camera] self._renderer = Application.getInstance().getRenderer() @@ -112,7 +113,9 @@ class PreviewPass(RenderPass): batch.render(render_camera) batch_support_mesh.render(render_camera) - batch_non_printing.render(render_camera) + + if not self._skip_non_printed_objects: + batch_non_printing.render(render_camera) self.release() diff --git a/cura/Snapshot.py b/cura/Snapshot.py index 1f2a24aecd..7745712651 100644 --- a/cura/Snapshot.py +++ b/cura/Snapshot.py @@ -43,7 +43,8 @@ class Snapshot: render_width, render_height = active_camera.getWindowSize() render_width = int(render_width) render_height = int(render_height) - preview_pass = PreviewPass(render_width, render_height) + skip_non_printed_objects = True + preview_pass = PreviewPass(render_width, render_height, skip_non_printed_objects) root = scene.getRoot() camera = Camera("snapshot", root) @@ -51,7 +52,7 @@ class Snapshot: # determine zoom and look at bbox = None for node in DepthFirstIterator(root): - if node.callDecoration("isSliceable") and node.getMeshData() and node.isVisible(): + if node.callDecoration("isSliceable") and node.getMeshData() and node.isVisible() and not node.callDecoration("isNonPrintingMesh"): if bbox is None: bbox = node.getBoundingBox() else: