Hopefully a working merge with trunk (could be one error left in raytrace.c - will...
[blender.git] / source / blender / blenloader / intern / writefile.c
index e9d9fae0936eb80574348d013fa11958771609d3..739b0f11e7eb1084da030d6fa0766b64b83ef5a5 100644 (file)
@@ -470,6 +470,8 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
                                write_curvemapping(wd, node->storage);
                        else if(ntree->type==NTREE_COMPOSIT && (node->type==CMP_NODE_TIME || node->type==CMP_NODE_CURVE_VEC || node->type==CMP_NODE_CURVE_RGB))
                                write_curvemapping(wd, node->storage);
+                       else if(ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
+                               write_curvemapping(wd, node->storage);
                        else 
                                writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
                }
@@ -1330,9 +1332,20 @@ static void write_textures(WriteData *wd, ListBase *idbase)
                        if (tex->id.properties) IDP_WriteProperty(tex->id.properties, wd);
 
                        /* direct data */
-                       if(tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
+                       if(tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
                        if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
-                       if(tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
+                       if(tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
+                       if(tex->pd) {
+                               writestruct(wd, DATA, "PointDensity", 1, tex->pd);
+                               if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
+                       }
+                       if(tex->vd) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
+                       
+                       /* nodetree is integral part of texture, no libdata */
+                       if(tex->nodetree) {
+                               writestruct(wd, DATA, "bNodeTree", 1, tex->nodetree);
+                               write_nodetree(wd, tex->nodetree);
+                       }
                        
                        write_previews(wd, tex->preview);
                }
@@ -2024,7 +2037,7 @@ static void write_global(WriteData *wd)
        fg.subversion= BLENDER_SUBVERSION;
        fg.minversion= BLENDER_MINVERSION;
        fg.minsubversion= BLENDER_MINSUBVERSION;
-       
+       fg.pads= 0; /* prevent mem checkers from complaining */
        writestruct(wd, GLOB, "FileGlobal", 1, &fg);
 }