Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-19 15:21:37 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-19 15:21:37 +0400
commit3aaa03e1f8a1cfa62758aa983d5c0b304128e546 (patch)
tree68354cb20bc02f498f2ac0768fc20028f3e79726 /source/blender/blenkernel/intern/world.c
parent4c28693ae3cfe919deebac31ec664b332f1f4d17 (diff)
Add localize_lamp and localize_world functions as already existed for materials
and textures, unused still.
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r--source/blender/blenkernel/intern/world.c29
1 files changed, 24 insertions, 5 deletions
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; a<MAX_MTEX; a++) {
if(wrld->mtex[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; a<MAX_MTEX; a++) {
+ if(wrld->mtex[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;
}