diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-12-06 23:06:11 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-12-06 23:07:39 +0300 |
commit | 8d09eecc50480158a916d3e7796a0dc7760de9c5 (patch) | |
tree | cd89e8ac9c7ea287650b77bfe68ef35a1dcc7617 | |
parent | a78199332b64027c4386ac82547a0771e6c5aaed (diff) |
Fix (unreported) Ocean modifier assuming all its faces are quads.
Would be true in most cases (and in particular with own generated geometry),
but in case one would be using original geometry this could have crashed badly.
-rw-r--r-- | source/blender/modifiers/intern/MOD_ocean.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index bb18ec5a97d..b82725a08e7 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -479,9 +479,10 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob, if (omd->flag & MOD_OCEAN_GENERATE_FOAM) { if (CustomData_number_of_layers(&dm->loopData, CD_MLOOPCOL) < MAX_MCOL) { const int num_polys = dm->getNumPolys(dm); + const int num_loops = dm->getNumLoops(dm); MLoop *mloops = dm->getLoopArray(dm); MLoopCol *mloopcols = CustomData_add_layer_named( - &dm->loopData, CD_MLOOPCOL, CD_CALLOC, NULL, num_polys * 4, omd->foamlayername); + &dm->loopData, CD_MLOOPCOL, CD_CALLOC, NULL, num_loops, omd->foamlayername); if (mloopcols) { /* unlikely to fail */ MPoly *mpolys = dm->getPolyArray(dm); |