Fix 3x slower major speed regression introduced in 98a9550260

The commit that introduced the problem was trying to optimise rendering
dense meshes with the opening decorator. However, it introduced more
calculation in the initial project load and stored more data on every
object. This resulted in models loading 3x slower for me which is pretty
major. The original problem needs further investigation.
This commit is contained in:
Dion Moult
2025-01-20 11:24:19 +11:00
parent 5769c0d442
commit 6af19bc98d
+1 -7
View File
@@ -936,8 +936,7 @@ class Loader(bonsai.core.tool.Loader):
# ios_edges holds true edges that aren't triangulated.
#
# we do `.tolist()` because Blender can't assign `np.int32` to it's custom attributes
ios_edges = list(set(tuple(e) for e in ifcopenshell.util.shape.get_edges(geometry).tolist()))
mesh["ios_edges"] = ios_edges
mesh["ios_edges"] = list(set(tuple(e) for e in ifcopenshell.util.shape.get_edges(geometry).tolist()))
ios_item_ids = ifcopenshell.util.shape.get_faces_representation_item_ids(geometry).tolist()
mesh["ios_item_ids"] = ios_item_ids
@@ -981,11 +980,6 @@ class Loader(bonsai.core.tool.Loader):
if rep.is_a("IfcShapeRepresentation"):
tool.Loader.load_indexed_colour_map(rep, mesh)
ios_edges_values = [
(e.vertices[0], e.vertices[1]) in ios_edges or (e.vertices[1], e.vertices[0]) in ios_edges
for e in mesh.edges
]
tool.Blender.Attribute.fill_attribute(mesh, "ios_edges", "EDGE", "BOOLEAN", ios_edges_values)
tool.Blender.Attribute.fill_attribute(mesh, "ios_item_ids", "FACE", "INT", ios_item_ids)
tool.Blender.Attribute.fill_attribute(mesh, "ios_material_ids", "FACE", "INT", geometry.material_ids)
else: