diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-03-17 14:29:36 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-03-17 17:02:05 +0300 |
commit | b852db57ba24adfcfaa0ada7e9ff513a79a399a2 (patch) | |
tree | 19d2a41451ecf6a3d07a53c98bb0cd4ad76c77e6 /source/blender/blenloader/BLO_readfile.h | |
parent | 9ce38909500a47beff87081147178d7a52449df7 (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/BLO_readfile.h')
-rw-r--r-- | source/blender/blenloader/BLO_readfile.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 00dbe334356..8495caa91b5 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -76,8 +76,11 @@ typedef struct WorkspaceConfigFileData { } WorkspaceConfigFileData; struct BlendFileReadParams { - uint skip_flags : 2; /* eBLOReadSkip */ + uint skip_flags : 3; /* eBLOReadSkip */ uint is_startup : 1; + + /** Whether we are reading the memfile for an undo (< 0) or a redo (> 0). */ + int undo_direction : 2; }; /* skip reading some data-block types (may want to skip screen data too). */ @@ -85,6 +88,8 @@ typedef enum eBLOReadSkip { BLO_READ_SKIP_NONE = 0, BLO_READ_SKIP_USERDEF = (1 << 0), BLO_READ_SKIP_DATA = (1 << 1), + /** Do not attempt to re-use IDs from old bmain for unchanged ones in case of undo. */ + BLO_READ_SKIP_UNDO_OLD_MAIN = (1 << 2), } eBLOReadSkip; #define BLO_READ_SKIP_ALL (BLO_READ_SKIP_USERDEF | BLO_READ_SKIP_DATA) @@ -98,7 +103,7 @@ BlendFileData *BLO_read_from_memory(const void *mem, BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename, struct MemFile *memfile, - eBLOReadSkip skip_flags, + const struct BlendFileReadParams *params, struct ReportList *reports); void BLO_blendfiledata_free(BlendFileData *bfd); |