diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-01-11 16:16:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-01-29 17:52:53 +0300 |
commit | 876fd40643dfa7b206edabbde30809e6e48e583b (patch) | |
tree | b102ab2279291afe72e14aea119e1a41f4549552 /source/blender/makesdna/DNA_ID.h | |
parent | 0e37d3efc017151309b272e4562edd901bfbde7a (diff) |
Fix T83411: Crash when using a workspace/layout data path in a driver
Building IDs which are not covered by copy-on-write process was not
implemented, which was causing parameters block not present, and, hence
causing crashes in areas which expected parameters to present.
First part of this change is related on making it so Copy-on-Write is
optional for ID nodes in the dependency graph.
Second part is related on using a generic builder for all ID types
which were not covered by Copy-on-Write before.
The final part is related on making it so build_id() is properly
handling ParticleSettings and Grease Pencil Data. Before they were not
covered there at all, and they need special handling because they do
have own build functions.
Not sure it worth trying to split those parts, as they are related to
each other and are not really possible to be tested standalone. Open
for a second opinion though.
Possible nut-tightening is to re-organize build_id() function so
that every branch does return and have an assert at the end, so that
missing ID type in the switch statement is easier to spot even when
using compilers which do not report missing switch cases.
As for question "why not use default" the answer is: to make it more
explicit and clear what is a decision when adding new ID types. We do
not want to quietly fall-back to a non-copy-on-write case for a newly
added ID types.
Differential Revision: https://developer.blender.org/D10075
Diffstat (limited to 'source/blender/makesdna/DNA_ID.h')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 51c47e917f1..263ce2203e9 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -526,7 +526,8 @@ typedef enum ID_Type { #define ID_IS_ASSET(_id) (((const ID *)(_id))->asset_data != NULL) /* Check whether datablock type is covered by copy-on-write. */ -#define ID_TYPE_IS_COW(_id_type) (!ELEM(_id_type, ID_BR, ID_PAL, ID_IM)) +#define ID_TYPE_IS_COW(_id_type) \ + (!ELEM(_id_type, ID_LI, ID_IP, ID_SCR, ID_VF, ID_BR, ID_WM, ID_PAL, ID_PC, ID_WS, ID_IM)) #ifdef GS # undef GS |