diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 02cc943823..18b762bb2c 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -252,14 +252,18 @@ class BuildVolume(SceneNode): if not self.getMeshData() or not self.isVisible(): return True + theme = self._application.getTheme() if not self._shader: self._shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "default.shader")) self._grid_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "grid.shader")) - theme = self._application.getTheme() - self._grid_shader.setUniformValue("u_plateColor", Color(*theme.getColor("buildplate").getRgb())) self._grid_shader.setUniformValue("u_gridColor0", Color(*theme.getColor("buildplate_grid").getRgb())) self._grid_shader.setUniformValue("u_gridColor1", Color(*theme.getColor("buildplate_grid_minor").getRgb())) + plate_color = Color(*theme.getColor("buildplate").getRgb()) + if self._global_container_stack.getMetaDataEntry("has_textured_buildplate", False): + plate_color.setA(0.5) + self._grid_shader.setUniformValue("u_plateColor", plate_color) + renderer.queueNode(self, mode = RenderBatch.RenderMode.Lines) renderer.queueNode(self, mesh = self._origin_mesh, backface_cull = True) renderer.queueNode(self, mesh = self._grid_mesh, shader = self._grid_shader, backface_cull = True, transparent = True, sort = -10) diff --git a/resources/definitions/ankermake_m5.def.json b/resources/definitions/ankermake_m5.def.json index 4e4b3498b3..c79870537a 100644 --- a/resources/definitions/ankermake_m5.def.json +++ b/resources/definitions/ankermake_m5.def.json @@ -12,6 +12,7 @@ "has_machine_quality": true, "machine_extruder_trains": { "0": "ankermake_m5_extruder_0" }, "platform_texture": "ankermake_m5.png", + "has_textured_buildplate": true, "preferred_material": "generic_pla", "preferred_quality_type": "normal" }, diff --git a/resources/definitions/ankermake_m5c.def.json b/resources/definitions/ankermake_m5c.def.json index 2f49e0f030..22d1e56a94 100644 --- a/resources/definitions/ankermake_m5c.def.json +++ b/resources/definitions/ankermake_m5c.def.json @@ -12,6 +12,7 @@ "has_machine_quality": true, "machine_extruder_trains": { "0": "ankermake_m5c_extruder_0" }, "platform_texture": "ankermake_m5c.png", + "has_textured_buildplate": true, "preferred_material": "generic_pla", "preferred_quality_type": "normal" }, diff --git a/resources/definitions/dagoma_sigma_pro.def.json b/resources/definitions/dagoma_sigma_pro.def.json index 8bbac5a483..31e477ca0e 100644 --- a/resources/definitions/dagoma_sigma_pro.def.json +++ b/resources/definitions/dagoma_sigma_pro.def.json @@ -17,6 +17,7 @@ "preferred_quality_type": "h0.2", "preferred_variant_name": "Brass 0.4mm", "quality_definition": "dagoma_sigma_pro", + "has_textured_buildplate": true, "variants_name": "Nozzle" }, "overrides": diff --git a/resources/definitions/dagoma_sigma_pro_dual.def.json b/resources/definitions/dagoma_sigma_pro_dual.def.json index eb11b37603..a81d1cc028 100644 --- a/resources/definitions/dagoma_sigma_pro_dual.def.json +++ b/resources/definitions/dagoma_sigma_pro_dual.def.json @@ -18,6 +18,7 @@ "1": "dagoma_sigma_pro_dual_extruder_left" }, "platform_texture": "dagoma_sigma_pro.png", + "has_textured_buildplate": true, "preferred_quality_type": "h0.2", "preferred_variant_name": "Brass 0.4mm", "quality_definition": "dagoma_sigma_pro_dual", diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 31cffc4dc3..58dacc3a17 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -15,6 +15,7 @@ "preferred_material": "generic_pla", "preferred_quality_type": "normal", "machine_extruder_trains": { "0": "fdmextruder" }, + "has_textured_buildplate": false, "supports_usb_connection": true, "supports_network_connection": false, "supports_abstract_color": false diff --git a/resources/definitions/flyingbear_ghost_4s.def.json b/resources/definitions/flyingbear_ghost_4s.def.json index fe5b82a49f..f283914237 100644 --- a/resources/definitions/flyingbear_ghost_4s.def.json +++ b/resources/definitions/flyingbear_ghost_4s.def.json @@ -8,6 +8,7 @@ "author": "oducceu", "platform": "flyingbear_platform.obj", "platform_texture": "flyingbear_platform.png", + "has_textured_buildplate": true, "quality_definition": "flyingbear_base" }, "overrides": diff --git a/resources/definitions/flyingbear_ghost_5.def.json b/resources/definitions/flyingbear_ghost_5.def.json index 26108d9eeb..615b910ee7 100644 --- a/resources/definitions/flyingbear_ghost_5.def.json +++ b/resources/definitions/flyingbear_ghost_5.def.json @@ -8,6 +8,7 @@ "author": "oducceu", "platform": "flyingbear_platform.obj", "platform_texture": "flyingbear_platform.png", + "has_textured_buildplate": true, "quality_definition": "flyingbear_base" }, "overrides": diff --git a/resources/definitions/flyingbear_ghost_6.def.json b/resources/definitions/flyingbear_ghost_6.def.json index 26c067285e..a32931748a 100644 --- a/resources/definitions/flyingbear_ghost_6.def.json +++ b/resources/definitions/flyingbear_ghost_6.def.json @@ -8,6 +8,7 @@ "author": "barrnet", "platform": "flyingbear_platform.obj", "platform_texture": "flyingbear_platform.png", + "has_textured_buildplate": true, "quality_definition": "flyingbear_base" }, "overrides": diff --git a/resources/definitions/hellbot_adonis.def.json b/resources/definitions/hellbot_adonis.def.json index 8f797dc668..9daa5fc720 100644 --- a/resources/definitions/hellbot_adonis.def.json +++ b/resources/definitions/hellbot_adonis.def.json @@ -16,7 +16,8 @@ -1, 0 ], - "platform_texture": "hellbot.png" + "platform_texture": "hellbot.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_hidra.def.json b/resources/definitions/hellbot_hidra.def.json index 810f308a19..3ebdb7bb99 100644 --- a/resources/definitions/hellbot_hidra.def.json +++ b/resources/definitions/hellbot_hidra.def.json @@ -20,7 +20,8 @@ 0, 5 ], - "platform_texture": "hellbot_hidra.png" + "platform_texture": "hellbot_hidra.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_hidra_plus.def.json b/resources/definitions/hellbot_hidra_plus.def.json index 60654b9dec..844faa1904 100644 --- a/resources/definitions/hellbot_hidra_plus.def.json +++ b/resources/definitions/hellbot_hidra_plus.def.json @@ -20,7 +20,8 @@ 0, 5 ], - "platform_texture": "hellbot_hidra_plus.png" + "platform_texture": "hellbot_hidra_plus.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_230.def.json b/resources/definitions/hellbot_magna_2_230.def.json index 10be0b79fc..6757599d3f 100644 --- a/resources/definitions/hellbot_magna_2_230.def.json +++ b/resources/definitions/hellbot_magna_2_230.def.json @@ -11,7 +11,8 @@ "platform": "Hellbot_Magna_2_230.obj", "has_materials": true, "machine_extruder_trains": { "0": "hellbot_magna_2_230_extruder_0" }, - "platform_texture": "Magna2_230.png" + "platform_texture": "Magna2_230.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_230_dual.def.json b/resources/definitions/hellbot_magna_2_230_dual.def.json index 31501cbea1..d913a0d89f 100644 --- a/resources/definitions/hellbot_magna_2_230_dual.def.json +++ b/resources/definitions/hellbot_magna_2_230_dual.def.json @@ -15,7 +15,8 @@ "0": "hellbot_magna_2_230_dual_extruder_0", "1": "hellbot_magna_2_230_dual_extruder_1" }, - "platform_texture": "Magna2_230.png" + "platform_texture": "Magna2_230.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_300.def.json b/resources/definitions/hellbot_magna_2_300.def.json index 3fd09e49f3..1a49f41a37 100644 --- a/resources/definitions/hellbot_magna_2_300.def.json +++ b/resources/definitions/hellbot_magna_2_300.def.json @@ -11,7 +11,8 @@ "platform": "Hellbot_Magna_2_300.obj", "has_materials": true, "machine_extruder_trains": { "0": "hellbot_magna_2_300_extruder_0" }, - "platform_texture": "Magna2_300.png" + "platform_texture": "Magna2_300.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_300_dual.def.json b/resources/definitions/hellbot_magna_2_300_dual.def.json index 11d98cf150..9db9e9774e 100644 --- a/resources/definitions/hellbot_magna_2_300_dual.def.json +++ b/resources/definitions/hellbot_magna_2_300_dual.def.json @@ -15,7 +15,8 @@ "0": "hellbot_magna_2_300_dual_extruder_0", "1": "hellbot_magna_2_300_dual_extruder_1" }, - "platform_texture": "Magna2_300.png" + "platform_texture": "Magna2_300.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_400.def.json b/resources/definitions/hellbot_magna_2_400.def.json index c27273c67b..797584e341 100644 --- a/resources/definitions/hellbot_magna_2_400.def.json +++ b/resources/definitions/hellbot_magna_2_400.def.json @@ -11,7 +11,8 @@ "platform": "Hellbot_Magna_2_400.obj", "has_materials": true, "machine_extruder_trains": { "0": "hellbot_magna_2_400_extruder_0" }, - "platform_texture": "Magna2_400.png" + "platform_texture": "Magna2_400.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_400_dual.def.json b/resources/definitions/hellbot_magna_2_400_dual.def.json index 560bd800b4..e74221bbd3 100644 --- a/resources/definitions/hellbot_magna_2_400_dual.def.json +++ b/resources/definitions/hellbot_magna_2_400_dual.def.json @@ -15,7 +15,8 @@ "0": "hellbot_magna_2_400_dual_extruder_0", "1": "hellbot_magna_2_400_dual_extruder_1" }, - "platform_texture": "Magna2_400.png" + "platform_texture": "Magna2_400.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_500.def.json b/resources/definitions/hellbot_magna_2_500.def.json index d718fd3635..61bddc7b9a 100644 --- a/resources/definitions/hellbot_magna_2_500.def.json +++ b/resources/definitions/hellbot_magna_2_500.def.json @@ -11,7 +11,8 @@ "platform": "Hellbot_Magna_2_500.obj", "has_materials": true, "machine_extruder_trains": { "0": "hellbot_magna_2_500_extruder_0" }, - "platform_texture": "Magna2_500.png" + "platform_texture": "Magna2_500.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_2_500_dual.def.json b/resources/definitions/hellbot_magna_2_500_dual.def.json index cb5e8b94be..040c289867 100644 --- a/resources/definitions/hellbot_magna_2_500_dual.def.json +++ b/resources/definitions/hellbot_magna_2_500_dual.def.json @@ -15,7 +15,8 @@ "0": "hellbot_magna_2_500_dual_extruder_0", "1": "hellbot_magna_2_500_dual_extruder_1" }, - "platform_texture": "Magna2_500.png" + "platform_texture": "Magna2_500.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_I.def.json b/resources/definitions/hellbot_magna_I.def.json index 263a182ebc..0adcaa38e2 100644 --- a/resources/definitions/hellbot_magna_I.def.json +++ b/resources/definitions/hellbot_magna_I.def.json @@ -16,7 +16,8 @@ -1, 0 ], - "platform_texture": "hellbot.png" + "platform_texture": "hellbot.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_SE.def.json b/resources/definitions/hellbot_magna_SE.def.json index 0c010151e6..f568d944ec 100644 --- a/resources/definitions/hellbot_magna_SE.def.json +++ b/resources/definitions/hellbot_magna_SE.def.json @@ -11,7 +11,8 @@ "platform": "hellbot_magna_SE.obj", "has_materials": true, "machine_extruder_trains": { "0": "hellbot_magna_SE_extruder" }, - "platform_texture": "hellbot_magna_SE.png" + "platform_texture": "hellbot_magna_SE.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_SE_300.def.json b/resources/definitions/hellbot_magna_SE_300.def.json index bc60eb3aa7..3c3aaa8195 100644 --- a/resources/definitions/hellbot_magna_SE_300.def.json +++ b/resources/definitions/hellbot_magna_SE_300.def.json @@ -11,7 +11,8 @@ "platform": "Hellbot_Magna_SE_300.obj", "has_materials": true, "machine_extruder_trains": { "0": "hellbot_magna_SE_300_extruder" }, - "platform_texture": "Hellbot_Magna_SE_300.png" + "platform_texture": "Hellbot_Magna_SE_300.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_SE_Pro.def.json b/resources/definitions/hellbot_magna_SE_Pro.def.json index 65f32c2aab..bb045f4517 100644 --- a/resources/definitions/hellbot_magna_SE_Pro.def.json +++ b/resources/definitions/hellbot_magna_SE_Pro.def.json @@ -11,7 +11,8 @@ "platform": "Hellbot_Magna_SE_Pro.obj", "has_materials": true, "machine_extruder_trains": { "0": "hellbot_magna_SE_Pro_extruder" }, - "platform_texture": "Hellbot_magna_SE_Pro.png" + "platform_texture": "Hellbot_magna_SE_Pro.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/hellbot_magna_dual.def.json b/resources/definitions/hellbot_magna_dual.def.json index e41fcb7cce..d403399028 100644 --- a/resources/definitions/hellbot_magna_dual.def.json +++ b/resources/definitions/hellbot_magna_dual.def.json @@ -20,7 +20,8 @@ -1, 0 ], - "platform_texture": "hellbot.png" + "platform_texture": "hellbot.png", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/koonovo_base.def.json b/resources/definitions/koonovo_base.def.json index f46c39ec1e..516e5a081c 100644 --- a/resources/definitions/koonovo_base.def.json +++ b/resources/definitions/koonovo_base.def.json @@ -14,6 +14,7 @@ "has_materials": true, "machine_extruder_trains": { "0": "koonovo_base_extruder_0" }, "platform_texture": "koonovo.png", + "has_textured_buildplate": true, "preferred_material": "generic_pla", "preferred_quality_type": "standard" }, diff --git a/resources/definitions/peopoly_moai.def.json b/resources/definitions/peopoly_moai.def.json index 9ce1438fe3..a45c5cf666 100644 --- a/resources/definitions/peopoly_moai.def.json +++ b/resources/definitions/peopoly_moai.def.json @@ -12,7 +12,8 @@ "has_machine_quality": true, "has_materials": false, "machine_extruder_trains": { "0": "peopoly_moai_extruder_0" }, - "platform_texture": "moai.jpg" + "platform_texture": "moai.jpg", + "has_textured_buildplate": true }, "overrides": { diff --git a/resources/definitions/ultimaker_sketch_sprint.def.json b/resources/definitions/ultimaker_sketch_sprint.def.json index f8d392fe1f..5e830f205f 100644 --- a/resources/definitions/ultimaker_sketch_sprint.def.json +++ b/resources/definitions/ultimaker_sketch_sprint.def.json @@ -66,6 +66,7 @@ 0 ], "platform_texture": "MakerbotSketchSprint.png", + "has_textured_buildplate": true, "preferred_material": "ultimaker_pla_175", "preferred_quality_type": "draft", "preferred_variant_name": "0.4mm", diff --git a/resources/definitions/uni_200.def.json b/resources/definitions/uni_200.def.json index 9b1d498408..17af2722a6 100644 --- a/resources/definitions/uni_200.def.json +++ b/resources/definitions/uni_200.def.json @@ -8,6 +8,7 @@ "author": "Nail` Gimadeev (C)", "platform": "uni_200_platform.stl", "platform_texture": "uni.png", + "has_textured_buildplate": true, "quality_definition": "uni_base" }, "overrides": diff --git a/resources/definitions/uni_250.def.json b/resources/definitions/uni_250.def.json index a6300a32e2..704f861fe6 100644 --- a/resources/definitions/uni_250.def.json +++ b/resources/definitions/uni_250.def.json @@ -8,6 +8,7 @@ "author": "Nail` Gimadeev (C)", "platform": "uni_250_platform.stl", "platform_texture": "uni.png", + "has_textured_buildplate": true, "quality_definition": "uni_base" }, "overrides": diff --git a/resources/definitions/uni_300.def.json b/resources/definitions/uni_300.def.json index a5c8be60a6..eee62529e5 100644 --- a/resources/definitions/uni_300.def.json +++ b/resources/definitions/uni_300.def.json @@ -8,6 +8,7 @@ "author": "Nail` Gimadeev (C)", "platform": "uni_300_platform.stl", "platform_texture": "uni.png", + "has_textured_buildplate": true, "quality_definition": "uni_base" }, "overrides": diff --git a/resources/definitions/uni_mini.def.json b/resources/definitions/uni_mini.def.json index 5c08db9fb3..e11d4f6679 100644 --- a/resources/definitions/uni_mini.def.json +++ b/resources/definitions/uni_mini.def.json @@ -8,6 +8,7 @@ "author": "Nail` Gimadeev (C)", "platform": "uni_mini_platform.stl", "platform_texture": "uni.png", + "has_textured_buildplate": true, "quality_definition": "uni_base" }, "overrides": diff --git a/resources/shaders/grid.shader b/resources/shaders/grid.shader index 5334461015..7386263c84 100644 --- a/resources/shaders/grid.shader +++ b/resources/shaders/grid.shader @@ -45,7 +45,7 @@ fragment = float majorLine = min(majorGrid.x, majorGrid.y); gl_FragColor = mix(minorGridColor, u_gridColor0, 1.0 - min(majorLine, 1.0)); - gl_FragColor.a = 0.98; + gl_FragColor.a = u_plateColor.a; } vertex41core = @@ -89,7 +89,7 @@ fragment41core = float majorLine = min(majorGrid.x, majorGrid.y); frag_color = mix(minorGridColor, u_gridColor0, 1.0 - min(majorLine, 1.0)); - frag_color.a = 0.98; + frag_color.a = u_plateColor.a; } [defaults]