mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 13:34:01 -06:00
Remove unnecessary code for taking snapshot for UFP file
CURA-5373
This commit is contained in:
parent
ac0bb2a06b
commit
36dbc70813
2 changed files with 3 additions and 13 deletions
|
@ -1,7 +1,6 @@
|
|||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
from UM.Application import Application
|
||||
from UM.Math.Color import Color
|
||||
from UM.Resources import Resources
|
||||
|
||||
from UM.View.RenderPass import RenderPass
|
||||
|
@ -34,10 +33,9 @@ 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, skip_non_printed_objects: bool = False):
|
||||
def __init__(self, width: int, height: int):
|
||||
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()
|
||||
|
@ -75,7 +73,6 @@ class PreviewPass(RenderPass):
|
|||
|
||||
# Create batches to be rendered
|
||||
batch = RenderBatch(self._shader)
|
||||
batch_non_printing = RenderBatch(self._non_printing_shader, type = RenderBatch.RenderType.Transparent)
|
||||
batch_support_mesh = RenderBatch(self._support_mesh_shader)
|
||||
|
||||
# Fill up the batch with objects that can be sliced. `
|
||||
|
@ -84,7 +81,7 @@ class PreviewPass(RenderPass):
|
|||
per_mesh_stack = node.callDecoration("getStack")
|
||||
if node.callDecoration("isNonPrintingMesh"):
|
||||
# Non printing mesh
|
||||
batch_non_printing.addItem(node.getWorldTransformation(), node.getMeshData(), uniforms = {})
|
||||
continue
|
||||
elif per_mesh_stack is not None and per_mesh_stack.getProperty("support_mesh", "value") == True:
|
||||
# Support mesh
|
||||
uniforms = {}
|
||||
|
@ -114,8 +111,5 @@ class PreviewPass(RenderPass):
|
|||
batch.render(render_camera)
|
||||
batch_support_mesh.render(render_camera)
|
||||
|
||||
if not self._skip_non_printed_objects:
|
||||
batch_non_printing.render(render_camera)
|
||||
|
||||
self.release()
|
||||
|
||||
|
|
|
@ -6,13 +6,10 @@ from PyQt5 import QtCore
|
|||
from PyQt5.QtGui import QImage
|
||||
|
||||
from cura.PreviewPass import PreviewPass
|
||||
from cura.Scene import ConvexHullNode
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Math.AxisAlignedBox import AxisAlignedBox
|
||||
from UM.Math.Matrix import Matrix
|
||||
from UM.Math.Vector import Vector
|
||||
from UM.Mesh.MeshData import transformVertices
|
||||
from UM.Scene.Camera import Camera
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
|
||||
|
@ -43,8 +40,7 @@ class Snapshot:
|
|||
render_width, render_height = active_camera.getWindowSize()
|
||||
render_width = int(render_width)
|
||||
render_height = int(render_height)
|
||||
skip_non_printed_objects = True
|
||||
preview_pass = PreviewPass(render_width, render_height, skip_non_printed_objects)
|
||||
preview_pass = PreviewPass(render_width, render_height)
|
||||
|
||||
root = scene.getRoot()
|
||||
camera = Camera("snapshot", root)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue