diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index ecaebb816d..58c75fff3f 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -173,19 +173,16 @@ class ProcessSlicedLayersJob(Job): if extruders: material_color_map = numpy.zeros((len(extruders), 4), dtype=numpy.float32) for extruder in extruders: - material = extruder.findContainer({"type": "material"}) position = int(extruder.getMetaDataEntry("position", default="0")) # Get the position - color_code = material.getMetaDataEntry("color_code", default="#e0e000") + color_code = extruder.material.getMetaDataEntry("color_code", default="#e0e000") color = colorCodeToRGBA(color_code) material_color_map[position, :] = color else: # Single extruder via global stack. material_color_map = numpy.zeros((1, 4), dtype=numpy.float32) - material = global_container_stack.findContainer({"type": "material"}) color_code = "#e0e000" - if material: - if material.getMetaDataEntry("color_code") is not None: - color_code = material.getMetaDataEntry("color_code") + if global_container_stack.material.getMetaDataEntry("color_code") is not None: + color_code = global_container_stack.material.getMetaDataEntry("color_code") color = colorCodeToRGBA(color_code) material_color_map[0, :] = color