Merging r46495 through r46557 from trunk into soc-2011-tomato
[blender.git] / source / blender / blenloader / intern / writefile.c
index 5c03fe0a6d7bbf1c7296e632d1ccbf26e217c3e1..93d7f9bdc2f281727b3ae2e676300bbd992ceda1 100644 (file)
@@ -153,6 +153,7 @@ Any case: direct data is ALWAYS after the lib block
 #include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_sequencer.h"
+#include "BKE_subsurf.h"
 #include "BKE_utildefines.h"
 #include "BKE_modifier.h"
 #include "BKE_fcurve.h"
@@ -734,6 +735,11 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
                        for (sock=node->inputs.first; sock; sock=sock->next)
                                writestruct(wd, DATA, "NodeImageMultiFileSocket", 1, sock->storage);
                }
+               if (node->type==CMP_NODE_IMAGE) {
+                       /* write extra socket info */
+                       for (sock=node->outputs.first; sock; sock=sock->next)
+                               writestruct(wd, DATA, "NodeImageLayer", 1, sock->storage);
+               }
        }
        
        for (link= ntree->links.first; link; link= link->next)
@@ -1655,6 +1661,24 @@ static void write_mdisps(WriteData *wd, int count, MDisps *mdlist, int external)
        }
 }
 
+static void write_grid_paint_mask(WriteData *wd, int count, GridPaintMask *grid_paint_mask)
+{
+       if(grid_paint_mask) {
+               int i;
+               
+               writestruct(wd, DATA, "GridPaintMask", count, grid_paint_mask);
+               for(i = 0; i < count; ++i) {
+                       GridPaintMask *gpm = &grid_paint_mask[i];
+                       if(gpm->data) {
+                               const int gridsize = ccg_gridsize(gpm->level);
+                               writedata(wd, DATA,
+                                                 sizeof(*gpm->data) * gridsize * gridsize,
+                                                 gpm->data);
+                       }
+               }
+       }
+}
+
 static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data, int partial_type, int partial_count)
 {
        int i;
@@ -1677,6 +1701,13 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
                else if (layer->type == CD_MDISPS) {
                        write_mdisps(wd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL);
                }
+               else if (layer->type == CD_PAINT_MASK) {
+                       float *layer_data = layer->data;
+                       writedata(wd, DATA, sizeof(*layer_data) * count, layer_data);
+               }
+               else if (layer->type == CD_GRID_PAINT_MASK) {
+                       write_grid_paint_mask(wd, count, layer->data);
+               }
                else {
                        CustomData_file_write_info(layer->type, &structname, &structnum);
                        if (structnum) {