From b97ed4c211235513257302fb2bc77ae756b4cb9b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 23 Nov 2017 09:59:34 +0100 Subject: [PATCH] CURA-4609 Minor improvements in Simulation View: Increase simulation speed. Hide Layer Thickness option in color scheme. Hide nozzle when switching layers. Set the handles in front of the view. Name changed back to "Layer View" --- plugins/SimulationView/SimulationPass.py | 10 +++++++--- plugins/SimulationView/SimulationView.qml | 11 ++++++----- plugins/SimulationView/__init__.py | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index 2b9063e27a..46fa7f1240 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -34,6 +34,7 @@ class SimulationPass(RenderPass): self._nozzle_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 self._gl = OpenGL.getInstance().getBindingsObject() self._scene = Application.getInstance().getController().getScene() self._extruder_manager = ExtruderManager.getInstance() @@ -91,7 +92,7 @@ class SimulationPass(RenderPass): self.bind() - tool_handle_batch = RenderBatch(self._tool_handle_shader, type = RenderBatch.RenderType.Solid) + tool_handle_batch = RenderBatch(self._tool_handle_shader, type = RenderBatch.RenderType.Overlay) head_position = None # Indicates the current position of the print head nozzle_node = None @@ -143,8 +144,10 @@ class SimulationPass(RenderPass): # All the layers but the current selected layer are rendered first if self._old_current_path != self._layer_view._current_path_num: self._current_shader = self._layer_shadow_shader + self._switching_layers = False if not self._layer_view.isSimulationRunning() and self._old_current_layer != self._layer_view._current_layer_num: self._current_shader = self._layer_shader + self._switching_layers = True layers_batch = RenderBatch(self._current_shader, type = RenderBatch.RenderType.Solid, mode = RenderBatch.RenderMode.Lines, range = (start, end)) layers_batch.addItem(node.getWorldTransformation(), layer_data) @@ -170,8 +173,9 @@ class SimulationPass(RenderPass): if len(batch.items) > 0: batch.render(self._scene.getActiveCamera()) - # The nozzle is drawn once we know the correct position - if not self._compatibility_mode and self._layer_view.getActivity() and nozzle_node is not None: + # The nozzle is drawn when once we know the correct position of the head, + # but the user is not using the layer slider, and the compatibility mode is not enabled + if not self._switching_layers and not self._compatibility_mode and self._layer_view.getActivity() and nozzle_node is not None: if head_position is not None: nozzle_node.setVisible(True) nozzle_node.setPosition(head_position) diff --git a/plugins/SimulationView/SimulationView.qml b/plugins/SimulationView/SimulationView.qml index 67ca39d992..17c71d2733 100644 --- a/plugins/SimulationView/SimulationView.qml +++ b/plugins/SimulationView/SimulationView.qml @@ -104,10 +104,11 @@ Item text: catalog.i18nc("@label:listbox", "Feedrate"), type_id: 2 }) - layerViewTypes.append({ - text: catalog.i18nc("@label:listbox", "Layer thickness"), - type_id: 3 // these ids match the switching in the shader - }) + // TODO DON'T DELETE!!!! This part must be enabled when adaptive layer height feature is available +// layerViewTypes.append({ +// text: catalog.i18nc("@label:listbox", "Layer thickness"), +// type_id: 3 // these ids match the switching in the shader +// }) } ComboBox @@ -591,7 +592,7 @@ Item Timer { id: simulationTimer - interval: 250 + interval: 100 running: false repeat: true onTriggered: { diff --git a/plugins/SimulationView/__init__.py b/plugins/SimulationView/__init__.py index f7ccf41acc..15e113bd8e 100644 --- a/plugins/SimulationView/__init__.py +++ b/plugins/SimulationView/__init__.py @@ -11,7 +11,7 @@ catalog = i18nCatalog("cura") def getMetaData(): return { "view": { - "name": catalog.i18nc("@item:inlistbox", "Simulation view"), + "name": catalog.i18nc("@item:inlistbox", "Layer view"), "view_panel": "SimulationView.qml", "weight": 2 }