mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
deprecate mixing up ifc materials and styles in one blender material on loading #4843
Part of the transition process disconnecting blender materials from IFC materials to make it less confusing. E.g. previously if we would load an element A with material M and style S it would load it as blender material M that looks like S. But also if you would load element B with just style S, it would add it as blender material M though B has nothing to do with material M.
This commit is contained in:
@@ -1614,26 +1614,7 @@ class IfcImporter:
|
|||||||
return blender_material
|
return blender_material
|
||||||
|
|
||||||
def create_styles(self) -> None:
|
def create_styles(self) -> None:
|
||||||
parsed_styles = set()
|
|
||||||
|
|
||||||
for material_definition_representation in self.file.by_type("IfcMaterialDefinitionRepresentation"):
|
|
||||||
material = material_definition_representation.RepresentedMaterial
|
|
||||||
blender_material = self.material_creator.materials[material.id()]
|
|
||||||
for representation in material_definition_representation.Representations:
|
|
||||||
styles = []
|
|
||||||
for styled_item in representation.Items:
|
|
||||||
styles.extend(styled_item.Styles)
|
|
||||||
while styles:
|
|
||||||
style = styles.pop()
|
|
||||||
if style.is_a("IfcSurfaceStyle"):
|
|
||||||
self.create_style(style, blender_material)
|
|
||||||
parsed_styles.add(style.id())
|
|
||||||
elif style.is_a("IfcPresentationStyleAssignment"):
|
|
||||||
styles.extend(style.Styles)
|
|
||||||
|
|
||||||
for style in self.file.by_type("IfcSurfaceStyle"):
|
for style in self.file.by_type("IfcSurfaceStyle"):
|
||||||
if style.id() in parsed_styles:
|
|
||||||
continue
|
|
||||||
self.create_style(style)
|
self.create_style(style)
|
||||||
|
|
||||||
def create_style(
|
def create_style(
|
||||||
|
|||||||
Reference in New Issue
Block a user