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:
Chun
2021-10-29 16:29:43 +08:00
committed by GitHub
parent b32bbb89a1
commit 0bae861b6a
4 changed files with 22 additions and 4 deletions
@@ -24,6 +24,7 @@ classes = (
operator.ColourByAttribute,
operator.ColourByClass,
operator.ColourByPset,
operator.IfcTypeFilterSelectingAction, #Add selecting/deselecting all operator
operator.ResetObjectColours,
operator.SelectAttribute,
operator.SelectGlobalId,
@@ -322,6 +322,19 @@ class ResetObjectColours(bpy.types.Operator):
obj.color = (1, 1, 1, 1)
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):
"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[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.name = name
new.total = total
@@ -358,4 +371,8 @@ class ActivateIfcTypeFilter(bpy.types.Operator):
"filter_classes",
context.scene.BIMSearchProperties,
"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"
@@ -50,7 +50,7 @@ def update_is_selected(self, context):
class BIMFilterClasses(PropertyGroup):
name: StringProperty(name="Name")
is_selected: BoolProperty(name="Is Selected", default=True, update=update_is_selected)
total: IntProperty(name="Total")
total: IntProperty(name="Total")
unselected_objects: CollectionProperty(type=ObjProperty, name="Unfiltered Objects")
@@ -78,8 +78,8 @@ class BIM_UL_ifctype_filter(bpy.types.UIList):
split = layout
split.use_property_split = True
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 = split.column()
split.scale_x = 0.5
split.prop(item, "total", text="", emboss=False)
split.label(text=str(item.total))