diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 2182a0748a..1e9721169a 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -57,25 +57,28 @@ class SolidView(View): # renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(),mode = Renderer.RenderLines) uniforms = {} - if self._extruders_model.rowCount() > 0: + if self._extruders_model.rowCount() == 0: + material = Application.getInstance().getGlobalContainerStack().findContainer({ "type": "material" }) + material_color = material.getMetaDataEntry("color_code", default = self._extruders_model.defaultColours[0]) if material else self._extruders_model.defaultColours[0] + else: # Get color to render this mesh in from ExtrudersModel extruder_index = 0 extruder_id = node.callDecoration("getActiveExtruder") if extruder_id: extruder_index = max(0, self._extruders_model.find("id", extruder_id)) - extruder_color = self._extruders_model.getItem(extruder_index)["colour"] - try: - # Colors are passed as rgb hex strings (eg "#ffffff"), and the shader needs - # an rgba list of floats (eg [1.0, 1.0, 1.0, 1.0]) - uniforms["diffuse_color"] = [ - int(extruder_color[1:3], 16) / 255, - int(extruder_color[3:5], 16) / 255, - int(extruder_color[5:7], 16) / 255, - 1.0 - ] - except ValueError: - pass + material_color = self._extruders_model.getItem(extruder_index)["colour"] + try: + # Colors are passed as rgb hex strings (eg "#ffffff"), and the shader needs + # an rgba list of floats (eg [1.0, 1.0, 1.0, 1.0]) + uniforms["diffuse_color"] = [ + int(material_color[1:3], 16) / 255, + int(material_color[3:5], 16) / 255, + int(material_color[5:7], 16) / 255, + 1.0 + ] + except ValueError: + pass if hasattr(node, "_outside_buildarea"): if node._outside_buildarea: