diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 045095567bc..ad89d3bbd53 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -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); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 8b86f6a5d1f..2a5a12cc513 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -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) diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index d4bf721e14e..237498f15fd 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -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--;