diff options
Diffstat (limited to 'source/blender/editors/mesh/editmesh_tools.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 656 |
1 files changed, 332 insertions, 324 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 36a1d30c85e..13660a47248 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -97,10 +97,10 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int cuts = RNA_int_get(op->ptr, "number_cuts"); + const int cuts = RNA_int_get(op->ptr, "number_cuts"); float smooth = 0.292f * RNA_float_get(op->ptr, "smoothness"); - float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f; - float along_normal = RNA_float_get(op->ptr, "fractal_along_normal"); + const float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f; + const float along_normal = RNA_float_get(op->ptr, "fractal_along_normal"); if (RNA_boolean_get(op->ptr, "quadtri") && RNA_enum_get(op->ptr, "quadcorner") == SUBD_STRAIGHT_CUT) @@ -112,10 +112,10 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op) smooth, fractal, along_normal, cuts, SUBDIV_SELECT_ORIG, RNA_enum_get(op->ptr, "quadcorner"), - RNA_boolean_get(op->ptr, "quadtri"), TRUE, FALSE, + RNA_boolean_get(op->ptr, "quadtri"), true, false, RNA_int_get(op->ptr, "seed")); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -168,14 +168,14 @@ static int edbm_unsubdivide_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; - int iterations = RNA_int_get(op->ptr, "iterations"); + const int iterations = RNA_int_get(op->ptr, "iterations"); EDBM_op_init(em, &bmop, op, "unsubdivide verts=%hv iterations=%i", BM_ELEM_SELECT, iterations); BMO_op_exec(em->bm, &bmop); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return 0; } @@ -184,7 +184,7 @@ static int edbm_unsubdivide_exec(bContext *C, wmOperator *op) } EDBM_selectmode_flush(em); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -247,7 +247,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c BMO_op_exec(em->bm, &bmop); BMO_ITER (f, &siter, bmop.slots_out, "faces.out", BM_FACE) { - BM_face_select_set(em->bm, f, TRUE); + BM_face_select_set(em->bm, f, true); /* set face vertex normals to face normal */ BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { @@ -255,7 +255,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c } } - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return 0; } @@ -273,9 +273,9 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char EDBM_flag_disable_all(em, BM_ELEM_SELECT); BMO_op_exec(em->bm, &bmop); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, true); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return 0; } @@ -290,12 +290,12 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char EDBM_op_init(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag); /* deselect original verts */ - BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "verts", BM_VERT, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "verts", BM_VERT, BM_ELEM_SELECT, true); BMO_op_exec(em->bm, &bmop); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return 0; } @@ -384,7 +384,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, zero_v3(nor); BMO_ITER (ele, &siter, extop.slots_out, "geom.out", BM_ALL) { - BM_elem_select_set(bm, ele, TRUE); + BM_elem_select_set(bm, ele, true); if (ele->head.htype == BM_FACE) { f = (BMFace *)ele; @@ -409,8 +409,8 @@ static short edbm_extrude_vert(Object *obedit, BMEditMesh *em, const char hflag, BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(eed, hflag)) { if (hflag & BM_ELEM_SELECT) { - BM_vert_select_set(em->bm, eed->v1, TRUE); - BM_vert_select_set(em->bm, eed->v2, TRUE); + BM_vert_select_set(em->bm, eed->v1, true); + BM_vert_select_set(em->bm, eed->v2, true); } BM_elem_flag_enable(eed->v1, hflag & ~BM_ELEM_SELECT); @@ -419,7 +419,7 @@ static short edbm_extrude_vert(Object *obedit, BMEditMesh *em, const char hflag, else { if (BM_elem_flag_test(eed->v1, hflag) && BM_elem_flag_test(eed->v2, hflag)) { if (hflag & BM_ELEM_SELECT) { - BM_edge_select_set(em->bm, eed, TRUE); + BM_edge_select_set(em->bm, eed, true); } BM_elem_flag_enable(eed, hflag & ~BM_ELEM_SELECT); @@ -436,9 +436,9 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(obedit); RegionView3D *rv3d = CTX_wm_region_view3d(C); - int steps = RNA_int_get(op->ptr, "steps"); + const int steps = RNA_int_get(op->ptr, "steps"); - float offs = RNA_float_get(op->ptr, "offset"); + const float offs = RNA_float_get(op->ptr, "offset"); float dvec[3], tmat[3][3], bmat[3][3], nor[3] = {0.0, 0.0, 0.0}; short a; @@ -463,7 +463,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op) EDBM_mesh_normals_update(em); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -585,7 +585,7 @@ static int edbm_extrude_region_exec(bContext *C, wmOperator *op) * done.*/ EDBM_mesh_normals_update(em); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -616,7 +616,7 @@ static int edbm_extrude_verts_exec(bContext *C, wmOperator *op) edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -647,7 +647,7 @@ static int edbm_extrude_edges_exec(bContext *C, wmOperator *op) edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -678,7 +678,7 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op) edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT, nor); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -706,7 +706,7 @@ static int edbm_select_all_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int action = RNA_enum_get(op->ptr, "action"); + const int action = RNA_enum_get(op->ptr, "action"); switch (action) { case SEL_TOGGLE: @@ -784,8 +784,8 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w BMVert *v1; BMIter iter; float min[3], max[3]; - int done = FALSE; - short use_proj; + bool done = false; + bool use_proj; em_setup_viewcontext(C, &vc); @@ -800,13 +800,13 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w BM_ITER_MESH (v1, &iter, vc.em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v1, BM_ELEM_SELECT)) { minmax_v3v3_v3(min, max, v1->co); - done = TRUE; + done = true; } } /* call extrude? */ if (done) { - const short rot_src = RNA_boolean_get(op->ptr, "rotate_source"); + const bool rot_src = RNA_boolean_get(op->ptr, "rotate_source"); BMEdge *eed; float vec[3], cent[3], mat[3][3]; float nor[3] = {0.0, 0.0, 0.0}; @@ -816,7 +816,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w (float)event->mval[1]}; /* check for edges that are half selected, use for rotation */ - done = FALSE; + done = false; BM_ITER_MESH (eed, &iter, vc.em->bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { float co1[2], co2[2]; @@ -837,7 +837,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w nor[0] += (co2[1] - co1[1]); nor[1] += -(co2[0] - co1[0]); } - done = TRUE; + done = true; } } } @@ -920,10 +920,10 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w BMO_op_exec(vc.em->bm, &bmop); BMO_ITER (v1, &oiter, bmop.slots_out, "vert.out", BM_VERT) { - BM_vert_select_set(vc.em->bm, v1, TRUE); + BM_vert_select_set(vc.em->bm, v1, true); } - if (!EDBM_op_finish(vc.em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(vc.em, &bmop, op, true)) { return OPERATOR_CANCELLED; } } @@ -936,7 +936,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w * done. */ EDBM_mesh_normals_update(vc.em); - EDBM_update_generic(vc.em, TRUE, TRUE); + EDBM_update_generic(vc.em, true, true); return OPERATOR_FINISHED; } @@ -972,7 +972,7 @@ static int edbm_delete_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int type = RNA_enum_get(op->ptr, "type"); + const int type = RNA_enum_get(op->ptr, "type"); if (type == 0) { if (!EDBM_op_callf(em, op, "delete geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */ @@ -1001,7 +1001,7 @@ static int edbm_delete_exec(bContext *C, wmOperator *op) EDBM_flag_disable_all(em, BM_ELEM_SELECT); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -1034,7 +1034,7 @@ static int edbm_collapse_edge_exec(bContext *C, wmOperator *op) if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -1062,7 +1062,7 @@ static int edbm_collapse_edge_loop_exec(bContext *C, wmOperator *op) if (!EDBM_op_callf(em, op, "dissolve_edge_loop edges=%he", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -1274,11 +1274,11 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op) BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true); } - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -1309,7 +1309,7 @@ static int edbm_mark_seam(bContext *C, wmOperator *op) BMesh *bm = em->bm; BMEdge *eed; BMIter iter; - int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); /* auto-enable seams drawing */ if (clear == 0) { @@ -1333,7 +1333,7 @@ static int edbm_mark_seam(bContext *C, wmOperator *op) } ED_uvedit_live_unwrap(scene, obedit); - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1363,7 +1363,7 @@ static int edbm_mark_sharp(bContext *C, wmOperator *op) BMesh *bm = em->bm; BMEdge *eed; BMIter iter; - int clear = RNA_boolean_get(op->ptr, "clear"); + const bool clear = RNA_boolean_get(op->ptr, "clear"); /* auto-enable sharp edge drawing */ if (clear == 0) { @@ -1387,7 +1387,7 @@ static int edbm_mark_sharp(bContext *C, wmOperator *op) } } - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1423,13 +1423,13 @@ static int edbm_vert_connect(bContext *C, wmOperator *op) } BMO_op_exec(bm, &bmop); len = BMO_slot_get(bmop.slots_out, "edges.out")->len; - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } else { EDBM_selectmode_flush(em); /* so newly created edges get the selection state from the vertex */ - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } @@ -1463,11 +1463,11 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op) } BMO_op_exec(bm, &bmop); len = BMO_slot_get(bmop.slots_out, "edges.out")->len; - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } @@ -1500,13 +1500,13 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -1545,7 +1545,7 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op) if (!EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1566,8 +1566,8 @@ void MESH_OT_flip_normals(wmOperatorType *ot) } static const EnumPropertyItem direction_items[] = { - {FALSE, "CW", 0, "Clockwise", ""}, - {TRUE, "CCW", 0, "Counter Clockwise", ""}, + {false, "CW", 0, "Clockwise", ""}, + {true, "CCW", 0, "Counter Clockwise", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1579,7 +1579,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) BMOperator bmop; BMEdge *eed; BMIter iter; - const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw"); + const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw"); int tot = 0; if (em->bm->totedgesel == 0) { @@ -1614,19 +1614,19 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) /* avoids leaving old verts selected which can be a problem running multiple times, * since this means the edges become selected around the face which then attempt to rotate */ - BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, true); BMO_op_exec(em->bm, &bmop); /* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */ - BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, TRUE); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, true); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, true); EDBM_selectmode_flush(em); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -1646,7 +1646,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ - RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", ""); + RNA_def_boolean(ot->srna, "use_ccw", false, "Counter Clockwise", ""); } @@ -1657,7 +1657,7 @@ static int edbm_hide_exec(bContext *C, wmOperator *op) EDBM_mesh_hide(em, RNA_boolean_get(op->ptr, "unselected")); - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1687,7 +1687,7 @@ static int edbm_reveal_exec(bContext *C, wmOperator *UNUSED(op)) EDBM_mesh_reveal(em); - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1714,13 +1714,13 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op) /* doflip has to do with bmesh_rationalize_normals, it's an internal * thing */ - if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf use_flip=%b", BM_ELEM_SELECT, TRUE)) + if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf use_flip=%b", BM_ELEM_SELECT, true)) return OPERATOR_CANCELLED; if (RNA_boolean_get(op->ptr, "inside")) EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT); - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1749,17 +1749,17 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); ModifierData *md; - int mirrx = FALSE, mirry = FALSE, mirrz = FALSE; + int mirrx = false, mirry = false, mirrz = false; int i, repeat; float clip_dist = 0.0f; - int xaxis = RNA_boolean_get(op->ptr, "xaxis"); - int yaxis = RNA_boolean_get(op->ptr, "yaxis"); - int zaxis = RNA_boolean_get(op->ptr, "zaxis"); + const bool xaxis = RNA_boolean_get(op->ptr, "xaxis"); + const bool yaxis = RNA_boolean_get(op->ptr, "yaxis"); + const bool zaxis = RNA_boolean_get(op->ptr, "zaxis"); /* mirror before smooth */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_verts_mirror_cache_begin(em, TRUE); + EDBM_verts_mirror_cache_begin(em, true); } /* if there is a mirror modifier with clipping, flag the verts that @@ -1771,11 +1771,11 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) if (mmd->flag & MOD_MIR_CLIPPING) { if (mmd->flag & MOD_MIR_AXIS_X) - mirrx = TRUE; + mirrx = true; if (mmd->flag & MOD_MIR_AXIS_Y) - mirry = TRUE; + mirry = true; if (mmd->flag & MOD_MIR_AXIS_Z) - mirrz = TRUE; + mirrz = true; clip_dist = mmd->tolerance; } @@ -1802,7 +1802,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) EDBM_verts_mirror_cache_end(em); } - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1831,7 +1831,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int usex = TRUE, usey = TRUE, usez = TRUE, preserve_volume = TRUE; + int usex = true, usey = true, usez = true, preserve_volume = true; int i, repeat; float lambda_factor; float lambda_border; @@ -1850,7 +1850,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) /* mirror before smooth */ if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) { - EDBM_verts_mirror_cache_begin(em, TRUE); + EDBM_verts_mirror_cache_begin(em, true); } repeat = RNA_int_get(op->ptr, "repeat"); @@ -1878,7 +1878,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) EDBM_verts_mirror_cache_end(em); } - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -1932,7 +1932,7 @@ static int edbm_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op)) mesh_set_smooth_faces(em, 1); - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); return OPERATOR_FINISHED; } @@ -1959,7 +1959,7 @@ static int edbm_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op)) mesh_set_smooth_faces(em, 0); - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); return OPERATOR_FINISHED; } @@ -1989,7 +1989,7 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op) BMOperator bmop; /* get the direction from RNA */ - const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw"); + const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw); @@ -1998,11 +1998,11 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); /* we succeeded */ return OPERATOR_FINISHED; @@ -2021,11 +2021,11 @@ static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); /* we succeeded */ return OPERATOR_FINISHED; @@ -2038,7 +2038,7 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op) BMOperator bmop; /* get the direction from RNA */ - const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw"); + const bool use_ccw = RNA_boolean_get(op->ptr, "use_ccw"); /* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */ EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw); @@ -2047,12 +2047,12 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } /* dependencies graph and notification stuff */ - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); /* we succeeded */ return OPERATOR_FINISHED; @@ -2072,11 +2072,11 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); /* finish the operator */ - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); /* we succeeded */ return OPERATOR_FINISHED; @@ -2097,7 +2097,7 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ - RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", ""); + RNA_def_boolean(ot->srna, "use_ccw", false, "Counter Clockwise", ""); } //void MESH_OT_uvs_mirror(wmOperatorType *ot) @@ -2134,7 +2134,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ - RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", ""); + RNA_def_boolean(ot->srna, "use_ccw", false, "Counter Clockwise", ""); } void MESH_OT_colors_reverse(wmOperatorType *ot) @@ -2156,7 +2156,7 @@ void MESH_OT_colors_reverse(wmOperatorType *ot) } -static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *wmop) +static bool merge_firstlast(BMEditMesh *em, const bool use_first, const bool use_uvmerge, wmOperator *wmop) { BMVert *mergevert; BMEditSelection *ese; @@ -2166,44 +2166,44 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w */ /* do sanity check in mergemenu in edit.c ?*/ - if (first == 0) { + if (use_first == false) { if (!em->bm->selected.last || ((BMEditSelection *)em->bm->selected.last)->htype != BM_VERT) - return OPERATOR_CANCELLED; + return false; ese = em->bm->selected.last; mergevert = (BMVert *)ese->ele; } else { if (!em->bm->selected.first || ((BMEditSelection *)em->bm->selected.first)->htype != BM_VERT) - return OPERATOR_CANCELLED; + return false; ese = em->bm->selected.first; mergevert = (BMVert *)ese->ele; } if (!BM_elem_flag_test(mergevert, BM_ELEM_SELECT)) - return OPERATOR_CANCELLED; + return false; - if (uvmerge) { + if (use_uvmerge) { if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv vert_snap=%e", BM_ELEM_SELECT, mergevert)) - return OPERATOR_CANCELLED; + return false; } if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, mergevert->co)) - return OPERATOR_CANCELLED; + return false; - return OPERATOR_FINISHED; + return true; } -static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob, - int target, int uvmerge, wmOperator *wmop) +static bool merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob, + const bool use_cursor, const bool use_uvmerge, wmOperator *wmop) { BMIter iter; BMVert *v; float co[3], cent[3] = {0.0f, 0.0f, 0.0f}; const float *vco = NULL; - if (target) { + if (use_cursor) { vco = give_cursor(scene, v3d); copy_v3_v3(co, vco); mul_m4_v3(ob->imat, co); @@ -2219,7 +2219,7 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob, } if (!i) - return OPERATOR_CANCELLED; + return false; fac = 1.0f / (float)i; mul_v3_fl(cent, fac); @@ -2228,17 +2228,17 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob, } if (!vco) - return OPERATOR_CANCELLED; + return false; - if (uvmerge) { + if (use_uvmerge) { if (!EDBM_op_callf(em, wmop, "average_vert_facedata verts=%hv", BM_ELEM_SELECT)) - return OPERATOR_CANCELLED; + return false; } if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, co)) - return OPERATOR_CANCELLED; + return false; - return OPERATOR_FINISHED; + return true; } static int edbm_merge_exec(bContext *C, wmOperator *op) @@ -2247,32 +2247,37 @@ static int edbm_merge_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int status = 0, uvs = RNA_boolean_get(op->ptr, "uvs"); + const int type = RNA_enum_get(op->ptr, "type"); + const bool uvs = RNA_boolean_get(op->ptr, "uvs"); + bool ok = false; - switch (RNA_enum_get(op->ptr, "type")) { + switch (type) { case 3: - status = merge_target(em, scene, v3d, obedit, 0, uvs, op); + ok = merge_target(em, scene, v3d, obedit, false, uvs, op); break; case 4: - status = merge_target(em, scene, v3d, obedit, 1, uvs, op); + ok = merge_target(em, scene, v3d, obedit, true, uvs, op); break; case 1: - status = merge_firstlast(em, 0, uvs, op); + ok = merge_firstlast(em, false, uvs, op); break; case 6: - status = merge_firstlast(em, 1, uvs, op); + ok = merge_firstlast(em, true, uvs, op); break; case 5: - status = 1; + ok = true; if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT)) - status = 0; + ok = false; break; + default: + BLI_assert(0); } - if (!status) + if (!ok) { return OPERATOR_CANCELLED; + } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -2356,8 +2361,8 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; const float threshold = RNA_float_get(op->ptr, "threshold"); - int use_unselected = RNA_boolean_get(op->ptr, "use_unselected"); - int totvert_orig = em->bm->totvert; + const bool use_unselected = RNA_boolean_get(op->ptr, "use_unselected"); + const int totvert_orig = em->bm->totvert; int count; if (use_unselected) { @@ -2366,7 +2371,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) BM_ELEM_SELECT, threshold); BMO_op_exec(em->bm, &bmop); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } } @@ -2381,7 +2386,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } } @@ -2389,7 +2394,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) count = totvert_orig - em->bm->totvert; BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -2439,7 +2444,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op) BMEditSelection *sv, *ev; /* get the type from RNA */ - int type = RNA_enum_get(op->ptr, "type"); + const int type = RNA_enum_get(op->ptr, "type"); /* first try to find vertices in edit selection */ sv = em->bm->selected.last; @@ -2491,16 +2496,16 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op) /* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */ /* select the output */ - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true); /* finish the operator */ - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } EDBM_selectmode_flush(em); - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); /* we succeeded */ return OPERATOR_FINISHED; @@ -2575,7 +2580,7 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op) shape_propagate(em, op); - EDBM_update_generic(em, FALSE, FALSE); + EDBM_update_generic(em, false, false); return OPERATOR_FINISHED; } @@ -2607,11 +2612,12 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) BMVert *eve; BMIter iter; float co[3], *sco; - float blend = RNA_float_get(op->ptr, "blend"); - int shape = RNA_enum_get(op->ptr, "shape"); - int add = RNA_boolean_get(op->ptr, "add"); int totshape; + const float blend = RNA_float_get(op->ptr, "blend"); + const int shape = RNA_enum_get(op->ptr, "shape"); + const bool use_add = RNA_boolean_get(op->ptr, "add"); + /* sanity check */ totshape = CustomData_number_of_layers(&em->bm->vdata, CD_SHAPEKEY); if (totshape == 0 || shape < 0 || shape >= totshape) @@ -2631,7 +2637,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) sco = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, shape); copy_v3_v3(co, sco); - if (add) { + if (use_add) { /* in add mode, we add relative shape key offset */ if (kb) { float *rco = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, kb->relative); @@ -2646,7 +2652,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) } } - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -2730,8 +2736,8 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); BMEditSelection *ese = em->bm->selected.last; - int axis = RNA_enum_get(op->ptr, "axis"); - int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */ + const int axis = RNA_enum_get(op->ptr, "axis"); + const int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */ if (ese == NULL || ese->htype != BM_VERT) { BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)"); @@ -2753,15 +2759,15 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) switch (mode) { case -1: /* aligned */ if (fabsf(ev->co[axis] - value) < limit) - BM_vert_select_set(em->bm, ev, TRUE); + BM_vert_select_set(em->bm, ev, true); break; case 0: /* neg */ if (ev->co[axis] > value) - BM_vert_select_set(em->bm, ev, TRUE); + BM_vert_select_set(em->bm, ev, true); break; case 1: /* pos */ if (ev->co[axis] < value) - BM_vert_select_set(em->bm, ev, TRUE); + BM_vert_select_set(em->bm, ev, true); break; } } @@ -2815,7 +2821,7 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op) BMesh *bm = em->bm; BMOperator bmop; - float thickness = RNA_float_get(op->ptr, "thickness"); + const float thickness = RNA_float_get(op->ptr, "thickness"); if (!EDBM_op_init(em, &bmop, op, "solidify geom=%hf thickness=%f", BM_ELEM_SELECT, thickness)) { return OPERATOR_CANCELLED; @@ -2824,19 +2830,19 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op) /* deselect only the faces in the region to be solidified (leave wire * edges and loose verts selected, as there will be no corresponding * geometry selected below) */ - BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "geom", BM_FACE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "geom", BM_FACE, BM_ELEM_SELECT, true); /* run the solidify operator */ BMO_op_exec(bm, &bmop); /* select the newly generated faces */ - BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "geom.out", BM_FACE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "geom.out", BM_FACE, BM_ELEM_SELECT, true); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3061,7 +3067,8 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) BMOperator bmop; float isect = 0.0f; int len = 0, isected, i; - short numcuts = 1, mode = RNA_int_get(op->ptr, "type"); + short numcuts = 1; + const short mode = RNA_int_get(op->ptr, "type"); BMOpSlot *slot_edge_percents; /* allocd vars */ @@ -3119,7 +3126,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) /* store percentage of edge cut for KNIFE_EXACT here.*/ slot_edge_percents = BMO_slot_get(bmop.slots_in, "edge_percents"); for (be = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); be; be = BM_iter_step(&iter)) { - int is_cut = FALSE; + bool is_cut = false; if (BM_elem_flag_test(be, BM_ELEM_SELECT)) { const float *sco_a = screen_vert_coords[BM_elem_index_get(be->v1)]; const float *sco_b = screen_vert_coords[BM_elem_index_get(be->v2)]; @@ -3151,17 +3158,17 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) BMO_slot_int_set(bmop.slots_in, "cuts", numcuts); BMO_slot_int_set(bmop.slots_in, "quad_corner_type", SUBD_STRAIGHT_CUT); - BMO_slot_bool_set(bmop.slots_in, "use_single_edge", FALSE); - BMO_slot_bool_set(bmop.slots_in, "use_grid_fill", FALSE); + BMO_slot_bool_set(bmop.slots_in, "use_single_edge", false); + BMO_slot_bool_set(bmop.slots_in, "use_grid_fill", false); BMO_slot_float_set(bmop.slots_in, "radius", 0); BMO_op_exec(bm, &bmop); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3226,25 +3233,25 @@ static int mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMesh /* deselect loose data - this used to get deleted, * we could de-select edges and verts only, but this turns out to be less complicated * since de-selecting all skips selection flushing logic */ - BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE); + BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); - BM_mesh_normals_update(bm_new, FALSE); + BM_mesh_normals_update(bm_new, false); - BM_mesh_bm_to_me(bm_new, base_new->object->data, FALSE); + BM_mesh_bm_to_me(bm_new, base_new->object->data, false); BM_mesh_free(bm_new); ((Mesh *)base_new->object->data)->edit_btmesh = NULL; - return TRUE; + return true; } -static int mesh_separate_selected(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old) +static bool mesh_separate_selected(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old) { /* we may have tags from previous operators */ - BM_mesh_elem_hflag_disable_all(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, FALSE); + BM_mesh_elem_hflag_disable_all(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, false); /* sel -> tag */ - BM_mesh_elem_hflag_enable_test(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, TRUE, BM_ELEM_SELECT); + BM_mesh_elem_hflag_enable_test(bm_old, BM_FACE | BM_EDGE | BM_VERT, BM_ELEM_TAG, true, BM_ELEM_SELECT); return mesh_separate_tagged(bmain, scene, base_old, bm_old); } @@ -3260,7 +3267,7 @@ static void bm_mesh_hflag_flush_vert(BMesh *bm, const char hflag) BMIter eiter; BMIter fiter; - int ok; + bool ok; BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e->v1, hflag) && @@ -3273,11 +3280,11 @@ static void bm_mesh_hflag_flush_vert(BMesh *bm, const char hflag) } } BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { - ok = TRUE; + ok = true; l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { if (!BM_elem_flag_test(l_iter->v, hflag)) { - ok = FALSE; + ok = false; break; } } while ((l_iter = l_iter->next) != l_first); @@ -3286,17 +3293,17 @@ static void bm_mesh_hflag_flush_vert(BMesh *bm, const char hflag) } } -static int mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old) +static bool mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old) { BMFace *f_cmp, *f; BMIter iter; - int result = FALSE; + bool result = false; while ((f_cmp = BM_iter_at_index(bm_old, BM_FACES_OF_MESH, NULL, 0))) { const short mat_nr = f_cmp->mat_nr; int tot = 0; - BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE); + BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false); BM_ITER_MESH (f, &iter, bm_old, BM_FACES_OF_MESH) { if (f->mat_nr == mat_nr) { @@ -3326,17 +3333,17 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMe return result; } -static int mesh_separate_loose(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old) +static bool mesh_separate_loose(Main *bmain, Scene *scene, Base *base_old, BMesh *bm_old) { int i; BMEdge *e; BMVert *v_seed; BMWalker walker; - int result = FALSE; + bool result = false; int max_iter = bm_old->totvert; /* Clear all selected vertices */ - BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE); + BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false); /* A "while (true)" loop should work here as each iteration should * select and remove at least one vertex and when all vertices @@ -3389,7 +3396,8 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - int retval = 0, type = RNA_enum_get(op->ptr, "type"); + const int type = RNA_enum_get(op->ptr, "type"); + int retval = 0; if (ED_operator_editmesh(C)) { Base *base = CTX_data_active_base(C); @@ -3412,7 +3420,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) else BLI_assert(0); if (retval) { - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); } } else { @@ -3433,14 +3441,14 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) bm_old = BM_mesh_create(&bm_mesh_allocsize_default); - BM_mesh_bm_from_me(bm_old, me, FALSE, 0); + BM_mesh_bm_from_me(bm_old, me, false, 0); if (type == 1) retval_iter = mesh_separate_material(bmain, scene, base_iter, bm_old); else if (type == 2) retval_iter = mesh_separate_loose(bmain, scene, base_iter, bm_old); else BLI_assert(0); if (retval_iter) { - BM_mesh_bm_to_me(bm_old, me, FALSE); + BM_mesh_bm_to_me(bm_old, me, false); DAG_id_tag_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); @@ -3497,7 +3505,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int use_beauty = RNA_boolean_get(op->ptr, "use_beauty"); + const bool use_beauty = RNA_boolean_get(op->ptr, "use_beauty"); BMOperator bmop; if (!EDBM_op_init(em, &bmop, op, @@ -3510,13 +3518,13 @@ static int edbm_fill_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); /* select new geometry */ - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, BM_ELEM_SELECT, true); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; @@ -3547,7 +3555,7 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op) if (!EDBM_op_callf(em, op, "beautify_fill faces=%hf edges=ae", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3574,7 +3582,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; - int use_beauty = RNA_boolean_get(op->ptr, "use_beauty"); + const bool use_beauty = RNA_boolean_get(op->ptr, "use_beauty"); EDBM_op_init(em, &bmop, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty); BMO_op_exec(em->bm, &bmop); @@ -3586,11 +3594,11 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) &bmop, "faces.out", &bmop, "edges.out"); } - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3617,7 +3625,7 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); int dosharp, douvs, dovcols, domaterials; - float limit = RNA_float_get(op->ptr, "limit"); + const float limit = RNA_float_get(op->ptr, "limit"); dosharp = RNA_boolean_get(op->ptr, "sharp"); douvs = RNA_boolean_get(op->ptr, "uvs"); @@ -3631,7 +3639,7 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3672,7 +3680,7 @@ static int edbm_dissolve_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int use_verts = RNA_boolean_get(op->ptr, "use_verts"); + const bool use_verts = RNA_boolean_get(op->ptr, "use_verts"); if (em->selectmode & SCE_SELECT_FACE) { if (!EDBM_op_callf(em, op, "dissolve_faces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts)) @@ -3687,7 +3695,7 @@ static int edbm_dissolve_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3717,7 +3725,7 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(obedit); BMesh *bm = em->bm; const float angle_limit = RNA_float_get(op->ptr, "angle_limit"); - const int use_dissolve_boundaries = RNA_boolean_get(op->ptr, "use_dissolve_boundaries"); + const bool use_dissolve_boundaries = RNA_boolean_get(op->ptr, "use_dissolve_boundaries"); char dissolve_flag; @@ -3759,7 +3767,7 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3793,18 +3801,18 @@ static int edbm_split_exec(bContext *C, wmOperator *op) BMEditMesh *em = BMEdit_FromObject(ob); BMOperator bmop; - EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE); + EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, false); BMO_op_exec(em->bm, &bmop); - BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } /* Geometry has changed, need to recalc normals and looptris */ EDBM_mesh_normals_update(em); - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3858,12 +3866,12 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) } BMO_op_exec(bm, &spinop); EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE); - if (!EDBM_op_finish(em, &spinop, op, TRUE)) { + BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); + if (!EDBM_op_finish(em, &spinop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -3976,18 +3984,18 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) if (!EDBM_op_init(em, &spinop, op, "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b", - BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), FALSE)) + BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), false)) { return OPERATOR_CANCELLED; } BMO_op_exec(bm, &spinop); EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, TRUE); - if (!EDBM_op_finish(em, &spinop, op, TRUE)) { + BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); + if (!EDBM_op_finish(em, &spinop, op, true)) { return OPERATOR_CANCELLED; } - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } @@ -4061,12 +4069,12 @@ static int edbm_select_face_by_sides_exec(bContext *C, wmOperator *op) break; default: BLI_assert(0); - select = FALSE; + select = false; break; } if (select) { - BM_face_select_set(em->bm, efa, TRUE); + BM_face_select_set(em->bm, efa, true); } } @@ -4101,7 +4109,7 @@ void MESH_OT_select_face_by_sides(wmOperatorType *ot) /* properties */ RNA_def_int(ot->srna, "number", 4, 3, INT_MAX, "Number of Vertices", "", 3, INT_MAX); RNA_def_enum(ot->srna, "type", type_items, 1, "Type", "Type of comparison to make"); - RNA_def_boolean(ot->srna, "extend", TRUE, "Extend", "Extend the selection"); + RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend the selection"); } static int edbm_select_loose_verts_exec(bContext *C, wmOperator *op) @@ -4117,13 +4125,13 @@ static int edbm_select_loose_verts_exec(bContext *C, wmOperator *op) BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { if (!eve->e) { - BM_vert_select_set(em->bm, eve, TRUE); + BM_vert_select_set(em->bm, eve, true); } } BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { if (!eed->l) { - BM_edge_select_set(em->bm, eed, TRUE); + BM_edge_select_set(em->bm, eed, true); } } @@ -4155,7 +4163,7 @@ static int edbm_select_mirror_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - int extend = RNA_boolean_get(op->ptr, "extend"); + bool extend = RNA_boolean_get(op->ptr, "extend"); if (em->bm->totvert && em->bm->totvertsel) { EDBM_select_mirrored(obedit, em, extend); @@ -4259,12 +4267,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, float co[3]; mul_v3_m4v3(co, mat, ve->co); - pb[i] = FALSE; + pb[i] = false; sb[affected[0]].org_idx = i; sb[affected[0]++].srt = co[coidx] * fact; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4279,12 +4287,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, mid_v3_v3v3(co, ed->v1->co, ed->v2->co); mul_m4_v3(mat, co); - pb[i] = FALSE; + pb[i] = false; sb[affected[1]].org_idx = i; sb[affected[1]++].srt = co[coidx] * fact; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4299,12 +4307,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_face_calc_center_mean(fa, co); mul_m4_v3(mat, co); - pb[i] = FALSE; + pb[i] = false; sb[affected[2]].org_idx = i; sb[affected[2]++].srt = co[coidx] * fact; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4328,12 +4336,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) { if (BM_elem_flag_test(ve, flag)) { - pb[i] = FALSE; + pb[i] = false; sb[affected[0]].org_idx = i; sb[affected[0]++].srt = len_squared_v3v3(cur, ve->co) * fact; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4347,12 +4355,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, float co[3]; mid_v3_v3v3(co, ed->v1->co, ed->v2->co); - pb[i] = FALSE; + pb[i] = false; sb[affected[1]].org_idx = i; sb[affected[1]++].srt = len_squared_v3v3(cur, co) * fact; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4366,12 +4374,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, float co[3]; BM_face_calc_center_mean(fa, co); - pb[i] = FALSE; + pb[i] = false; sb[affected[2]].org_idx = i; sb[affected[2]++].srt = len_squared_v3v3(cur, co) * fact; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4387,14 +4395,14 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, /* Reverse materials' order, not order of faces inside each mat! */ /* Note: cannot use totcol, as mat_nr may sometimes be greater... */ float srt = reverse ? (float)(MAXMAT - fa->mat_nr) : (float)fa->mat_nr; - pb[i] = FALSE; + pb[i] = false; sb[affected[2]].org_idx = i; /* Multiplying with totface and adding i ensures us we keep current order for all faces of same mat. */ sb[affected[2]++].srt = srt * ((float)totelem[2]) + ((float)i); /* printf("e: %d; srt: %f; final: %f\n", i, srt, srt * ((float)totface) + ((float)i));*/ } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4488,12 +4496,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) { if (BM_elem_flag_test(ve, flag)) { - pb[i] = FALSE; + pb[i] = false; sb[affected[0]].org_idx = i; sb[affected[0]++].srt = BLI_frand(); } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4505,12 +4513,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_ITER_MESH_INDEX (ed, &iter, em->bm, BM_EDGES_OF_MESH, i) { if (BM_elem_flag_test(ed, flag)) { - pb[i] = FALSE; + pb[i] = false; sb[affected[1]].org_idx = i; sb[affected[1]++].srt = BLI_frand(); } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4522,12 +4530,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) { if (BM_elem_flag_test(fa, flag)) { - pb[i] = FALSE; + pb[i] = false; sb[affected[2]].org_idx = i; sb[affected[2]++].srt = BLI_frand(); } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4540,12 +4548,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) { if (BM_elem_flag_test(ve, flag)) { - pb[i] = FALSE; + pb[i] = false; sb[affected[0]].org_idx = i; sb[affected[0]++].srt = (float)-i; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4556,12 +4564,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_ITER_MESH_INDEX (ed, &iter, em->bm, BM_EDGES_OF_MESH, i) { if (BM_elem_flag_test(ed, flag)) { - pb[i] = FALSE; + pb[i] = false; sb[affected[1]].org_idx = i; sb[affected[1]++].srt = (float)-i; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4572,12 +4580,12 @@ static void sort_bmelem_flag(Scene *scene, Object *ob, BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) { if (BM_elem_flag_test(fa, flag)) { - pb[i] = FALSE; + pb[i] = false; sb[affected[2]].org_idx = i; sb[affected[2]++].srt = (float)-i; } else { - pb[i] = TRUE; + pb[i] = true; } } } @@ -4647,9 +4655,9 @@ static int edbm_sort_elements_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = ED_view3d_context_rv3d(C); - int action = RNA_enum_get(op->ptr, "type"); + const int action = RNA_enum_get(op->ptr, "type"); PropertyRNA *prop_elem_types = RNA_struct_find_property(op->ptr, "elements"); - int reverse = RNA_boolean_get(op->ptr, "reverse"); + const bool use_reverse = RNA_boolean_get(op->ptr, "reverse"); unsigned int seed = RNA_int_get(op->ptr, "seed"); int elem_types = 0; @@ -4676,32 +4684,32 @@ static int edbm_sort_elements_exec(bContext *C, wmOperator *op) } sort_bmelem_flag(scene, ob, v3d, rv3d, - elem_types, BM_ELEM_SELECT, action, reverse, seed); + elem_types, BM_ELEM_SELECT, action, use_reverse, seed); return OPERATOR_FINISHED; } -static int edbm_sort_elements_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) +static bool edbm_sort_elements_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop) { const char *prop_id = RNA_property_identifier(prop); - int action = RNA_enum_get(ptr, "type"); + const int action = RNA_enum_get(ptr, "type"); /* Only show seed for randomize action! */ if (STREQ(prop_id, "seed")) { if (action == SRT_RANDOMIZE) - return TRUE; + return true; else - return FALSE; + return false; } /* Hide seed for reverse and randomize actions! */ if (STREQ(prop_id, "reverse")) { if (ELEM(action, SRT_RANDOMIZE, SRT_REVERSE)) - return FALSE; + return false; else - return TRUE; + return true; } - return TRUE; + return true; } static void edbm_sort_elements_ui(bContext *C, wmOperator *op) @@ -4760,7 +4768,7 @@ void MESH_OT_sort_elements(wmOperatorType *ot) ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Type of re-ordering operation to apply"); RNA_def_enum_flag(ot->srna, "elements", elem_items, 0, "Elements", "Which elements to affect (vertices, edges and/or faces)"); - RNA_def_boolean(ot->srna, "reverse", FALSE, "Reverse", "Reverse the sorting effect"); + RNA_def_boolean(ot->srna, "reverse", false, "Reverse", "Reverse the sorting effect"); RNA_def_int(ot->srna, "seed", 0, 0, INT_MAX, "Seed", "Seed for random-based operations", 0, 255); } @@ -4774,7 +4782,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op) Tex *tex; BMVert *eve; BMIter iter; - float fac = RNA_float_get(op->ptr, "factor"); + const float fac = RNA_float_get(op->ptr, "factor"); if (em == NULL) { return OPERATOR_FINISHED; @@ -4814,7 +4822,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op) EDBM_mesh_normals_update(em); - EDBM_update_generic(em, TRUE, FALSE); + EDBM_update_generic(em, true, false); return OPERATOR_FINISHED; } @@ -4899,13 +4907,13 @@ static int edbm_bevel_calc(wmOperator *op) BevelData *opdata = op->customdata; BMEditMesh *em = opdata->em; BMOperator bmop; - float offset = RNA_float_get(op->ptr, "offset"); - int segments = RNA_int_get(op->ptr, "segments"); - int vertex_only = RNA_boolean_get(op->ptr, "vertex_only"); + const float offset = RNA_float_get(op->ptr, "offset"); + const int segments = RNA_int_get(op->ptr, "segments"); + const bool vertex_only = RNA_boolean_get(op->ptr, "vertex_only"); /* revert to original mesh */ if (opdata->is_modal) { - EDBM_redo_state_restore(opdata->mesh_backup, em, FALSE); + EDBM_redo_state_restore(opdata->mesh_backup, em, false); } if (!EDBM_op_init(em, &bmop, op, @@ -4921,16 +4929,16 @@ static int edbm_bevel_calc(wmOperator *op) /* not essential, but we may have some loose geometry that * won't get bevel'd and better not leave it selected */ EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); } /* no need to de-select existing geometry */ - if (!EDBM_op_finish(em, &bmop, op, TRUE)) + if (!EDBM_op_finish(em, &bmop, op, true)) return 0; EDBM_mesh_normals_update(opdata->em); - EDBM_update_generic(opdata->em, TRUE, TRUE); + EDBM_update_generic(opdata->em, true, true); return 1; } @@ -4946,7 +4954,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op) } if (opdata->is_modal) { - EDBM_redo_state_free(&opdata->mesh_backup, NULL, FALSE); + EDBM_redo_state_free(&opdata->mesh_backup, NULL, false); } MEM_freeN(opdata); op->customdata = NULL; @@ -4956,8 +4964,8 @@ static int edbm_bevel_cancel(bContext *C, wmOperator *op) { BevelData *opdata = op->customdata; if (opdata->is_modal) { - EDBM_redo_state_free(&opdata->mesh_backup, opdata->em, TRUE); - EDBM_update_generic(opdata->em, FALSE, TRUE); + EDBM_redo_state_free(&opdata->mesh_backup, opdata->em, true); + EDBM_update_generic(opdata->em, false, true); } edbm_bevel_exit(C, op); @@ -4970,7 +4978,7 @@ static int edbm_bevel_cancel(bContext *C, wmOperator *op) /* bevel! yay!!*/ static int edbm_bevel_exec(bContext *C, wmOperator *op) { - if (!edbm_bevel_init(C, op, FALSE)) { + if (!edbm_bevel_init(C, op, false)) { edbm_bevel_exit(C, op); return OPERATOR_CANCELLED; } @@ -4993,7 +5001,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event) float mlen[2]; float center_3d[3]; - if (!edbm_bevel_init(C, op, TRUE)) { + if (!edbm_bevel_init(C, op, true)) { return OPERATOR_CANCELLED; } @@ -5025,7 +5033,7 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event) static float edbm_bevel_mval_factor(wmOperator *op, const wmEvent *event) { BevelData *opdata = op->customdata; - int use_dist = TRUE; + int use_dist = true; float mdiff[2]; float factor; @@ -5147,7 +5155,7 @@ void MESH_OT_bevel(wmOperatorType *ot) RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Offset", "", 0.0f, 1.0f); RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8); - RNA_def_boolean(ot->srna, "vertex_only", FALSE, "Vertex only", "Bevel only vertices"); + RNA_def_boolean(ot->srna, "vertex_only", false, "Vertex only", "Bevel only vertices"); } static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) @@ -5155,7 +5163,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) BMOperator bmop; Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); - const int use_merge = RNA_boolean_get(op->ptr, "use_merge"); + const bool use_merge = RNA_boolean_get(op->ptr, "use_merge"); const float merge_factor = RNA_float_get(op->ptr, "merge_factor"); EDBM_op_init(em, &bmop, op, @@ -5165,17 +5173,17 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); /* when merge is used the edges are joined and remain selected */ - if (use_merge == FALSE) { + if (use_merge == false) { EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); } - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } else { - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } } @@ -5196,7 +5204,7 @@ void MESH_OT_bridge_edge_loops(wmOperatorType *ot) RNA_def_boolean(ot->srna, "inside", 0, "Inside", ""); - RNA_def_boolean(ot->srna, "use_merge", FALSE, "Merge", "Merge rather than creating faces"); + RNA_def_boolean(ot->srna, "use_merge", false, "Merge", "Merge rather than creating faces"); RNA_def_float(ot->srna, "merge_factor", 0.5f, 0.0f, 1.0f, "Merge Factor", "", 0.0f, 1.0f); } @@ -5256,8 +5264,8 @@ static int edbm_inset_init(bContext *C, wmOperator *op, int is_modal) opdata->old_thickness = 0.01; opdata->old_depth = 0.0; - opdata->modify_depth = FALSE; - opdata->shift = FALSE; + opdata->modify_depth = false; + opdata->shift = false; opdata->shift_amount = 0.0f; opdata->is_modal = is_modal; opdata->em = em; @@ -5279,7 +5287,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op) opdata = op->customdata; if (opdata->is_modal) - EDBM_redo_state_free(&opdata->backup, NULL, FALSE); + EDBM_redo_state_free(&opdata->backup, NULL, false); if (sa) { ED_area_headerprint(sa, NULL); @@ -5293,8 +5301,8 @@ static int edbm_inset_cancel(bContext *C, wmOperator *op) opdata = op->customdata; if (opdata->is_modal) { - EDBM_redo_state_free(&opdata->backup, opdata->em, TRUE); - EDBM_update_generic(opdata->em, FALSE, TRUE); + EDBM_redo_state_free(&opdata->backup, opdata->em, true); + EDBM_update_generic(opdata->em, false, true); } edbm_inset_exit(C, op); @@ -5310,19 +5318,19 @@ static int edbm_inset_calc(wmOperator *op) BMEditMesh *em; BMOperator bmop; - int use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); - int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset"); - int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset"); - float thickness = RNA_float_get(op->ptr, "thickness"); - float depth = RNA_float_get(op->ptr, "depth"); - int use_outset = RNA_boolean_get(op->ptr, "use_outset"); - int use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ + const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); + const bool use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset"); + const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset"); + const float thickness = RNA_float_get(op->ptr, "thickness"); + const float depth = RNA_float_get(op->ptr, "depth"); + const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); + const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ opdata = op->customdata; em = opdata->em; if (opdata->is_modal) { - EDBM_redo_state_restore(opdata->backup, em, FALSE); + EDBM_redo_state_restore(opdata->backup, em, false); } EDBM_op_init(em, &bmop, op, @@ -5336,27 +5344,27 @@ static int edbm_inset_calc(wmOperator *op) if (use_select_inset) { /* deselect original faces/verts */ EDBM_flag_disable_all(em, BM_ELEM_SELECT); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); } else { - BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, FALSE); - BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, FALSE); + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, false); + BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, false); /* re-select faces so the verts and edges get selected too */ - BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, TRUE, BM_ELEM_SELECT); + BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, BM_ELEM_SELECT); } - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return 0; } else { - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return 1; } } static int edbm_inset_exec(bContext *C, wmOperator *op) { - edbm_inset_init(C, op, FALSE); + edbm_inset_init(C, op, false); if (!edbm_inset_calc(op)) { edbm_inset_exit(C, op); @@ -5374,7 +5382,7 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event) float mlen[2]; float center_3d[3]; - edbm_inset_init(C, op, TRUE); + edbm_inset_init(C, op, true); opdata = op->customdata; @@ -5476,11 +5484,11 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) opdata->shift_amount = RNA_float_get(op->ptr, "depth"); else opdata->shift_amount = RNA_float_get(op->ptr, "thickness"); - opdata->shift = TRUE; + opdata->shift = true; } else { opdata->shift_amount = 0.0f; - opdata->shift = FALSE; + opdata->shift = false; } break; @@ -5496,13 +5504,13 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) opdata->old_thickness = RNA_float_get(op->ptr, "thickness"); if (opdata->shift) opdata->shift_amount = opdata->old_thickness; - opdata->modify_depth = TRUE; + opdata->modify_depth = true; } else { opdata->old_depth = RNA_float_get(op->ptr, "depth"); if (opdata->shift) opdata->shift_amount = opdata->old_depth; - opdata->modify_depth = FALSE; + opdata->modify_depth = false; } opdata->initial_length = len_v2(mlen); @@ -5512,7 +5520,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) case OKEY: if (event->val == KM_PRESS) { - int use_outset = RNA_boolean_get(op->ptr, "use_outset"); + const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); RNA_boolean_set(op->ptr, "use_outset", !use_outset); if (edbm_inset_calc(op)) { edbm_inset_update_header(op, C); @@ -5525,7 +5533,7 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) break; case BKEY: if (event->val == KM_PRESS) { - int use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); + const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); RNA_boolean_set(op->ptr, "use_boundary", !use_boundary); if (edbm_inset_calc(op)) { edbm_inset_update_header(op, C); @@ -5562,9 +5570,9 @@ void MESH_OT_inset(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING; /* properties */ - RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundaries"); - RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness"); - RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry"); + RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries"); + RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness"); + RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry"); prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f); /* use 1 rather then 10 for max else dragging the button moves too far */ @@ -5572,8 +5580,8 @@ void MESH_OT_inset(wmOperatorType *ot) prop = RNA_def_float(ot->srna, "depth", 0.0f, -FLT_MAX, FLT_MAX, "Depth", "", -10.0f, 10.0f); RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4); - RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "Outset rather than inset"); - RNA_def_boolean(ot->srna, "use_select_inset", TRUE, "Select Outer", "Select the new inset faces"); + RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); + RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces"); } static int edbm_wireframe_exec(bContext *C, wmOperator *op) @@ -5581,12 +5589,12 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); BMOperator bmop; - const int use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); - const int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset"); - const int use_replace = RNA_boolean_get(op->ptr, "use_replace"); - const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset"); - const int use_crease = RNA_boolean_get(op->ptr, "use_crease"); - const float thickness = RNA_float_get(op->ptr, "thickness"); + const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); + const bool use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset"); + const bool use_replace = RNA_boolean_get(op->ptr, "use_replace"); + const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset"); + const bool use_crease = RNA_boolean_get(op->ptr, "use_crease"); + const float thickness = RNA_float_get(op->ptr, "thickness"); EDBM_op_init(em, &bmop, op, "wireframe faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b use_crease=%b " @@ -5597,22 +5605,22 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); if (use_replace) { - BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE); + BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_TAG, false); BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, "delete geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES); } - BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE); + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } else { - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; } } @@ -5634,17 +5642,17 @@ void MESH_OT_wireframe(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundaries"); - RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness"); - RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry"); - RNA_def_boolean(ot->srna, "use_crease", FALSE, "Crease", "Crease hub edges for improved subsurf"); + RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries"); + RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness"); + RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry"); + RNA_def_boolean(ot->srna, "use_crease", false, "Crease", "Crease hub edges for improved subsurf"); prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f); /* use 1 rather then 10 for max else dragging the button moves too far */ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4); - RNA_def_boolean(ot->srna, "use_replace", TRUE, "Replace", "Remove original faces"); + RNA_def_boolean(ot->srna, "use_replace", true, "Replace", "Remove original faces"); } #ifdef WITH_BULLET @@ -5662,7 +5670,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) /* Hull fails if input is coplanar */ if (BMO_error_occurred(em->bm)) { - EDBM_op_finish(em, &bmop, op, TRUE); + EDBM_op_finish(em, &bmop, op, true); return OPERATOR_CANCELLED; } @@ -5672,7 +5680,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) if (!EDBM_op_callf(em, op, "delete geom=%S context=%i", &bmop, "geom_unused.out", DEL_ONLYTAGGED)) { - EDBM_op_finish(em, &bmop, op, TRUE); + EDBM_op_finish(em, &bmop, op, true); return OPERATOR_CANCELLED; } } @@ -5682,7 +5690,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) if (!EDBM_op_callf(em, op, "delete geom=%S context=%i", &bmop, "geom_holes.out", DEL_ONLYTAGGED)) { - EDBM_op_finish(em, &bmop, op, TRUE); + EDBM_op_finish(em, &bmop, op, true); return OPERATOR_CANCELLED; } } @@ -5693,16 +5701,16 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op) &bmop, "geom.out", RNA_float_get(op->ptr, "limit"))) { - EDBM_op_finish(em, &bmop, op, TRUE); + EDBM_op_finish(em, &bmop, op, true); return OPERATOR_CANCELLED; } } - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } else { - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); EDBM_selectmode_flush(em); return OPERATOR_FINISHED; } @@ -5723,19 +5731,19 @@ void MESH_OT_convex_hull(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ - RNA_def_boolean(ot->srna, "delete_unused", TRUE, + RNA_def_boolean(ot->srna, "delete_unused", true, "Delete Unused", "Delete selected elements that are not used by the hull"); - RNA_def_boolean(ot->srna, "use_existing_faces", TRUE, + RNA_def_boolean(ot->srna, "use_existing_faces", true, "Use Existing Faces", "Skip hull triangles that are covered by a pre-existing face"); - RNA_def_boolean(ot->srna, "make_holes", FALSE, + RNA_def_boolean(ot->srna, "make_holes", false, "Make Holes", "Delete selected faces that are used by the hull"); - RNA_def_boolean(ot->srna, "join_triangles", TRUE, + RNA_def_boolean(ot->srna, "join_triangles", true, "Join Triangles", "Merge adjacent triangles into quads"); @@ -5753,11 +5761,11 @@ static int mesh_symmetrize_exec(bContext *C, wmOperator *op) BM_ELEM_SELECT, RNA_enum_get(op->ptr, "direction")); BMO_op_exec(em->bm, &bmop); - if (!EDBM_op_finish(em, &bmop, op, TRUE)) { + if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } else { - EDBM_update_generic(em, TRUE, TRUE); + EDBM_update_generic(em, true, true); EDBM_selectmode_flush(em); return OPERATOR_FINISHED; } |