For for [#20330] Can't open a file made in 2.49
authorMatt Ebb <matt@mke3.net>
Fri, 11 Dec 2009 00:09:58 +0000 (00:09 +0000)
committerMatt Ebb <matt@mke3.net>
Fri, 11 Dec 2009 00:09:58 +0000 (00:09 +0000)
Hair clothsim internal_friction wasn't being initialised correctly.

source/blender/blenkernel/intern/cloth.c
source/blender/blenloader/intern/readfile.c

index 6c4c7daea7fa683b8243791af9aafbcbc7aed0c0..dc9a70f276798b1d61968f5e68a187950bbb6c0f 100644 (file)
@@ -154,6 +154,7 @@ void cloth_init ( ClothModifierData *clmd )
        clmd->sim_parms->defgoal = 0.0f;
        clmd->sim_parms->goalspring = 1.0f;
        clmd->sim_parms->goalfrict = 0.0f;
+       clmd->sim_parms->velocity_smooth = 0.0f;
 
        if(!clmd->sim_parms->effector_weights)
                clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
index 860225b7dc33743412bb69b74381b93abd0d1c99..eada820ba89d34391c9eed19682370b6b66f17c2 100644 (file)
@@ -10184,6 +10184,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                sce->toolsettings->particle.selectmode= SCE_SELECT_PATH;
        }
 
+       {
+               Object *ob;
+               
+               /* properly initialise hair clothsim data on old files */
+               for(ob = main->object.first; ob; ob = ob->id.next) {
+                       ModifierData *md;
+                       for(md= ob->modifiers.first; md; md= md->next) {
+                               if (md->type == eModifierType_Cloth) {
+                                       ClothModifierData *clmd = (ClothModifierData *)md;
+                                       if (clmd->sim_parms->velocity_smooth < 0.01f)
+                                               clmd->sim_parms->velocity_smooth = 0.f;
+                               }
+                       }
+               }
+       }
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */