Fix #4236. Consolidate revert, reload IFC, and reload selected IFC operations.

Reload IFC incrementally (via diff) is moved to the debug panel since it is a dangerous advanced user command.
This commit is contained in:
Dion Moult
2024-01-20 13:15:59 +11:00
parent ff3c7786f6
commit 25573cd0e0
5 changed files with 11 additions and 28 deletions
+7 -8
View File
@@ -96,23 +96,22 @@ for name in modules.keys():
classes = [
operator.AddIfcFile,
operator.BIM_OT_add_section_plane,
operator.BIM_OT_open_webbrowser,
operator.BIM_OT_remove_section_plane,
operator.BIM_OT_show_description,
operator.EditBlenderCollection,
operator.FileAssociate,
operator.FileUnassociate,
operator.OpenUpstream,
operator.OpenUri,
operator.SwitchTab,
operator.SetTab,
operator.ReloadIfcFile,
operator.RemoveIfcFile,
operator.SelectDataDir,
operator.SelectIfcFile,
operator.ReloadSelectedIfcFile,
operator.SelectSchemaDir,
operator.FileAssociate,
operator.FileUnassociate,
operator.SelectURIAttribute,
operator.EditBlenderCollection,
operator.BIM_OT_open_webbrowser,
operator.BIM_OT_show_description,
operator.SetTab,
operator.SwitchTab,
prop.StrProperty,
operator.BIM_OT_enum_property_search, # /!\ Register AFTER prop.StrProperty
prop.ObjProperty,
@@ -37,7 +37,6 @@ class BIM_PT_debug(Panel):
row = self.layout.row(align=True)
row.prop(context.scene.BIMProperties, "ifc_file", text="")
row.operator("bim.validate_ifc_file", icon="CHECKMARK", text="")
row.operator("bim.reload_selected_ifc_file", icon="FILE_REFRESH", text="")
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
row = self.layout.row(align=True)
@@ -45,6 +44,9 @@ class BIM_PT_debug(Panel):
row.operator("bim.parse_express", icon="IMPORT", text="")
row.operator("bim.select_express_file", icon="FILE_FOLDER", text="")
row = layout.row()
row.operator("bim.reload_ifc_file", text="Incrementally Reload Changes")
row = layout.row()
row.operator("bim.print_ifc_file")
@@ -683,7 +683,7 @@ class RevertProject(bpy.types.Operator, IFCFileSelector):
bl_idname = "bim.revert_project"
bl_label = "Revert IFC Project"
bl_options = {"REGISTER", "UNDO"}
bl_description = "Reload currently opened IFC project discarding all unsaved changes"
bl_description = "Revert to a fresh session discarding all unsaved changes"
@classmethod
def poll(cls, context):
@@ -211,7 +211,6 @@ class BIM_PT_project(Panel):
row = self.layout.row(align=True)
row.prop(props, "ifc_file", text="")
row.operator("bim.reload_ifc_file", icon="FILE_REFRESH", text="")
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
row.operator("bim.unload_project", text="", icon="CANCEL")
else:
-17
View File
@@ -142,23 +142,6 @@ class SelectIfcFile(bpy.types.Operator, IFCFileSelector):
return {"RUNNING_MODAL"}
class ReloadSelectedIfcFile(bpy.types.Operator):
bl_idname = "bim.reload_selected_ifc_file"
bl_label = "Reload selected IFC File"
bl_options = {"REGISTER", "UNDO"}
bl_description = "Reload currently selected IFC file"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
filepath = context.scene.BIMProperties.ifc_file
valid_file = os.path.exists(filepath) and "ifc" in os.path.splitext(filepath)[1].lower()
if not valid_file:
self.report({"ERROR"}, f"Couldn't find .ifc file by the path '{filepath}'")
return {"CANCELLED"}
context.scene.BIMProperties.ifc_file = context.scene.BIMProperties.ifc_file
return {"FINISHED"}
class SelectDataDir(bpy.types.Operator):
bl_idname = "bim.select_data_dir"
bl_label = "Select Data Directory"