Visibility during collector assignment now depends on the visibility mode set in the UI.

This commit is contained in:
Dion Moult
2025-10-13 08:08:35 +11:00
parent fb15435296
commit 155827528a
+10 -3
View File
@@ -51,9 +51,13 @@ class Collector(bonsai.core.tool.Collector):
if tool.Geometry.is_locked(element): if tool.Geometry.is_locked(element):
tool.Geometry.lock_object(obj) tool.Geometry.lock_object(obj)
element = (element.PartOfU or element.PartOfV or element.PartOfW)[0] element = (element.PartOfU or element.PartOfV or element.PartOfW)[0]
if not tool.Spatial.get_grid_props().is_visible:
obj.hide_viewport = True
elif element.is_a("IfcGrid"): elif element.is_a("IfcGrid"):
if tool.Geometry.is_locked(element): if tool.Geometry.is_locked(element):
tool.Geometry.lock_object(obj) tool.Geometry.lock_object(obj)
if not tool.Spatial.get_grid_props().is_visible:
obj.hide_viewport = True
if element.is_a("IfcProject"): if element.is_a("IfcProject"):
if tool.Geometry.is_locked(element): if tool.Geometry.is_locked(element):
@@ -69,7 +73,8 @@ class Collector(bonsai.core.tool.Collector):
tool.Geometry.lock_object(obj) tool.Geometry.lock_object(obj)
collection = cls._create_project_child_collection("IfcSpace") collection = cls._create_project_child_collection("IfcSpace")
cls.link_collection_object_safe(collection, obj) cls.link_collection_object_safe(collection, obj)
obj.hide_viewport = True if not tool.Spatial.get_spatial_props().is_visible:
obj.hide_viewport = True
elif element.is_a("IfcStructuralItem"): elif element.is_a("IfcStructuralItem"):
collection = cls._create_project_child_collection("IfcStructuralItem") collection = cls._create_project_child_collection("IfcStructuralItem")
cls.link_collection_object_safe(collection, obj) cls.link_collection_object_safe(collection, obj)
@@ -93,7 +98,8 @@ class Collector(bonsai.core.tool.Collector):
cls.link_collection_object_safe(collection, obj) cls.link_collection_object_safe(collection, obj)
project_obj = tool.Ifc.get_object(tool.Ifc.get().by_type("IfcProject")[0]) project_obj = tool.Ifc.get_object(tool.Ifc.get().by_type("IfcProject")[0])
cls.link_collection_child_safe(tool.Blender.get_object_bim_props(project_obj).collection, collection) cls.link_collection_child_safe(tool.Blender.get_object_bim_props(project_obj).collection, collection)
obj.hide_viewport = True if not tool.Spatial.get_spatial_props().is_visible:
obj.hide_viewport = True
elif ( elif (
tool.Ifc.get_schema() != "IFC2X3" tool.Ifc.get_schema() != "IFC2X3"
and element.is_a("IfcSpatialElement") and element.is_a("IfcSpatialElement")
@@ -105,7 +111,8 @@ class Collector(bonsai.core.tool.Collector):
cls.link_collection_object_safe(collection, obj) cls.link_collection_object_safe(collection, obj)
project_obj = tool.Ifc.get_object(tool.Ifc.get().by_type("IfcProject")[0]) project_obj = tool.Ifc.get_object(tool.Ifc.get().by_type("IfcProject")[0])
cls.link_collection_child_safe(tool.Blender.get_object_bim_props(project_obj).collection, collection) cls.link_collection_child_safe(tool.Blender.get_object_bim_props(project_obj).collection, collection)
obj.hide_viewport = True if not tool.Spatial.get_spatial_props().is_visible:
obj.hide_viewport = True
elif element.is_a("IfcAnnotation") and element.ObjectType == "DRAWING": elif element.is_a("IfcAnnotation") and element.ObjectType == "DRAWING":
if collection := cls._create_own_collection(obj): if collection := cls._create_own_collection(obj):
cls.link_collection_object_safe(collection, obj) cls.link_collection_object_safe(collection, obj)