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/windowmanager/intern/wm_files_link.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_files_link.c') diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 1b60167be4f..cf6ecd55757 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -113,12 +113,13 @@ static bool wm_link_append_poll(bContext *C) static int wm_link_append_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { if (!RNA_struct_property_is_set(op->ptr, "filepath")) { + const char *blendfile_path = BKE_main_blendfile_path_from_global(); if (G.lib[0] != '\0') { RNA_string_set(op->ptr, "filepath", G.lib); } - else if (G.relbase_valid) { + else if (blendfile_path[0] != '\0') { char path[FILE_MAX]; - BLI_strncpy(path, BKE_main_blendfile_path_from_global(), sizeof(path)); + STRNCPY(path, blendfile_path); BLI_path_parent_dir(path); RNA_string_set(op->ptr, "filepath", path); } -- cgit v1.2.3