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
path: root/source
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
parent4c28693ae3cfe919deebac31ec664b332f1f4d17 (diff)
Add localize_lamp and localize_world functions as already existed for materials
and textures, unused still.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/BKE_world.h1
-rw-r--r--source/blender/blenkernel/intern/material.c3
-rw-r--r--source/blender/blenkernel/intern/object.c29
-rw-r--r--source/blender/blenkernel/intern/world.c29
5 files changed, 52 insertions, 11 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 3a98f892bd8..a6b5c04b5c3 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -83,6 +83,7 @@ float dof_camera(struct Object *ob);
void *add_lamp(const char *name);
struct Lamp *copy_lamp(struct Lamp *la);
+struct Lamp *localize_lamp(struct Lamp *la);
void make_local_lamp(struct Lamp *la);
void free_camera(struct Camera *ca);
void free_lamp(struct Lamp *la);
diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h
index 30780b87085..6c8d1ba7945 100644
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@ -40,6 +40,7 @@ struct World;
void free_world(struct World *sc);
struct World *add_world(const char *name);
struct World *copy_world(struct World *wrld);
+struct World *localize_world(struct World *wrld);
void make_local_world(struct World *wrld);
#endif
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index fd58dc2dfc0..334f018efc9 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -258,9 +258,8 @@ Material *localize_material(Material *ma)
man->preview = NULL;
- if(ma->nodetree) {
+ if(ma->nodetree)
man->nodetree= ntreeLocalize(ma->nodetree);
- }
man->gpumaterial.first= man->gpumaterial.last= NULL;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index c3ea40b09d6..bad6c6248a1 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -867,11 +867,32 @@ Lamp *copy_lamp(Lamp *la)
lan->curfalloff = curvemapping_copy(la->curfalloff);
-#if 0 // XXX old animation system
- id_us_plus((ID *)lan->ipo);
-#endif // XXX old animation system
+ if(la->preview)
+ lan->preview = BKE_previewimg_copy(la->preview);
+
+ return lan;
+}
+
+Lamp *localize_lamp(Lamp *la)
+{
+ Lamp *lan;
+ int a;
+
+ lan= copy_libblock(la);
+ BLI_remlink(&G.main->lamp, lan);
+
+ for(a=0; a<MAX_MTEX; a++) {
+ if(lan->mtex[a]) {
+ lan->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_lamp");
+ memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
+ /* free lamp decrements */
+ id_us_plus((ID *)lan->mtex[a]->tex);
+ }
+ }
+
+ lan->curfalloff = curvemapping_copy(la->curfalloff);
- if (la->preview) lan->preview = BKE_previewimg_copy(la->preview);
+ lan->preview= NULL;
return lan;
}
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;
}