mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
bim.attribute_search_values - support not just scene props
This commit is contained in:
@@ -131,7 +131,7 @@ def draw_attribute(
|
|||||||
op = layout.operator("bim.attribute_search_values", text="", icon="VIEWZOOM")
|
op = layout.operator("bim.attribute_search_values", text="", icon="VIEWZOOM")
|
||||||
op.attribute_name = attribute.name
|
op.attribute_name = attribute.name
|
||||||
op.attribute_ifc_class = attribute.ifc_class
|
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
|
op.data_type = attribute.data_type
|
||||||
|
|
||||||
if attribute.is_optional:
|
if attribute.is_optional:
|
||||||
|
|||||||
@@ -1368,10 +1368,8 @@ class BIM_OT_attribute_search_values(bpy.types.Operator):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_data_path(data_path: str) -> tuple[str, "Attribute"]:
|
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."""
|
"""Resolve the data path of an object's attribute to get the attribute name and the object."""
|
||||||
path_parts = data_path.split(".")
|
attribute_obj, _, attr_name = data_path.rpartition(".")
|
||||||
obj_path = ".".join(path_parts[:-1])
|
attribute_obj = eval(attribute_obj)
|
||||||
attr_name = path_parts[-1]
|
|
||||||
attribute_obj = eval(f"bpy.context.scene.{obj_path}")
|
|
||||||
return attr_name, attribute_obj
|
return attr_name, attribute_obj
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
|
|||||||
Reference in New Issue
Block a user