mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 18:57:17 +00:00
fixed issue with importing ifc objects with uv after 03a6ee912
This commit is contained in:
@@ -127,19 +127,22 @@ 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:
|
||||||
coords = coords[0]
|
return
|
||||||
# IfcTextureCoordinateGenerator handled in the style shader graph
|
for texture in texture_style.Textures or []:
|
||||||
if coords.is_a("IfcIndexedTextureMap"):
|
if coords := getattr(texture, "IsMappedBy", None):
|
||||||
return coords
|
coords = coords[0]
|
||||||
# TODO: support IfcTextureMap
|
# IfcTextureCoordinateGenerator handled in the style shader graph
|
||||||
if coords.is_a("IfcTextureMap"):
|
if coords.is_a("IfcIndexedTextureMap"):
|
||||||
print(f"WARNING. IfcTextureMap texture coordinates is not supported.")
|
return coords
|
||||||
return
|
# TODO: support IfcTextureMap
|
||||||
|
if coords.is_a("IfcTextureMap"):
|
||||||
|
print(f"WARNING. IfcTextureMap texture coordinates is not supported.")
|
||||||
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user