diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-10-28 21:00:53 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-10-28 21:00:53 +0400 |
commit | 46ae692710467d3622f58e0c5ce371674a6a7d9b (patch) | |
tree | ebd27a8cc3adad65343a6a8d3d22ce02cad24db8 /source/blender/blenkernel/intern/particle.c | |
parent | fae903e263fd11d788a4e55900ff25f4fc8b26db (diff) | |
parent | 7627a742ab6e630522186b04a71fa40533d87db2 (diff) |
Merge with trunk r41342
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index fdaeb8fb2d3..2d372b33dfb 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -56,6 +54,7 @@ #include "BLI_rand.h" #include "BLI_threads.h" #include "BLI_linklist.h" +#include "BLI_bpath.h" #include "BKE_anim.h" #include "BKE_animsys.h" @@ -3612,7 +3611,7 @@ void make_local_particlesettings(ParticleSettings *part) { 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 @@ -3621,34 +3620,35 @@ void make_local_particlesettings(ParticleSettings *part) if(part->id.lib==0) return; if(part->id.us==1) { - part->id.lib= 0; - part->id.flag= LIB_LOCAL; - new_id(&bmain->particle, (ID *)part, 0); + id_clear_lib_data(bmain, &part->id); expand_local_particlesettings(part); return; } /* test objects */ - for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) { + for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) { ParticleSystem *psys=ob->particlesystem.first; for(; psys; psys=psys->next){ if(psys->part==part) { - if(ob->id.lib) lib= 1; - else local= 1; + if(ob->id.lib) is_lib= TRUE; + else is_local= TRUE; } } } - if(local && lib==0) { - part->id.lib= 0; - part->id.flag= LIB_LOCAL; - new_id(&bmain->particle, (ID *)part, 0); + if(is_local && is_lib==FALSE) { + id_clear_lib_data(bmain, &part->id); expand_local_particlesettings(part); } - else if(local && lib) { + else if(is_local && is_lib) { + char *bpath_user_data[2]= {bmain->name, part->id.lib->filepath}; ParticleSettings *partn= psys_copy_settings(part); + partn->id.us= 0; - + + /* Remap paths of new ID using old library as base. */ + bpath_traverse_id(bmain, &partn->id, bpath_relocate_visitor, 0, bpath_user_data); + /* do objects */ for(ob= bmain->object.first; ob; ob= ob->id.next) { ParticleSystem *psys; |