mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 09:47:50 -06:00
allow immediate change of preference for showing xray errors in solid view
This commit is contained in:
parent
4b1a426873
commit
0e633a0dfa
1 changed files with 42 additions and 30 deletions
|
@ -139,6 +139,17 @@ class SolidView(View):
|
||||||
|
|
||||||
self._checkSetup()
|
self._checkSetup()
|
||||||
|
|
||||||
|
if not CuraApplication.getInstance().getPreferences().getValue(self._show_xray_warning_preference):
|
||||||
|
self._xray_error_image = None
|
||||||
|
self._xray_shader = None
|
||||||
|
self._xray_composite_shader = None
|
||||||
|
if self._composite_pass and 'xray' in self._composite_pass.getLayerBindings():
|
||||||
|
self._composite_pass.setLayerBindings(self._old_layer_bindings)
|
||||||
|
self._composite_pass.setCompositeShader(self._old_composite_shader)
|
||||||
|
self._old_layer_bindings = None
|
||||||
|
self._old_composite_shader = None
|
||||||
|
self._xray_warning_message.hide()
|
||||||
|
else:
|
||||||
if not self._xray_error_image:
|
if not self._xray_error_image:
|
||||||
self._xray_error_image = OpenGL.getInstance().createTexture()
|
self._xray_error_image = OpenGL.getInstance().createTexture()
|
||||||
texture_file = "xray_error.png"
|
texture_file = "xray_error.png"
|
||||||
|
@ -157,7 +168,7 @@ class SolidView(View):
|
||||||
self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb()))
|
self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb()))
|
||||||
self._xray_composite_shader.setTexture(3, self._xray_error_image)
|
self._xray_composite_shader.setTexture(3, self._xray_error_image)
|
||||||
|
|
||||||
if not self.getRenderer().getRenderPass("xray"):
|
if not self._composite_pass or not 'xray' in self._composite_pass.getLayerBindings():
|
||||||
# Currently the RenderPass constructor requires a size > 0
|
# Currently the RenderPass constructor requires a size > 0
|
||||||
# This should be fixed in RenderPass's constructor.
|
# This should be fixed in RenderPass's constructor.
|
||||||
self._xray_pass = XRayPass.XRayPass(1, 1)
|
self._xray_pass = XRayPass.XRayPass(1, 1)
|
||||||
|
@ -290,6 +301,7 @@ class SolidView(View):
|
||||||
|
|
||||||
|
|
||||||
if event.type == Event.ViewDeactivateEvent:
|
if event.type == Event.ViewDeactivateEvent:
|
||||||
|
if self._composite_pass and 'xray' in self._composite_pass.getLayerBindings():
|
||||||
self.getRenderer().removeRenderPass(self._xray_pass)
|
self.getRenderer().removeRenderPass(self._xray_pass)
|
||||||
self._composite_pass.setLayerBindings(self._old_layer_bindings)
|
self._composite_pass.setLayerBindings(self._old_layer_bindings)
|
||||||
self._composite_pass.setCompositeShader(self._old_composite_shader)
|
self._composite_pass.setCompositeShader(self._old_composite_shader)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue