mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 11:18:01 +00:00
Fix #1436. Bug where saving is done twice in authoring mode.
This commit is contained in:
@@ -46,9 +46,6 @@ class IfcExporter:
|
|||||||
jsonData = ifcjson.IFC2JSON5a(self.file, self.ifc_export_settings.json_compact).spf2Json()
|
jsonData = ifcjson.IFC2JSON5a(self.file, self.ifc_export_settings.json_compact).spf2Json()
|
||||||
with open(self.ifc_export_settings.output_file, "w") as outfile:
|
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)
|
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):
|
def set_header(self):
|
||||||
# TODO: add all metadata, pending bug #747
|
# TODO: add all metadata, pending bug #747
|
||||||
|
|||||||
@@ -81,9 +81,7 @@ def loadIfcStore(scene):
|
|||||||
@persistent
|
@persistent
|
||||||
def ensureIfcExported(scene):
|
def ensureIfcExported(scene):
|
||||||
if IfcStore.get_file() and not bpy.context.scene.BIMProperties.ifc_file:
|
if IfcStore.get_file() and not bpy.context.scene.BIMProperties.ifc_file:
|
||||||
# The invocation pops up a file select window.
|
bpy.ops.export_ifc.bim("INVOKE_DEFAULT")
|
||||||
# This is non-blocking, therefore the Blend file is saved before we export.
|
|
||||||
bpy.ops.export_ifc.bim("INVOKE_DEFAULT", should_force_resave=True)
|
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ class ExportIFC(bpy.types.Operator):
|
|||||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
json_version: bpy.props.EnumProperty(items=[("4", "4", ""), ("5a", "5a", "")], name="IFC JSON Version")
|
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)
|
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):
|
def invoke(self, context, event):
|
||||||
if not self.filepath:
|
if not self.filepath:
|
||||||
@@ -104,8 +103,8 @@ class ExportIFC(bpy.types.Operator):
|
|||||||
new.name = output_file
|
new.name = output_file
|
||||||
if not bpy.context.scene.BIMProperties.ifc_file:
|
if not bpy.context.scene.BIMProperties.ifc_file:
|
||||||
bpy.context.scene.BIMProperties.ifc_file = output_file
|
bpy.context.scene.BIMProperties.ifc_file = output_file
|
||||||
if self.should_force_resave:
|
if bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath:
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath)
|
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user