svn merge -r 12347:12382 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blender / blenloader / intern / writefile.c
index 45621c5fcd080c125ea7f284566c466bf0289d3b..ba4cbd1b9506e0abded49a6e160611ca7e230127 100644 (file)
@@ -107,6 +107,7 @@ Important to know is that 'streaming' has been added to files, for Blender Publi
 #include "DNA_actuator_types.h"
 #include "DNA_brush_types.h"
 #include "DNA_camera_types.h"
+#include "DNA_cloth_types.h"
 #include "DNA_color_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_controller_types.h"
@@ -154,6 +155,7 @@ Important to know is that 'streaming' has been added to files, for Blender Publi
 #include "BKE_action.h"
 #include "BKE_bad_level_calls.h" // build_seqar (from WHILE_SEQ) free_oops error
 #include "BKE_blender.h"
+#include "BKE_cloth.h"
 #include "BKE_curve.h"
 #include "BKE_customdata.h"
 #include "BKE_constraint.h"
@@ -769,6 +771,23 @@ static void write_constraint_channels(WriteData *wd, ListBase *chanbase)
 
 }
 
+/*
+// TODO: finish this
+static void write_cloth_cache(WriteData *wd, LinkNode *ln)
+{
+       
+       while(ln) {
+               writestruct(wd, DATA, "cloth_cache", 1, ln);            
+               writestruct(wd, DATA, "cloth_cache_frame", 1, ln->link);
+               writestruct(wd, DATA, "cloth_cache_frame_verts", 1, ln->link);
+               writestruct(wd, DATA, "cloth_cache_frame_springs", 1, ln->link);
+               }
+
+               ln = ln->next;
+       }
+}
+*/
+               
 static void write_modifiers(WriteData *wd, ListBase *modbase)
 {
        ModifierData *md;
@@ -784,6 +803,24 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
                        HookModifierData *hmd = (HookModifierData*) md;
                        
                        writedata(wd, DATA, sizeof(int)*hmd->totindex, hmd->indexar);
+       }
+       else if (md->type==eModifierType_Cloth) {
+                  int                                  n;
+                  ClothModifierData    *clmd = (ClothModifierData *) md;
+
+                  if (clmd->sim_parms.cache) {
+                         // Compute the number of vertices we're saving.
+                          // TODO
+                          // write_cloth_cache();
+                         /*
+                          // old code
+                         n = (clmd->sim_parms.bake_end_frame - clmd->sim_parms.bake_start_frame + 1) *
+                                clmd->sim_parms.bake_num_verts;
+                         writedata (wd, DATA, n *  sizeof (clmd->baked_data [0]), clmd->baked_data);
+                         printf ("write_modifiers: wrote %d elements of size %d for cloth baked data.\n",
+                                         n, sizeof (clmd->baked_data [0]));
+                          */
+                  }
                }
        }
 }