Visual clean up of bulk property editing UI

This commit is contained in:
Dion Moult
2022-01-07 14:57:50 +11:00
parent 84096529e1
commit eb04a7d579
5 changed files with 58 additions and 60 deletions
@@ -377,7 +377,7 @@ class CopyPropertyToSelection(bpy.types.Operator, Operator):
class BIM_OT_add_property_to_edit(bpy.types.Operator): class BIM_OT_add_property_to_edit(bpy.types.Operator):
bl_label = "Add new row" bl_label = "Add Edit Rule"
bl_idname = "bim.add_property_to_edit" bl_idname = "bim.add_property_to_edit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
option: bpy.props.StringProperty() option: bpy.props.StringProperty()
+46 -48
View File
@@ -379,18 +379,19 @@ class BIM_PT_work_schedule_psets(Panel):
class BIM_PT_bulk_property_editor(Panel): class BIM_PT_bulk_property_editor(Panel):
bl_label = "IFC Bulk Property Editor" bl_label = "IFC Bulk Property Editor"
bl_space_type = 'PROPERTIES' bl_space_type = "PROPERTIES"
bl_region_type = 'WINDOW' bl_region_type = "WINDOW"
bl_context = "object" bl_context = "object"
bl_options = {"DEFAULT_CLOSED"}
def draw(self, context): def draw(self, context):
pass pass
class BIM_PT_rename_parameters(Panel): class BIM_PT_rename_parameters(Panel):
bl_label = "Rename all building elements" bl_label = "Bulk Rename Properties"
bl_space_type = 'PROPERTIES' bl_space_type = "PROPERTIES"
bl_region_type = 'WINDOW' bl_region_type = "WINDOW"
bl_context = "object" bl_context = "object"
bl_parent_id = "BIM_PT_bulk_property_editor" bl_parent_id = "BIM_PT_bulk_property_editor"
bl_options = {"DEFAULT_CLOSED"} bl_options = {"DEFAULT_CLOSED"}
@@ -400,32 +401,31 @@ class BIM_PT_rename_parameters(Panel):
layout = self.layout layout = self.layout
props = context.scene.RenameProperties props = context.scene.RenameProperties
if props:
for index, prop in enumerate(props):
row = layout.row()
row.prop(prop, "pset_name", text="")
row.prop(prop, "existing_property_name", text="")
row.prop(prop, "new_property_name", text="")
op = row.operator("bim.remove_property_to_edit",icon="PANEL_CLOSE", text="")
op.index = index
op.option = "RenameProperties"
row = layout.row() row = layout.row()
row.label() op = row.operator("bim.add_property_to_edit", icon="ADD")
op = row.operator("bim.add_property_to_edit", icon="ADD",text="")
op.option = "RenameProperties" op.option = "RenameProperties"
if props: if props:
row = layout.row() for index, prop in enumerate(props):
clear = row.operator("bim.clear_list") row = layout.row(align=True)
row.prop(prop, "pset_name", text="")
row.prop(prop, "existing_property_name", text="")
row.prop(prop, "new_property_name", text="")
op = row.operator("bim.remove_property_to_edit", icon="X", text="")
op.index = index
op.option = "RenameProperties"
if props:
row = layout.row(align=True)
row.operator("bim.rename_parameters", icon="CHECKMARK")
clear = row.operator("bim.clear_list", icon="CANCEL", text="")
clear.option = "RenameProperties" clear.option = "RenameProperties"
row.operator("bim.rename_parameters")
class BIM_PT_add_edit_custom_properties(Panel): class BIM_PT_add_edit_custom_properties(Panel):
bl_label = "Add/Edit Custom Properties and Values (to selected objects)" bl_label = "Bulk Add / Edit Custom Properties"
bl_space_type = 'PROPERTIES' bl_space_type = "PROPERTIES"
bl_region_type = 'WINDOW' bl_region_type = "WINDOW"
bl_context = "object" bl_context = "object"
bl_parent_id = "BIM_PT_bulk_property_editor" bl_parent_id = "BIM_PT_bulk_property_editor"
bl_options = {"DEFAULT_CLOSED"} bl_options = {"DEFAULT_CLOSED"}
@@ -435,33 +435,32 @@ class BIM_PT_add_edit_custom_properties(Panel):
layout = self.layout layout = self.layout
props = context.scene.AddEditProperties props = context.scene.AddEditProperties
row = layout.row()
op = row.operator("bim.add_property_to_edit", icon="ADD")
op.option = "AddEditProperties"
if props: if props:
for index, prop in enumerate(props): for index, prop in enumerate(props):
row = layout.row() row = layout.row(align=True)
row.prop(prop, "pset_name", text="") row.prop(prop, "pset_name", text="")
row.prop(prop, "property_name", text="") row.prop(prop, "property_name", text="")
row.prop(prop, prop.get_value_name(), text="") row.prop(prop, prop.get_value_name(), text="")
row.prop(prop, "primary_measure_type", text="") row.prop(prop, "primary_measure_type", text="")
op = row.operator("bim.remove_property_to_edit",icon="PANEL_CLOSE", text="") op = row.operator("bim.remove_property_to_edit", icon="X", text="")
op.index = index op.index = index
op.option = "AddEditProperties" op.option = "AddEditProperties"
row = layout.row()
row.label()
op = row.operator("bim.add_property_to_edit", icon="ADD",text="")
op.option = "AddEditProperties"
if props: if props:
row = layout.row() row = layout.row(align=True)
clear = row.operator("bim.clear_list") op = row.operator("bim.add_edit_custom_property", icon="CHECKMARK", text="Apply Changes")
clear = row.operator("bim.clear_list", icon="CANCEL", text="")
clear.option = "AddEditProperties" clear.option = "AddEditProperties"
op = row.operator("bim.add_edit_custom_property",icon="ADD", text="Apply Changes")
class BIM_PT_delete_psets(Panel): class BIM_PT_delete_psets(Panel):
bl_label = "Bulk remove psets from selected objects" bl_label = "Bulk Remove Psets"
bl_space_type = 'PROPERTIES' bl_space_type = "PROPERTIES"
bl_region_type = 'WINDOW' bl_region_type = "WINDOW"
bl_context = "object" bl_context = "object"
bl_parent_id = "BIM_PT_bulk_property_editor" bl_parent_id = "BIM_PT_bulk_property_editor"
bl_options = {"DEFAULT_CLOSED"} bl_options = {"DEFAULT_CLOSED"}
@@ -470,22 +469,21 @@ class BIM_PT_delete_psets(Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
props = context.scene.DeletePsets props = context.scene.DeletePsets
row = layout.row()
op = row.operator("bim.add_property_to_edit", icon="ADD")
op.option = "DeletePsets"
if props: if props:
for index, prop in enumerate(props): for index, prop in enumerate(props):
row = layout.row() row = layout.row(align=True)
row.prop(prop, "pset_name", text="Pset") row.prop(prop, "pset_name", text="")
op = row.operator("bim.remove_property_to_edit",icon="PANEL_CLOSE", text="") op = row.operator("bim.remove_property_to_edit", icon="X", text="")
op.index = index op.index = index
op.option = "DeletePsets" op.option = "DeletePsets"
row = layout.row(align=True)
row.label()
op = row.operator("bim.add_property_to_edit", icon="ADD",text="")
op.option = "DeletePsets"
if props: if props:
row = layout.row() row = layout.row(align=True)
clear = row.operator("bim.clear_list") op = row.operator("bim.bulk_remove_psets", icon="CHECKMARK", text="Apply Changes")
clear = row.operator("bim.clear_list", icon="CANCEL", text="")
clear.option = "DeletePsets" clear.option = "DeletePsets"
op = row.operator("bim.bulk_remove_psets", text="Apply Changes")
@@ -46,6 +46,7 @@ def update_is_class_selected(self, context):
new = self.unselected_objects.add() new = self.unselected_objects.add()
new.obj = obj new.obj = obj
def update_is_level_selected(self, context): def update_is_level_selected(self, context):
if self.is_selected: if self.is_selected:
for obj in self.unselected_objects: for obj in self.unselected_objects:
@@ -59,6 +60,7 @@ def update_is_level_selected(self, context):
new = self.unselected_objects.add() new = self.unselected_objects.add()
new.obj = obj new.obj = obj
class BIMFilterClasses(PropertyGroup): class BIMFilterClasses(PropertyGroup):
name: StringProperty(name="Name") name: StringProperty(name="Name")
is_selected: BoolProperty(name="Is Selected", default=True, update=update_is_class_selected) is_selected: BoolProperty(name="Is Selected", default=True, update=update_is_class_selected)
@@ -320,9 +320,7 @@ class AssignStructuralAnalysisModel(bpy.types.Operator, Operator):
def _execute(self, context): def _execute(self, context):
core.assign_structural_analysis_model( core.assign_structural_analysis_model(
tool.Ifc, tool.Structural, tool.Ifc, tool.Structural, product=self.product, structural_analysis_model=self.structural_analysis_model
product=self.product,
structural_analysis_model=self.structural_analysis_model
) )
@@ -335,9 +333,7 @@ class UnassignStructuralAnalysisModel(bpy.types.Operator, Operator):
def _execute(self, context): def _execute(self, context):
core.unassign_structural_analysis_model( core.unassign_structural_analysis_model(
tool.Ifc, tool.Structural, tool.Ifc, tool.Structural, product=self.product, structural_analysis_model=self.structural_analysis_model
product=self.product,
structural_analysis_model=self.structural_analysis_model
) )
@@ -36,11 +36,13 @@ class TypeData:
# These two are loaded discretely because relating_types depends on relating_type_classes # These two are loaded discretely because relating_types depends on relating_type_classes
cls.data["relating_type_classes"] = cls.relating_type_classes() cls.data["relating_type_classes"] = cls.relating_type_classes()
cls.data["relating_types"] = cls.relating_types() cls.data["relating_types"] = cls.relating_types()
cls.data.update({ cls.data.update(
"is_product": cls.is_product(), {
"total_instances": cls.total_instances(), "is_product": cls.is_product(),
"type_name": cls.type_name(), "total_instances": cls.total_instances(),
}) "type_name": cls.type_name(),
}
)
@classmethod @classmethod
def relating_type_classes(cls): def relating_type_classes(cls):