Writefile: move file flags to BlendFileWriteParams
This removes G_FILE_HISTORY, G_FILE_SAVE_COPY & G_FILE_USERPREFS. Using file-flags made logic harder to follow since it's not so clear which flags are expected to be in G.fileflags & which are meant to be set and passed as arguments, these are shared between read & write functions too. Add BlendFileWriteParams so options which don't need to be stored aren't mixed up with flags that are stored for reuse.
This commit is contained in:
@@ -35,25 +35,30 @@ struct ReportList;
|
||||
*/
|
||||
typedef enum eBLO_WritePathRemap {
|
||||
/** No path manipulation. */
|
||||
BLO_WRITE_PATH_REMAP_NONE = 1,
|
||||
BLO_WRITE_PATH_REMAP_NONE = 0,
|
||||
/** Remap existing relative paths (default). */
|
||||
BLO_WRITE_PATH_REMAP_RELATIVE = 2,
|
||||
BLO_WRITE_PATH_REMAP_RELATIVE = 1,
|
||||
/** Remap paths making all paths relative to the new location. */
|
||||
BLO_WRITE_PATH_REMAP_RELATIVE_ALL = 3,
|
||||
BLO_WRITE_PATH_REMAP_RELATIVE_ALL = 2,
|
||||
/** Make all paths absolute. */
|
||||
BLO_WRITE_PATH_REMAP_ABSOLUTE = 4,
|
||||
BLO_WRITE_PATH_REMAP_ABSOLUTE = 3,
|
||||
} 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);
|
||||
/** Similar to #BlendFileReadParams. */
|
||||
struct BlendFileWriteParams {
|
||||
eBLO_WritePathRemap remap_mode;
|
||||
/** Save `.blend1`, `.blend2`... etc. */
|
||||
uint use_save_versions : 1;
|
||||
/** On write, restore paths after editing them (see #BLO_WRITE_PATH_REMAP_RELATIVE). */
|
||||
uint use_save_as_copy : 1;
|
||||
uint use_userdef : 1;
|
||||
const struct BlendThumbnail *thumb;
|
||||
};
|
||||
|
||||
extern bool BLO_write_file(struct Main *mainvar,
|
||||
const char *filepath,
|
||||
const int write_flags,
|
||||
const struct BlendFileWriteParams *params,
|
||||
struct ReportList *reports);
|
||||
|
||||
extern bool BLO_write_file_mem(struct Main *mainvar,
|
||||
|
||||
Reference in New Issue
Block a user