mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Revert "Use hide_set() for IfcSpaces instead of hide_viewport"
This reverts commit 96fe9b5398.
This commit contains a logical error where hide_viewport is checked in
the if statement but hide_set() is used as the effect. This causes a
regression in tests about project visibility. `hide_viewport` is the
correct hiding setting to use, because hide_set is more ephemeral and
affected by Shift-H, Alt-H etc.
This commit is contained in:
@@ -290,7 +290,6 @@ class IfcImporter:
|
||||
self.profile_code("Load linked models")
|
||||
self.add_project_to_scene()
|
||||
self.profile_code("Add project to scene")
|
||||
self.hide_ifc_spaces()
|
||||
if self.ifc_import_settings.should_clean_mesh and len(self.file.by_type("IfcElement")) < 1000:
|
||||
self.clean_mesh()
|
||||
self.profile_code("Mesh cleaning")
|
||||
@@ -1287,13 +1286,6 @@ class IfcImporter:
|
||||
properties={"Aggregate_Index": aggregate_index, "Name": name},
|
||||
)
|
||||
|
||||
def hide_ifc_spaces(self):
|
||||
"""Hide IfcSpace objects after they've been added to the scene."""
|
||||
for ifc_definition_id, obj in self.added_data.items():
|
||||
if isinstance(obj, bpy.types.Object):
|
||||
element = self.file.by_id(ifc_definition_id)
|
||||
if element.is_a("IfcSpace"):
|
||||
obj.hide_set(True)
|
||||
|
||||
|
||||
class IfcImportSettings:
|
||||
|
||||
@@ -50,12 +50,12 @@ class Collector(bonsai.core.tool.Collector):
|
||||
tool.Geometry.lock_object(obj)
|
||||
element = (element.PartOfU or element.PartOfV or element.PartOfW)[0]
|
||||
if not tool.Spatial.get_grid_props().is_visible:
|
||||
obj.hide_set(True)
|
||||
obj.hide_viewport = True
|
||||
elif element.is_a("IfcGrid"):
|
||||
if tool.Geometry.is_locked(element):
|
||||
tool.Geometry.lock_object(obj)
|
||||
if not tool.Spatial.get_grid_props().is_visible:
|
||||
obj.hide_set(True)
|
||||
obj.hide_viewport = True
|
||||
|
||||
if element.is_a("IfcProject"):
|
||||
if tool.Geometry.is_locked(element):
|
||||
@@ -71,6 +71,8 @@ class Collector(bonsai.core.tool.Collector):
|
||||
tool.Geometry.lock_object(obj)
|
||||
collection = cls._create_project_child_collection("IfcSpace")
|
||||
cls.link_collection_object_safe(collection, obj)
|
||||
if not tool.Spatial.get_spatial_props().is_visible:
|
||||
obj.hide_viewport = True
|
||||
elif element.is_a("IfcStructuralItem"):
|
||||
collection = cls._create_project_child_collection("IfcStructuralItem")
|
||||
cls.link_collection_object_safe(collection, obj)
|
||||
|
||||
@@ -1213,18 +1213,18 @@ class Spatial(bonsai.core.tool.Spatial):
|
||||
for element in elements:
|
||||
if obj := tool.Ifc.get_object(element):
|
||||
if obj.hide_viewport is True and is_visible:
|
||||
obj.hide_set(False)
|
||||
obj.hide_viewport = False
|
||||
elif obj.hide_viewport is False and not is_visible:
|
||||
obj.hide_set(True)
|
||||
obj.hide_viewport = True
|
||||
|
||||
@classmethod
|
||||
def set_grid_visibility(cls, is_visible: bool) -> None:
|
||||
for element in tool.Ifc.get().by_type("IfcGrid") + tool.Ifc.get().by_type("IfcGridAxis"):
|
||||
if obj := tool.Ifc.get_object(element):
|
||||
if obj.hide_viewport is True and is_visible:
|
||||
obj.hide_set(False)
|
||||
obj.hide_viewport = False
|
||||
elif obj.hide_viewport is False and not is_visible:
|
||||
obj.hide_set(True)
|
||||
obj.hide_viewport = True
|
||||
|
||||
@classmethod
|
||||
def toggle_spaces_visibility_wired_and_textured(cls, spaces: list[ifcopenshell.entity_instance]) -> None:
|
||||
|
||||
Reference in New Issue
Block a user