diff options
author | Lukas Steiblys <imbusy@imbusy.org> | 2009-10-02 02:29:15 +0400 |
---|---|---|
committer | Lukas Steiblys <imbusy@imbusy.org> | 2009-10-02 02:29:15 +0400 |
commit | 0677398a649b6b8c293df3ce3c6668f0a3be3bc8 (patch) | |
tree | 9d510a5bd23559bf4fae670ed04d7e5d6c12578c /source/blender/blenkernel/intern/library.c | |
parent | 59248e9f62006ba05e3098e4d213f3dcb23fe711 (diff) | |
parent | bc942eceacb638735dc4f4f68252c4c207147a70 (diff) |
merge from 23153 to 23595soc-2009-imbusy
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 53 |
1 files changed, 18 insertions, 35 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 02d92a62b59..0f65be207d9 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -455,6 +455,15 @@ void flag_all_listbases_ids(short flag, short value) while(a--) flag_listbase_ids(lbarray[a], flag, value); } +void recalc_all_library_objects(Main *main) +{ + Object *ob; + + /* flag for full recalc */ + for(ob=main->object.first; ob; ob=ob->id.next) + if(ob->id.lib) + ob->recalc |= OB_RECALC; +} /* note: MAX_LIBARRAY define should match this code */ int set_listbasepointers(Main *main, ListBase **lb) @@ -631,42 +640,15 @@ void *alloc_libblock(ListBase *lb, short type, const char *name) } /* by spec, animdata is first item after ID */ -/* we still read ->adt itself, to ensure compiler warns when it doesnt exist */ +/* and, trust that BKE_animdata_from_id() will only find AnimData for valid ID-types */ static void id_copy_animdata(ID *id) { - switch(GS(id->name)) { - case ID_OB: - ((Object *)id)->adt= BKE_copy_animdata(((Object *)id)->adt); - break; - case ID_CU: - ((Curve *)id)->adt= BKE_copy_animdata(((Curve *)id)->adt); - break; - case ID_CA: - ((Camera *)id)->adt= BKE_copy_animdata(((Camera *)id)->adt); - break; - case ID_KE: - ((Key *)id)->adt= BKE_copy_animdata(((Key *)id)->adt); - break; - case ID_LA: - ((Lamp *)id)->adt= BKE_copy_animdata(((Lamp *)id)->adt); - break; - case ID_MA: - ((Material *)id)->adt= BKE_copy_animdata(((Material *)id)->adt); - break; - case ID_NT: - ((bNodeTree *)id)->adt= BKE_copy_animdata(((bNodeTree *)id)->adt); - break; - case ID_SCE: - ((Scene *)id)->adt= BKE_copy_animdata(((Scene *)id)->adt); - break; - case ID_TE: - ((Tex *)id)->adt= BKE_copy_animdata(((Tex *)id)->adt); - break; - case ID_WO: - ((World *)id)->adt= BKE_copy_animdata(((World *)id)->adt); - break; - } + AnimData *adt= BKE_animdata_from_id(id); + if (adt) { + IdAdtTemplate *iat = (IdAdtTemplate *)id; + iat->adt= BKE_copy_animdata(iat->adt); + } } /* used everywhere in blenkernel and text.c */ @@ -696,8 +678,9 @@ void *copy_libblock(void *rt) id->newid= idn; idn->flag |= LIB_NEW; if (id->properties) idn->properties = IDP_CopyProperty(id->properties); - - id_copy_animdata(id); + + /* the duplicate should get a copy of the animdata */ + id_copy_animdata(idn); return idn; } |