[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44694] trunk/blender/source/blender/ editors/mesh/bmesh_tools.c: use a better method if picking the rip vertex to use, rather then finding the edge closest to the mouse, find the face corner attached to the vert - thats closest to the mouse, this way ripping gives predictable outcome.
Campbell Barton
ideasman42 at gmail.com
Wed Mar 7 05:20:41 CET 2012
Revision: 44694
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44694
Author: campbellbarton
Date: 2012-03-07 04:20:30 +0000 (Wed, 07 Mar 2012)
Log Message:
-----------
use a better method if picking the rip vertex to use, rather then finding the edge closest to the mouse, find the face corner attached to the vert - thats closest to the mouse, this way ripping gives predictable outcome.
Modified Paths:
--------------
trunk/blender/source/blender/editors/mesh/bmesh_tools.c
Modified: trunk/blender/source/blender/editors/mesh/bmesh_tools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/bmesh_tools.c 2012-03-07 03:58:23 UTC (rev 44693)
+++ trunk/blender/source/blender/editors/mesh/bmesh_tools.c 2012-03-07 04:20:30 UTC (rev 44694)
@@ -2341,7 +2341,7 @@
BMesh *bm = em->bm;
BMOperator bmop;
BMOIter siter;
- BMIter iter, eiter;
+ BMIter iter, eiter, liter;
BMLoop *l;
BMEdge *e, *e2;
BMVert *v, *ripvert = NULL;
@@ -2512,6 +2512,8 @@
if (singlesel) {
BMVert *v_best = NULL;
+ float l_prev_co[3], l_next_co[3], l_corner_co[3];
+ float scale;
/* not good enough! - original vert may not be attached to the closest edge */
#if 0
@@ -2525,8 +2527,20 @@
/* disable by default, re-enable winner at end */
BM_elem_select_set(bm, v, FALSE);
- BM_ITER(e, &eiter, bm, BM_EDGES_OF_VERT, v) {
- d = mesh_rip_edgedist(ar, projectMat, e->v1->co, e->v2->co, fmval);
+ BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v) {
+ /* calculate a point in the face, rather then calculate the middle,
+ * make a vector pointing between the 2 edges attached to this loop */
+ sub_v3_v3v3(l_prev_co, l->prev->v->co, l->v->co);
+ sub_v3_v3v3(l_next_co, l->next->v->co, l->v->co);
+
+ scale = normalize_v3(l_prev_co) + normalize_v3(l_next_co);
+ mul_v3_fl(l_prev_co, scale);
+ mul_v3_fl(l_next_co, scale);
+
+ add_v3_v3v3(l_corner_co, l_prev_co, l_next_co);
+ add_v3_v3(l_corner_co, l->v->co);
+
+ d = mesh_rip_edgedist(ar, projectMat, l->v->co, l_corner_co, fmval);
if (d < dist) {
v_best = v;
dist = d;
More information about the Bf-blender-cvs
mailing list