From 3aaa03e1f8a1cfa62758aa983d5c0b304128e546 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 19 May 2011 11:21:37 +0000 Subject: Add localize_lamp and localize_world functions as already existed for materials and textures, unused still. --- source/blender/blenkernel/intern/world.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'source/blender/blenkernel/intern/world.c') diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 7a76e61c17b..8cecad97902 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -117,17 +117,36 @@ World *copy_world(World *wrld) for(a=0; amtex[a]) { - wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial"); + wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "copy_world"); memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex)); id_us_plus((ID *)wrldn->mtex[a]->tex); } } - if (wrld->preview) wrldn->preview = BKE_previewimg_copy(wrld->preview); + if(wrld->preview) + wrldn->preview = BKE_previewimg_copy(wrld->preview); -#if 0 // XXX old animation system - id_us_plus((ID *)wrldn->ipo); -#endif // XXX old animation system + return wrldn; +} + +World *localize_world(World *wrld) +{ + World *wrldn; + int a; + + wrldn= copy_libblock(wrld); + BLI_remlink(&G.main->world, wrldn); + + for(a=0; amtex[a]) { + wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_world"); + memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex)); + /* free world decrements */ + id_us_plus((ID *)wrldn->mtex[a]->tex); + } + } + + wrldn->preview= NULL; return wrldn; } -- cgit v1.2.3