From 7d4a017c1523e4c731b7594fa825fcc60c1b98ee Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Fri, 14 Mar 2025 19:17:50 +0000 Subject: [PATCH] Don't create orientation slots for all spaces Trying to create orientation slots for all spaces could potentially involve a lot of duplicate method calls because blender has no way to query the list of existing orientation slots, so we can't check to see if setting a slot is necessary. So this patch now simply creates/overwrites and uses a single orientation slot whenever the user switches the default spatial container, and then only if the spatial orientation is non-world. --- src/bonsai/bonsai/bim/module/spatial/operator.py | 1 - src/bonsai/bonsai/core/spatial.py | 5 ----- 2 files changed, 6 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/spatial/operator.py b/src/bonsai/bonsai/bim/module/spatial/operator.py index 1e6ed86ee6..039ae18b82 100644 --- a/src/bonsai/bonsai/bim/module/spatial/operator.py +++ b/src/bonsai/bonsai/bim/module/spatial/operator.py @@ -239,7 +239,6 @@ class ImportSpatialDecomposition(bpy.types.Operator): def execute(self, context): core.import_spatial_decomposition(tool.Spatial) - core.create_orientation_slots(ifc=tool.Ifc, spatial=tool.Spatial) return {"FINISHED"} diff --git a/src/bonsai/bonsai/core/spatial.py b/src/bonsai/bonsai/core/spatial.py index 50e80bbed8..1e59583570 100644 --- a/src/bonsai/bonsai/core/spatial.py +++ b/src/bonsai/bonsai/core/spatial.py @@ -121,11 +121,6 @@ def import_spatial_decomposition(spatial: tool.Spatial) -> None: spatial.import_spatial_decomposition() -def create_orientation_slots(ifc: tool.Ifc, spatial: tool.Spatial) -> None: - products = ifc.get().by_type("IfcSpatialElement") - spatial.create_orientation_slots(products, use=False) - - def set_orientation_slot(spatial: tool.Spatial, product: ifcopenshell.entity_instance) -> None: spatial.create_orientation_slots([product], use=True)