mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
bim.attribute_search_values - enable it in more places
Since this feature can be generally useful, let's try it out to see the cases when it should be disabled. Additionally to Materials UI, it's now enabled in object attributes, materials, profiles, styles and explorer ui.
This commit is contained in:
@@ -52,6 +52,7 @@ def draw_attributes(
|
||||
copy_operator: Optional[str] = None,
|
||||
popup_active_attribute: Optional[bonsai.bim.prop.Attribute] = None,
|
||||
callback: Optional[Callable[[bonsai.bim.prop.Attribute, bpy.types.UILayout], None]] = None,
|
||||
*,
|
||||
enable_search: bool = False,
|
||||
) -> None:
|
||||
"""Draw editable UI for prop.Attributes.
|
||||
|
||||
@@ -38,7 +38,9 @@ def draw_ui(context: bpy.types.Context, layout: bpy.types.UILayout, attributes)
|
||||
row.operator("bim.edit_attributes", icon="CHECKMARK", text="Save Attributes")
|
||||
row.operator("bim.disable_editing_attributes", icon="CANCEL", text="")
|
||||
|
||||
bonsai.bim.helper.draw_attributes(props.attributes, layout, copy_operator="bim.copy_attribute_to_selection")
|
||||
bonsai.bim.helper.draw_attributes(
|
||||
props.attributes, layout, copy_operator="bim.copy_attribute_to_selection", enable_search=True
|
||||
)
|
||||
else:
|
||||
row = layout.row()
|
||||
op = row.operator("bim.enable_editing_attributes", icon="GREASEPENCIL", text="Edit")
|
||||
@@ -121,7 +123,7 @@ class BIM_PT_explorer(Panel):
|
||||
row = box.row(align=True)
|
||||
row.operator("bim.explorer_edit_entity", icon="CHECKMARK")
|
||||
row.operator("bim.explorer_disable_editing_entity", icon="CANCEL", text="")
|
||||
bonsai.bim.helper.draw_attributes(props.entity_attributes, box)
|
||||
bonsai.bim.helper.draw_attributes(props.entity_attributes, box, enable_search=True)
|
||||
|
||||
|
||||
class BIM_UL_explorer(bpy.types.UIList):
|
||||
|
||||
@@ -140,7 +140,7 @@ class BIM_PT_profiles(Panel):
|
||||
self.draw_editable_ui(context)
|
||||
|
||||
def draw_editable_ui(self, context):
|
||||
bonsai.bim.helper.draw_attributes(self.props.profile_attributes, self.layout)
|
||||
bonsai.bim.helper.draw_attributes(self.props.profile_attributes, self.layout, enable_search=True)
|
||||
|
||||
|
||||
class BIM_UL_profiles(UIList):
|
||||
|
||||
@@ -135,7 +135,7 @@ class BIM_PT_styles(Panel):
|
||||
# display style elements props during edit
|
||||
if self.props.is_editing_style:
|
||||
if self.props.is_editing_class == "IfcSurfaceStyle":
|
||||
bonsai.bim.helper.draw_attributes(self.props.attributes, self.layout)
|
||||
bonsai.bim.helper.draw_attributes(self.props.attributes, self.layout, enable_search=True)
|
||||
edit_label = "Save Attributes"
|
||||
elif self.props.is_editing_class == "IfcSurfaceStyleShading":
|
||||
self.draw_surface_style_shading()
|
||||
@@ -246,10 +246,10 @@ class BIM_PT_styles(Panel):
|
||||
op = row.operator("bim.browse_external_style", icon="APPEND_BLEND", text="Append From Blend File")
|
||||
style = self.props.active_style
|
||||
op.active_surface_style_id = style.ifc_definition_id
|
||||
bonsai.bim.helper.draw_attributes(self.props.external_style_attributes, self.layout)
|
||||
bonsai.bim.helper.draw_attributes(self.props.external_style_attributes, self.layout, enable_search=True)
|
||||
|
||||
def draw_refraction_surface_style(self):
|
||||
bonsai.bim.helper.draw_attributes(self.props.refraction_style_attributes, self.layout)
|
||||
bonsai.bim.helper.draw_attributes(self.props.refraction_style_attributes, self.layout, enable_search=True)
|
||||
row = self.layout.row(align=True)
|
||||
|
||||
def draw_lighting_surface_style(self):
|
||||
|
||||
@@ -1373,6 +1373,9 @@ class BIM_OT_attribute_search_values(bpy.types.Operator):
|
||||
return attr_name, attribute_obj
|
||||
|
||||
def invoke(self, context, event):
|
||||
required_props = (self.attribute_name, self.attribute_ifc_class, self.data_path)
|
||||
assert all(required_props), required_props
|
||||
|
||||
attr_name, attribute_obj = self.resolve_data_path(self.data_path)
|
||||
self.search_value = str(getattr(attribute_obj, attr_name, ""))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user