From 5de109cc2d220ca3bd731216b9cd521269ad663e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 Dec 2021 11:38:10 +1100 Subject: Remove G.relbase_valid In almost all cases there is no difference between `G.relbase_valid` and checking `G.main->filepath` isn't an empty string. In many places a non-empty string is already being used instead of `G.relbase_valid`. The only situation where this was needed was when saving from `wm_file_write` where they temporarily became out of sync. This has been replaced by adding a new member to `BlendFileWriteParams` to account for saving an unsaved file for the first time. Reviewed By: brecht Ref D13564 --- source/blender/editors/space_info/info_ops.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_info/info_ops.c') diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 8e37e5fe9a8..2a797fd1a78 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -408,13 +408,14 @@ void FILE_OT_unpack_item(wmOperatorType *ot) static int make_paths_relative_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); + const char *blendfile_path = BKE_main_blendfile_path(bmain); - if (!G.relbase_valid) { + if (blendfile_path[0] == '\0') { BKE_report(op->reports, RPT_WARNING, "Cannot set relative paths with an unsaved blend file"); return OPERATOR_CANCELLED; } - BKE_bpath_relative_convert(bmain, BKE_main_blendfile_path(bmain), op->reports); + BKE_bpath_relative_convert(bmain, blendfile_path, op->reports); /* redraw everything so any changed paths register */ WM_main_add_notifier(NC_WINDOW, NULL); @@ -445,13 +446,14 @@ void FILE_OT_make_paths_relative(wmOperatorType *ot) static int make_paths_absolute_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); + const char *blendfile_path = BKE_main_blendfile_path(bmain); - if (!G.relbase_valid) { + if (blendfile_path[0] == '\0') { BKE_report(op->reports, RPT_WARNING, "Cannot set absolute paths with an unsaved blend file"); return OPERATOR_CANCELLED; } - BKE_bpath_absolute_convert(bmain, BKE_main_blendfile_path(bmain), op->reports); + BKE_bpath_absolute_convert(bmain, blendfile_path, op->reports); /* redraw everything so any changed paths register */ WM_main_add_notifier(NC_WINDOW, NULL); -- cgit v1.2.3