diff options
author | Ghostkeeper <rubend@tutanota.com> | 2020-08-20 17:35:52 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2020-08-20 17:35:52 +0300 |
commit | 9ea418c0a1bcb5645a61b9534c61381e8c618e3a (patch) | |
tree | 2c495ae5acb4f1680944434905a86c6917e46e93 /plugins/SimulationView | |
parent | a757dc7fa0b1b19efa1024132e2d6c94d2788626 (diff) |
Revert "Revert "Merge branch '4.7' of github.com:Ultimaker/Cura into 4.7""
This reverts commit 28f4d8513db7efce17bfd8b80fa7c8b237fd1c18.
The original revert was to revert an accidental merge from master to 4.7. This now reverts the revert on Master, so that we still have those changes on Master.
Diffstat (limited to 'plugins/SimulationView')
-rw-r--r-- | plugins/SimulationView/SimulationPass.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index b720fc5758..f594fefbe5 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -32,6 +32,7 @@ class SimulationPass(RenderPass): self._current_shader = None # This shader will be the shadow or the normal depending if the user wants to see the paths or the layers self._tool_handle_shader = None self._nozzle_shader = None + self._disabled_shader = None self._old_current_layer = 0 self._old_current_path = 0 self._switching_layers = True # It tracks when the user is moving the layers' slider @@ -90,9 +91,17 @@ class SimulationPass(RenderPass): self._nozzle_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "color.shader")) self._nozzle_shader.setUniformValue("u_color", Color(*Application.getInstance().getTheme().getColor("layerview_nozzle").getRgb())) + if not self._disabled_shader: + self._disabled_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "striped.shader")) + self._disabled_shader.setUniformValue("u_diffuseColor1", Color(*Application.getInstance().getTheme().getColor("model_unslicable").getRgb())) + self._disabled_shader.setUniformValue("u_diffuseColor2", Color(*Application.getInstance().getTheme().getColor("model_unslicable_alt").getRgb())) + self._disabled_shader.setUniformValue("u_width", 50.0) + self._disabled_shader.setUniformValue("u_opacity", 0.6) + self.bind() tool_handle_batch = RenderBatch(self._tool_handle_shader, type = RenderBatch.RenderType.Overlay, backface_cull = True) + disabled_batch = RenderBatch(self._disabled_shader) head_position = None # Indicates the current position of the print head nozzle_node = None @@ -105,6 +114,9 @@ class SimulationPass(RenderPass): nozzle_node = node nozzle_node.setVisible(False) + elif getattr(node, "_outside_buildarea", False) and isinstance(node, SceneNode) and node.getMeshData() and node.isVisible(): + disabled_batch.addItem(node.getWorldTransformation(copy=False), node.getMeshData()) + elif isinstance(node, SceneNode) and (node.getMeshData() or node.callDecoration("isBlockSlicing")) and node.isVisible(): layer_data = node.callDecoration("getLayerData") if not layer_data: @@ -183,6 +195,9 @@ class SimulationPass(RenderPass): nozzle_batch.addItem(nozzle_node.getWorldTransformation(), mesh = nozzle_node.getMeshData()) nozzle_batch.render(self._scene.getActiveCamera()) + if len(disabled_batch.items) > 0: + disabled_batch.render(self._scene.getActiveCamera()) + # Render toolhandles on top of the layerview if len(tool_handle_batch.items) > 0: tool_handle_batch.render(self._scene.getActiveCamera()) |