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:
authorCampbell Barton <ideasman42@gmail.com>2020-06-18 08:25:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-18 08:49:10 +0300
commit3ada1949f8633293b4a424bf20789d94cf924c43 (patch)
treec996f2c6a612922e3eeee5822864bb2fbb716dc1 /source/blender/blenloader/BLO_writefile.h
parentaab165b575ce312675e543f519c962cbf9939d34 (diff)
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.
Diffstat (limited to 'source/blender/blenloader/BLO_writefile.h')
-rw-r--r--source/blender/blenloader/BLO_writefile.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h
index d83abf7f9ed..18783474392 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -30,11 +30,32 @@ struct Main;
struct MemFile;
struct ReportList;
+/**
+ * Adjust paths when saving (kept unless #G_FILE_SAVE_COPY is set).
+ */
+typedef enum eBLO_WritePathRemap {
+ /** No path manipulation. */
+ BLO_WRITE_PATH_REMAP_NONE = 1,
+ /** Remap existing relative paths (default). */
+ BLO_WRITE_PATH_REMAP_RELATIVE = 2,
+ /** Remap paths making all paths relative to the new location. */
+ BLO_WRITE_PATH_REMAP_RELATIVE_ALL = 3,
+ /** Make all paths absolute. */
+ BLO_WRITE_PATH_REMAP_ABSOLUTE = 4,
+} eBLO_WritePathRemap;
+
+extern bool BLO_write_file_ex(struct Main *mainvar,
+ const char *filepath,
+ const int write_flags,
+ struct ReportList *reports,
+ /* Extra arguments. */
+ eBLO_WritePathRemap remap_mode,
+ const struct BlendThumbnail *thumb);
extern bool BLO_write_file(struct Main *mainvar,
const char *filepath,
- int write_flags,
- struct ReportList *reports,
- const struct BlendThumbnail *thumb);
+ const int write_flags,
+ struct ReportList *reports);
+
extern bool BLO_write_file_mem(struct Main *mainvar,
struct MemFile *compare,
struct MemFile *current,