Make grid-translucency depend on if machine has texture on BP.

part of CURA-12188
This commit is contained in:
Remco Burema 2024-11-05 20:44:25 +01:00
parent 8bf6320ff0
commit c89b708525
33 changed files with 56 additions and 21 deletions

View file

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

View file

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

View file

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

View file

@ -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":

View file

@ -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",

View file

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

View file

@ -8,6 +8,7 @@
"author": "oducceu",
"platform": "flyingbear_platform.obj",
"platform_texture": "flyingbear_platform.png",
"has_textured_buildplate": true,
"quality_definition": "flyingbear_base"
},
"overrides":

View file

@ -8,6 +8,7 @@
"author": "oducceu",
"platform": "flyingbear_platform.obj",
"platform_texture": "flyingbear_platform.png",
"has_textured_buildplate": true,
"quality_definition": "flyingbear_base"
},
"overrides":

View file

@ -8,6 +8,7 @@
"author": "barrnet",
"platform": "flyingbear_platform.obj",
"platform_texture": "flyingbear_platform.png",
"has_textured_buildplate": true,
"quality_definition": "flyingbear_base"
},
"overrides":

View file

@ -16,7 +16,8 @@
-1,
0
],
"platform_texture": "hellbot.png"
"platform_texture": "hellbot.png",
"has_textured_buildplate": true
},
"overrides":
{

View file

@ -20,7 +20,8 @@
0,
5
],
"platform_texture": "hellbot_hidra.png"
"platform_texture": "hellbot_hidra.png",
"has_textured_buildplate": true
},
"overrides":
{

View file

@ -20,7 +20,8 @@
0,
5
],
"platform_texture": "hellbot_hidra_plus.png"
"platform_texture": "hellbot_hidra_plus.png",
"has_textured_buildplate": true
},
"overrides":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -16,7 +16,8 @@
-1,
0
],
"platform_texture": "hellbot.png"
"platform_texture": "hellbot.png",
"has_textured_buildplate": true
},
"overrides":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -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":
{

View file

@ -20,7 +20,8 @@
-1,
0
],
"platform_texture": "hellbot.png"
"platform_texture": "hellbot.png",
"has_textured_buildplate": true
},
"overrides":
{

View file

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

View file

@ -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":
{

View file

@ -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",

View file

@ -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":

View file

@ -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":

View file

@ -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":

View file

@ -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":

View file

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