diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-05 16:19:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-05 16:21:18 +0300 |
commit | 67ec0ef277d862ff69ff667566502045c1b93493 (patch) | |
tree | 618d00adbb61adb6a0751f291db9b80f297a225e /source/blender/bmesh | |
parent | 2f87db681ad9fe161573e858ed7486e00a9f77f1 (diff) |
Editmesh: report a warning when fill fails
also prevent assert with zero normal
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/operators/bmo_triangulate.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 5e25f57a3d1..cb9ba5e361c 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -183,7 +183,11 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) calc_winding = false; } - normalize_v3(normal); + /* in this case we almost certainly have degenerate geometry, + * better set a fallback value as a last resort */ + if (UNLIKELY(normalize_v3(normal) == 0.0f)) { + normal[2] = 1.0f; + } BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, normal); |