mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +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
|
@staticmethod
|
||||||
def execute_ifc_operator(operator, context, is_invoke=False):
|
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)
|
is_top_level_operator = not bool(IfcStore.current_transaction)
|
||||||
|
|
||||||
if is_top_level_operator:
|
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)
|
save_blend_file = bool(bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath)
|
||||||
if save_blend_file:
|
if save_blend_file:
|
||||||
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
|
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
|
||||||
|
bpy.context.scene.BIMProperties.is_dirty = False
|
||||||
blenderbim.bim.handler.refresh_ui_data()
|
blenderbim.bim.handler.refresh_ui_data()
|
||||||
self.report(
|
self.report(
|
||||||
{"INFO"},
|
{"INFO"},
|
||||||
|
|||||||
@@ -206,7 +206,10 @@ class BIM_PT_project(Panel):
|
|||||||
|
|
||||||
if props.ifc_file:
|
if props.ifc_file:
|
||||||
row = self.layout.row(align=True)
|
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.label(text=ProjectData.data["last_saved"])
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ class BIMTabProperties(PropertyGroup):
|
|||||||
|
|
||||||
|
|
||||||
class BIMProperties(PropertyGroup):
|
class BIMProperties(PropertyGroup):
|
||||||
|
is_dirty: BoolProperty(name="Is Dirty", default=False)
|
||||||
schema_dir: StringProperty(
|
schema_dir: StringProperty(
|
||||||
default=os.path.join(cwd, "schema") + os.path.sep, name="Schema Directory", update=update_schema_dir
|
default=os.path.join(cwd, "schema") + os.path.sep, name="Schema Directory", update=update_schema_dir
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user