mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 05:14:30 +00:00
Pamateric doors/windows - add material select shortcut to UI
Example - https://i.imgur.com/UfJTjGz.png
This commit is contained in:
@@ -293,7 +293,10 @@ def prop_with_search(
|
|||||||
should_click_ok: bool = False,
|
should_click_ok: bool = False,
|
||||||
original_operator_path: Optional[str] = None,
|
original_operator_path: Optional[str] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
):
|
) -> bpy.types.UILayout:
|
||||||
|
"""
|
||||||
|
:return: Added row.
|
||||||
|
"""
|
||||||
# kwargs are layout.prop arguments (text, icon, etc.)
|
# kwargs are layout.prop arguments (text, icon, etc.)
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(data, prop_name, **kwargs)
|
row.prop(data, prop_name, **kwargs)
|
||||||
@@ -307,6 +310,7 @@ def prop_with_search(
|
|||||||
op.original_operator_path = original_operator_path or ""
|
op.original_operator_path = original_operator_path or ""
|
||||||
except TypeError: # Prop is not iterable
|
except TypeError: # Prop is not iterable
|
||||||
pass
|
pass
|
||||||
|
return row
|
||||||
|
|
||||||
|
|
||||||
def get_enum_items(
|
def get_enum_items(
|
||||||
|
|||||||
@@ -451,9 +451,12 @@ class BIM_PT_window(bpy.types.Panel):
|
|||||||
|
|
||||||
self.layout.use_property_split = True
|
self.layout.use_property_split = True
|
||||||
self.layout.label(text="Material Properties")
|
self.layout.label(text="Material Properties")
|
||||||
prop_with_search(self.layout, props, "lining_material")
|
row = prop_with_search(self.layout, props, "lining_material")
|
||||||
prop_with_search(self.layout, props, "framing_material", text="Panel Material")
|
tool.Model.draw_material_ui_select(row, props.lining_material)
|
||||||
prop_with_search(self.layout, props, "glazing_material")
|
row = prop_with_search(self.layout, props, "framing_material", text="Panel Material")
|
||||||
|
tool.Model.draw_material_ui_select(row, props.framing_material)
|
||||||
|
row = prop_with_search(self.layout, props, "glazing_material")
|
||||||
|
tool.Model.draw_material_ui_select(row, props.glazing_material)
|
||||||
else:
|
else:
|
||||||
row.operator("bim.enable_editing_window", icon="GREASEPENCIL", text="")
|
row.operator("bim.enable_editing_window", icon="GREASEPENCIL", text="")
|
||||||
row.operator("bim.remove_window", icon="X", text="")
|
row.operator("bim.remove_window", icon="X", text="")
|
||||||
@@ -548,10 +551,14 @@ class BIM_PT_door(bpy.types.Panel):
|
|||||||
|
|
||||||
self.layout.use_property_split = True
|
self.layout.use_property_split = True
|
||||||
self.layout.label(text="Material Properties")
|
self.layout.label(text="Material Properties")
|
||||||
prop_with_search(self.layout, props, "lining_material")
|
|
||||||
prop_with_search(self.layout, props, "framing_material", text="Panel Material")
|
row = prop_with_search(self.layout, props, "lining_material")
|
||||||
|
tool.Model.draw_material_ui_select(row, props.lining_material)
|
||||||
|
row = prop_with_search(self.layout, props, "framing_material", text="Panel Material")
|
||||||
|
tool.Model.draw_material_ui_select(row, props.framing_material)
|
||||||
if props.transom_thickness:
|
if props.transom_thickness:
|
||||||
prop_with_search(self.layout, props, "glazing_material")
|
row = prop_with_search(self.layout, props, "glazing_material")
|
||||||
|
tool.Model.draw_material_ui_select(row, props.framing_material)
|
||||||
else:
|
else:
|
||||||
row.operator("bim.enable_editing_door", icon="GREASEPENCIL", text="")
|
row.operator("bim.enable_editing_door", icon="GREASEPENCIL", text="")
|
||||||
row.operator("bim.remove_door", icon="X", text="")
|
row.operator("bim.remove_door", icon="X", text="")
|
||||||
|
|||||||
@@ -2031,3 +2031,11 @@ class Model(bonsai.core.tool.Model):
|
|||||||
ifcopenshell.api.grid.create_axis_curve(
|
ifcopenshell.api.grid.create_axis_curve(
|
||||||
tool.Ifc.get(), p1=points[0], p2=points[1], is_si=True, grid_axis=grid_axis
|
tool.Ifc.get(), p1=points[0], p2=points[1], is_si=True, grid_axis=grid_axis
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def draw_material_ui_select(cls, layout: bpy.types.UILayout, material_id: str) -> None:
|
||||||
|
material_id_int = int(material_id)
|
||||||
|
if not material_id_int:
|
||||||
|
return
|
||||||
|
op = layout.operator("bim.material_ui_select", icon="ZOOM_SELECTED", text="")
|
||||||
|
op.material_id = material_id_int
|
||||||
|
|||||||
Reference in New Issue
Block a user