From bb68f488dbf9af533b59b11ae3908e5c9b137e3a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Jul 2017 09:41:28 +0200 Subject: [PATCH] Make material finding more robust The .findContainer technique is obsolete since we now just have a field for this. Hopefully contributes to issue #2053. --- plugins/CuraEngineBackend/ProcessSlicedLayersJob.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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