Merge branch '3.1'

This commit is contained in:
ChrisTerBeke 2017-11-24 10:31:22 +01:00
commit 7d1db1b165
26 changed files with 565 additions and 64 deletions

View file

@ -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)

View file

@ -376,7 +376,7 @@ class SimulationView(View):
if layer is None:
return
new_max_paths = layer.lineMeshElementCount()
if new_max_paths > 0 and new_max_paths != self._max_paths:
if new_max_paths >= 0 and new_max_paths != self._max_paths:
self._max_paths = new_max_paths
self.maxPathsChanged.emit()

View file

@ -138,10 +138,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
@ -619,7 +620,7 @@ Item
Timer
{
id: simulationTimer
interval: 250
interval: 100
running: false
repeat: true
onTriggered: {

View file

@ -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
}