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:
authorBastien Montagne <b.mont29@gmail.com>2020-03-17 14:29:36 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-03-17 17:02:05 +0300
commitb852db57ba24adfcfaa0ada7e9ff513a79a399a2 (patch)
tree19d2a41451ecf6a3d07a53c98bb0cd4ad76c77e6 /source/blender/blenloader/intern/readfile.h
parent9ce38909500a47beff87081147178d7a52449df7 (diff)
Add experimental global undo speedup.
The feature is hidden behind an experimental option, you'll have to enable it in the preferences to try it. This feature is not yet considered fully stable, crashes may happen, as well as .blend file corruptions (very unlikely, but still possible). In a nutshell, the ideas behind this code are to: * Detect unchanged IDs across an undo step. * Reuse as much as possible existing IDs memory, even when its content did change. * Re-use existing depsgraphs instead of building new ones from scratch. * Store accumulated recalc flags, to avoid needless re-compute of things that did not change, when the ID itself is detected as modified. See T60695 and D6580 for more technical details.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.h')
-rw-r--r--source/blender/blenloader/intern/readfile.h23
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);