diff options
Diffstat (limited to 'source/blender/blenkernel/intern/speaker.c')
-rw-r--r-- | source/blender/blenkernel/intern/speaker.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index ae29230423f..d5788d7a748 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -36,6 +34,8 @@ #include "DNA_speaker_types.h" #include "BLI_math.h" +#include "BLI_utildefines.h" +#include "BLI_bpath.h" #include "BKE_animsys.h" #include "BKE_global.h" @@ -80,7 +80,7 @@ void make_local_speaker(Speaker *spk) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - only lib users: do nothing * - only local users: set flag @@ -89,30 +89,30 @@ void make_local_speaker(Speaker *spk) if(spk->id.lib==NULL) return; if(spk->id.us==1) { - spk->id.lib= NULL; - spk->id.flag= LIB_LOCAL; - new_id(&bmain->speaker, (ID *)spk, NULL); + id_clear_lib_data(bmain, &spk->id); return; } ob= bmain->object.first; while(ob) { if(ob->data==spk) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } ob= ob->id.next; } - if(local && lib==0) { - spk->id.lib= NULL; - spk->id.flag= LIB_LOCAL; - new_id(&bmain->speaker, (ID *)spk, NULL); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &spk->id); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, spk->id.lib->filepath}; Speaker *spkn= copy_speaker(spk); spkn->id.us= 0; + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &spkn->id, bpath_relocate_visitor, 0, bpath_user_data); + ob= bmain->object.first; while(ob) { if(ob->data==spk) { |