Drop save-time parametric-edit confirm dialog

The dialog's only outcomes were "Apply & Save" (same as silent save)
or "Cancel" (same as not saving) — net friction with no actual choice.
Auto-commit stays as the safety net; the count now suffixes the
existing save-success report so it isn't immediately overwritten.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Gorgious56
2026-05-21 11:00:19 +02:00
committed by Thomas Krijnen
parent 74906ac9fe
commit 4df946be71
2 changed files with 7 additions and 45 deletions
@@ -1874,11 +1874,6 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
json_compact: bpy.props.BoolProperty(name="Export Compact IFCJSON", default=False)
should_save_as: bpy.props.BoolProperty(name="Should Save As", default=False, options={"HIDDEN"})
use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False)
confirm_parametric_edits: bpy.props.BoolProperty(
default=False,
options={"HIDDEN", "SKIP_SAVE"},
description="Internal: routes draw() to the parametric-commit confirm body instead of the file dialog.",
)
if TYPE_CHECKING:
filter_glob: str
@@ -1886,7 +1881,6 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
json_compact: bool
should_save_as: bool
use_relative_path: bool
confirm_parametric_edits: bool
@classmethod
def poll(cls, context):
@@ -1894,9 +1888,6 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
def draw(self, context):
layout = self.layout
if self.confirm_parametric_edits:
self._draw_parametric_confirm(layout)
return
layout.prop(self, "json_version")
layout.prop(self, "json_compact")
if bpy.data.is_saved:
@@ -1906,14 +1897,6 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
layout.label(text="Supported formats for export:")
layout.label(text=",".join(self.supported_filexts))
def _draw_parametric_confirm(self, layout: bpy.types.UILayout) -> None:
col = layout.column(align=True)
col.label(text="Saving will apply all parametric edits (stairs, walls, etc.).")
layout.separator()
box = layout.box()
col = box.column(align=True)
col.label(text="You can disable this prompt in Bonsai preferences", icon="INFO")
def invoke(self, context, event):
if not tool.Ifc.get():
bpy.ops.wm.save_mainfile("INVOKE_DEFAULT")
@@ -1924,17 +1907,7 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
filepath = props.ifc_file
if not filepath or self.should_save_as:
return ExportHelper.invoke(self, context, event)
# Set filepath before showing pending edits prompt :
self.filepath = str(tool.Blender.ensure_blender_path_is_abs(Path(filepath)))
prefs = tool.Blender.get_addon_preferences()
if prefs.prompt_auto_commit_parametric_edits and tool.Parametric.get_pending_edits():
self.confirm_parametric_edits = True
return context.window_manager.invoke_props_dialog(
self,
width=400,
title="Pending Parametric Edits",
confirm_text="Apply Edits & Save",
)
return self.execute(context)
def check(self, context):
@@ -1961,7 +1934,11 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
return {"FINISHED"}
def _execute(self, context):
_, failed_commits = tool.Parametric.commit_pending_edits()
committed, failed_commits = tool.Parametric.commit_pending_edits()
# Suffix is appended to the IFC save-success report below so the auto-commit
# info isn't immediately overwritten by the success message in Blender's
# status bar (only the latest self.report({"INFO"}, ...) sticks).
commit_suffix = f" (auto-committed {committed} pending parametric edit(s))" if committed else ""
if failed_commits:
names = ", ".join(o.name for o in failed_commits)
msg = f"Auto-commit failed for {len(failed_commits)} object(s): {names}"
@@ -2035,7 +2012,7 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
blendmetadata_path = output_file + suffix
self.report(
{"INFO"},
f'IFC Project "{os.path.basename(output_file)}" And Metadata File Saved to: {os.path.basename(blendmetadata_path)}',
f'IFC Project "{os.path.basename(output_file)}" And Metadata File Saved to: {os.path.basename(blendmetadata_path)}{commit_suffix}',
)
except Exception as e:
self.report({"ERROR"}, f"Failed to save blend metadata file: {e}")
@@ -2045,7 +2022,7 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
self.report(
{"INFO"},
f'IFC Project "{os.path.basename(output_file)}" {"" if not save_blend_file else "And Current Blend File Are"} Saved',
f'IFC Project "{os.path.basename(output_file)}" {"" if not save_blend_file else "And Current Blend File Are"} Saved{commit_suffix}',
)
bonsai.bim.handler.refresh_ui_data()
-15
View File
@@ -738,19 +738,6 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
should_disable_undo_on_save: BoolProperty(
name="Disable Undo When Saving (Faster saves, no undo for you!)", default=False
)
prompt_auto_commit_parametric_edits: BoolProperty(
name="Confirm Before Auto-Committing Parametric Edits on Save",
description=(
"When saving while a door/window/stair/railing/roof/wall edit is in progress, "
"show a confirmation dialog. Saving always commits the edit; this preference "
"only controls whether you are warned first. "
"Save As bypasses the prompt because the file picker is itself a dialog — "
"commits then happen silently. "
"Each committed edit is a separate undo step; saving with N edits in progress "
"produces N undo entries (one per commit) plus one for the save itself."
),
default=True,
)
should_stream: BoolProperty(name="Stream Data From IFC-SPF (Only for advanced users)", default=False)
occurrence_name_style: bpy.props.EnumProperty(
items=[("CLASS", "By Class", ""), ("TYPE", "By Type", ""), ("CUSTOM", "Custom", "")],
@@ -859,7 +846,6 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
bsdd_load_test_dictionaries: bool
bsdd_baseurl: str
should_disable_undo_on_save: bool
prompt_auto_commit_parametric_edits: bool
should_stream: bool
occurrence_name_style: Literal["CLASS", "TYPE", "CUSTOM"]
occurrence_name_function: str
@@ -1065,7 +1051,6 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
def draw_other_settings(self, layout: bpy.types.UILayout, context: bpy.types.Context) -> None:
layout.prop(self, "opening_focus_opacity")
layout.prop(self, "should_disable_undo_on_save")
layout.prop(self, "prompt_auto_commit_parametric_edits")
layout.prop(self, "should_stream")
layout.label(text="bSDD:")
layout.prop(self, "bsdd_load_preview_dictionaries")