Fix #2719. Indicator whether or not IFC is dirty to help users know when to save.

This commit is contained in:
Dion Moult
2024-01-23 16:29:42 +11:00
parent 266236ee49
commit ec79d61095
4 changed files with 7 additions and 1 deletions
+1
View File
@@ -321,6 +321,7 @@ class IfcStore:
@staticmethod
def execute_ifc_operator(operator, context, is_invoke=False):
bpy.context.scene.BIMProperties.is_dirty = True
is_top_level_operator = not bool(IfcStore.current_transaction)
if is_top_level_operator:
@@ -1105,6 +1105,7 @@ class ExportIFC(bpy.types.Operator):
save_blend_file = bool(bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath)
if save_blend_file:
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
bpy.context.scene.BIMProperties.is_dirty = False
blenderbim.bim.handler.refresh_ui_data()
self.report(
{"INFO"},
@@ -206,7 +206,10 @@ class BIM_PT_project(Panel):
if props.ifc_file:
row = self.layout.row(align=True)
row.label(text="Saved", icon="EXPORT")
if context.scene.BIMProperties.is_dirty:
row.label(text="Saved*", icon="EXPORT")
else:
row.label(text="Saved", icon="EXPORT")
row.label(text=ProjectData.data["last_saved"])
row = self.layout.row(align=True)
+1
View File
@@ -351,6 +351,7 @@ class BIMTabProperties(PropertyGroup):
class BIMProperties(PropertyGroup):
is_dirty: BoolProperty(name="Is Dirty", default=False)
schema_dir: StringProperty(
default=os.path.join(cwd, "schema") + os.path.sep, name="Schema Directory", update=update_schema_dir
)