svn merge -r 13415:13452 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blender / blenloader / intern / readfile.c
index 3d1a9822ecbc4e7286d7b0082db134e3d73c26d0..f6c5264efc41106e39160daeccb63c3e3a745b1a 100644 (file)
@@ -60,6 +60,7 @@
 #include "DNA_actuator_types.h"
 #include "DNA_brush_types.h"
 #include "DNA_camera_types.h"
 #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_controller_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_color_types.h"
 #include "DNA_controller_types.h"
 #include "DNA_constraint_types.h"
 
 #include "BKE_action.h"
 #include "BKE_armature.h"
 
 #include "BKE_action.h"
 #include "BKE_armature.h"
+#include "BKE_cloth.h"
 #include "BKE_colortools.h"
 #include "BKE_constraint.h"
 #include "BKE_curve.h"
 #include "BKE_colortools.h"
 #include "BKE_constraint.h"
 #include "BKE_curve.h"
@@ -3004,7 +3006,46 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                        SubsurfModifierData *smd = (SubsurfModifierData*) md;
 
                        smd->emCache = smd->mCache = 0;
                        SubsurfModifierData *smd = (SubsurfModifierData*) md;
 
                        smd->emCache = smd->mCache = 0;
-               } else if (md->type==eModifierType_Hook) {
+               }
+               else if (md->type==eModifierType_Cloth) {
+                       ClothModifierData *clmd = (ClothModifierData*) md;
+                       
+                       clmd->clothObject = NULL;
+                       
+                       clmd->sim_parms= newdataadr(fd, clmd->sim_parms);
+                       clmd->coll_parms= newdataadr(fd, clmd->coll_parms);
+                       
+                       clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_LOADED;
+                       clmd->sim_parms->flags &= ~CLOTH_SIMSETTINGS_FLAG_EDITMODE;
+                       
+               }
+               else if (md->type==eModifierType_Collision) {
+                       
+                       CollisionModifierData *collmd = (CollisionModifierData*) md;
+                       /*
+                       // TODO: CollisionModifier should use pointcache 
+                       // + have proper reset events before enabling this
+                       collmd->x = newdataadr(fd, collmd->x);
+                       collmd->xnew = newdataadr(fd, collmd->xnew);
+                       collmd->mfaces = newdataadr(fd, collmd->mfaces);
+                       
+                       collmd->current_x = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_x");
+                       collmd->current_xnew = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_xnew");
+                       collmd->current_v = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_v");
+                       */
+                       
+                       collmd->x = NULL;
+                       collmd->xnew = NULL;
+                       collmd->current_x = NULL;
+                       collmd->current_xnew = NULL;
+                       collmd->current_v = NULL;
+                       collmd->time = -1;
+                       collmd->numverts = 0;
+                       collmd->tree = NULL;
+                       collmd->mfaces = NULL;
+                       
+               }
+               else if (md->type==eModifierType_Hook) {
                        HookModifierData *hmd = (HookModifierData*) md;
 
                        hmd->indexar= newdataadr(fd, hmd->indexar);
                        HookModifierData *hmd = (HookModifierData*) md;
 
                        hmd->indexar= newdataadr(fd, hmd->indexar);
@@ -3149,7 +3190,6 @@ static void direct_link_object(FileData *fd, Object *ob)
                sb->bpoint= NULL;       // init pointers so it gets rebuilt nicely
                sb->bspring= NULL;
                sb->scratch= NULL;
                sb->bpoint= NULL;       // init pointers so it gets rebuilt nicely
                sb->bspring= NULL;
                sb->scratch= NULL;
-
                /* although not used anymore */
                /* still have to be loaded to be compatible with old files */
                sb->keys= newdataadr(fd, sb->keys);
                /* although not used anymore */
                /* still have to be loaded to be compatible with old files */
                sb->keys= newdataadr(fd, sb->keys);