mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Optimize loading meshes using numpy arrays
1) avoid calling geometry.xxx multiple times as each time it creates a new copy 2) use numpy arrays with correct data type, so Blender could perform buffer copy significantly reducing overhead
This commit is contained in:
@@ -614,7 +614,7 @@ class TestApplyIfcMaterialChanges(NewFile):
|
||||
tool.Geometry._reload_representation(obj)
|
||||
|
||||
def get_material_indices(mesh: bpy.types.Mesh) -> np.ndarray:
|
||||
buffer = np.empty(len(mesh.polygons), dtype=np.int32)
|
||||
buffer = np.empty(len(mesh.polygons), dtype="I")
|
||||
mesh.polygons.foreach_get("material_index", buffer)
|
||||
return buffer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user