Hopefully a working merge with trunk (could be one error left in raytrace.c - will...
[blender.git] / source / blender / blenloader / intern / writefile.c
index e53c725867a6dcedd2b13750a7daba30d9ab34b2..739b0f11e7eb1084da030d6fa0766b64b83ef5a5 100644 (file)
@@ -174,8 +174,6 @@ Important to know is that 'streaming' has been added to files, for Blender Publi
 #include "BIF_verse.h"
 #endif
 
-#include "GEN_messaging.h"
-
 #include "BLO_writefile.h"
 #include "BLO_readfile.h"
 #include "BLO_undofile.h"
@@ -399,7 +397,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr)      /* do not
 void IDP_WriteProperty_OnlyData(IDProperty *prop, void *wd);
 void IDP_WriteProperty(IDProperty *prop, void *wd);
 
-void IDP_WriteArray(IDProperty *prop, void *wd)
+static void IDP_WriteArray(IDProperty *prop, void *wd)
 {
        /*REMEMBER to set totalen to len in the linking code!!*/
        if (prop->data.pointer) {
@@ -407,13 +405,13 @@ void IDP_WriteArray(IDProperty *prop, void *wd)
        }
 }
 
-void IDP_WriteString(IDProperty *prop, void *wd)
+static void IDP_WriteString(IDProperty *prop, void *wd)
 {
        /*REMEMBER to set totalen to len in the linking code!!*/
        writedata(wd, DATA, prop->len+1, prop->data.pointer);
 }
 
-void IDP_WriteGroup(IDProperty *prop, void *wd)
+static void IDP_WriteGroup(IDProperty *prop, void *wd)
 {
        IDProperty *loop;
 
@@ -472,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);
                }
@@ -922,6 +922,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
                        writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
                        writestruct(wd, DATA, "SoftBody", 1, ob->soft);
                        if(ob->soft) writestruct(wd, DATA, "PointCache", 1, ob->soft->pointcache);
+                       writestruct(wd, DATA, "BulletSoftBody", 1, ob->bsoft);
                        
                        write_particlesystems(wd, &ob->particlesystem);
                        write_modifiers(wd, &ob->modifiers);
@@ -1065,7 +1066,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
        }
 }
 
-int amount_of_chars(char *str)
+static int amount_of_chars(char *str)
 {
        // Since the data is saved as UTF-8 to the cu->str
        // The cu->len is not same as the strlen(cu->str)
@@ -1331,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);
                }
@@ -2025,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);
 }