Revision: 30587 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30587 Author: blendix Date: 2010-07-21 17:22:11 +0200 (Wed, 21 Jul 2010)
Log Message: ----------- Fix #20196: division by zero in edge slide with two overlapping loops. Modified Paths: -------------- trunk/blender/source/blender/editors/transform/transform.c trunk/blender/source/blender/editors/transform/transform_input.c Modified: trunk/blender/source/blender/editors/transform/transform.c =================================================================== --- trunk/blender/source/blender/editors/transform/transform.c 2010-07-21 14:13:48 UTC (rev 30586) +++ trunk/blender/source/blender/editors/transform/transform.c 2010-07-21 15:22:11 UTC (rev 30587) @@ -4780,10 +4780,11 @@ //Non prop code look = vertlist; while(look) { - float newlen; + float newlen, edgelen; ev = look->link; tempsv = BLI_ghash_lookup(vertgh,ev); - newlen = (len / len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co)); + edgelen = len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co); + newlen = (edgelen != 0.0f)? (len / edgelen): 0.0f; if(newlen > 1.0) {newlen = 1.0;} if(newlen < 0.0) {newlen = 0.0;} if(flip == 0) { Modified: trunk/blender/source/blender/editors/transform/transform_input.c =================================================================== --- trunk/blender/source/blender/editors/transform/transform_input.c 2010-07-21 14:13:48 UTC (rev 30586) +++ trunk/blender/source/blender/editors/transform/transform_input.c 2010-07-21 15:22:11 UTC (rev 30587) @@ -197,17 +197,17 @@ mdx = (mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f) - data[2]; mdy = (mi->precision_mval[1] + (float)(mval[1] - mi->precision_mval[1]) / 10.0f) - data[3]; - distance = (mdx*dx + mdy*dy) / length; + distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; } else { short mdx, mdy; mdx = mval[0] - data[2]; mdy = mval[1] - data[3]; - distance = (mdx*dx + mdy*dy) / length; + distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; } - output[0] = distance / length; + output[0] = (length != 0.0f)? distance / length: 0.0f; } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs