Cleanup: Editors/Mesh, Clang-Tidy else-after-return fixes

This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/mesh` module.

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2020-07-03 15:19:52 +02:00
parent 7d0a0b8a6d
commit 19483125f8
18 changed files with 501 additions and 604 deletions

View File

@ -626,7 +626,7 @@ static bool edbm_bevel_poll_property(const bContext *UNUSED(C),
if (STREQ(prop_id, "offset") && offset_type == BEVEL_AMT_PERCENT) {
return false;
}
else if (STREQ(prop_id, "offset_pct") && offset_type != BEVEL_AMT_PERCENT) {
if (STREQ(prop_id, "offset_pct") && offset_type != BEVEL_AMT_PERCENT) {
return false;
}
}
@ -729,7 +729,7 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
edbm_bevel_update_status_text(C, op);
return OPERATOR_RUNNING_MODAL;
}
else if (etype == MOUSEMOVE) {
if (etype == MOUSEMOVE) {
if (!has_numinput) {
edbm_bevel_mouse_set_value(op, event);
edbm_bevel_calc(op);

View File

@ -424,11 +424,10 @@ static bool edbm_extrude_mesh(Object *obedit, BMEditMesh *em, wmOperator *op)
if (changed) {
return true;
}
else {
BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude");
return false;
}
}
/* extrude without transform */
static int edbm_extrude_region_exec(bContext *C, wmOperator *op)

View File

@ -313,11 +313,10 @@ static bool edbm_inset_calc(wmOperator *op)
if (!EDBM_op_finish(em, &bmop, op, true)) {
continue;
}
else {
EDBM_update_generic(obedit->data, true, true);
changed = true;
}
}
return changed;
}
@ -387,18 +386,16 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
edbm_inset_update_header(op, C);
return OPERATOR_RUNNING_MODAL;
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
}
else if ((event->type == opdata->launch_event) && (event->val == KM_RELEASE) &&
if ((event->type == opdata->launch_event) && (event->val == KM_RELEASE) &&
RNA_boolean_get(op->ptr, "release_confirm")) {
edbm_inset_calc(op);
edbm_inset_exit(C, op);
return OPERATOR_FINISHED;
}
else {
bool handled = false;
switch (event->type) {
case EVT_ESCKEY:
@ -562,12 +559,9 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
edbm_inset_update_header(op, C);
return OPERATOR_RUNNING_MODAL;
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
}
}
return OPERATOR_RUNNING_MODAL;
}

View File

@ -60,10 +60,8 @@ static int bm_face_isect_self(BMFace *f, void *UNUSED(user_data))
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
return 0;
}
else {
return -1;
}
}
/**
* Compare selected/unselected.
@ -73,13 +71,11 @@ static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
return -1;
}
else if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
return 1;
}
else {
return 0;
}
}
/**
* A flipped version of #bm_face_isect_pair
@ -90,13 +86,11 @@ static int bm_face_isect_pair_swap(BMFace *f, void *UNUSED(user_data))
if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
return -1;
}
else if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
return 0;
}
else {
return 1;
}
}
/**
* Use for intersect and boolean.
@ -515,13 +509,11 @@ static int bm_edge_sort_length_cb(const void *e_a_v, const void *e_b_v)
if (val_a > val_b) {
return 1;
}
else if (val_a < val_b) {
if (val_a < val_b) {
return -1;
}
else {
return 0;
}
}
static void bm_face_split_by_edges_island_connect(
BMesh *bm, BMFace *f, LinkNode *e_link, const int e_link_len, MemArena *mem_arena_edgenet)

View File

@ -649,29 +649,23 @@ static int linehit_compare(const void *vlh1, const void *vlh2)
if (lh1->l < lh2->l) {
return -1;
}
else if (lh1->l > lh2->l) {
if (lh1->l > lh2->l) {
return 1;
}
else {
if (lh1->m < lh2->m) {
return -1;
}
else if (lh1->m > lh2->m) {
if (lh1->m > lh2->m) {
return 1;
}
else {
if (lh1->v < lh2->v) {
return -1;
}
else if (lh1->v > lh2->v) {
if (lh1->v > lh2->v) {
return 1;
}
else {
return 0;
}
}
}
}
/*
* Sort linehits by distance along cut line, and secondarily from
@ -816,12 +810,10 @@ static void knife_add_single_cut(KnifeTool_OpData *kcd,
kfe->e = e_base;
return;
}
else {
if (knife_add_single_cut__is_linehit_outside_face(f, lh1, lh2->hit) ||
knife_add_single_cut__is_linehit_outside_face(f, lh2, lh1->hit)) {
return;
}
}
/* Check if edge actually lies within face (might not, if this face is concave) */
if ((lh1->v && !lh1->kfe) && (lh2->v && !lh2->kfe)) {
@ -1405,10 +1397,8 @@ static bool coinciding_edges(BMEdge *e1, BMEdge *e2)
(equals_v3v3(co11, co22) && equals_v3v3(co12, co21))) {
return true;
}
else {
return false;
}
}
/* Callback used in point_is_visible to exclude hits on the faces that are the same
* as or contain the hitting element (which is in user_data).
@ -2191,14 +2181,12 @@ static KnifeVert *knife_find_closest_vert(
return curv;
}
else {
if (fptr) {
*fptr = f;
}
return NULL;
}
}
if (fptr) {
*fptr = NULL;
@ -2310,13 +2298,11 @@ static int sort_verts_by_dist_cb(void *co_p, const void *cur_a_p, const void *cu
if (a_sq < b_sq) {
return -1;
}
else if (a_sq > b_sq) {
if (a_sq > b_sq) {
return 1;
}
else {
return 0;
}
}
static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f)
{

View File

@ -152,13 +152,12 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports,
RPT_ERROR,
"No other selected objects have wire or boundary edges to use for projection");
return OPERATOR_CANCELLED;
}
}
void MESH_OT_knife_project(wmOperatorType *ot)
{

View File

@ -451,12 +451,11 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
"hold Alt for smooth"));
return OPERATOR_RUNNING_MODAL;
}
else {
ringsel_finish(C, op);
ringsel_exit(C, op);
return OPERATOR_FINISHED;
}
}
static int ringcut_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{

View File

@ -66,10 +66,8 @@ static bool paint_mask_extract_poll(bContext *C)
CTX_wm_operator_poll_msg_set(C, "The mask can not be extracted with dyntopo activated");
return false;
}
else {
return ED_operator_object_active_editable_mesh(C);
}
}
return false;
}

View File

@ -642,10 +642,10 @@ static BMElem *edbm_elem_find_nearest(ViewContext *vc, const char htype)
if ((em->selectmode & SCE_SELECT_VERTEX) && (htype == BM_VERT)) {
return (BMElem *)EDBM_vert_find_nearest(vc, &dist);
}
else if ((em->selectmode & SCE_SELECT_EDGE) && (htype == BM_EDGE)) {
if ((em->selectmode & SCE_SELECT_EDGE) && (htype == BM_EDGE)) {
return (BMElem *)EDBM_edge_find_nearest(vc, &dist);
}
else if ((em->selectmode & SCE_SELECT_FACE) && (htype == BM_FACE)) {
if ((em->selectmode & SCE_SELECT_FACE) && (htype == BM_FACE)) {
return (BMElem *)EDBM_face_find_nearest(vc, &dist);
}

View File

@ -247,10 +247,8 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C,
WM_event_add_mousemove(vc.win);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MESH_OT_polybuild_delete_at_cursor(wmOperatorType *ot)
{
@ -415,10 +413,8 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MESH_OT_polybuild_face_at_cursor(wmOperatorType *ot)
{
@ -470,7 +466,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
if (ele_act == NULL || ele_act->head.hflag == BM_FACE) {
return OPERATOR_PASS_THROUGH;
}
else if (ele_act->head.htype == BM_EDGE) {
if (ele_act->head.htype == BM_EDGE) {
BMEdge *e_act = (BMEdge *)ele_act;
mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co);
mul_m4_v3(vc.obedit->obmat, center);
@ -503,10 +499,8 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MESH_OT_polybuild_split_at_cursor(wmOperatorType *ot)
{
@ -596,10 +590,8 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C,
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MESH_OT_polybuild_dissolve_at_cursor(wmOperatorType *ot)
{

View File

@ -155,10 +155,8 @@ static float edbm_rip_edge_side_measure(
dist_squared_to_line_segment_v2(fmval, e_v1_co, e_v2_co)) {
return score;
}
else {
return -score;
}
}
/* - Advanced selection handling 'ripsel' functions ----- */
@ -433,10 +431,8 @@ static UnorderedLoopPair *edbm_tagged_loop_pairs_to_fill(BMesh *bm)
return uloop_pairs;
}
else {
return NULL;
}
}
static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *uloop_pairs)
{
@ -658,7 +654,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
/* should never happen */
return OPERATOR_CANCELLED;
}
else {
int vi_best = 0;
if (ese.ele) {
@ -741,7 +737,6 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
return OPERATOR_FINISHED;
}
}
if (!e_best) {
return OPERATOR_CANCELLED;
@ -1090,15 +1085,15 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* Ignore it. */
return OPERATOR_CANCELLED;
}
else if (error_face_selected) {
if (error_face_selected) {
BKE_report(op->reports, RPT_ERROR, "Cannot rip selected faces");
return OPERATOR_CANCELLED;
}
else if (error_disconnected_vertices) {
if (error_disconnected_vertices) {
BKE_report(op->reports, RPT_ERROR, "Cannot rip multiple disconnected vertices");
return OPERATOR_CANCELLED;
}
else if (error_rip_failed) {
if (error_rip_failed) {
BKE_report(op->reports, RPT_ERROR, "Rip failed");
return OPERATOR_CANCELLED;
}

View File

@ -316,7 +316,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
}
return NULL;
}
else {
struct NearestVertUserData data = {{0}};
const struct NearestVertUserData_Hit *hit = NULL;
const eV3DProjTest clip_flag = RV3D_CLIPPING_ENABLED(vc->v3d, vc->rv3d) ?
@ -348,8 +348,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
data.cycle_index_prev = 0;
}
data.hit.dist = data.hit_cycle.dist = data.hit.dist_bias = data.hit_cycle.dist_bias =
*r_dist;
data.hit.dist = data.hit_cycle.dist = data.hit.dist_bias = data.hit_cycle.dist_bias = *r_dist;
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, clip_flag);
@ -375,7 +374,6 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
return hit->vert;
}
}
BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist)
{
@ -563,7 +561,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
}
return NULL;
}
else {
struct NearestEdgeUserData data = {{0}};
const struct NearestEdgeUserData_Hit *hit = NULL;
/* interpolate along the edge before doing a clipping plane test */
@ -595,8 +593,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
data.cycle_index_prev = 0;
}
data.hit.dist = data.hit_cycle.dist = data.hit.dist_bias = data.hit_cycle.dist_bias =
*r_dist;
data.hit.dist = data.hit_cycle.dist = data.hit.dist_bias = data.hit_cycle.dist_bias = *r_dist;
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mesh_foreachScreenEdge(vc, find_nearest_edge__doClosest, &data, clip_flag);
@ -626,7 +623,6 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
return hit->edge;
}
}
BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
{
@ -769,7 +765,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
}
return NULL;
}
else {
struct NearestFaceUserData data = {{0}};
const struct NearestFaceUserData_Hit *hit = NULL;
const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT;
@ -799,8 +795,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
data.cycle_index_prev = 0;
}
data.hit.dist = data.hit_cycle.dist = data.hit.dist_bias = data.hit_cycle.dist_bias =
*r_dist;
data.hit.dist = data.hit_cycle.dist = data.hit.dist_bias = data.hit_cycle.dist_bias = *r_dist;
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mesh_foreachScreenFace(vc, findnearestface__doClosest, &data, clip_flag);
@ -830,7 +825,6 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
return hit->face;
}
}
BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
{
@ -1353,10 +1347,8 @@ static int edbm_select_mode_exec(bContext *C, wmOperator *op)
if (EDBM_selectmode_toggle_multi(C, type, action, use_extend, use_expand)) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
static int edbm_select_mode_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
@ -1809,10 +1801,8 @@ static int edbm_select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *e
RNA_boolean_get(op->ptr, "ring"))) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MESH_OT_loop_select(wmOperatorType *ot)
{
@ -2556,10 +2546,8 @@ bool EDBM_selectmode_disable(Scene *scene,
return true;
}
else {
return false;
}
}
/** \} */
@ -4202,11 +4190,11 @@ static bool edbm_deselect_nth(BMEditMesh *em, const struct CheckerIntervalParams
walker_deselect_nth(em, op_params, &v->head);
return true;
}
else if (e) {
if (e) {
walker_deselect_nth(em, op_params, &e->head);
return true;
}
else if (f) {
if (f) {
walker_deselect_nth(em, op_params, &f->head);
return true;
}

View File

@ -245,11 +245,9 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
if (custom_data_offset == -1) {
continue;
}
else {
gset_array[ob_index] = BLI_gset_ptr_new("Select similar face: facemap gset");
}
}
}
BMFace *face; /* Mesh face. */
BMIter iter; /* Selected faces iterator. */
@ -1249,13 +1247,11 @@ static int edbm_select_similar_exec(bContext *C, wmOperator *op)
if (type < 100) {
return similar_vert_select_exec(C, op);
}
else if (type < 200) {
if (type < 200) {
return similar_edge_select_exec(C, op);
}
else {
return similar_face_select_exec(C, op);
}
}
static const EnumPropertyItem *select_similar_type_itemf(bContext *C,
PointerRNA *UNUSED(ptr),

View File

@ -1557,7 +1557,7 @@ static int edbm_vert_connect_path_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Invalid selection order");
return OPERATOR_CANCELLED;
}
else if (failed_connect_len == objects_len) {
if (failed_connect_len == objects_len) {
BKE_report(op->reports, RPT_ERROR, "Could not connect vertices");
return OPERATOR_CANCELLED;
}
@ -2686,7 +2686,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "No selected vertex");
return OPERATOR_CANCELLED;
}
else if (tot_invalid == objects_len) {
if (tot_invalid == objects_len) {
BKE_report(op->reports, RPT_WARNING, "Selected faces must be triangles or quads");
return OPERATOR_CANCELLED;
}
@ -3505,7 +3505,7 @@ static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No selected vertex");
return OPERATOR_CANCELLED;
}
else if (tot_shapekeys == 0) {
if (tot_shapekeys == 0) {
BKE_report(op->reports,
RPT_ERROR,
objects_len > 1 ? "Meshes do not have shape keys" :
@ -3562,7 +3562,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Active mesh does not have shape keys");
return OPERATOR_CANCELLED;
}
else if (shape_ref >= totshape_ref) {
if (shape_ref >= totshape_ref) {
/* This case occurs if operator was used before on object with more keys than current one. */
shape_ref = 0; /* default to basis */
}
@ -3592,10 +3592,8 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
if (!key) {
continue;
}
else {
kb = BKE_keyblock_find_name(key, kb_ref->name);
shape = BLI_findindex(&key->block, kb);
}
if (kb) {
/* Perform blending on selected vertices. */
@ -3861,7 +3859,7 @@ static float bm_edge_seg_isect(const float sco_a[2],
return perc;
}
/* test e->v2 */
else if ((x11 == x22 && y11 == y22) || (x12 == x22 && y12 == y22)) {
if ((x11 == x22 && y11 == y22) || (x12 == x22 && y12 == y22)) {
perc = 0;
*isected = 2;
return perc;
@ -5885,13 +5883,11 @@ static int edbm_dissolve_mode_exec(bContext *C, wmOperator *op)
if (em->selectmode & SCE_SELECT_VERTEX) {
return edbm_dissolve_verts_exec(C, op);
}
else if (em->selectmode & SCE_SELECT_EDGE) {
if (em->selectmode & SCE_SELECT_EDGE) {
return edbm_dissolve_edges_exec(C, op);
}
else {
return edbm_dissolve_faces_exec(C, op);
}
}
void MESH_OT_dissolve_mode(wmOperatorType *ot)
{
@ -6814,20 +6810,16 @@ static bool edbm_sort_elements_poll_property(const bContext *UNUSED(C),
if (action == SRT_RANDOMIZE) {
return true;
}
else {
return false;
}
}
/* Hide seed for reverse and randomize actions! */
if (STREQ(prop_id, "reverse")) {
if (ELEM(action, SRT_RANDOMIZE, SRT_REVERSE)) {
return false;
}
else {
return true;
}
}
return true;
}
@ -7507,11 +7499,9 @@ static int mesh_symmetrize_exec(bContext *C, wmOperator *op)
if (!EDBM_op_finish(em, &bmop, op, true)) {
continue;
}
else {
EDBM_update_generic(obedit->data, true, true);
EDBM_selectmode_flush(em);
}
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
@ -8869,7 +8859,7 @@ static bool average_normals_draw_check_prop(PointerRNA *ptr,
if (STREQ(prop_id, "weight")) {
return (average_type == EDBM_CLNOR_AVERAGE_LOOP);
}
else if (STREQ(prop_id, "threshold")) {
if (STREQ(prop_id, "threshold")) {
return (average_type == EDBM_CLNOR_AVERAGE_LOOP);
}

View File

@ -187,7 +187,7 @@ bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool
return false;
}
else {
em->emcopyusers--;
if (em->emcopyusers < 0) {
printf("warning: em->emcopyusers was less than zero.\n");
@ -201,7 +201,6 @@ bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool
return true;
}
}
bool EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
{
@ -1628,10 +1627,10 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
if (f && !edge_ray_cast(tree, co2, dir2, NULL, e)) {
return true;
}
else if (f && !edge_ray_cast(tree, co3, dir3, NULL, e)) {
if (f && !edge_ray_cast(tree, co3, dir3, NULL, e)) {
return true;
}
else if (!f) {
if (!f) {
return true;
}

View File

@ -370,10 +370,8 @@ bool ED_mesh_uv_texture_remove_active(Mesh *me)
if (n != -1) {
return ED_mesh_uv_texture_remove_index(me, n);
}
else {
return false;
}
}
bool ED_mesh_uv_texture_remove_named(Mesh *me, const char *name)
{
/* texpoly/uv are assumed to be in sync */
@ -382,10 +380,8 @@ bool ED_mesh_uv_texture_remove_named(Mesh *me, const char *name)
if (n != -1) {
return ED_mesh_uv_texture_remove_index(me, n);
}
else {
return false;
}
}
/* note: keep in sync with ED_mesh_uv_texture_add */
int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set, const bool do_init)
@ -479,10 +475,8 @@ bool ED_mesh_color_remove_active(Mesh *me)
if (n != -1) {
return ED_mesh_color_remove_index(me, n);
}
else {
return false;
}
}
bool ED_mesh_color_remove_named(Mesh *me, const char *name)
{
CustomData *ldata = GET_CD_DATA(me, ldata);
@ -490,10 +484,8 @@ bool ED_mesh_color_remove_named(Mesh *me, const char *name)
if (n != -1) {
return ED_mesh_color_remove_index(me, n);
}
else {
return false;
}
}
/*********************** Sculpt Vertex colors operators ************************/
@ -590,10 +582,8 @@ bool ED_mesh_sculpt_color_remove_active(Mesh *me)
if (n != -1) {
return ED_mesh_sculpt_color_remove_index(me, n);
}
else {
return false;
}
}
bool ED_mesh_sculpt_color_remove_named(Mesh *me, const char *name)
{
CustomData *vdata = GET_CD_DATA(me, vdata);
@ -601,10 +591,8 @@ bool ED_mesh_sculpt_color_remove_named(Mesh *me, const char *name)
if (n != -1) {
return ED_mesh_sculpt_color_remove_index(me, n);
}
else {
return false;
}
}
/*********************** UV texture operators ************************/
@ -817,10 +805,8 @@ static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int typ
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
/* Clear Mask */
static bool mesh_customdata_mask_clear_poll(bContext *C)
@ -855,10 +841,8 @@ static int mesh_customdata_mask_clear_exec(bContext *C, wmOperator *UNUSED(op))
if (ret_a == OPERATOR_FINISHED || ret_b == OPERATOR_FINISHED) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
void MESH_OT_customdata_mask_clear(wmOperatorType *ot)
{
@ -1289,7 +1273,7 @@ void ED_mesh_verts_remove(Mesh *mesh, ReportList *reports, int count)
BKE_report(reports, RPT_ERROR, "Cannot remove vertices in edit mode");
return;
}
else if (count > mesh->totvert) {
if (count > mesh->totvert) {
BKE_report(reports, RPT_ERROR, "Cannot remove more vertices than the mesh contains");
return;
}
@ -1303,7 +1287,7 @@ void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
BKE_report(reports, RPT_ERROR, "Cannot remove edges in edit mode");
return;
}
else if (count > mesh->totedge) {
if (count > mesh->totedge) {
BKE_report(reports, RPT_ERROR, "Cannot remove more edges than the mesh contains");
return;
}
@ -1317,7 +1301,7 @@ void ED_mesh_loops_remove(Mesh *mesh, ReportList *reports, int count)
BKE_report(reports, RPT_ERROR, "Cannot remove loops in edit mode");
return;
}
else if (count > mesh->totloop) {
if (count > mesh->totloop) {
BKE_report(reports, RPT_ERROR, "Cannot remove more loops than the mesh contains");
return;
}
@ -1331,7 +1315,7 @@ void ED_mesh_polys_remove(Mesh *mesh, ReportList *reports, int count)
BKE_report(reports, RPT_ERROR, "Cannot remove polys in edit mode");
return;
}
else if (count > mesh->totpoly) {
if (count > mesh->totpoly) {
BKE_report(reports, RPT_ERROR, "Cannot remove more polys than the mesh contains");
return;
}

View File

@ -129,7 +129,7 @@ static int mirrtopo_hash_sort(const void *l1, const void *l2)
if ((MirrTopoHash_t)(intptr_t)l1 > (MirrTopoHash_t)(intptr_t)l2) {
return 1;
}
else if ((MirrTopoHash_t)(intptr_t)l1 < (MirrTopoHash_t)(intptr_t)l2) {
if ((MirrTopoHash_t)(intptr_t)l1 < (MirrTopoHash_t)(intptr_t)l2) {
return -1;
}
return 0;
@ -140,7 +140,7 @@ static int mirrtopo_vert_sort(const void *v1, const void *v2)
if (((MirrTopoVert_t *)v1)->hash > ((MirrTopoVert_t *)v2)->hash) {
return 1;
}
else if (((MirrTopoVert_t *)v1)->hash < ((MirrTopoVert_t *)v2)->hash) {
if (((MirrTopoVert_t *)v1)->hash < ((MirrTopoVert_t *)v2)->hash) {
return -1;
}
return 0;
@ -166,10 +166,8 @@ bool ED_mesh_mirrtopo_recalc_check(BMEditMesh *em, Mesh *me, MirrTopoStore_t *me
(totvert != mesh_topo_store->prev_vert_tot) || (totedge != mesh_topo_store->prev_edge_tot)) {
return true;
}
else {
return false;
}
}
void ED_mesh_mirrtopo_init(BMEditMesh *em,
Mesh *me,
@ -278,10 +276,8 @@ void ED_mesh_mirrtopo_init(BMEditMesh *em,
* higher number of unique values compared to the previous loop. */
break;
}
else {
tot_unique_prev = tot_unique;
tot_unique_edges_prev = tot_unique_edges;
}
/* Copy the hash calculated this iteration, so we can use them next time */
memcpy(topo_hash_prev, topo_hash, sizeof(MirrTopoHash_t) * totvert);

View File

@ -892,10 +892,8 @@ int mesh_get_x_mirror_vert(Object *ob, Mesh *me_eval, int index, const bool use_
if (use_topology) {
return mesh_get_x_mirror_vert_topo(ob, me_eval, index);
}
else {
return mesh_get_x_mirror_vert_spatial(ob, me_eval, index);
}
}
static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, const float co[3])
{
@ -963,10 +961,8 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob,
if (use_topology) {
return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
}
else {
return editbmesh_get_x_mirror_vert_spatial(ob, em, co);
}
}
/**
* Wrapper for object-mode/edit-mode.
@ -1072,13 +1068,13 @@ static int mirror_facerotation(MFace *a, MFace *b)
if (a->v1 == b->v1 && a->v2 == b->v2 && a->v3 == b->v3 && a->v4 == b->v4) {
return 0;
}
else if (a->v4 == b->v1 && a->v1 == b->v2 && a->v2 == b->v3 && a->v3 == b->v4) {
if (a->v4 == b->v1 && a->v1 == b->v2 && a->v2 == b->v3 && a->v3 == b->v4) {
return 1;
}
else if (a->v3 == b->v1 && a->v4 == b->v2 && a->v1 == b->v3 && a->v2 == b->v4) {
if (a->v3 == b->v1 && a->v4 == b->v2 && a->v1 == b->v3 && a->v2 == b->v4) {
return 2;
}
else if (a->v2 == b->v1 && a->v3 == b->v2 && a->v4 == b->v3 && a->v1 == b->v4) {
if (a->v2 == b->v1 && a->v3 == b->v2 && a->v4 == b->v3 && a->v1 == b->v4) {
return 3;
}
}
@ -1086,10 +1082,10 @@ static int mirror_facerotation(MFace *a, MFace *b)
if (a->v1 == b->v1 && a->v2 == b->v2 && a->v3 == b->v3) {
return 0;
}
else if (a->v3 == b->v1 && a->v1 == b->v2 && a->v2 == b->v3) {
if (a->v3 == b->v1 && a->v1 == b->v2 && a->v2 == b->v3) {
return 1;
}
else if (a->v2 == b->v1 && a->v3 == b->v2 && a->v1 == b->v3) {
if (a->v2 == b->v1 && a->v3 == b->v2 && a->v1 == b->v3) {
return 2;
}
}
@ -1468,10 +1464,8 @@ MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index)
if (index == -1 || me->dvert == NULL) {
return NULL;
}
else {
return me->dvert + index;
}
}
MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
{
@ -1479,14 +1473,10 @@ MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
if (ob->mode & OB_MODE_EDIT) {
return ED_mesh_active_dvert_get_em(ob, NULL);
}
else {
return ED_mesh_active_dvert_get_ob(ob, NULL);
}
}
else {
return NULL;
}
}
void EDBM_mesh_stats_multi(struct Object **objects,
const uint objects_len,