Bugfix [#28267] keyframed values for shapekeys of copied objects are

linked

Shapekey actions weren't getting copied when their owner data was.

This was due to the IMO totally convoluted way in which the duplicate
action flags have been set up:
- the function to copy animdata takes a param to specify whether
actions are copied or not, but this is never touched (i.e. this always
just gets FALSE passed in)
- instead, we jump around in hoops later figuring out whether the
userpref wants copying to occur, then fixing up the links

IIRC, part of this may be due to a desire/need to not duplicate
actions when dealing with NodeTree copies for multi-threaded
rendering, but at the expense of complicating everything else.
This commit is contained in:
Joshua Leung 2011-08-16 01:02:26 +00:00
parent a458de88b6
commit a67562e73c
3 changed files with 7 additions and 24 deletions

@ -287,7 +287,7 @@ int BKE_copy_animdata_id (ID *id_to, ID *id_from, const short do_action)
return 1;
}
void BKE_copy_animdata_id_action(struct ID *id)
void BKE_copy_animdata_id_action(ID *id)
{
AnimData *adt= BKE_animdata_from_id(id);
if (adt) {

@ -604,7 +604,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
/* calculate the 'number' of the cycle */
cycle= ((float)side * (evaltime - ofs) / cycdx);
/* calculate the time inside the cycle */
cyct= fmod(evaltime - ofs, cycdx);

@ -39,6 +39,7 @@
#include "DNA_curve_types.h"
#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
@ -65,6 +66,7 @@
#include "BKE_group.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_key.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mball.h"
@ -1496,28 +1498,6 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
/* duplicates using userflags */
#if 0 // XXX old animation system
if(dupflag & USER_DUP_IPO) {
bConstraintChannel *chan;
id= (ID *)obn->ipo;
if(id) {
ID_NEW_US( obn->ipo)
else obn->ipo= copy_ipo(obn->ipo);
id->us--;
}
/* Handle constraint ipos */
for (chan=obn->constraintChannels.first; chan; chan=chan->next){
id= (ID *)chan->ipo;
if(id) {
ID_NEW_US( chan->ipo)
else chan->ipo= copy_ipo(chan->ipo);
id->us--;
}
}
}
#endif // XXX old animation system
if(dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action(&obn->id);
}
@ -1674,8 +1654,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
/* check if obdata is copied */
if(didit) {
Key *key = ob_get_key(obn);
if(dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action((ID *)obn->data);
if(key) BKE_copy_animdata_id_action((ID*)key);
}
if(dupflag & USER_DUP_MAT) {