diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 14:19:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 14:19:58 +0400 |
commit | 59b082dc272feb6567a73a45b9eb9a742e4131d7 (patch) | |
tree | 623b73b72fe2aac19e21ee1da44a97d06720383c /source/blender/bmesh/operators/bmo_bisect_plane.c | |
parent | 5b5cae86b72776375f1b01dc555d98429e5c5782 (diff) |
fix for error in recetly added bisect operator, in rare cases it could attempt to remove vertices twice.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_bisect_plane.c')
-rw-r--r-- | source/blender/bmesh/operators/bmo_bisect_plane.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/source/blender/bmesh/operators/bmo_bisect_plane.c b/source/blender/bmesh/operators/bmo_bisect_plane.c index 575e6888df0..6ebbf7d6a72 100644 --- a/source/blender/bmesh/operators/bmo_bisect_plane.c +++ b/source/blender/bmesh/operators/bmo_bisect_plane.c @@ -72,27 +72,19 @@ void bmo_bisect_plane_exec(BMesh *bm, BMOperator *op) if (clear_outer || clear_inner) { BMOIter siter; BMVert *v; - float plane_alt[4]; - - copy_v3_v3(plane_alt, plane); - - if (clear_outer) { - plane_alt[3] = plane[3] - dist; - - BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) { - if (plane_point_side_v3(plane_alt, v->co) > 0.0f) { - BM_vert_kill(bm, v); - } - } - } - - if (clear_inner) { - plane_alt[3] = plane[3] + dist; - - BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) { - if (plane_point_side_v3(plane_alt, v->co) < 0.0f) { - BM_vert_kill(bm, v); - } + float plane_inner[4]; + float plane_outer[4]; + + copy_v3_v3(plane_outer, plane); + copy_v3_v3(plane_inner, plane); + plane_outer[3] = plane[3] - dist; + plane_inner[3] = plane[3] + dist; + + BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) { + if ((clear_outer && plane_point_side_v3(plane_outer, v->co) > 0.0f) || + (clear_inner && plane_point_side_v3(plane_inner, v->co) < 0.0f)) + { + BM_vert_kill(bm, v); } } } |