fixed issue with importing ifc objects with uv after 03a6ee912

This commit is contained in:
Andrej730
2023-11-27 15:05:37 +05:00
parent 304acdccef
commit ac15452dd3
+7 -4
View File
@@ -127,9 +127,12 @@ class MaterialCreator:
for style_id in style_ids: for style_id in style_ids:
material = self.styles[style_id] material = self.styles[style_id]
def get_ifc_coordinate(style_id): def get_ifc_coordinate(material):
style = self.ifc_importer.file.by_id(style_id) texture_style = tool.Style.get_texture_style(material)
if coords := getattr(style, "IsMappedTo", None): if not texture_style:
return
for texture in texture_style.Textures or []:
if coords := getattr(texture, "IsMappedBy", None):
coords = coords[0] coords = coords[0]
# IfcTextureCoordinateGenerator handled in the style shader graph # IfcTextureCoordinateGenerator handled in the style shader graph
if coords.is_a("IfcIndexedTextureMap"): if coords.is_a("IfcIndexedTextureMap"):
@@ -139,7 +142,7 @@ class MaterialCreator:
print(f"WARNING. IfcTextureMap texture coordinates is not supported.") print(f"WARNING. IfcTextureMap texture coordinates is not supported.")
return return
if coords := get_ifc_coordinate(style_id): if coords := get_ifc_coordinate(material):
self.load_texture_map(coords) self.load_texture_map(coords)
if self.mesh.materials.find(material.name) == -1: if self.mesh.materials.find(material.name) == -1:
self.mesh.materials.append(material) self.mesh.materials.append(material)