From 3d851bfd5bf4fd486d8e9b8baec3d184dd4be939 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 20 Apr 2012 10:52:13 +0000 Subject: knife tool modifications from user freedback it seems there are 2 use cases, both valid. * Select geometry and cut the selection in half (as 2.4x worked) * Point-to-point define the faces to cut, dont cut through everything (only cut what you see). With the second, since you are already selecting the edges to cut and snapping to them. only cutting the selecting is limiting/annoying. Modifying these options while the knife tool runs doesn't work well, so expose under 2 keys, K, Shift-K. --- source/blender/editors/mesh/editmesh_bvh.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/mesh/editmesh_bvh.c') diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c index 8be0cc0aa36..6155ad1be1c 100644 --- a/source/blender/editors/mesh/editmesh_bvh.c +++ b/source/blender/editors/mesh/editmesh_bvh.c @@ -104,8 +104,16 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit) tree->bm = em->bm; tree->epsilon = FLT_EPSILON * 2.0f; tree->flag = flag; - - if (flag & BMBVH_RESPECT_HIDDEN) { + + if (flag & (BMBVH_RESPECT_SELECT)) { + tottri = 0; + for (i = 0; i < em->tottri; i++) { + if (BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_SELECT)) { + tottri++; + } + } + } + else if (flag & (BMBVH_RESPECT_HIDDEN)) { tottri = 0; for (i = 0; i < em->tottri; i++) { if (!BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_HIDDEN)) { @@ -146,7 +154,14 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit) for (i = 0; i < em->tottri; i++) { - if (flag & BMBVH_RESPECT_HIDDEN) { + + if (flag & BMBVH_RESPECT_SELECT) { + /* note, the arrays wont allign now! take care */ + if (!BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_SELECT)) { + continue; + } + } + else if (flag & BMBVH_RESPECT_HIDDEN) { /* note, the arrays wont allign now! take care */ if (BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_HIDDEN)) { continue; -- cgit v1.2.3