Python API: path mapping options for library writing function

When "Relative Remap" option was added, the intention was only to remap
paths that were already relative. However it remapped all paths.

This was reported as T62612 and fixed recently,
however some Python script authors depended on the old behavior.

For users, it's reasonable to use the existing operators to make paths
absolute/relative. For scripts however it's useful to be able to write
out individual data-blocks with the ability to make all paths relative.

Now `bpy.data.libraries.write()` takes a path_remap argument which can
be `NONE/RELATIVE/RELATIVE_ALL/ABSOLUTE` allowing the script author to
choose how paths are handled when writing out data-blocks.

Addresses T77768.
This commit is contained in:
2020-06-18 15:25:22 +10:00
parent aab165b575
commit 3ada1949f8
10 changed files with 139 additions and 54 deletions

View File

@@ -500,7 +500,7 @@ void WM_exit_ex(bContext *C, const bool do_python)
has_edited = ED_editors_flush_edits(bmain);
if ((has_edited && BLO_write_file(bmain, filename, fileflags, NULL, NULL)) ||
if ((has_edited && BLO_write_file(bmain, filename, fileflags, NULL)) ||
(undo_memfile && BLO_memfile_write_file(undo_memfile, filename))) {
printf("Saved session recovery to '%s'\n", filename);
}