From 8d1255f0bc81cf6ba9bf776d98736d6807c20e6c Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 28 Feb 2025 16:03:13 +0500 Subject: [PATCH] Fix toggling wireframe for odd case when there are no objects linked Noticed investigating #6242 --- src/bonsai/bonsai/bim/module/project/operator.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/project/operator.py b/src/bonsai/bonsai/bim/module/project/operator.py index eb49a01535..ee06a59b11 100644 --- a/src/bonsai/bonsai/bim/module/project/operator.py +++ b/src/bonsai/bonsai/bim/module/project/operator.py @@ -1488,16 +1488,12 @@ class ToggleLinkVisibility(bpy.types.Operator): return {"FINISHED"} def toggle_wireframe(self, link: "Link") -> None: + link.is_wireframe = not link.is_wireframe + display_type = "WIRE" if link.is_wireframe else "TEXTURED" for collection in self.get_linked_collections(): objs = filter(lambda obj: "IfcOpeningElement" not in obj.name, collection.all_objects) - for i, obj in enumerate(objs): - if i == 0: - if obj.display_type == "WIRE": - display_type = "TEXTURED" - else: - display_type = "WIRE" + for obj in objs: obj.display_type = display_type - link.is_wireframe = display_type == "WIRE" def toggle_visibility(self, link: "Link") -> None: linked_collections = self.get_linked_collections()