diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-27 09:34:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-27 09:34:39 +0400 |
commit | f7d5cea669bd40de9c0aa5fc3aaa4c7f49f697a8 (patch) | |
tree | 30ad1870a5f6b3a3bbc1cb4904db92c882fe5a6f /source/blender/blenkernel/intern/curve.c | |
parent | fa6e6e7fc0977248e7ac10dddc79499304f05bda (diff) |
use path remapping for all make local functions, patch from Alex Fraser with changes.
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index f5335bb12cd..3f014f241ff 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -36,6 +36,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_bpath.h" #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -245,7 +246,7 @@ void make_local_curve(Curve *cu) { Main *bmain= G.main; Object *ob; - int local=0, lib=0; + int is_local= FALSE, is_lib= FALSE; /* - when there are only lib users: don't do * - when there are only local users: set flag @@ -255,26 +256,31 @@ void make_local_curve(Curve *cu) if(cu->id.lib==NULL) return; if(cu->id.us==1) { - id_clear_lib_data(bmain, (ID *)cu); + id_clear_lib_data(bmain, &cu->id); extern_local_curve(cu); return; } - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) { if(ob->data == cu) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } - if(local && lib==0) { - id_clear_lib_data(bmain, (ID *)cu); + if(is_local && is_lib == FALSE) { + id_clear_lib_data(bmain, &cu->id); extern_local_curve(cu); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, cu->id.lib->filepath}; Curve *cun= copy_curve(cu); cun->id.us= 0; + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &cun->id, bpath_relocate_visitor, 0, bpath_user_data); + for(ob= bmain->object.first; ob; ob= ob->id.next) { if(ob->data==cu) { if(ob->id.lib==NULL) { |