Merge branch '3.1'

This commit is contained in:
Jack Ha 2017-11-23 10:49:42 +01:00
commit f09f73a586
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

@ -138,10 +138,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
@ -619,7 +620,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
} }