Fix expanding paths ignoring data-block libraries
authorCampbell Barton <ideasman42@gmail.com>
Thu, 3 Oct 2019 21:03:53 +0000 (07:03 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 3 Oct 2019 21:03:53 +0000 (07:03 +1000)
- Image views.
- Sequencer text strip font.
- Text check for modified/reload.
- Collada image export.
- Brush icons.

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

index bc682ffb8c84108f4edc38fa7d6f5cd9a857da51..332549c6b4707fec4ba75a5da6397e64948aa54f 100644 (file)
@@ -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);
index dbdaaaa5fc3aa03336ad3d9631715916fb626a1d..236fb43e89ce3e28bffea4b4db7b9c47785631b6 100644 (file)
@@ -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);
   }
index 4b01b6467dd2aa5ed809512ab51e741a055f42a5..5c050dde99014a525a4e2c230d9550a0b0f99ebd 100644 (file)
@@ -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;
index 71201c8a55cdf7e64be404db0c1991c893681d62..6e31e17fb26c3f386b595d6b2c028decd44dcb35 100644 (file)
@@ -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) {
index 3e001ef25b5a4c8428003ee659145cfb3fe31657..55fbd701a4765764d688b03c0f980fa6a9d75630 100644 (file)
@@ -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);