diff options
Diffstat (limited to 'source/blender/blenloader/intern/readfile.h')
-rw-r--r-- | source/blender/blenloader/intern/readfile.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index fb307f6bde3..4965845d167 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -30,6 +30,8 @@ #include "DNA_space_types.h" #include "DNA_windowmanager_types.h" /* for ReportType */ +struct IDNameLib_Map; +struct GSet; struct Key; struct MemFile; struct Object; @@ -38,6 +40,8 @@ struct PartEff; struct ReportList; struct View3D; +typedef struct IDNameLib_Map IDNameLib_Map; + enum eFileDataFlag { FD_FLAGS_SWITCH_ENDIAN = 1 << 0, FD_FLAGS_FILE_POINTSIZE_IS_4 = 1 << 1, @@ -57,7 +61,10 @@ enum eFileDataFlag { typedef int64_t off64_t; #endif -typedef int(FileDataReadFn)(struct FileData *filedata, void *buffer, unsigned int size); +typedef int(FileDataReadFn)(struct FileData *filedata, + void *buffer, + unsigned int size, + bool *r_is_memchunk_identical); typedef off64_t(FileDataSeekFn)(struct FileData *filedata, off64_t offset, int whence); typedef struct FileData { @@ -78,6 +85,14 @@ typedef struct FileData { const char *buffer; /** Variables needed for reading from memfile (undo). */ struct MemFile *memfile; + /** Whether all data read from memfile so far was identical + * (i.e. shared with some previous undo step). + * Updated by `fd_read_from_memfile()`, user is responsible to reset it to true when needed. + * Used to detect unchanged IDs. */ + bool are_memchunks_identical; + /** Whether we are undoing (< 0) or redoing (> 0), used to choose which 'unchanged' flag to use + * to detect unchanged data from memfile. */ + short undo_direction; /** Variables needed for reading from file. */ gzFile gzfiledes; @@ -120,6 +135,7 @@ typedef struct FileData { ListBase *mainlist; /** Used for undo. */ ListBase *old_mainlist; + struct IDNameLib_Map *old_idmap; struct ReportList *reports; } FileData; @@ -135,7 +151,9 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath); FileData *blo_filedata_from_file(const char *filepath, struct ReportList *reports); FileData *blo_filedata_from_memory(const void *buffer, int buffersize, struct ReportList *reports); -FileData *blo_filedata_from_memfile(struct MemFile *memfile, struct ReportList *reports); +FileData *blo_filedata_from_memfile(struct MemFile *memfile, + const struct BlendFileReadParams *params, + struct ReportList *reports); void blo_clear_proxy_pointers_from_lib(struct Main *oldmain); void blo_make_image_pointer_map(FileData *fd, struct Main *oldmain); @@ -149,6 +167,7 @@ void blo_end_sound_pointer_map(FileData *fd, struct Main *oldmain); void blo_make_packed_pointer_map(FileData *fd, struct Main *oldmain); void blo_end_packed_pointer_map(FileData *fd, struct Main *oldmain); void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd); +void blo_make_old_idmap_from_main(FileData *fd, struct Main *bmain); void blo_filedata_free(FileData *fd); |