From adcc23541ad63611d3644c7bbd5389c2db92130d Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 14 Jan 2025 13:35:01 +1100 Subject: [PATCH] Fix bug where starting a new file in an existing session would prompt an error. Bpy.context.active_object is not available in-between loading / starting a new file. --- src/bonsai/bonsai/bim/module/model/data.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/data.py b/src/bonsai/bonsai/bim/module/model/data.py index df2e66dc7c..eeec8ffe50 100644 --- a/src/bonsai/bonsai/bim/module/model/data.py +++ b/src/bonsai/bonsai/bim/module/model/data.py @@ -241,10 +241,9 @@ class AuthoringData: @classmethod def is_representation_item_active(cls) -> bool: - object = bpy.context.active_object - if not object: + if not (obj := tool.Blender.get_active_object()): return False - return tool.Geometry.is_representation_item(object) + return tool.Geometry.is_representation_item(obj) @classmethod def active_representation_type(cls):