diff options
author | Matt Ebb <matt@mke3.net> | 2010-06-22 13:13:30 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-06-22 13:13:30 +0400 |
commit | 8bc1e44e3364ba6d7888c04f97ecea0fad382d41 (patch) | |
tree | a4a7cb617ac9d38d78ac2e23912f47c829678349 /source/blender/blenkernel | |
parent | 2849201339f21eec8d5287e3e2199573b625fc40 (diff) |
slight cleaning of texture type changing functionality, done while working on other stuff today
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_texture.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index ace352395d2..39c12a2bfd8 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -64,6 +64,7 @@ void colorband_table_RGBA(struct ColorBand *coba, float **array, int *size); void default_tex(struct Tex *tex); struct Tex *add_texture(const char *name); +void tex_set_type(struct Tex *tex, int type); void default_mtex(struct MTex *mtex); struct MTex *add_mtex(void); struct Tex *copy_texture(struct Tex *tex); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 6d8c339d2b9..31826f5be28 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -509,6 +509,27 @@ void default_tex(Tex *tex) tex->preview = NULL; } +void tex_set_type(Tex *tex, int type) +{ + switch(type) { + + case TEX_VOXELDATA: + if (tex->vd == NULL) + tex->vd = BKE_add_voxeldata(); + break; + case TEX_POINTDENSITY: + if (tex->pd == NULL) + tex->pd = BKE_add_pointdensity(); + break; + case TEX_ENVMAP: + if (tex->env == NULL) + tex->env = BKE_add_envmap(); + break; + } + + tex->type = type; +} + /* ------------------------------------------------------------------------- */ Tex *add_texture(const char *name) |