mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 12:40:07 +00:00
Improved UI for psets and qtos with collapsible panels and improved readibility
This commit is contained in:
@@ -1646,6 +1646,8 @@ class IfcParameter(PropertyGroup):
|
|||||||
class PsetQto(PropertyGroup):
|
class PsetQto(PropertyGroup):
|
||||||
name: StringProperty(name="Name")
|
name: StringProperty(name="Name")
|
||||||
properties: CollectionProperty(name="Properties", type=Attribute)
|
properties: CollectionProperty(name="Properties", type=Attribute)
|
||||||
|
is_expanded: BoolProperty(name="Is Expanded")
|
||||||
|
is_editable: BoolProperty(name="Is Editable")
|
||||||
|
|
||||||
|
|
||||||
class GlobalId(PropertyGroup):
|
class GlobalId(PropertyGroup):
|
||||||
|
|||||||
@@ -195,7 +195,12 @@ class BIM_PT_object_material(Panel):
|
|||||||
row.prop(material, "category")
|
row.prop(material, "category")
|
||||||
elif props.material_type == "IfcMaterialProfileSet":
|
elif props.material_type == "IfcMaterialProfileSet":
|
||||||
row.template_list(
|
row.template_list(
|
||||||
"MATERIAL_UL_matslots", "", set_props, "material_profiles", set_props, "active_material_profile_index",
|
"MATERIAL_UL_matslots",
|
||||||
|
"",
|
||||||
|
set_props,
|
||||||
|
"material_profiles",
|
||||||
|
set_props,
|
||||||
|
"active_material_profile_index",
|
||||||
)
|
)
|
||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
col.operator("bim.add_material_profile", icon="ADD", text="")
|
col.operator("bim.add_material_profile", icon="ADD", text="")
|
||||||
@@ -253,13 +258,27 @@ class BIM_PT_object_psets(Panel):
|
|||||||
|
|
||||||
def draw_psets_ui(self, props, enabled=True):
|
def draw_psets_ui(self, props, enabled=True):
|
||||||
for index, pset in enumerate(props.psets):
|
for index, pset in enumerate(props.psets):
|
||||||
row = self.layout.row(align=True)
|
box = self.layout.box()
|
||||||
row.enabled = enabled
|
row = box.row(align=True)
|
||||||
row.prop(pset, "name", text="")
|
row.prop(
|
||||||
|
pset,
|
||||||
|
"is_expanded",
|
||||||
|
icon="TRIA_DOWN" if pset.is_expanded else "TRIA_RIGHT",
|
||||||
|
icon_only=True,
|
||||||
|
emboss=False,
|
||||||
|
)
|
||||||
|
row2 = row.row(align=True)
|
||||||
|
row2.enabled = enabled
|
||||||
|
row2.prop(pset, "name", text="", icon="COPY_ID", emboss=pset.is_editable)
|
||||||
|
|
||||||
if enabled:
|
if enabled:
|
||||||
|
row.prop(pset, "is_editable", icon="CHECKMARK" if pset.is_editable else "GREASEPENCIL", icon_only=True)
|
||||||
row.operator("bim.remove_pset", icon="X", text="").pset_index = index
|
row.operator("bim.remove_pset", icon="X", text="").pset_index = index
|
||||||
|
if not pset.is_expanded:
|
||||||
|
continue
|
||||||
|
if pset.is_editable:
|
||||||
for prop in pset.properties:
|
for prop in pset.properties:
|
||||||
row = self.layout.row(align=True)
|
row = box.row(align=True)
|
||||||
row.enabled = enabled
|
row.enabled = enabled
|
||||||
row.prop(prop, "name", text="")
|
row.prop(prop, "name", text="")
|
||||||
row.prop(prop, "string_value", text="")
|
row.prop(prop, "string_value", text="")
|
||||||
@@ -269,6 +288,13 @@ class BIM_PT_object_psets(Panel):
|
|||||||
op.pset_name = pset.name
|
op.pset_name = pset.name
|
||||||
op.prop_name = prop.name
|
op.prop_name = prop.name
|
||||||
op.prop_value = prop.string_value
|
op.prop_value = prop.string_value
|
||||||
|
else:
|
||||||
|
col = box.column(align=True)
|
||||||
|
for prop in pset.properties:
|
||||||
|
if not prop.string_value:
|
||||||
|
continue
|
||||||
|
col.enabled = enabled
|
||||||
|
col.prop(prop, "string_value", text=prop.name)
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_object_qto(Panel):
|
class BIM_PT_object_qto(Panel):
|
||||||
@@ -292,11 +318,18 @@ class BIM_PT_object_qto(Panel):
|
|||||||
row.operator("bim.add_qto")
|
row.operator("bim.add_qto")
|
||||||
|
|
||||||
for index, qto in enumerate(props.qtos):
|
for index, qto in enumerate(props.qtos):
|
||||||
row = layout.row(align=True)
|
box = self.layout.box()
|
||||||
row.prop(qto, "name", text="")
|
row = box.row(align=True)
|
||||||
|
|
||||||
|
row.prop(
|
||||||
|
qto, "is_expanded", icon="TRIA_DOWN" if qto.is_expanded else "TRIA_RIGHT", icon_only=True, emboss=False
|
||||||
|
)
|
||||||
|
row.prop(qto, "name", text="", icon="COPY_ID")
|
||||||
row.operator("bim.remove_qto", icon="X", text="").index = index
|
row.operator("bim.remove_qto", icon="X", text="").index = index
|
||||||
|
if not qto.is_expanded:
|
||||||
|
continue
|
||||||
for index2, prop in enumerate(qto.properties):
|
for index2, prop in enumerate(qto.properties):
|
||||||
row = layout.row(align=True)
|
row = box.row(align=True)
|
||||||
row.prop(prop, "name", text="")
|
row.prop(prop, "name", text="")
|
||||||
row.prop(prop, "string_value", text="")
|
row.prop(prop, "string_value", text="")
|
||||||
if (
|
if (
|
||||||
@@ -836,7 +869,12 @@ class BIM_PT_presentation_layer_data(Panel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
layout.template_list(
|
layout.template_list(
|
||||||
"BIM_UL_generic", "", scene_props, "presentation_layers", scene_props, "active_presentation_layer_index",
|
"BIM_UL_generic",
|
||||||
|
"",
|
||||||
|
scene_props,
|
||||||
|
"presentation_layers",
|
||||||
|
scene_props,
|
||||||
|
"active_presentation_layer_index",
|
||||||
)
|
)
|
||||||
if scene_props.active_presentation_layer_index < len(scene_props.presentation_layers):
|
if scene_props.active_presentation_layer_index < len(scene_props.presentation_layers):
|
||||||
op = layout.row().operator("bim.assign_presentation_layer")
|
op = layout.row().operator("bim.assign_presentation_layer")
|
||||||
|
|||||||
Reference in New Issue
Block a user