fix for logical errors
authorCampbell Barton <ideasman42@gmail.com>
Sun, 7 Oct 2012 10:01:54 +0000 (10:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 7 Oct 2012 10:01:54 +0000 (10:01 +0000)
- range check on hair_velocity_smoothing() was off by one.
- cloth sim parm's are used before NULL check in readfile.c

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

index ebb95a6561e2fb34a0a99a8b8a7d0b799fc7ca0a..2b23e8450aefb8cbbc4ee88ea1d6bb4f75e30b79 100644 (file)
@@ -1450,7 +1450,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
                i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0);
                j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1);
                k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2);
                i = HAIR_GRID_INDEX(lX[v], gmin, gmax, 0);
                j = HAIR_GRID_INDEX(lX[v], gmin, gmax, 1);
                k = HAIR_GRID_INDEX(lX[v], gmin, gmax, 2);
-               if (i < 0 || j < 0 || k < 0 || i > 10 || j >= 10 || k >= 10)
+               if (i < 0 || j < 0 || k < 0 || i >= 10 || j >= 10 || k >= 10)
                        continue;
 
                grid[i][j][k].velocity[0] += lV[v][0];
                        continue;
 
                grid[i][j][k].velocity[0] += lV[v][0];
index 26d9fb9e8294d236590e7ca2b035d92e23194bc4..fdb68d4cc1757e048372abac4439e135403e2ffc 100644 (file)
@@ -3567,10 +3567,10 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                        psys->clmd->clothObject = NULL;
                        
                        psys->clmd->sim_parms= newdataadr(fd, psys->clmd->sim_parms);
                        psys->clmd->clothObject = NULL;
                        
                        psys->clmd->sim_parms= newdataadr(fd, psys->clmd->sim_parms);
-                       psys->clmd->sim_parms->effector_weights = NULL;
                        psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms);
                        
                        if (psys->clmd->sim_parms) {
                        psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms);
                        
                        if (psys->clmd->sim_parms) {
+                               psys->clmd->sim_parms->effector_weights = NULL;
                                if (psys->clmd->sim_parms->presets > 10)
                                        psys->clmd->sim_parms->presets = 0;
                        }
                                if (psys->clmd->sim_parms->presets > 10)
                                        psys->clmd->sim_parms->presets = 0;
                        }