Fixup for MESH_OT_vertices_smooth_laplacian
authorDalai Felinto <dfelinto@gmail.com>
Fri, 31 Aug 2018 20:00:21 +0000 (17:00 -0300)
committerDalai Felinto <dfelinto@gmail.com>
Fri, 31 Aug 2018 20:02:37 +0000 (17:02 -0300)
Failing to repeat should return, but continue the object loop.
Should test for selected vertex, not face.

source/blender/editors/mesh/editmesh_tools.c

index cc17a6c86dff2bfe5662e967b0f3d0bdf0dccf3f..1cc1330abe14d5d607fe60ef8a462938de92cf9f 100644 (file)
@@ -2274,7 +2274,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
                Mesh *me = obedit->data;
                bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
 
-               if (em->bm->totfacesel == 0){
+               if (em->bm->totvertsel == 0) {
                        tot_unselected++;
                        tot_invalid++;
                        continue;
@@ -2300,15 +2300,20 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
                        EDBM_verts_mirror_cache_begin(em, 0, false, true, use_topology);
                }
 
+               bool failed_repeat_loop = false;
                for (int i = 0; i < repeat; i++) {
                        if (!EDBM_op_callf(
                                em, op,
                                "smooth_laplacian_vert verts=%hv lambda_factor=%f lambda_border=%f use_x=%b use_y=%b use_z=%b preserve_volume=%b",
                                BM_ELEM_SELECT, lambda_factor, lambda_border, usex, usey, usez, preserve_volume))
                        {
-                               return OPERATOR_CANCELLED;
+                               failed_repeat_loop = true;
+                               break;
                        }
                }
+               if (failed_repeat_loop) {
+                       continue;
+               }
 
                /* Apply mirror. */
                if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
@@ -2321,7 +2326,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
        MEM_freeN(objects);
 
        if (tot_unselected == objects_len){
-               BKE_report(op->reports, RPT_WARNING, "No selected faces");
+               BKE_report(op->reports, RPT_WARNING, "No selected vertex");
                return OPERATOR_CANCELLED;
        }
        else if (tot_invalid == objects_len){