diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-06-03 16:28:46 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-06-03 16:28:46 +0400 |
commit | 902976e0125fd21b560aca5babe906c30d059b4a (patch) | |
tree | 8b00ac875ea81802ee99fe5cbd6f4135ffe07da0 | |
parent | 29d0c8cb19d45966e7716f0099cb6c2a7e6fbd2d (diff) |
Fix #35378: Shape Key Animation Data still linked when creating full copy of scene
Two issues were found:
- Mesh/Curve/Lattice kay blocks weren't copying their actions
when making object data local. This lead to object data using
diffrent AnimData structures which were using the same action.
- Copying actions shall happen after object object data was
localized. This is so because otherwise we'll copy actions
for original AnimData, not for copied one.
Reviewed by Joshua, thanks!
-rw-r--r-- | source/blender/editors/object/object_relations.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index a5dc0e9cd41..5acaedb7b81 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1712,6 +1712,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) //Camera *cam; Base *base; Mesh *me; + Lattice *lat; ID *id; int a; @@ -1722,9 +1723,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) if (id && id->us > 1 && id->lib == NULL) { DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - - BKE_copy_animdata_id_action(id); - + switch (ob->type) { case OB_LAMP: ob->data = la = BKE_lamp_copy(ob->data); @@ -1738,10 +1737,9 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) ob->data = BKE_camera_copy(ob->data); break; case OB_MESH: - ob->data = BKE_mesh_copy(ob->data); - //me = ob->data; - //if (me && me->key) - // ipo_idnew(me->key->ipo); /* drivers */ + ob->data = me = BKE_mesh_copy(ob->data); + if (me->key) + BKE_copy_animdata_id_action((ID*)me->key); break; case OB_MBALL: ob->data = BKE_mball_copy(ob->data); @@ -1752,9 +1750,13 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) ob->data = cu = BKE_curve_copy(ob->data); ID_NEW(cu->bevobj); ID_NEW(cu->taperobj); + if (cu->key) + BKE_copy_animdata_id_action((ID*)cu->key); break; case OB_LATTICE: - ob->data = BKE_lattice_copy(ob->data); + ob->data = lat = BKE_lattice_copy(ob->data); + if (lat->key) + BKE_copy_animdata_id_action((ID*)lat->key); break; case OB_ARMATURE: DAG_id_tag_update(&ob->id, OB_RECALC_DATA); @@ -1769,7 +1771,14 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) printf("ERROR %s: can't copy %s\n", __func__, id->name); return; } - + + /* Copy animation data after object data became local, + * otherwise old and new object data will share the same + * AnimData structure, which is not what we want. + * (sergey) + */ + BKE_copy_animdata_id_action((ID*)ob->data); + id->us--; id->newid = ob->data; |