From 44431db092af902b79249e84082ba26bd5ff3c24 Mon Sep 17 00:00:00 2001 From: "Sigma Dimensions (Yass)" <79010126+myoualid@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:32:18 +0100 Subject: [PATCH] fix toggle link selectability and visibility when linked IFCs use a relative path --- .../blenderbim/bim/module/project/operator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/project/operator.py b/src/blenderbim/blenderbim/bim/module/project/operator.py index 1f924ab63e..6c47978d98 100644 --- a/src/blenderbim/blenderbim/bim/module/project/operator.py +++ b/src/blenderbim/blenderbim/bim/module/project/operator.py @@ -910,6 +910,9 @@ class ToggleLinkSelectability(bpy.types.Operator): def execute(self, context): props = context.scene.BIMProjectProperties link = props.links.get(self.link) + self.filepath = self.link + if not os.path.isabs(self.filepath): + self.filepath = os.path.abspath(os.path.join(bpy.path.abspath("//"), self.filepath)) for collection in self.get_linked_collections(): collection.hide_select = not collection.hide_select link.is_selectable = not collection.hide_select @@ -917,7 +920,7 @@ class ToggleLinkSelectability(bpy.types.Operator): def get_linked_collections(self): return [ - c for c in bpy.data.collections if "IfcProject" in c.name and c.library and c.library.filepath == self.link + c for c in bpy.data.collections if "IfcProject" in c.name and c.library and c.library.filepath == self.filepath ] @@ -932,6 +935,9 @@ class ToggleLinkVisibility(bpy.types.Operator): def execute(self, context): props = context.scene.BIMProjectProperties link = props.links.get(self.link) + self.filepath = self.link + if not os.path.isabs(self.filepath): + self.filepath = os.path.abspath(os.path.join(bpy.path.abspath("//"), self.filepath)) if self.mode == "WIREFRAME": self.toggle_wireframe(link) elif self.mode == "VISIBLE": @@ -968,7 +974,7 @@ class ToggleLinkVisibility(bpy.types.Operator): def get_linked_collections(self): return [ - c for c in bpy.data.collections if "IfcProject" in c.name and c.library and c.library.filepath == self.link + c for c in bpy.data.collections if "IfcProject" in c.name and c.library and c.library.filepath == self.filepath ]