MaterialGroup.py 1.3 KB

12345678910111213141516171819202122232425
  1. # Copyright (c) 2018 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. #
  4. # A MaterialGroup represents a group of material InstanceContainers that are derived from a single material profile.
  5. # The main InstanceContainer which has the ID of the material profile file name is called the "root_material". For
  6. # example: "generic_abs" is the root material (ID) of "generic_abs_ultimaker3" and "generic_abs_ultimaker3_AA_0.4",
  7. # and "generic_abs_ultimaker3" and "generic_abs_ultimaker3_AA_0.4" are derived materials of "generic_abs".
  8. #
  9. # Using "generic_abs" as an example, the MaterialGroup for "generic_abs" will contain the following information:
  10. # - name: "generic_abs", root_material_id
  11. # - root_material_node: MaterialNode of "generic_abs"
  12. # - derived_material_node_list: A list of MaterialNodes that are derived from "generic_abs",
  13. # so "generic_abs_ultimaker3", "generic_abs_ultimaker3_AA_0.4", etc.
  14. #
  15. class MaterialGroup:
  16. __slots__ = ("name", "root_material_node", "derived_material_node_list")
  17. def __init__(self, name: str):
  18. self.name = name
  19. self.root_material_node = None
  20. self.derived_material_node_list = []
  21. def __str__(self) -> str:
  22. return "%s[%s]" % (self.__class__.__name__, self.name)