From e97f979f73ffb1872a7bb388efab883b47544e78 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 22 Aug 2013 17:56:08 +0000 Subject: new bmesh operator bisect_plane, cuts a mesh in half, takes a user defined plane as an argument, handles concave ngons which need multiple cuts. --- source/blender/bmesh/intern/bmesh_opdefines.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source/blender/bmesh/intern/bmesh_opdefines.c') diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index d83d3b738eb..14a7bee5d15 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1117,6 +1117,29 @@ static BMOpDefine bmo_subdivide_edgering_def = { BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, }; +/* + * Bisect Plane. + * + * Bisects the mesh by a plane (cut the mesh in half). + */ +static BMOpDefine bmo_bisect_plane_def = { + "bisect_plane", + /* slots_in */ + {{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, + {"dist", BMO_OP_SLOT_FLT}, /* minimum distance when testing if a vert is exactly on the plane */ + {"plane_co", BMO_OP_SLOT_VEC}, /* point on the plane */ + {"plane_no", BMO_OP_SLOT_VEC}, /* direction of the plane */ + {"clear_outer", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the positive side of the plane */ + {"clear_inner", BMO_OP_SLOT_BOOL}, /* when enabled. remove all geometry on the negative side of the plane */ + {{'\0'}}, + }, + {{"geom_cut.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE}}, /* output new geometry from the cut */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input and output geometry (result of cut) */ + {{'\0'}}}, + bmo_bisect_plane_exec, + BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, +}; + /* * Delete Geometry. * @@ -1835,6 +1858,7 @@ const BMOpDefine *bmo_opdefines[] = { &bmo_split_edges_def, &bmo_subdivide_edges_def, &bmo_subdivide_edgering_def, + &bmo_bisect_plane_def, &bmo_symmetrize_def, &bmo_transform_def, &bmo_translate_def, -- cgit v1.2.3