diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-26 11:17:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-26 11:17:21 +0400 |
commit | e4cc1c3f2c3e5a85fbf4f7f2757b09544dd556ee (patch) | |
tree | 1d134f4085ba2d90e854c47848c6fc82704667bb /source/blender/blenkernel/intern/world.c | |
parent | 461a7c5c8185d0504c63ddc8de0b2c765e72be4b (diff) |
fix [#27178] Material links lost when making mesh data local
- making local object data - Curve/Mesh/MBall lost references to linked materials.
- joining a linked mesh object into a local one lost the link.
As well as these reported bugs, checked all local functions for consistency/correctness and found other cases which would also fail.
- making local metaball didn't ensure unique ID name.
- make_local_armature() was missing check for object users - main body of code would never run.
- local particles didn't set the dupli-group or textures to extern.
checked all local functions for consistency/correctness.
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index ff58e8bd0a4..7a76e61c17b 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -43,6 +43,8 @@ #include "DNA_scene_types.h" #include "DNA_texture_types.h" +#include "BLI_utildefines.h" + #include "BKE_world.h" #include "BKE_library.h" #include "BKE_animsys.h" @@ -134,7 +136,6 @@ void make_local_world(World *wrld) { Main *bmain= G.main; Scene *sce; - World *wrldn; int local=0, lib=0; /* - only lib users: do nothing @@ -150,34 +151,30 @@ void make_local_world(World *wrld) return; } - sce= bmain->scene.first; - while(sce) { - if(sce->world==wrld) { + for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) { + if(sce->world == wrld) { if(sce->id.lib) lib= 1; else local= 1; } - sce= sce->id.next; } - + if(local && lib==0) { wrld->id.lib= NULL; wrld->id.flag= LIB_LOCAL; new_id(NULL, (ID *)wrld, NULL); } else if(local && lib) { - wrldn= copy_world(wrld); + World *wrldn= copy_world(wrld); wrldn->id.us= 0; - sce= bmain->scene.first; - while(sce) { - if(sce->world==wrld) { + for(sce= bmain->scene.first; sce; sce= sce->id.next) { + if(sce->world == wrld) { if(sce->id.lib==NULL) { sce->world= wrldn; wrldn->id.us++; wrld->id.us--; } } - sce= sce->id.next; } } } |