Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-07 10:31:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-07 10:31:54 +0400
commitcdc9e553c13741807208fa7e3a1d7a330bdf6b52 (patch)
treebe952dd78a50c12bf2b482e96fb1767f17a28690 /source/blender/editors/mesh
parentacfff7a65f551f8d7313a93137b1beb4c338ff27 (diff)
minor improvements to rip
- rip tool didnt select the best edge to rip for wire verts (no connected faces) - ripping one vert with 2 edges connected didnt work.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c55
1 files changed, 40 insertions, 15 deletions
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index 8325e0a50d4..03ee8320567 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -380,6 +380,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
float dist = FLT_MAX;
float d;
+ int is_wire;
BMEditSelection ese;
int totboundary_edge = 0;
@@ -403,6 +404,8 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
if (!v)
return OPERATOR_CANCELLED;
+ is_wire = BM_vert_is_wire(v);
+
e2 = NULL;
if (v->e) {
@@ -430,8 +433,11 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
* - we cant find an edge - this means we are ripping a faces vert that is connected to other
* geometry only at the vertex.
* - the boundary edge total is greater then 2,
- * in this case edge split _can_ work but we get far nicer results if we use this special case. */
- if (totboundary_edge > 2) {
+ * in this case edge split _can_ work but we get far nicer results if we use this special case.
+ * - there are only 2 edges but we are a wire vert. */
+ if ((is_wire == FALSE && totboundary_edge > 2) ||
+ (is_wire == TRUE && totboundary_edge > 1))
+ {
BMVert **vout;
int vout_len;
@@ -458,21 +464,40 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
dist = FLT_MAX;
- for (i = 0; i < vout_len; i++) {
- BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
- if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
- float l_mid_co[3];
- BM_loop_calc_face_tangent(l, l_mid_co);
+ if (is_wire) {
+ for (i = 0; i < vout_len; i++) {
+ BM_ITER_ELEM (e, &iter, vout[i], BM_EDGES_OF_VERT) {
+ if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
+ float e_mid_co[3];
+ mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co);
- /* scale to average of surrounding edge size, only needs to be approx */
- mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f);
- add_v3_v3(l_mid_co, v->co);
+ d = edbm_rip_rip_edgedist(ar, projectMat, v->co, e_mid_co, fmval);
- d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval);
-
- if (d < dist) {
- dist = d;
- vi_best = i;
+ if (d < dist) {
+ dist = d;
+ vi_best = i;
+ }
+ }
+ }
+ }
+ }
+ else {
+ for (i = 0; i < vout_len; i++) {
+ BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
+ if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
+ float l_mid_co[3];
+ BM_loop_calc_face_tangent(l, l_mid_co);
+
+ /* scale to average of surrounding edge size, only needs to be approx */
+ mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f);
+ add_v3_v3(l_mid_co, v->co);
+
+ d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval);
+
+ if (d < dist) {
+ dist = d;
+ vi_best = i;
+ }
}
}
}