[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55306] trunk/blender/source/blender/ editors/mesh/editmesh_knife.c: knife project:
Campbell Barton
ideasman42 at gmail.com
Fri Mar 15 15:43:09 CET 2013
Revision: 55306
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55306
Author: campbellbarton
Date: 2013-03-15 14:43:09 +0000 (Fri, 15 Mar 2013)
Log Message:
-----------
knife project:
- selecting faces inside the cut now works properly
- improve epsilon for detecing if faces are inside a cut (still not perfect)
Modified Paths:
--------------
trunk/blender/source/blender/editors/mesh/editmesh_knife.c
Modified: trunk/blender/source/blender/editors/mesh/editmesh_knife.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_knife.c 2013-03-15 14:32:29 UTC (rev 55305)
+++ trunk/blender/source/blender/editors/mesh/editmesh_knife.c 2013-03-15 14:43:09 UTC (rev 55306)
@@ -3279,7 +3279,10 @@
static bool edbm_mesh_knife_face_isect(ARegion *ar, LinkNode *polys, BMFace *f, float projmat[4][4])
{
- float co[3];
+ float co_a[3];
+ float co_b[3];
+ float co_ss_a[2];
+ float co_ss_b[2];
float co_ss[2];
{
@@ -3289,11 +3292,14 @@
l = BM_FACE_FIRST_LOOP(f);
BM_loop_calc_face_tangent(l, tangent);
/* get a point inside the face (tiny offset) - we could be more clever here */
- mul_v3_fl(tangent, 0.02f);
- add_v3_v3v3(co, l->v->co, tangent);
+
+ copy_v3_v3(co_a, l->v->co);
+ add_v3_v3v3(co_b, co_a, tangent);
}
- ED_view3d_project_float_v3_m4(ar, co, co_ss, projmat);
+ ED_view3d_project_float_v3_m4(ar, co_a, co_ss_a, projmat);
+ ED_view3d_project_float_v3_m4(ar, co_b, co_ss_b, projmat);
+ interp_v2_v2v2(co_ss, co_ss_a, co_ss_b, 0.005f);
/* check */
{
@@ -3413,11 +3419,18 @@
int found = false;
do {
- if (BM_elem_flag_test(l_iter, BM_ELEM_TAG) != false) {
- found = true;
- break;
+ if (BM_elem_flag_test(l_iter->e, BM_ELEM_TAG) != false) {
+ /* now check if the adjacent faces us tagged */
+ BMLoop *l_radial_iter = l_iter->radial_next;
+ if (l_radial_iter != l_iter) {
+ do {
+ if (BM_elem_flag_test(l_radial_iter->f, BM_ELEM_TAG)) {
+ found = true;
+ }
+ } while ((l_radial_iter = l_radial_iter->radial_next) != l_iter && (found == false));
+ }
}
- } while ((l_iter = l_iter->next) != l_first);
+ } while ((l_iter = l_iter->next) != l_first && (found == false));
if (found) {
// if (edbm_mesh_knife_face_isect(kcd->ar, polys, f, projmat))
More information about the Bf-blender-cvs
mailing list