UI: Different Warning for Revert if Unsaved Images

Change to the confirmation when reverting the current blend file to
include a specific warning if there are unsaved images.

Pull Request: https://projects.blender.org/blender/blender/pulls/121288
This commit is contained in:
Harley Acheson
2024-05-05 19:31:20 +02:00
committed by Harley Acheson
parent 18600e430c
commit 8735a8a6be

View File

@@ -3180,10 +3180,16 @@ void WM_OT_open_mainfile(wmOperatorType *ot)
static int wm_revert_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
std::string message = IFACE_("Any unsaved changes will be lost.");
if (ED_image_should_save_modified(CTX_data_main(C))) {
message += "\n";
message += IFACE_("Warning: There are unsaved external image(s).");
}
return WM_operator_confirm_ex(C,
op,
IFACE_("Revert to the Saved File"),
IFACE_("Any unsaved changes will be lost."),
message.c_str(),
IFACE_("Revert"),
ALERT_ICON_WARNING,
false);