From 757d7eee50aa20d01fde1681b257b4fd93800726 Mon Sep 17 00:00:00 2001 From: bas <38720940+BasF0@users.noreply.github.com> Date: Wed, 28 Oct 2020 09:49:26 +0100 Subject: [PATCH 1/4] layers3d.shader now detects and draws 'starts' as boxes Also adds a "show starts" option to the SimulationViewMenuComponent and corresponding logic SimulationPass.py adds a prev_line_types attribute to the shader, which the shader uses to compare with its line_type to detect starts. --- plugins/SimulationView/SimulationPass.py | 9 ++++++ plugins/SimulationView/SimulationView.py | 11 +++++++ .../SimulationViewMenuComponent.qml | 7 ++++ plugins/SimulationView/layers3d.shader | 32 ++++++++++++++++++- 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index f594fefbe5..e623be9b8d 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -18,6 +18,7 @@ from cura.Settings.ExtruderManager import ExtruderManager import os.path +import numpy ## RenderPass used to display g-code paths. from .NozzleNode import NozzleNode @@ -71,6 +72,7 @@ class SimulationPass(RenderPass): self._layer_shader.setUniformValue("u_show_helpers", self._layer_view.getShowHelpers()) self._layer_shader.setUniformValue("u_show_skin", self._layer_view.getShowSkin()) self._layer_shader.setUniformValue("u_show_infill", self._layer_view.getShowInfill()) + self._layer_shader.setUniformValue("u_show_starts", self._layer_view.getShowStarts()) else: #defaults self._layer_shader.setUniformValue("u_max_feedrate", 1) @@ -83,6 +85,7 @@ class SimulationPass(RenderPass): self._layer_shader.setUniformValue("u_show_helpers", 1) self._layer_shader.setUniformValue("u_show_skin", 1) self._layer_shader.setUniformValue("u_show_infill", 1) + self._layer_shader.setUniformValue("u_show_starts", 1) if not self._tool_handle_shader: self._tool_handle_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "toolhandle.shader")) @@ -161,6 +164,12 @@ class SimulationPass(RenderPass): self._current_shader = self._layer_shader self._switching_layers = True + # The first line does not have a previous line: add a zero in front + prev_line_types = numpy.concatenate([numpy.asarray([0], dtype=numpy.float32), layer_data._attributes["line_types"]["value"]]) + # Remove the last element + prev_line_types = prev_line_types[0:layer_data._attributes["line_types"]["value"].size] + layer_data._attributes["prev_line_types"] = {'opengl_type': 'float', 'value': prev_line_types, 'opengl_name': 'a_prev_line_type'} + layers_batch = RenderBatch(self._current_shader, type = RenderBatch.RenderType.Solid, mode = RenderBatch.RenderMode.Lines, range = (start, end), backface_cull = True) layers_batch.addItem(node.getWorldTransformation(), layer_data) layers_batch.render(self._scene.getActiveCamera()) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 349426d463..d558852044 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -111,6 +111,7 @@ class SimulationView(CuraView): Application.getInstance().getPreferences().addPreference("layerview/show_helpers", True) Application.getInstance().getPreferences().addPreference("layerview/show_skin", True) Application.getInstance().getPreferences().addPreference("layerview/show_infill", True) + Application.getInstance().getPreferences().addPreference("layerview/show_starts", True) self._updateWithPreferences() @@ -146,6 +147,7 @@ class SimulationView(CuraView): self._show_helpers = True self._show_skin = True self._show_infill = True + self._show_starts = True self.resetLayerData() def getActivity(self) -> bool: @@ -355,6 +357,13 @@ class SimulationView(CuraView): def getShowInfill(self) -> bool: return self._show_infill + def setShowStarts(self, show: bool) -> None: + self._show_starts = show + self.currentLayerNumChanged.emit() + + def getShowStarts(self) -> bool: + return self._show_starts + def getCompatibilityMode(self) -> bool: return self._compatibility_mode @@ -638,6 +647,7 @@ class SimulationView(CuraView): self.setShowHelpers(bool(Application.getInstance().getPreferences().getValue("layerview/show_helpers"))) self.setShowSkin(bool(Application.getInstance().getPreferences().getValue("layerview/show_skin"))) self.setShowInfill(bool(Application.getInstance().getPreferences().getValue("layerview/show_infill"))) + self.setShowStarts(bool(Application.getInstance().getPreferences().getValue("layerview/show_starts"))) self._startUpdateTopLayers() self.preferencesChanged.emit() @@ -653,6 +663,7 @@ class SimulationView(CuraView): "layerview/show_helpers", "layerview/show_skin", "layerview/show_infill", + "layerview/show_starts", }: return diff --git a/plugins/SimulationView/SimulationViewMenuComponent.qml b/plugins/SimulationView/SimulationViewMenuComponent.qml index ffb7eebc95..1d5776ccef 100644 --- a/plugins/SimulationView/SimulationViewMenuComponent.qml +++ b/plugins/SimulationView/SimulationViewMenuComponent.qml @@ -82,6 +82,7 @@ Cura.ExpandableComponent property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers") property bool show_skin: UM.Preferences.getValue("layerview/show_skin") property bool show_infill: UM.Preferences.getValue("layerview/show_infill") + property bool show_starts: UM.Preferences.getValue("layerview/show_starts") // If we are in compatibility mode, we only show the "line type" property bool show_legend: UM.SimulationView.compatibilityMode ? true : UM.Preferences.getValue("layerview/layer_view_type") == 1 @@ -250,6 +251,12 @@ Cura.ExpandableComponent preference: "layerview/show_infill", colorId: "layerview_infill" }); + typesLegendModel.append({ + label: catalog.i18nc("@label", "Starts"), + initialValue: viewSettings.show_starts, + preference: "layerview/show_starts", + colorId: "layerview_starts" + }); } } diff --git a/plugins/SimulationView/layers3d.shader b/plugins/SimulationView/layers3d.shader index ceda09f9d5..c9c911ecaa 100644 --- a/plugins/SimulationView/layers3d.shader +++ b/plugins/SimulationView/layers3d.shader @@ -21,6 +21,7 @@ vertex41core = in highp vec4 a_normal; in highp vec2 a_line_dim; // line width and thickness in highp float a_extruder; + in highp float a_prev_line_type; in highp float a_line_type; in highp float a_feedrate; in highp float a_thickness; @@ -32,6 +33,7 @@ vertex41core = out lowp vec2 v_line_dim; out highp int v_extruder; out highp mat4 v_extruder_opacity; + out float v_prev_line_type; out float v_line_type; out lowp vec4 f_color; @@ -92,6 +94,7 @@ vertex41core = v_normal = (u_normalMatrix * normalize(a_normal)).xyz; v_line_dim = a_line_dim; v_extruder = int(a_extruder); + v_prev_line_type = a_prev_line_type; v_line_type = a_line_type; v_extruder_opacity = u_extruder_opacity; @@ -112,9 +115,10 @@ geometry41core = uniform int u_show_helpers; uniform int u_show_skin; uniform int u_show_infill; + uniform int u_show_starts; layout(lines) in; - layout(triangle_strip, max_vertices = 26) out; + layout(triangle_strip, max_vertices = 40) out; in vec4 v_color[]; in vec3 v_vertex[]; @@ -122,6 +126,7 @@ geometry41core = in vec2 v_line_dim[]; in int v_extruder[]; in mat4 v_extruder_opacity[]; + in float v_prev_line_type[]; in float v_line_type[]; out vec4 f_color; @@ -268,6 +273,29 @@ geometry41core = EndPrimitive(); } + + + if ((u_show_starts == 1) && (v_prev_line_type[0] != 1) && (v_line_type[0] == 1)) { + float w = v_line_dim[0].x / 2; + float h = v_line_dim[0].y / 2; + + myEmitVertex(v_vertex[0] + vec3( w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left + myEmitVertex(v_vertex[0] + vec3(-w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right + myEmitVertex(v_vertex[0] + vec3( w, -h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left + myEmitVertex(v_vertex[0] + vec3(-w, -h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, w, 0.0))); // Front-bottom-right + myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right + myEmitVertex(v_vertex[0] + vec3(-w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right + myEmitVertex(v_vertex[0] + vec3(-w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right + myEmitVertex(v_vertex[0] + vec3( w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left + myEmitVertex(v_vertex[0] + vec3( w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left + myEmitVertex(v_vertex[0] + vec3( w, -h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left + myEmitVertex(v_vertex[0] + vec3( w, -h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, -w, 0.0))); // Back-bottom-left + myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right + myEmitVertex(v_vertex[0] + vec3( w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left + myEmitVertex(v_vertex[0] + vec3(-w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right + + EndPrimitive(); + } } fragment41core = @@ -316,6 +344,7 @@ u_show_travel_moves = 0 u_show_helpers = 1 u_show_skin = 1 u_show_infill = 1 +u_show_starts = 1 u_min_feedrate = 0 u_max_feedrate = 1 @@ -337,6 +366,7 @@ a_normal = normal a_line_dim = line_dim a_extruder = extruder a_material_color = material_color +a_prev_line_type = prev_line_type a_line_type = line_type a_feedrate = feedrate a_thickness = thickness From f6badcaecaf772fa52bd6872e71a41e959a6d123 Mon Sep 17 00:00:00 2001 From: bas <38720940+BasF0@users.noreply.github.com> Date: Wed, 11 Nov 2020 13:44:21 +0100 Subject: [PATCH 2/4] Added starts color to theme, and support in shader / simulationpass --- plugins/SimulationView/SimulationPass.py | 3 +++ plugins/SimulationView/layers3d.shader | 32 +++++++++++++----------- resources/themes/cura-light/theme.json | 1 + 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index e623be9b8d..f7f730bf61 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -61,6 +61,9 @@ class SimulationPass(RenderPass): self._current_shader = self._layer_shader # Use extruder 0 if the extruder manager reports extruder index -1 (for single extrusion printers) self._layer_shader.setUniformValue("u_active_extruder", float(max(0, self._extruder_manager.activeExtruderIndex))) + if not self._compatibility_mode: + self._layer_shader.setUniformValue("u_starts_color", Color(*Application.getInstance().getTheme().getColor("layerview_starts").getRgb())) + if self._layer_view: self._layer_shader.setUniformValue("u_max_feedrate", self._layer_view.getMaxFeedrate()) self._layer_shader.setUniformValue("u_min_feedrate", self._layer_view.getMinFeedrate()) diff --git a/plugins/SimulationView/layers3d.shader b/plugins/SimulationView/layers3d.shader index c9c911ecaa..0a5cc23ce7 100644 --- a/plugins/SimulationView/layers3d.shader +++ b/plugins/SimulationView/layers3d.shader @@ -111,6 +111,8 @@ geometry41core = uniform highp mat4 u_viewMatrix; uniform highp mat4 u_projectionMatrix; + uniform lowp vec4 u_starts_color; + uniform int u_show_travel_moves; uniform int u_show_helpers; uniform int u_show_skin; @@ -279,20 +281,20 @@ geometry41core = float w = v_line_dim[0].x / 2; float h = v_line_dim[0].y / 2; - myEmitVertex(v_vertex[0] + vec3( w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left - myEmitVertex(v_vertex[0] + vec3(-w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right - myEmitVertex(v_vertex[0] + vec3( w, -h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left - myEmitVertex(v_vertex[0] + vec3(-w, -h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, w, 0.0))); // Front-bottom-right - myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right - myEmitVertex(v_vertex[0] + vec3(-w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right - myEmitVertex(v_vertex[0] + vec3(-w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right - myEmitVertex(v_vertex[0] + vec3( w, h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left - myEmitVertex(v_vertex[0] + vec3( w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left - myEmitVertex(v_vertex[0] + vec3( w, -h, w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left - myEmitVertex(v_vertex[0] + vec3( w, -h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, -w, 0.0))); // Back-bottom-left - myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right - myEmitVertex(v_vertex[0] + vec3( w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left - myEmitVertex(v_vertex[0] + vec3(-w, h, -w), vec4(1.0, 1.0, 1.0, 1.0), normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right + myEmitVertex(v_vertex[0] + vec3( w, h, w), u_starts_color, normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left + myEmitVertex(v_vertex[0] + vec3(-w, h, w), u_starts_color, normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right + myEmitVertex(v_vertex[0] + vec3( w, -h, w), u_starts_color, normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left + myEmitVertex(v_vertex[0] + vec3(-w, -h, w), u_starts_color, normalize(vec3(-1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, w, 0.0))); // Front-bottom-right + myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), u_starts_color, normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right + myEmitVertex(v_vertex[0] + vec3(-w, h, w), u_starts_color, normalize(vec3(-1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, w, 0.0))); // Front-top-right + myEmitVertex(v_vertex[0] + vec3(-w, h, -w), u_starts_color, normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right + myEmitVertex(v_vertex[0] + vec3( w, h, w), u_starts_color, normalize(vec3( 1.0, 1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, w, 0.0))); // Front-top-left + myEmitVertex(v_vertex[0] + vec3( w, h, -w), u_starts_color, normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left + myEmitVertex(v_vertex[0] + vec3( w, -h, w), u_starts_color, normalize(vec3( 1.0, -1.0, 1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, w, 0.0))); // Front-bottom-left + myEmitVertex(v_vertex[0] + vec3( w, -h, -w), u_starts_color, normalize(vec3( 1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, -h, -w, 0.0))); // Back-bottom-left + myEmitVertex(v_vertex[0] + vec3(-w, -h, -w), u_starts_color, normalize(vec3(-1.0, -1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, -h, -w, 0.0))); // Back-bottom-right + myEmitVertex(v_vertex[0] + vec3( w, h, -w), u_starts_color, normalize(vec3( 1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4( w, h, -w, 0.0))); // Back-top-left + myEmitVertex(v_vertex[0] + vec3(-w, h, -w), u_starts_color, normalize(vec3(-1.0, 1.0, -1.0)), viewProjectionMatrix * (gl_in[0].gl_Position + vec4(-w, h, -w, 0.0))); // Back-top-right EndPrimitive(); } @@ -340,6 +342,8 @@ u_diffuseColor = [1.0, 0.79, 0.14, 1.0] u_minimumAlbedo = [0.1, 0.1, 0.1, 1.0] u_shininess = 20.0 +u_starts_color = [1.0, 1.0, 1.0, 1.0] + u_show_travel_moves = 0 u_show_helpers = 1 u_show_skin = 1 diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 05a7109361..d0ae589d62 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -389,6 +389,7 @@ "layerview_support_interface": [63, 127, 255, 127], "layerview_prime_tower": [0, 255, 255, 255], "layerview_nozzle": [181, 166, 66, 50], + "layerview_starts": [255, 255, 255, 255], "tab_status_connected": [50, 130, 255, 255], "tab_status_disconnected": [200, 200, 200, 255], From 10331333556804dd287862dd179a9683fca732b6 Mon Sep 17 00:00:00 2001 From: bas <38720940+BasF0@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:21:08 +0100 Subject: [PATCH 3/4] undo irrelevant change --- resources/themes/cura-light/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 7b208fc379..e51a5f88dc 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -388,7 +388,7 @@ "layerview_move_retraction": [128, 127, 255, 255], "layerview_support_interface": [63, 127, 255, 127], "layerview_prime_tower": [0, 255, 255, 255], - "layerview_nozzle": [181, 166, 66, 50], + "layerview_nozzle": [224, 192, 16, 64], "layerview_starts": [255, 255, 255, 255], "tab_status_connected": [50, 130, 255, 255], From 46933693a7f2637bb436327395265a1ebd696fd7 Mon Sep 17 00:00:00 2001 From: bas <38720940+BasF0@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:55:25 +0100 Subject: [PATCH 4/4] removed hardcoded 0: now using LayerPolygon.MoveCombingType --- plugins/SimulationView/SimulationPass.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index 015b31175e..cbe75cc548 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -15,7 +15,7 @@ from UM.View.RenderBatch import RenderBatch from UM.View.GL.OpenGL import OpenGL from cura.Settings.ExtruderManager import ExtruderManager - +from cura.LayerPolygon import LayerPolygon import os.path import numpy @@ -167,8 +167,9 @@ class SimulationPass(RenderPass): self._current_shader = self._layer_shader self._switching_layers = True - # The first line does not have a previous line: add a zero in front - prev_line_types = numpy.concatenate([numpy.asarray([0], dtype=numpy.float32), layer_data._attributes["line_types"]["value"]]) + # The first line does not have a previous line: add a MoveCombingType in front for start detection + # this way the first start of the layer can also be drawn + prev_line_types = numpy.concatenate([numpy.asarray([LayerPolygon.MoveCombingType], dtype = numpy.float32), layer_data._attributes["line_types"]["value"]]) # Remove the last element prev_line_types = prev_line_types[0:layer_data._attributes["line_types"]["value"].size] layer_data._attributes["prev_line_types"] = {'opengl_type': 'float', 'value': prev_line_types, 'opengl_name': 'a_prev_line_type'}