fix for smooth not working with mirror clip.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 10 Feb 2012 15:25:12 +0000 (15:25 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 10 Feb 2012 15:25:12 +0000 (15:25 +0000)
source/blender/bmesh/operators/utils.c
source/blender/editors/mesh/bmesh_tools.c

index 4ba7ed96324c26e05efb44072e8ff1b7c2e5f3bb..50b97ba44619852d1d77265c4880dbe65e20d63f 100644 (file)
@@ -421,11 +421,11 @@ void bmesh_vertexsmooth_exec(BMesh *bm, BMOperator *op)
                mul_v3_fl(co, 1.0f / (float)j);
                mid_v3_v3v3(co, co, v->co);
 
-               if (clipx && fabsf(v->co[0]) < clipdist)
+               if (clipx && fabsf(v->co[0]) <= clipdist)
                        co[0] = 0.0f;
-               if (clipy && fabsf(v->co[1]) < clipdist)
+               if (clipy && fabsf(v->co[1]) <= clipdist)
                        co[1] = 0.0f;
-               if (clipz && fabsf(v->co[2]) < clipdist)
+               if (clipz && fabsf(v->co[2]) <= clipdist)
                        co[2] = 0.0f;
 
                i++;
index c31d24a2d8b6256be97876c696bc8b9d11d3d3f5..1e268cd58fdc1ef900bcd0cf25200c092edd5a74 100644 (file)
@@ -1608,6 +1608,7 @@ static int do_smooth_vertex(bContext *C, wmOperator *op)
        ModifierData *md;
        int mirrx=0, mirry=0, mirrz=0;
        int i, repeat;
+       float clipdist = 0.0f;
 
        /* mirror before smooth */
        if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
@@ -1628,6 +1629,8 @@ static int do_smooth_vertex(bContext *C, wmOperator *op)
                                        mirry = 1;
                                if (mmd->flag & MOD_MIR_AXIS_Z)
                                        mirrz = 1;
+
+                               clipdist = mmd->tolerance;
                        }
                }
        }
@@ -1637,8 +1640,9 @@ static int do_smooth_vertex(bContext *C, wmOperator *op)
                repeat = 1;
        
        for (i=0; i<repeat; i++) {
-               if (!EDBM_CallOpf(em, op, "vertexsmooth verts=%hv mirror_clip_x=%d mirror_clip_y=%d mirror_clip_z=%d",
-                                 BM_SELECT, mirrx, mirry, mirrz))
+               if (!EDBM_CallOpf(em, op,
+                                 "vertexsmooth verts=%hv mirror_clip_x=%d mirror_clip_y=%d mirror_clip_z=%d clipdist=%f",
+                                 BM_SELECT, mirrx, mirry, mirrz, clipdist))
                {
                        return OPERATOR_CANCELLED;
                }