slight cleaning of texture type changing functionality, done while working on other...
authorMatt Ebb <matt@mke3.net>
Tue, 22 Jun 2010 09:13:30 +0000 (09:13 +0000)
committerMatt Ebb <matt@mke3.net>
Tue, 22 Jun 2010 09:13:30 +0000 (09:13 +0000)
source/blender/blenkernel/BKE_texture.h
source/blender/blenkernel/intern/texture.c
source/blender/makesrna/intern/rna_texture.c

index ace352395d237bd071d8c57d9a655f40d8f07e0d..39c12a2bfd875ea9be70c1d83c4b3beef15c03ae 100644 (file)
@@ -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);
index 6d8c339d2b98e8cbf45728013532b044c91943b8..31826f5be28a700f5d54f22f8d700479e19995a2 100644 (file)
@@ -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)
index 32221e51cb9a76b0a2bef727424393bcbfbe1956..a12b8c55552a857055ef3dcf17e8f6f4a75b4fb2 100644 (file)
@@ -160,24 +160,8 @@ static void rna_Texture_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 static void rna_Texture_type_set(PointerRNA *ptr, int value)
 {
        Tex *tex= (Tex*)ptr->data;
-
-       switch(value) {
-
-               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 = value;
+       tex_set_type(tex, value);
 }
 
 void rna_TextureSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)