Temporary fix for loading crash of .blends with cached frames. Also fixed some goal...
[blender.git] / source / blender / blenkernel / intern / cloth.c
index 47925e352eb1fc4cfa3c2298a408761dee861624..14370b59d68f54d07da227ca81f875c30845b5d9 100644 (file)
@@ -913,13 +913,10 @@ static void cloth_apply_vgroup(ClothModifierData *clmd, DerivedMesh *dm, short v
        verts = clothObj->verts;
 
        for (i = 0; i < numverts; i++, verts++)
-       {                               
-               /* so this will definily be below SOFTGOALSNAP */
-               verts->goal= 0.0f; 
-               
+       {                                       
                // LATER ON, support also mass painting here
                if(clmd->sim_parms.flags & CSIMSETT_FLAG_GOAL) 
-               {                       
+               {                                               
                        dvert = dm->getVertData(dm, i, CD_MDEFORMVERT);
                        if(dvert)       
                        {               
@@ -1211,7 +1208,12 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
                                Mat4MulVecfl(ob->obmat, verts->x);
 
                                verts->mass = clmd->sim_parms.mass;
-                               verts->goal= clmd->sim_parms.defgoal;
+                               
+                               if(clmd->sim_parms.flags & CSIMSETT_FLAG_GOAL) 
+                                       verts->goal= clmd->sim_parms.defgoal;
+                               else
+                                       verts->goal= 0.0f;
+                               
                                verts->flags = 0;
                                VECCOPY(verts->xold, verts->x);
                                VECCOPY(verts->xconst, verts->x);