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"
This commit is contained in:
Diego Prado Gesto 2017-11-23 09:59:34 +01:00
parent 105d7a5615
commit b97ed4c211
3 changed files with 14 additions and 9 deletions

View file

@ -34,6 +34,7 @@ class SimulationPass(RenderPass):
self._nozzle_shader = None self._nozzle_shader = None
self._old_current_layer = 0 self._old_current_layer = 0
self._old_current_path = 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._gl = OpenGL.getInstance().getBindingsObject()
self._scene = Application.getInstance().getController().getScene() self._scene = Application.getInstance().getController().getScene()
self._extruder_manager = ExtruderManager.getInstance() self._extruder_manager = ExtruderManager.getInstance()
@ -91,7 +92,7 @@ class SimulationPass(RenderPass):
self.bind() 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 head_position = None # Indicates the current position of the print head
nozzle_node = None nozzle_node = None
@ -143,8 +144,10 @@ class SimulationPass(RenderPass):
# All the layers but the current selected layer are rendered first # All the layers but the current selected layer are rendered first
if self._old_current_path != self._layer_view._current_path_num: if self._old_current_path != self._layer_view._current_path_num:
self._current_shader = self._layer_shadow_shader 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: if not self._layer_view.isSimulationRunning() and self._old_current_layer != self._layer_view._current_layer_num:
self._current_shader = self._layer_shader 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 = RenderBatch(self._current_shader, type = RenderBatch.RenderType.Solid, mode = RenderBatch.RenderMode.Lines, range = (start, end))
layers_batch.addItem(node.getWorldTransformation(), layer_data) layers_batch.addItem(node.getWorldTransformation(), layer_data)
@ -170,8 +173,9 @@ class SimulationPass(RenderPass):
if len(batch.items) > 0: if len(batch.items) > 0:
batch.render(self._scene.getActiveCamera()) batch.render(self._scene.getActiveCamera())
# The nozzle is drawn once we know the correct position # The nozzle is drawn when once we know the correct position of the head,
if not self._compatibility_mode and self._layer_view.getActivity() and nozzle_node is not None: # 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: if head_position is not None:
nozzle_node.setVisible(True) nozzle_node.setVisible(True)
nozzle_node.setPosition(head_position) nozzle_node.setPosition(head_position)

View file

@ -104,10 +104,11 @@ Item
text: catalog.i18nc("@label:listbox", "Feedrate"), text: catalog.i18nc("@label:listbox", "Feedrate"),
type_id: 2 type_id: 2
}) })
layerViewTypes.append({ // TODO DON'T DELETE!!!! This part must be enabled when adaptive layer height feature is available
text: catalog.i18nc("@label:listbox", "Layer thickness"), // layerViewTypes.append({
type_id: 3 // these ids match the switching in the shader // text: catalog.i18nc("@label:listbox", "Layer thickness"),
}) // type_id: 3 // these ids match the switching in the shader
// })
} }
ComboBox ComboBox
@ -591,7 +592,7 @@ Item
Timer Timer
{ {
id: simulationTimer id: simulationTimer
interval: 250 interval: 100
running: false running: false
repeat: true repeat: true
onTriggered: { onTriggered: {

View file

@ -11,7 +11,7 @@ catalog = i18nCatalog("cura")
def getMetaData(): def getMetaData():
return { return {
"view": { "view": {
"name": catalog.i18nc("@item:inlistbox", "Simulation view"), "name": catalog.i18nc("@item:inlistbox", "Layer view"),
"view_panel": "SimulationView.qml", "view_panel": "SimulationView.qml",
"weight": 2 "weight": 2
} }