Skip to content

Commit 98f4581

Browse files
committed
Improved UI for psets and qtos with collapsible panels and improved readibility
1 parent e3f6151 commit 98f4581

2 files changed

Lines changed: 59 additions & 19 deletions

File tree

src/ifcblenderexport/blenderbim/bim/prop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,8 @@ class IfcParameter(PropertyGroup):
16461646
class PsetQto(PropertyGroup):
16471647
name: StringProperty(name="Name")
16481648
properties: CollectionProperty(name="Properties", type=Attribute)
1649+
is_expanded: BoolProperty(name="Is Expanded")
1650+
is_editable: BoolProperty(name="Is Editable")
16491651

16501652

16511653
class GlobalId(PropertyGroup):

src/ifcblenderexport/blenderbim/bim/ui.py

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ def draw(self, context):
195195
row.prop(material, "category")
196196
elif props.material_type == "IfcMaterialProfileSet":
197197
row.template_list(
198-
"MATERIAL_UL_matslots", "", set_props, "material_profiles", set_props, "active_material_profile_index",
198+
"MATERIAL_UL_matslots",
199+
"",
200+
set_props,
201+
"material_profiles",
202+
set_props,
203+
"active_material_profile_index",
199204
)
200205
col = row.column(align=True)
201206
col.operator("bim.add_material_profile", icon="ADD", text="")
@@ -253,22 +258,43 @@ def draw(self, context):
253258

254259
def draw_psets_ui(self, props, enabled=True):
255260
for index, pset in enumerate(props.psets):
256-
row = self.layout.row(align=True)
257-
row.enabled = enabled
258-
row.prop(pset, "name", text="")
261+
box = self.layout.box()
262+
row = box.row(align=True)
263+
row.prop(
264+
pset,
265+
"is_expanded",
266+
icon="TRIA_DOWN" if pset.is_expanded else "TRIA_RIGHT",
267+
icon_only=True,
268+
emboss=False,
269+
)
270+
row2 = row.row(align=True)
271+
row2.enabled = enabled
272+
row2.prop(pset, "name", text="", icon="COPY_ID", emboss=pset.is_editable)
273+
259274
if enabled:
275+
row.prop(pset, "is_editable", icon="CHECKMARK" if pset.is_editable else "GREASEPENCIL", icon_only=True)
260276
row.operator("bim.remove_pset", icon="X", text="").pset_index = index
261-
for prop in pset.properties:
262-
row = self.layout.row(align=True)
263-
row.enabled = enabled
264-
row.prop(prop, "name", text="")
265-
row.prop(prop, "string_value", text="")
266-
if not enabled:
267-
continue
268-
op = row.operator("bim.copy_property_to_selection", icon="COPYDOWN", text="")
269-
op.pset_name = pset.name
270-
op.prop_name = prop.name
271-
op.prop_value = prop.string_value
277+
if not pset.is_expanded:
278+
continue
279+
if pset.is_editable:
280+
for prop in pset.properties:
281+
row = box.row(align=True)
282+
row.enabled = enabled
283+
row.prop(prop, "name", text="")
284+
row.prop(prop, "string_value", text="")
285+
if not enabled:
286+
continue
287+
op = row.operator("bim.copy_property_to_selection", icon="COPYDOWN", text="")
288+
op.pset_name = pset.name
289+
op.prop_name = prop.name
290+
op.prop_value = prop.string_value
291+
else:
292+
col = box.column(align=True)
293+
for prop in pset.properties:
294+
if not prop.string_value:
295+
continue
296+
col.enabled = enabled
297+
col.prop(prop, "string_value", text=prop.name)
272298

273299

274300
class BIM_PT_object_qto(Panel):
@@ -292,11 +318,18 @@ def draw(self, context):
292318
row.operator("bim.add_qto")
293319

294320
for index, qto in enumerate(props.qtos):
295-
row = layout.row(align=True)
296-
row.prop(qto, "name", text="")
321+
box = self.layout.box()
322+
row = box.row(align=True)
323+
324+
row.prop(
325+
qto, "is_expanded", icon="TRIA_DOWN" if qto.is_expanded else "TRIA_RIGHT", icon_only=True, emboss=False
326+
)
327+
row.prop(qto, "name", text="", icon="COPY_ID")
297328
row.operator("bim.remove_qto", icon="X", text="").index = index
329+
if not qto.is_expanded:
330+
continue
298331
for index2, prop in enumerate(qto.properties):
299-
row = layout.row(align=True)
332+
row = box.row(align=True)
300333
row.prop(prop, "name", text="")
301334
row.prop(prop, "string_value", text="")
302335
if (
@@ -836,7 +869,12 @@ def draw(self, context):
836869
return
837870

838871
layout.template_list(
839-
"BIM_UL_generic", "", scene_props, "presentation_layers", scene_props, "active_presentation_layer_index",
872+
"BIM_UL_generic",
873+
"",
874+
scene_props,
875+
"presentation_layers",
876+
scene_props,
877+
"active_presentation_layer_index",
840878
)
841879
if scene_props.active_presentation_layer_index < len(scene_props.presentation_layers):
842880
op = layout.row().operator("bim.assign_presentation_layer")

0 commit comments

Comments
 (0)