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:
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r--source/blender/blenkernel/intern/world.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 7a76e61c17b..d413177873f 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -43,6 +43,7 @@
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
+#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BKE_world.h"
@@ -117,17 +118,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;
}