From 0ad5ace35f76211f8f7a01d46208f714ec22f4bd Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 9 Jul 2025 18:01:37 +0500 Subject: [PATCH] bim.attribute_search_values - support not just scene props --- src/bonsai/bonsai/bim/helper.py | 2 +- src/bonsai/bonsai/bim/operator.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bonsai/bonsai/bim/helper.py b/src/bonsai/bonsai/bim/helper.py index 93fc8b6a88..978fe02b30 100644 --- a/src/bonsai/bonsai/bim/helper.py +++ b/src/bonsai/bonsai/bim/helper.py @@ -131,7 +131,7 @@ def draw_attribute( op = layout.operator("bim.attribute_search_values", text="", icon="VIEWZOOM") op.attribute_name = attribute.name op.attribute_ifc_class = attribute.ifc_class - op.data_path = attribute.path_from_id(value_name) + op.data_path = tool.Blender.get_full_data_path(attribute, value_name) op.data_type = attribute.data_type if attribute.is_optional: diff --git a/src/bonsai/bonsai/bim/operator.py b/src/bonsai/bonsai/bim/operator.py index c45c6a0c44..fc5497334c 100644 --- a/src/bonsai/bonsai/bim/operator.py +++ b/src/bonsai/bonsai/bim/operator.py @@ -1368,10 +1368,8 @@ class BIM_OT_attribute_search_values(bpy.types.Operator): @staticmethod def resolve_data_path(data_path: str) -> tuple[str, "Attribute"]: """Resolve the data path of an object's attribute to get the attribute name and the object.""" - path_parts = data_path.split(".") - obj_path = ".".join(path_parts[:-1]) - attr_name = path_parts[-1] - attribute_obj = eval(f"bpy.context.scene.{obj_path}") + attribute_obj, _, attr_name = data_path.rpartition(".") + attribute_obj = eval(attribute_obj) return attr_name, attribute_obj def invoke(self, context, event):