Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-18 21:11:14 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-18 21:11:14 +0300
commit9d318da4a7f250350c757c20fd25aa01d18130a6 (patch)
treecf032efd0132b9c17397a25062285e22bbc4dafb /source/blender/blenkernel/intern/blendfile.c
parent4925bb1ec3186f1884fe5dabe0f23fb0b3613e4b (diff)
parent1d05f0dc22e3fedfed3b1691eac3ece26a06a17b (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile.c')
-rw-r--r--source/blender/blenkernel/intern/blendfile.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index b7f134ed01b..5f716d191e4 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -663,10 +663,6 @@ bool BKE_blendfile_write_partial(
* (otherwise main->name will not be set at read time). */
BLI_strncpy(bmain_dst->name, bmain_src->name, sizeof(bmain_dst->name));
- if (write_flags & G_FILE_RELATIVE_REMAP) {
- path_list_backup = BKE_bpath_list_backup(bmain_src, path_list_flag);
- }
-
BLO_main_expander(blendfile_write_partial_cb);
BLO_expand_main(NULL, bmain_src);
@@ -686,10 +682,27 @@ bool BKE_blendfile_write_partial(
}
}
+ /* Backup paths because remap relative will overwrite them.
+ *
+ * NOTE: we do this only on the list of datablocks that we are writing
+ * because the restored full list is not guaranteed to be in the same
+ * order as before, as expected by BKE_bpath_list_restore.
+ *
+ * This happens because id_sort_by_name does not take into account
+ * string case or the library name, so the order is not strictly
+ * defined for two linked datablocks with the same name! */
+ if (write_flags & G_FILE_RELATIVE_REMAP) {
+ path_list_backup = BKE_bpath_list_backup(bmain_dst, path_list_flag);
+ }
/* save the buffer */
retval = BLO_write_file(bmain_dst, filepath, write_flags, reports, NULL);
+ if (path_list_backup) {
+ BKE_bpath_list_restore(bmain_dst, path_list_flag, path_list_backup);
+ BKE_bpath_list_free(path_list_backup);
+ }
+
/* move back the main, now sorted again */
set_listbasepointers(bmain_src, lbarray_dst);
a = set_listbasepointers(bmain_dst, lbarray_src);
@@ -705,11 +718,6 @@ bool BKE_blendfile_write_partial(
MEM_freeN(bmain_dst);
- if (path_list_backup) {
- BKE_bpath_list_restore(bmain_src, path_list_flag, path_list_backup);
- BKE_bpath_list_free(path_list_backup);
- }
-
return retval;
}