Don't require material manager any more to find available materials

We have our container tree for that.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-21 15:51:27 +02:00
parent e7609fadf4
commit b7213ad020
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -115,7 +115,14 @@ class BaseMaterialsModel(ListModel):
return False
extruder_stack = global_stack.extruders[extruder_position]
self._available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack)
nozzle_name = None
if extruder_stack.variant.getId() != "empty_variant":
nozzle_name = extruder_stack.variant.getName()
# Update the available materials (ContainerNode) for the current active machine and extruder setup.
materials = self.getAvailableMaterials(global_stack.definition.getId(), nozzle_name)
compatible_material_diameter = str(round(extruder_stack.getCompatibleMaterialDiameter()))
self._available_materials = {key: material for key, material in materials.items() if material.container.getMetaDataEntry("approximate_diameter") == compatible_material_diameter}
return True
## This is another convenience function which is shared by all material