Fix T73817: Shape key users not properly mapped when duplicating their obdata.

Once again those crappy weirdos IDs with their crappy weirdos 'loopback'
pointers...

This is a quick hack for now, think id_copy needs to be reworked a bit
to supported re-entrant sub-ID copying (also an issue with nodes I bet).
This commit is contained in:
Bastien Montagne 2020-02-17 15:47:24 +01:00
parent 852cdd476b
commit 3a53ae8d4b
Notes: blender-bot 2023-06-07 10:31:13 +02:00
Referenced by issue #73817, Shape key users not properly mapped when duplicating an object & mesh
3 changed files with 6 additions and 0 deletions

View File

@ -205,6 +205,8 @@ void BKE_curve_copy_data(Main *bmain, Curve *cu_dst, const Curve *cu_src, const
if (cu_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
BKE_id_copy_ex(bmain, &cu_src->key->id, (ID **)&cu_dst->key, flag);
/* XXX This is not nice, we need to make BKE_id_copy_ex fully re-entrant... */
cu_dst->key->from = &cu_dst->id;
}
cu_dst->editnurb = NULL;

View File

@ -282,6 +282,8 @@ void BKE_lattice_copy_data(Main *bmain, Lattice *lt_dst, const Lattice *lt_src,
if (lt_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
BKE_id_copy_ex(bmain, &lt_src->key->id, (ID **)&lt_dst->key, flag);
/* XXX This is not nice, we need to make BKE_id_copy_ex fully re-entrant... */
lt_dst->key->from = &lt_dst->id;
}
if (lt_src->dvert) {

View File

@ -608,6 +608,8 @@ void BKE_mesh_copy_data(Main *bmain, Mesh *me_dst, const Mesh *me_src, const int
/* TODO Do we want to add flag to prevent this? */
if (me_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
BKE_id_copy_ex(bmain, &me_src->key->id, (ID **)&me_dst->key, flag);
/* XXX This is not nice, we need to make BKE_id_copy_ex fully re-entrant... */
me_dst->key->from = &me_dst->id;
}
}