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>2015-05-22 11:12:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-05-22 11:14:03 +0300
commited2cb8de2fa9bff1cfab737ca8e9e92de2320cca (patch)
treea4064ea8f1d1d8f530076bf0c89402e990b7ff0a /source/blender/bmesh/operators/bmo_join_triangles.c
parent476feb622cd440e378533eddb063e00dc4e2a906 (diff)
Fix for join faces ignoring angle limit
Angle limit for join-faces was more advice then actual limit. Now joining entire selection, gives assurance that no faces above the limit will be merged. The purpose of this was to allow users to isolate 2 faces and always join them. Instead, support this by bypassing limit only when its not set and 2 faces are selected.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_join_triangles.c')
-rw-r--r--source/blender/bmesh/operators/bmo_join_triangles.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index 7fef9e1190a..76856f6d1e0 100644
--- a/source/blender/bmesh/operators/bmo_join_triangles.c
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -47,7 +47,8 @@
/* assumes edges are validated before reaching this poin */
static float measure_facepair(
const float v1[3], const float v2[3],
- const float v3[3], const float v4[3], float limit)
+ const float v3[3], const float v4[3],
+ const float limit)
{
/* gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make */
/* Note: this is more complicated than it needs to be and should be cleaned up.. */
@@ -199,7 +200,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
const bool do_tf = do_uv; /* texture face, make make its own option eventually */
const bool do_vcol = BMO_slot_bool_get(op->slots_in, "cmp_vcols");
const bool do_mat = BMO_slot_bool_get(op->slots_in, "cmp_materials");
- const float limit = BMO_slot_float_get(op->slots_in, "limit");
+ float limit;
BMIter iter;
BMOIter siter;
@@ -210,6 +211,11 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
unsigned i, totedge;
unsigned int totedge_tag = 0;
+ limit = BMO_slot_float_get(op->slots_in, "limit");
+ if (limit == DEG2RADF(180.0f)) {
+ limit = FLT_MAX;
+ }
+
/* flag all edges of all input face */
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
if (f->len == 3) {
@@ -308,39 +314,5 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
}
}
- /* join 2-tri islands */
- BM_ITER_MESH_MUTABLE (e, e_next, &iter, bm, BM_EDGES_OF_MESH) {
- if (BMO_elem_flag_test(bm, e, EDGE_MARK)) {
- BMLoop *l_a, *l_b;
- BMFace *f_a, *f_b;
-
- /* ok, this edge wasn't merged, check if it's
- * in a 2-tri-pair island, and if so merge */
- l_a = e->l;
- l_b = e->l->radial_next;
-
- f_a = l_a->f;
- f_b = l_b->f;
-
- /* check the other 2 edges in both tris are untagged */
- if ((f_a->len == 3 && f_b->len == 3) &&
- (BMO_elem_flag_test(bm, l_a->next->e, EDGE_MARK) == false) &&
- (BMO_elem_flag_test(bm, l_a->prev->e, EDGE_MARK) == false) &&
- (BMO_elem_flag_test(bm, l_b->next->e, EDGE_MARK) == false) &&
- (BMO_elem_flag_test(bm, l_b->prev->e, EDGE_MARK) == false) &&
- /* check for faces that use same verts, this is supported but raises an error
- * and cancels the operation when performed from editmode, since this is only
- * two triangles we only need to compare a single vertex */
- (LIKELY(l_a->prev->v != l_b->prev->v)))
- {
- BMFace *f_new;
- f_new = BM_faces_join_pair(bm, f_a, f_b, e, true);
- if (f_new) {
- BMO_elem_flag_enable(bm, f_new, FACE_OUT);
- }
- }
- }
- }
-
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT);
}