[Bf-blender-cvs] [fbc096cf075] master: Fix expanding paths ignoring data-block libraries

Campbell Barton noreply at git.blender.org
Thu Oct 3 23:04:25 CEST 2019


Commit: fbc096cf075b65981bfb766353b002686a847503
Author: Campbell Barton
Date:   Fri Oct 4 07:03:53 2019 +1000
Branches: master
https://developer.blender.org/rBfbc096cf075b65981bfb766353b002686a847503

Fix expanding paths ignoring data-block libraries

- Image views.
- Sequencer text strip font.
- Text check for modified/reload.
- Collada image export.
- Brush icons.

===================================================================

M	source/blender/blenkernel/intern/image.c
M	source/blender/blenkernel/intern/seqeffects.c
M	source/blender/blenkernel/intern/text.c
M	source/blender/collada/ImageExporter.cpp
M	source/blender/editors/render/render_preview.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list