diff options
author | Jack Ha <j.ha@ultimaker.com> | 2017-02-08 13:24:41 +0300 |
---|---|---|
committer | Jack Ha <j.ha@ultimaker.com> | 2017-02-08 13:24:41 +0300 |
commit | 50ba236e660ac7df92e3070585de59a6d25374b0 (patch) | |
tree | bb211163836ec5b0be8ab216145b59c99b13e5f6 /cura/LayerDataBuilder.py | |
parent | 6c19bc1c16c15329539c9275581c80842f516cb1 (diff) |
Removed unused option in LayerPolygon, added comments
Diffstat (limited to 'cura/LayerDataBuilder.py')
-rw-r--r-- | cura/LayerDataBuilder.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cura/LayerDataBuilder.py b/cura/LayerDataBuilder.py index dcc3991833..1de2302f77 100644 --- a/cura/LayerDataBuilder.py +++ b/cura/LayerDataBuilder.py @@ -48,8 +48,10 @@ class LayerDataBuilder(MeshBuilder): self._layers[layer].setThickness(thickness) - # material color map: [r, g, b, a] for each extruder row. - # line_type_brightness: compatibility layer view uses line type brightness of 0.5 + ## Return the layer data as LayerData. + # + # \param material_color_map: [r, g, b, a] for each extruder row. + # \param line_type_brightness: compatibility layer view uses line type brightness of 0.5 def build(self, material_color_map, line_type_brightness = 1.0): vertex_count = 0 index_count = 0 @@ -75,9 +77,12 @@ class LayerDataBuilder(MeshBuilder): self.addColors(colors) self.addIndices(indices.flatten()) + # Note: we're using numpy indexing here. + # See also: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html material_colors = numpy.zeros((line_dimensions.shape[0], 4), dtype=numpy.float32) for extruder_nr in range(material_color_map.shape[0]): material_colors[extruders == extruder_nr] = material_color_map[extruder_nr] + # Set material_colors with indices where line_types (also numpy array) == MoveCombingType material_colors[line_types == LayerPolygon.MoveCombingType] = colors[line_types == LayerPolygon.MoveCombingType] material_colors[line_types == LayerPolygon.MoveRetractionType] = colors[line_types == LayerPolygon.MoveRetractionType] |