mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 22:12:32 +00:00
IfcType Filter suggestions for better User Experience (#1840)
* 1.Added Selecting/Deselecting All function 2.Suggested an idea for UI improvment 3.Fixed an UX bug * Improve the user experience of IfcType Filter
This commit is contained in:
@@ -24,6 +24,7 @@ classes = (
|
|||||||
operator.ColourByAttribute,
|
operator.ColourByAttribute,
|
||||||
operator.ColourByClass,
|
operator.ColourByClass,
|
||||||
operator.ColourByPset,
|
operator.ColourByPset,
|
||||||
|
operator.IfcTypeFilterSelectingAction, #Add selecting/deselecting all operator
|
||||||
operator.ResetObjectColours,
|
operator.ResetObjectColours,
|
||||||
operator.SelectAttribute,
|
operator.SelectAttribute,
|
||||||
operator.SelectGlobalId,
|
operator.SelectGlobalId,
|
||||||
|
|||||||
@@ -322,6 +322,19 @@ class ResetObjectColours(bpy.types.Operator):
|
|||||||
obj.color = (1, 1, 1, 1)
|
obj.color = (1, 1, 1, 1)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
class IfcTypeFilterSelectingAction(bpy.types.Operator):
|
||||||
|
"Click to select/deselect all ifctype"
|
||||||
|
bl_idname = "bim.ifctype_filter_selecting_action"
|
||||||
|
bl_label = "IfcType Filter Selecting Action"
|
||||||
|
selecting_action: bpy.props.EnumProperty(items=( ("SELECT",'Select',"") , ("DESELECT","Deselect","") ))
|
||||||
|
def execute(self, context):
|
||||||
|
if self.selecting_action == "SELECT":
|
||||||
|
self.selecting_actionbool = True
|
||||||
|
else:
|
||||||
|
self.selecting_actionbool = False
|
||||||
|
for ifcelement in bpy.context.scene.BIMSearchProperties.filter_classes:
|
||||||
|
ifcelement.is_selected = self.selecting_actionbool
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
class ActivateIfcTypeFilter(bpy.types.Operator):
|
class ActivateIfcTypeFilter(bpy.types.Operator):
|
||||||
"It helps you to filter your selection by IFC class"
|
"It helps you to filter your selection by IFC class"
|
||||||
@@ -339,7 +352,7 @@ class ActivateIfcTypeFilter(bpy.types.Operator):
|
|||||||
ifc_types.setdefault(element.is_a(), 0)
|
ifc_types.setdefault(element.is_a(), 0)
|
||||||
ifc_types[element.is_a()] += 1
|
ifc_types[element.is_a()] += 1
|
||||||
|
|
||||||
for name, total in ifc_types.items():
|
for name, total in dict(sorted(ifc_types.items())).items():
|
||||||
new = context.scene.BIMSearchProperties.filter_classes.add()
|
new = context.scene.BIMSearchProperties.filter_classes.add()
|
||||||
new.name = name
|
new.name = name
|
||||||
new.total = total
|
new.total = total
|
||||||
@@ -358,4 +371,8 @@ class ActivateIfcTypeFilter(bpy.types.Operator):
|
|||||||
"filter_classes",
|
"filter_classes",
|
||||||
context.scene.BIMSearchProperties,
|
context.scene.BIMSearchProperties,
|
||||||
"filter_classes_index",
|
"filter_classes_index",
|
||||||
|
rows = 20 if len(bpy.context.scene.BIMSearchProperties.filter_classes) > 20 else len(bpy.context.scene.BIMSearchProperties.filter_classes),
|
||||||
)
|
)
|
||||||
|
row = self.layout.row()
|
||||||
|
row.operator(IfcTypeFilterSelectingAction.bl_idname, text = "Select All").selecting_action = "SELECT"
|
||||||
|
row.operator(IfcTypeFilterSelectingAction.bl_idname, text = "Deselect All").selecting_action = "DESELECT"
|
||||||
@@ -78,8 +78,8 @@ class BIM_UL_ifctype_filter(bpy.types.UIList):
|
|||||||
split = layout
|
split = layout
|
||||||
split.use_property_split = True
|
split.use_property_split = True
|
||||||
split.use_property_decorate = False
|
split.use_property_decorate = False
|
||||||
split.prop(item, "is_selected", text="", icon="ADD" if item.is_selected else "REMOVE")
|
split.prop(item, "is_selected", text="", icon="CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT")
|
||||||
split.prop(item, "name", text="", emboss=False, slider=True)
|
split.prop(item, "name", text="", emboss=False, slider=True)
|
||||||
split = split.column()
|
split = split.column()
|
||||||
split.scale_x = 0.5
|
split.scale_x = 0.5
|
||||||
split.prop(item, "total", text="", emboss=False)
|
split.label(text=str(item.total))
|
||||||
Reference in New Issue
Block a user