mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 04:26:05 +08:00
Merge pull request #10210 from Ultimaker/CURA-8412_fix_contextmenu_snapshot_crash
[CURA-8412] Part of fix for crash on context menu open + click on slice.
This commit is contained in:
commit
310417bb5b
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2020 Ultimaker B.V.
|
# Copyright (c) 2021 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from typing import Optional, TYPE_CHECKING, cast, List
|
from typing import Optional, TYPE_CHECKING, cast, List
|
||||||
@ -74,6 +74,7 @@ class PreviewPass(RenderPass):
|
|||||||
self._shader.setUniformValue("u_faceId", -1) # Don't render any selected faces in the preview.
|
self._shader.setUniformValue("u_faceId", -1) # Don't render any selected faces in the preview.
|
||||||
else:
|
else:
|
||||||
Logger.error("Unable to compile shader program: overhang.shader")
|
Logger.error("Unable to compile shader program: overhang.shader")
|
||||||
|
return
|
||||||
|
|
||||||
if not self._non_printing_shader:
|
if not self._non_printing_shader:
|
||||||
self._non_printing_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "transparent_object.shader"))
|
self._non_printing_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "transparent_object.shader"))
|
||||||
|
@ -93,7 +93,7 @@ class Snapshot:
|
|||||||
pixel_output = preview_pass.getOutput()
|
pixel_output = preview_pass.getOutput()
|
||||||
try:
|
try:
|
||||||
min_x, max_x, min_y, max_y = Snapshot.getImageBoundaries(pixel_output)
|
min_x, max_x, min_y, max_y = Snapshot.getImageBoundaries(pixel_output)
|
||||||
except ValueError:
|
except (ValueError, AttributeError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
size = max((max_x - min_x) / render_width, (max_y - min_y) / render_height)
|
size = max((max_x - min_x) / render_width, (max_y - min_y) / render_height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user