From 31e912cf125e10cd36bdb84ecde0156f0cd3f39d Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 4 Dec 2023 12:47:07 +1100 Subject: [PATCH] Fix #4073. Objects with no applicable context for the drawing view are now hidden. --- src/blenderbim/blenderbim/tool/drawing.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/blenderbim/blenderbim/tool/drawing.py b/src/blenderbim/blenderbim/tool/drawing.py index 45e5244ab0..2e31b17c23 100644 --- a/src/blenderbim/blenderbim/tool/drawing.py +++ b/src/blenderbim/blenderbim/tool/drawing.py @@ -1653,10 +1653,12 @@ class Drawing(blenderbim.core.tool.Drawing): subcontext = current_representation.ContextOfItems current_representation_subcontext = tool.Geometry.get_subcontext_parameters(subcontext) + has_context = False for subcontext in subcontexts: # prioritize already active representation if it matches the subcontext # (element could have multiple representations in the same subcontext) if current_representation and subcontext == current_representation_subcontext: + has_context = True break priority_representation = ifcopenshell.util.representation.get_representation(element, *subcontext) if priority_representation: @@ -1669,8 +1671,13 @@ class Drawing(blenderbim.core.tool.Drawing): is_global=True, should_sync_changes_first=True, ) + has_context = True break + if not has_context: + obj.hide_set(True) + obj.hide_render = True + @classmethod def get_elements_in_camera_view(cls, camera, objs): props = camera.data.BIMCameraProperties