Fix (unreported) bad handling of shapekeys when applying override rules.

We need to do a full proper swap of those shape keys as well, previous
code ended up breaking relationships between data-blocks...
This commit is contained in:
Bastien Montagne 2020-07-20 19:14:37 +02:00
parent 62a819202e
commit bb63ce9839
1 changed files with 6 additions and 2 deletions

View File

@ -1276,8 +1276,6 @@ void BKE_lib_override_library_update(Main *bmain, ID *local)
Key *local_key = BKE_key_from_id(local);
Key *tmp_key = BKE_key_from_id(tmp_id);
if (local_key != NULL && tmp_key != NULL) {
/* This is some kind of hard-coded 'always enforced override'... */
tmp_key->from = local_key->from;
tmp_key->id.flag |= (local_key->id.flag & LIB_EMBEDDED_DATA_LIB_OVERRIDE);
}
@ -1296,6 +1294,12 @@ void BKE_lib_override_library_update(Main *bmain, ID *local)
* So when we'll free tmp_id, we'll actually free old, outdated data from local. */
BKE_lib_id_swap(bmain, local, tmp_id);
if (local_key != NULL && tmp_key != NULL) {
/* This is some kind of hard-coded 'always enforced override'... */
BKE_lib_id_swap(bmain, &local_key->id, &tmp_key->id);
tmp_key->id.flag |= (local_key->id.flag & LIB_EMBEDDED_DATA_LIB_OVERRIDE);
}
/* Again, horribly inn-efficient in our case, we need something off-Main
* (aka more generic nolib copy/free stuff)! */
/* XXX And crashing in complex cases (e.g. because depsgraph uses same data...). */