Fix #1436. Bug where saving is done twice in authoring mode.

This commit is contained in:
Dion Moult
2021-04-17 20:18:01 +10:00
parent 3e1eb9648f
commit f5d27621e7
3 changed files with 3 additions and 9 deletions
@@ -46,9 +46,6 @@ class IfcExporter:
jsonData = ifcjson.IFC2JSON5a(self.file, self.ifc_export_settings.json_compact).spf2Json()
with open(self.ifc_export_settings.output_file, "w") as outfile:
json.dump(jsonData, outfile, indent=None if self.ifc_export_settings.json_compact else 4)
if bpy.context.scene.BIMProjectProperties.is_authoring:
if bpy.data.filepath:
bpy.ops.wm.save_mainfile()
def set_header(self):
# TODO: add all metadata, pending bug #747
+1 -3
View File
@@ -81,9 +81,7 @@ def loadIfcStore(scene):
@persistent
def ensureIfcExported(scene):
if IfcStore.get_file() and not bpy.context.scene.BIMProperties.ifc_file:
# The invocation pops up a file select window.
# This is non-blocking, therefore the Blend file is saved before we export.
bpy.ops.export_ifc.bim("INVOKE_DEFAULT", should_force_resave=True)
bpy.ops.export_ifc.bim("INVOKE_DEFAULT")
@persistent
+2 -3
View File
@@ -67,7 +67,6 @@ class ExportIFC(bpy.types.Operator):
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
json_version: bpy.props.EnumProperty(items=[("4", "4", ""), ("5a", "5a", "")], name="IFC JSON Version")
json_compact: bpy.props.BoolProperty(name="Export Compact IFCJSON", default=False)
should_force_resave: bpy.props.BoolProperty(name="Resave .blend", default=False)
def invoke(self, context, event):
if not self.filepath:
@@ -104,8 +103,8 @@ class ExportIFC(bpy.types.Operator):
new.name = output_file
if not bpy.context.scene.BIMProperties.ifc_file:
bpy.context.scene.BIMProperties.ifc_file = output_file
if self.should_force_resave:
bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath)
if bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath:
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
return {"FINISHED"}