From ffce9bd1723b71c42c0c5d0b34e4f94130cab3c3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 4 Jan 2019 14:59:26 +0100 Subject: [PATCH] Ensure that the primetower gets drawn in the right color again CURA-5932 --- cura/LayerPolygon.py | 11 +++++++--- plugins/CuraEngineBackend/Cura.proto | 1 + .../ProcessSlicedLayersJob.py | 1 + plugins/SimulationView/layers3d.shader | 2 +- plugins/SimulationView/layers_shadow.shader | 20 ++++++++++++------- resources/themes/cura-light/theme.json | 1 + 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/cura/LayerPolygon.py b/cura/LayerPolygon.py index f33934de0c..1941a558ba 100644 --- a/cura/LayerPolygon.py +++ b/cura/LayerPolygon.py @@ -5,6 +5,8 @@ from UM.Application import Application from typing import Any import numpy +from UM.Logger import Logger + class LayerPolygon: NoneType = 0 @@ -18,7 +20,8 @@ class LayerPolygon: MoveCombingType = 8 MoveRetractionType = 9 SupportInterfaceType = 10 - __number_of_types = 11 + PrimeTower = 11 + __number_of_types = 12 __jump_map = numpy.logical_or(numpy.logical_or(numpy.arange(__number_of_types) == NoneType, numpy.arange(__number_of_types) == MoveCombingType), numpy.arange(__number_of_types) == MoveRetractionType) @@ -33,7 +36,8 @@ class LayerPolygon: self._extruder = extruder self._types = line_types for i in range(len(self._types)): - if self._types[i] >= self.__number_of_types: #Got faulty line data from the engine. + if self._types[i] >= self.__number_of_types: # Got faulty line data from the engine. + Logger.log("w", "Found an unknown line type: %s", i) self._types[i] = self.NoneType self._data = data self._line_widths = line_widths @@ -236,7 +240,8 @@ class LayerPolygon: theme.getColor("layerview_support_infill").getRgbF(), # SupportInfillType theme.getColor("layerview_move_combing").getRgbF(), # MoveCombingType theme.getColor("layerview_move_retraction").getRgbF(), # MoveRetractionType - theme.getColor("layerview_support_interface").getRgbF() # SupportInterfaceType + theme.getColor("layerview_support_interface").getRgbF(), # SupportInterfaceType + theme.getColor("layerview_prime_tower").getRgbF() ]) return cls.__color_map diff --git a/plugins/CuraEngineBackend/Cura.proto b/plugins/CuraEngineBackend/Cura.proto index c4f934bc00..2eabe62366 100644 --- a/plugins/CuraEngineBackend/Cura.proto +++ b/plugins/CuraEngineBackend/Cura.proto @@ -58,6 +58,7 @@ message Polygon { MoveCombingType = 8; MoveRetractionType = 9; SupportInterfaceType = 10; + PrimeTowerType = 11; } Type type = 1; // Type of move bytes points = 2; // The points of the polygon, or two points if only a line segment (Currently only line segments are used) diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 71c96880e8..3cc23130ea 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -137,6 +137,7 @@ class ProcessSlicedLayersJob(Job): extruder = polygon.extruder line_types = numpy.fromstring(polygon.line_type, dtype="u1") # Convert bytearray to numpy array + line_types = line_types.reshape((-1,1)) points = numpy.fromstring(polygon.points, dtype="f4") # Convert bytearray to numpy array diff --git a/plugins/SimulationView/layers3d.shader b/plugins/SimulationView/layers3d.shader index de2b9335d8..a277606509 100644 --- a/plugins/SimulationView/layers3d.shader +++ b/plugins/SimulationView/layers3d.shader @@ -154,7 +154,7 @@ geometry41core = if ((u_show_travel_moves == 0) && ((v_line_type[0] == 8) || (v_line_type[0] == 9))) { return; } - if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10))) { + if ((u_show_helpers == 0) && ((v_line_type[0] == 4) || (v_line_type[0] == 5) || (v_line_type[0] == 7) || (v_line_type[0] == 10) || v_line_type[0] == 11)) { return; } if ((u_show_skin == 0) && ((v_line_type[0] == 1) || (v_line_type[0] == 2) || (v_line_type[0] == 3))) { diff --git a/plugins/SimulationView/layers_shadow.shader b/plugins/SimulationView/layers_shadow.shader index 7ceccff21e..6149cc1703 100644 --- a/plugins/SimulationView/layers_shadow.shader +++ b/plugins/SimulationView/layers_shadow.shader @@ -45,19 +45,23 @@ fragment = void main() { - if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) { // actually, 8 and 9 + if ((u_show_travel_moves == 0) && (v_line_type >= 7.5) && (v_line_type <= 9.5)) + { // actually, 8 and 9 // discard movements discard; } - // support: 4, 5, 7, 10 + // support: 4, 5, 7, 10, 11 if ((u_show_helpers == 0) && ( ((v_line_type >= 3.5) && (v_line_type <= 4.5)) || ((v_line_type >= 6.5) && (v_line_type <= 7.5)) || ((v_line_type >= 9.5) && (v_line_type <= 10.5)) || - ((v_line_type >= 4.5) && (v_line_type <= 5.5)) - )) { + ((v_line_type >= 4.5) && (v_line_type <= 5.5)) || + ((v_line_type >= 10.5) && (v_line_type <= 11.5)) + )) + { discard; } + // skin: 1, 2, 3 if ((u_show_skin == 0) && ( (v_line_type >= 0.5) && (v_line_type <= 3.5) @@ -65,7 +69,8 @@ fragment = discard; } // infill: - if ((u_show_infill == 0) && (v_line_type >= 5.5) && (v_line_type <= 6.5)) { + if ((u_show_infill == 0) && (v_line_type >= 5.5) && (v_line_type <= 6.5)) + { // discard movements discard; } @@ -117,12 +122,13 @@ fragment41core = // discard movements discard; } - // helpers: 4, 5, 7, 10 + // helpers: 4, 5, 7, 10, 11 if ((u_show_helpers == 0) && ( ((v_line_type >= 3.5) && (v_line_type <= 4.5)) || ((v_line_type >= 6.5) && (v_line_type <= 7.5)) || ((v_line_type >= 9.5) && (v_line_type <= 10.5)) || - ((v_line_type >= 4.5) && (v_line_type <= 5.5)) + ((v_line_type >= 4.5) && (v_line_type <= 5.5)) || + ((v_line_type >= 10.5) && (v_line_type <= 11.5)) )) { discard; } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2b9ce3d218..9770994e74 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -294,6 +294,7 @@ "layerview_move_combing": [0, 0, 255, 255], "layerview_move_retraction": [128, 128, 255, 255], "layerview_support_interface": [64, 192, 255, 255], + "layerview_prime_tower": [0, 255, 255, 255], "layerview_nozzle": [181, 166, 66, 50], "tab_status_connected": [50, 130, 255, 255],