From 5b6f1323a5f74be6f4568ea0e60ad07373e4ca14 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 25 Jul 2023 17:12:00 +1000 Subject: [PATCH] Fix #3469. Fix bug where you couldn't load models if there was no style due to no polygons. --- src/blenderbim/blenderbim/bim/import_ifc.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/import_ifc.py b/src/blenderbim/blenderbim/bim/import_ifc.py index f189561103..bcd1d9b674 100644 --- a/src/blenderbim/blenderbim/bim/import_ifc.py +++ b/src/blenderbim/blenderbim/bim/import_ifc.py @@ -142,11 +142,12 @@ class MaterialCreator: if len(self.mesh.materials) == 1: return material_to_slot = {} - for i, material in enumerate(self.mesh["ios_materials"]): - slot_index = self.mesh.materials.find(self.styles[material].name) - material_to_slot[i] = slot_index if len(self.mesh.polygons) == len(self.mesh["ios_material_ids"]): + for i, material in enumerate(self.mesh["ios_materials"]): + slot_index = self.mesh.materials.find(self.styles[material].name) + material_to_slot[i] = slot_index + material_index = [ (material_to_slot[mat_id] if mat_id != -1 else 0) for mat_id in self.mesh["ios_material_ids"] ]