From fbc096cf075b65981bfb766353b002686a847503 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 4 Oct 2019 07:03:53 +1000 Subject: Fix expanding paths ignoring data-block libraries - Image views. - Sequencer text strip font. - Text check for modified/reload. - Collada image export. - Brush icons. --- source/blender/blenkernel/intern/image.c | 4 ++-- source/blender/blenkernel/intern/seqeffects.c | 2 +- source/blender/blenkernel/intern/text.c | 6 +++--- source/blender/collada/ImageExporter.cpp | 2 +- source/blender/editors/render/render_preview.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index bc682ffb8c8..332549c6b47 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -569,7 +569,7 @@ Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exist char str[FILE_MAX], strtest[FILE_MAX]; STRNCPY(str, filepath); - BLI_path_abs(str, BKE_main_blendfile_path_from_global()); + BLI_path_abs(str, bmain->name); /* first search an identical filepath */ for (ima = bmain->images.first; ima; ima = ima->id.next) { @@ -5310,7 +5310,7 @@ static void image_update_views_format(Image *ima, ImageUser *iuser) char str[FILE_MAX]; STRNCPY(str, iv->filepath); - BLI_path_abs(str, BKE_main_blendfile_path_from_global()); + BLI_path_abs(str, ID_BLEND_PATH_FROM_GLOBAL(&ima->id)); /* exists? */ file = BLI_open(str, O_BINARY | O_RDONLY, 0); diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index dbdaaaa5fc3..236fb43e89c 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -3822,7 +3822,7 @@ void BKE_sequencer_text_font_load(TextVars *data, const bool do_id_user) char path[FILE_MAX]; STRNCPY(path, data->text_font->name); BLI_assert(BLI_thread_is_main()); - BLI_path_abs(path, BKE_main_blendfile_path_from_global()); + BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&data->text_font->id)); data->text_blf_id = BLF_load(path); } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 4b01b6467dd..5c050dde990 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -312,7 +312,7 @@ bool BKE_text_reload(Text *text) } BLI_strncpy(filepath_abs, text->name, FILE_MAX); - BLI_path_abs(filepath_abs, BKE_main_blendfile_path_from_global()); + BLI_path_abs(filepath_abs, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len); if (buffer == NULL) { @@ -477,7 +477,7 @@ int BKE_text_file_modified_check(Text *text) } BLI_strncpy(file, text->name, FILE_MAX); - BLI_path_abs(file, BKE_main_blendfile_path_from_global()); + BLI_path_abs(file, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); if (!BLI_exists(file)) { return 2; @@ -511,7 +511,7 @@ void BKE_text_file_modified_ignore(Text *text) } BLI_strncpy(file, text->name, FILE_MAX); - BLI_path_abs(file, BKE_main_blendfile_path_from_global()); + BLI_path_abs(file, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); if (!BLI_exists(file)) { return; diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 71201c8a55c..6e31e17fb26 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -107,7 +107,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) /* make absolute source path */ BLI_strncpy(source_path, image->name, sizeof(source_path)); - BLI_path_abs(source_path, BKE_main_blendfile_path_from_global()); + BLI_path_abs(source_path, ID_BLEND_PATH_FROM_GLOBAL(&image->id)); BLI_cleanup_path(NULL, source_path); if (use_copies) { diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 3e001ef25b5..55fbd701a47 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -115,7 +115,7 @@ ImBuf *get_brush_icon(Brush *brush) // first use the path directly to try and load the file BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath)); - BLI_path_abs(path, BKE_main_blendfile_path_from_global()); + BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&brush->id)); /* use default colorspaces for brushes */ brush->icon_imbuf = IMB_loadiffname(path, flags, NULL); -- cgit v1.2.3