mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Make material finding more robust
The .findContainer technique is obsolete since we now just have a field for this. Hopefully contributes to issue #2053.
This commit is contained in:
parent
271d4a30f0
commit
bb68f488db
1 changed files with 3 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue