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 <mont29>2020-06-15 16:10:17 +0300
committerBastien Montagne <bastien@blender.org>2020-06-25 11:42:27 +0300
commit91f07fbfd662ddb311d4dc459eab556db5936370 (patch)
treef1d84d8fc50a003bc33e2a89dff0a89455e0f870 /source/blender/makesdna
parent6e13cff487117e621138ffb5531d7866b61d5865 (diff)
Fix T77774: New undo code broken by 'make local' behavior.
This is actually a nice issue due to too much optimization... * Making an ID local just reuse the linked one whenever possible, instead of actually making a copy of it. * Therefore, the collection containing that ID is seen as unchanged, since the pointer itself remained the same. * But on undo step, there is no way to reuse that local object, which then gets deleted, and linked one gets re-created - at a different address. * Collection, however, since unchanged, is not updated at all and thus keeps reference to the to-be-deleted local object, instead of the linked one. * Issue gets even worse with viewlayers, this leads to the crash. To address this, this patch adds a 'virtual' update flags that does nothing in update case, but will ensure that the affected IDs using the one made local are properly detected as changed across the relevant undo step. Note that the recalc flags were chosen mostly for a logical reason, and also because they are already properly dealt with and cleared by undo code, so this looks like the optimal solution. Note: slightly ammended for 2.83, change should not have any effect in practice. Reviewed By: brecht Maniphest Tasks: T77774 Differential Revision: https://developer.blender.org/D8006
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_ID.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 7ce84e0092c..0cf45fa4bcc 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -680,6 +680,15 @@ typedef enum IDRecalcFlag {
* input file or for color space changes. */
ID_RECALC_SOURCE = (1 << 23),
+ /* Virtual recalc tag/marker required for undo in some cases, where actual data does not change
+ * and hence do not require an update, but conceptually we are dealing with something new.
+ *
+ * Current known case: linked IDs made local without requiring any copy. While their users do not
+ * require any update, they have actually been 'virtually' remapped from the linked ID to the
+ * local one.
+ */
+ ID_RECALC_TAG_FOR_UNDO = (1 << 24),
+
/***************************************************************************
* Pseudonyms, to have more semantic meaning in the actual code without
* using too much low-level and implementation specific tags. */