mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix #2719. Indicator whether or not IFC is dirty to help users know when to save.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user