Make linked animdata working again, copies NLA too, as well as ObData animdata where types match

This commit is contained in:
Campbell Barton 2010-01-10 20:23:59 +00:00
parent 6a15ac70b6
commit 0185e24861
3 changed files with 25 additions and 8 deletions

@ -55,6 +55,9 @@ void BKE_free_animdata(struct ID *id);
/* Copy AnimData */
struct AnimData *BKE_copy_animdata(struct AnimData *adt);
/* Copy AnimData */
int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from);
/* Make Local */
void BKE_animdata_make_local(struct AnimData *adt);

@ -203,6 +203,26 @@ AnimData *BKE_copy_animdata (AnimData *adt)
return dadt;
}
int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from)
{
AnimData *adt;
if((id_to && id_from) && (GS(id_to->name) != GS(id_from->name)))
return 0;
BKE_free_animdata(id_to);
adt = BKE_animdata_from_id(id_from);
if (adt) {
IdAdtTemplate *iat = (IdAdtTemplate *)id_to;
iat->adt= BKE_copy_animdata(adt);
}
return 1;
}
/* Make Local -------------------------------------------- */
static void make_local_strips(ListBase *strips)

@ -1219,14 +1219,8 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
}
break;
case MAKE_LINKS_ANIMDATA:
#if 0 // XXX old animation system
if(obt->ipo) obt->ipo->id.us--;
obt->ipo= ob->ipo;
if(obt->ipo) {
id_us_plus((ID *)obt->ipo);
do_ob_ipo(scene, obt);
}
#endif // XXX old animation system
BKE_copy_animdata_id((ID *)obt, (ID *)ob);
BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data);
break;
case MAKE_LINKS_DUPLIGROUP:
if(ob->dup_group) ob->dup_group->id.us--;