bim.attribute_search_values - support not just scene props

This commit is contained in:
Andrej730
2025-07-09 18:01:37 +05:00
parent f7fdb8cc81
commit 0ad5ace35f
2 changed files with 3 additions and 5 deletions
+1 -1
View File
@@ -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:
+2 -4
View File
@@ -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):