From b852db57ba24adfcfaa0ada7e9ff513a79a399a2 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 17 Mar 2020 12:29:36 +0100 Subject: 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. --- source/blender/makesdna/DNA_ID.h | 4 ++++ source/blender/makesdna/DNA_userdef_types.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index f2923c7f144..063ea04bdba 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -559,6 +559,10 @@ enum { /* Datablock was not allocated by standard system (BKE_libblock_alloc), do not free its memory * (usual type-specific freeing is called though). */ LIB_TAG_NOT_ALLOCATED = 1 << 18, + + /* RESET_AFTER_USE Used by undo system to tag unchanged IDs re-used from old Main (instead of + * read from memfile). */ + LIB_TAG_UNDO_OLD_ID_REUSED = 1 << 19, }; /* Tag given ID for an update in all the dependency graphs. */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 6961a9e9c3e..904d7b8a52e 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -613,7 +613,8 @@ typedef struct UserDef_FileSpaceData { } UserDef_FileSpaceData; typedef struct UserDef_Experimental { - char _pad0[8]; /* makesdna does not allow empty structs. */ + char use_undo_speedup; + char _pad0[7]; /* makesdna does not allow empty structs. */ } UserDef_Experimental; #define USER_EXPERIMENTAL_TEST(userdef, member) \ -- cgit v1.2.3