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,10 +424,9 @@ 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;
}
BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude");
return false;
}
/* extrude without transform */

View File

@ -313,10 +313,9 @@ 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;
}
EDBM_update_generic(obedit->data, true, true);
changed = true;
}
return changed;
}
@ -387,186 +386,181 @@ 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;
}
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
else if ((event->type == opdata->launch_event) && (event->val == KM_RELEASE) &&
RNA_boolean_get(op->ptr, "release_confirm")) {
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:
case RIGHTMOUSE:
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
case MOUSEMOVE:
if (!has_numinput) {
float mdiff[2];
float amount;
bool handled = false;
switch (event->type) {
case EVT_ESCKEY:
case RIGHTMOUSE:
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
mdiff[0] = opdata->mcenter[0] - event->mval[0];
mdiff[1] = opdata->mcenter[1] - event->mval[1];
case MOUSEMOVE:
if (!has_numinput) {
float mdiff[2];
float amount;
if (opdata->modify_depth) {
amount = opdata->old_depth +
((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
opdata->max_obj_scale;
}
else {
amount = opdata->old_thickness -
((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
opdata->max_obj_scale;
}
mdiff[0] = opdata->mcenter[0] - event->mval[0];
mdiff[1] = opdata->mcenter[1] - event->mval[1];
/* Fake shift-transform... */
if (opdata->shift) {
amount = (amount - opdata->shift_amount) * 0.1f + opdata->shift_amount;
}
if (opdata->modify_depth) {
RNA_float_set(op->ptr, "depth", amount);
}
else {
amount = max_ff(amount, 0.0f);
RNA_float_set(op->ptr, "thickness", amount);
}
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
}
break;
case LEFTMOUSE:
case EVT_PADENTER:
case EVT_RETKEY:
if ((event->val == KM_PRESS) ||
((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm"))) {
edbm_inset_calc(op);
edbm_inset_exit(C, op);
return OPERATOR_FINISHED;
}
break;
case EVT_LEFTSHIFTKEY:
case EVT_RIGHTSHIFTKEY:
if (event->val == KM_PRESS) {
if (opdata->modify_depth) {
opdata->shift_amount = RNA_float_get(op->ptr, "depth");
}
else {
opdata->shift_amount = RNA_float_get(op->ptr, "thickness");
}
opdata->shift = true;
handled = true;
if (opdata->modify_depth) {
amount = opdata->old_depth +
((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
opdata->max_obj_scale;
}
else {
opdata->shift_amount = 0.0f;
opdata->shift = false;
handled = true;
amount = opdata->old_thickness -
((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
opdata->max_obj_scale;
}
break;
case EVT_LEFTCTRLKEY:
case EVT_RIGHTCTRLKEY: {
float mlen[2];
/* Fake shift-transform... */
if (opdata->shift) {
amount = (amount - opdata->shift_amount) * 0.1f + opdata->shift_amount;
}
mlen[0] = opdata->mcenter[0] - event->mval[0];
mlen[1] = opdata->mcenter[1] - event->mval[1];
if (event->val == KM_PRESS) {
opdata->old_thickness = RNA_float_get(op->ptr, "thickness");
if (opdata->shift) {
opdata->shift_amount = opdata->old_thickness;
}
opdata->modify_depth = true;
if (opdata->modify_depth) {
RNA_float_set(op->ptr, "depth", amount);
}
else {
opdata->old_depth = RNA_float_get(op->ptr, "depth");
if (opdata->shift) {
opdata->shift_amount = opdata->old_depth;
}
opdata->modify_depth = false;
amount = max_ff(amount, 0.0f);
RNA_float_set(op->ptr, "thickness", amount);
}
opdata->initial_length = len_v2(mlen);
edbm_inset_update_header(op, C);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
break;
}
break;
case EVT_OKEY:
if (event->val == KM_PRESS) {
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);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
case LEFTMOUSE:
case EVT_PADENTER:
case EVT_RETKEY:
if ((event->val == KM_PRESS) ||
((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm"))) {
edbm_inset_calc(op);
edbm_inset_exit(C, op);
return OPERATOR_FINISHED;
}
break;
case EVT_LEFTSHIFTKEY:
case EVT_RIGHTSHIFTKEY:
if (event->val == KM_PRESS) {
if (opdata->modify_depth) {
opdata->shift_amount = RNA_float_get(op->ptr, "depth");
}
break;
case EVT_BKEY:
if (event->val == KM_PRESS) {
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);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
else {
opdata->shift_amount = RNA_float_get(op->ptr, "thickness");
}
break;
case EVT_IKEY:
if (event->val == KM_PRESS) {
const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
RNA_boolean_set(op->ptr, "use_individual", !use_individual);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
}
break;
}
/* Modal numinput inactive, try to handle numeric inputs last... */
if (!handled && event->val == KM_PRESS && handleNumInput(C, &opdata->num_input, event)) {
float amounts[2] = {RNA_float_get(op->ptr, "thickness"), RNA_float_get(op->ptr, "depth")};
applyNumInput(&opdata->num_input, amounts);
amounts[0] = max_ff(amounts[0], 0.0f);
RNA_float_set(op->ptr, "thickness", amounts[0]);
RNA_float_set(op->ptr, "depth", amounts[1]);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
return OPERATOR_RUNNING_MODAL;
opdata->shift = true;
handled = true;
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
opdata->shift_amount = 0.0f;
opdata->shift = false;
handled = true;
}
break;
case EVT_LEFTCTRLKEY:
case EVT_RIGHTCTRLKEY: {
float mlen[2];
mlen[0] = opdata->mcenter[0] - event->mval[0];
mlen[1] = opdata->mcenter[1] - event->mval[1];
if (event->val == KM_PRESS) {
opdata->old_thickness = RNA_float_get(op->ptr, "thickness");
if (opdata->shift) {
opdata->shift_amount = opdata->old_thickness;
}
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->initial_length = len_v2(mlen);
edbm_inset_update_header(op, C);
handled = true;
break;
}
case EVT_OKEY:
if (event->val == KM_PRESS) {
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);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
}
break;
case EVT_BKEY:
if (event->val == KM_PRESS) {
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);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
}
break;
case EVT_IKEY:
if (event->val == KM_PRESS) {
const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
RNA_boolean_set(op->ptr, "use_individual", !use_individual);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
handled = true;
}
break;
}
/* Modal numinput inactive, try to handle numeric inputs last... */
if (!handled && event->val == KM_PRESS && handleNumInput(C, &opdata->num_input, event)) {
float amounts[2] = {RNA_float_get(op->ptr, "thickness"), RNA_float_get(op->ptr, "depth")};
applyNumInput(&opdata->num_input, amounts);
amounts[0] = max_ff(amounts[0], 0.0f);
RNA_float_set(op->ptr, "thickness", amounts[0]);
RNA_float_set(op->ptr, "depth", amounts[1]);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
return OPERATOR_RUNNING_MODAL;
}
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
return OPERATOR_RUNNING_MODAL;

View File

@ -60,9 +60,7 @@ 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;
}
return -1;
}
/**
@ -73,12 +71,10 @@ 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;
}
return 0;
}
/**
@ -90,12 +86,10 @@ 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;
}
return 1;
}
/**
@ -515,12 +509,10 @@ 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;
}
return 0;
}
static void bm_face_split_by_edges_island_connect(

View File

@ -649,28 +649,22 @@ 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) {
return 1;
}
else {
if (lh1->v < lh2->v) {
return -1;
}
else if (lh1->v > lh2->v) {
return 1;
}
else {
return 0;
}
}
if (lh1->m < lh2->m) {
return -1;
}
if (lh1->m > lh2->m) {
return 1;
}
if (lh1->v < lh2->v) {
return -1;
}
if (lh1->v > lh2->v) {
return 1;
}
return 0;
}
/*
@ -816,11 +810,9 @@ 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;
}
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) */
@ -1405,9 +1397,7 @@ static bool coinciding_edges(BMEdge *e1, BMEdge *e2)
(equals_v3v3(co11, co22) && equals_v3v3(co12, co21))) {
return true;
}
else {
return false;
}
return false;
}
/* Callback used in point_is_visible to exclude hits on the faces that are the same
@ -2191,13 +2181,11 @@ static KnifeVert *knife_find_closest_vert(
return curv;
}
else {
if (fptr) {
*fptr = f;
}
return NULL;
if (fptr) {
*fptr = f;
}
return NULL;
}
if (fptr) {
@ -2310,12 +2298,10 @@ 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;
}
return 0;
}
static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f)

View File

@ -152,12 +152,11 @@ 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;
}
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,11 +451,10 @@ 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;
}
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,9 +66,7 @@ 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 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,9 +247,7 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C,
WM_event_add_mousemove(vc.win);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void MESH_OT_polybuild_delete_at_cursor(wmOperatorType *ot)
@ -415,9 +413,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
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,9 +499,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void MESH_OT_polybuild_split_at_cursor(wmOperatorType *ot)
@ -596,9 +590,7 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C,
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void MESH_OT_polybuild_dissolve_at_cursor(wmOperatorType *ot)

View File

@ -155,9 +155,7 @@ 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;
}
return -score;
}
/* - Advanced selection handling 'ripsel' functions ----- */
@ -433,9 +431,7 @@ static UnorderedLoopPair *edbm_tagged_loop_pairs_to_fill(BMesh *bm)
return uloop_pairs;
}
else {
return NULL;
}
return NULL;
}
static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *uloop_pairs)
@ -658,89 +654,88 @@ 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) {
BM_select_history_remove(bm, ese.ele);
}
int vi_best = 0;
dist_sq = FLT_MAX;
/* in the loop below we find the best vertex to drag based on its connected geometry,
* either by its face corner, or connected edge (when no faces are attached) */
for (i = 0; i < vout_len; i++) {
if (BM_vert_is_wire(vout[i]) == false) {
/* find the best face corner */
BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
float l_mid_co[3];
edbm_calc_loop_co(l, l_mid_co);
d = edbm_rip_edgedist_squared(
region, projectMat, v->co, l_mid_co, fmval, INSET_DEFAULT);
if (d < dist_sq) {
dist_sq = d;
vi_best = i;
}
}
}
}
else {
BMEdge *e;
/* a wire vert, find the best edge */
BM_ITER_ELEM (e, &iter, vout[i], BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
float e_mid_co[3];
mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co);
d = edbm_rip_edgedist_squared(
region, projectMat, v->co, e_mid_co, fmval, INSET_DEFAULT);
if (d < dist_sq) {
dist_sq = d;
vi_best = i;
}
}
}
}
}
/* vout[0] == best
* vout[1] == glue
* vout[2+] == splice with glue (when vout_len > 2)
*/
if (vi_best != 0) {
SWAP(BMVert *, vout[0], vout[vi_best]);
vi_best = 0;
}
/* select the vert from the best region */
v = vout[vi_best];
BM_vert_select_set(bm, v, true);
if (ese.ele) {
BM_select_history_store(bm, v);
}
/* splice all others back together */
if (vout_len > 2) {
for (i = 2; i < vout_len; i++) {
BM_vert_splice(bm, vout[1], vout[i]);
}
}
if (do_fill) {
/* match extrude vert-order */
BM_edge_create(bm, vout[1], vout[0], NULL, BM_CREATE_NOP);
}
MEM_freeN(vout);
return OPERATOR_FINISHED;
if (ese.ele) {
BM_select_history_remove(bm, ese.ele);
}
dist_sq = FLT_MAX;
/* in the loop below we find the best vertex to drag based on its connected geometry,
* either by its face corner, or connected edge (when no faces are attached) */
for (i = 0; i < vout_len; i++) {
if (BM_vert_is_wire(vout[i]) == false) {
/* find the best face corner */
BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
float l_mid_co[3];
edbm_calc_loop_co(l, l_mid_co);
d = edbm_rip_edgedist_squared(
region, projectMat, v->co, l_mid_co, fmval, INSET_DEFAULT);
if (d < dist_sq) {
dist_sq = d;
vi_best = i;
}
}
}
}
else {
BMEdge *e;
/* a wire vert, find the best edge */
BM_ITER_ELEM (e, &iter, vout[i], BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
float e_mid_co[3];
mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co);
d = edbm_rip_edgedist_squared(
region, projectMat, v->co, e_mid_co, fmval, INSET_DEFAULT);
if (d < dist_sq) {
dist_sq = d;
vi_best = i;
}
}
}
}
}
/* vout[0] == best
* vout[1] == glue
* vout[2+] == splice with glue (when vout_len > 2)
*/
if (vi_best != 0) {
SWAP(BMVert *, vout[0], vout[vi_best]);
vi_best = 0;
}
/* select the vert from the best region */
v = vout[vi_best];
BM_vert_select_set(bm, v, true);
if (ese.ele) {
BM_select_history_store(bm, v);
}
/* splice all others back together */
if (vout_len > 2) {
for (i = 2; i < vout_len; i++) {
BM_vert_splice(bm, vout[1], vout[i]);
}
}
if (do_fill) {
/* match extrude vert-order */
BM_edge_create(bm, vout[1], vout[0], NULL, BM_CREATE_NOP);
}
MEM_freeN(vout);
return OPERATOR_FINISHED;
}
if (!e_best) {
@ -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,65 +316,63 @@ 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) ?
V3D_PROJ_TEST_CLIP_DEFAULT :
V3D_PROJ_TEST_CLIP_DEFAULT & ~V3D_PROJ_TEST_CLIP_BB;
BMesh *prev_select_bm = NULL;
static struct {
int index;
const BMVert *elem;
const BMesh *bm;
} prev_select = {0};
struct NearestVertUserData data = {{0}};
const struct NearestVertUserData_Hit *hit = NULL;
const eV3DProjTest clip_flag = RV3D_CLIPPING_ENABLED(vc->v3d, vc->rv3d) ?
V3D_PROJ_TEST_CLIP_DEFAULT :
V3D_PROJ_TEST_CLIP_DEFAULT & ~V3D_PROJ_TEST_CLIP_BB;
BMesh *prev_select_bm = NULL;
data.mval_fl[0] = vc->mval[0];
data.mval_fl[1] = vc->mval[1];
data.use_select_bias = use_select_bias;
data.use_cycle = use_cycle;
static struct {
int index;
const BMVert *elem;
const BMesh *bm;
} prev_select = {0};
for (; base_index < bases_len; base_index++) {
Base *base_iter = bases[base_index];
ED_view3d_viewcontext_init_object(vc, base_iter->object);
if (use_cycle && prev_select.bm == vc->em->bm &&
prev_select.elem == BM_vert_at_index_find_or_table(vc->em->bm, prev_select.index)) {
data.cycle_index_prev = prev_select.index;
/* No need to compare in the rest of the loop. */
use_cycle = false;
}
else {
data.cycle_index_prev = 0;
}
data.mval_fl[0] = vc->mval[0];
data.mval_fl[1] = vc->mval[1];
data.use_select_bias = use_select_bias;
data.use_cycle = use_cycle;
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);
hit = (data.use_cycle && data.hit_cycle.vert) ? &data.hit_cycle : &data.hit;
if (hit->dist < *r_dist) {
if (r_base_index) {
*r_base_index = base_index;
}
*r_dist = hit->dist;
prev_select_bm = vc->em->bm;
}
for (; base_index < bases_len; base_index++) {
Base *base_iter = bases[base_index];
ED_view3d_viewcontext_init_object(vc, base_iter->object);
if (use_cycle && prev_select.bm == vc->em->bm &&
prev_select.elem == BM_vert_at_index_find_or_table(vc->em->bm, prev_select.index)) {
data.cycle_index_prev = prev_select.index;
/* No need to compare in the rest of the loop. */
use_cycle = false;
}
else {
data.cycle_index_prev = 0;
}
if (hit == NULL) {
return NULL;
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);
hit = (data.use_cycle && data.hit_cycle.vert) ? &data.hit_cycle : &data.hit;
if (hit->dist < *r_dist) {
if (r_base_index) {
*r_base_index = base_index;
}
*r_dist = hit->dist;
prev_select_bm = vc->em->bm;
}
prev_select.index = hit->index;
prev_select.elem = hit->vert;
prev_select.bm = prev_select_bm;
return hit->vert;
}
if (hit == NULL) {
return NULL;
}
prev_select.index = hit->index;
prev_select.elem = hit->vert;
prev_select.bm = prev_select_bm;
return hit->vert;
}
BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist)
@ -563,69 +561,67 @@ 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 */
const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT & ~V3D_PROJ_TEST_CLIP_BB;
BMesh *prev_select_bm = NULL;
static struct {
int index;
const BMEdge *elem;
const BMesh *bm;
} prev_select = {0};
struct NearestEdgeUserData data = {{0}};
const struct NearestEdgeUserData_Hit *hit = NULL;
/* interpolate along the edge before doing a clipping plane test */
const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT & ~V3D_PROJ_TEST_CLIP_BB;
BMesh *prev_select_bm = NULL;
data.vc = *vc;
data.mval_fl[0] = vc->mval[0];
data.mval_fl[1] = vc->mval[1];
data.use_select_bias = use_select_bias;
data.use_cycle = use_cycle;
static struct {
int index;
const BMEdge *elem;
const BMesh *bm;
} prev_select = {0};
for (; base_index < bases_len; base_index++) {
Base *base_iter = bases[base_index];
ED_view3d_viewcontext_init_object(vc, base_iter->object);
if (use_cycle && prev_select.bm == vc->em->bm &&
prev_select.elem == BM_edge_at_index_find_or_table(vc->em->bm, prev_select.index)) {
data.cycle_index_prev = prev_select.index;
/* No need to compare in the rest of the loop. */
use_cycle = false;
}
else {
data.cycle_index_prev = 0;
}
data.vc = *vc;
data.mval_fl[0] = vc->mval[0];
data.mval_fl[1] = vc->mval[1];
data.use_select_bias = use_select_bias;
data.use_cycle = use_cycle;
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);
hit = (data.use_cycle && data.hit_cycle.edge) ? &data.hit_cycle : &data.hit;
if (hit->dist < *r_dist) {
if (r_base_index) {
*r_base_index = base_index;
}
*r_dist = hit->dist;
prev_select_bm = vc->em->bm;
}
for (; base_index < bases_len; base_index++) {
Base *base_iter = bases[base_index];
ED_view3d_viewcontext_init_object(vc, base_iter->object);
if (use_cycle && prev_select.bm == vc->em->bm &&
prev_select.elem == BM_edge_at_index_find_or_table(vc->em->bm, prev_select.index)) {
data.cycle_index_prev = prev_select.index;
/* No need to compare in the rest of the loop. */
use_cycle = false;
}
else {
data.cycle_index_prev = 0;
}
if (hit == NULL) {
return NULL;
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);
hit = (data.use_cycle && data.hit_cycle.edge) ? &data.hit_cycle : &data.hit;
if (hit->dist < *r_dist) {
if (r_base_index) {
*r_base_index = base_index;
}
*r_dist = hit->dist;
prev_select_bm = vc->em->bm;
}
if (r_dist_center) {
*r_dist_center = hit->dist_center;
}
prev_select.index = hit->index;
prev_select.elem = hit->edge;
prev_select.bm = prev_select_bm;
return hit->edge;
}
if (hit == NULL) {
return NULL;
}
if (r_dist_center) {
*r_dist_center = hit->dist_center;
}
prev_select.index = hit->index;
prev_select.elem = hit->edge;
prev_select.bm = prev_select_bm;
return hit->edge;
}
BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist)
@ -769,67 +765,65 @@ 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;
BMesh *prev_select_bm = NULL;
static struct {
int index;
const BMFace *elem;
const BMesh *bm;
} prev_select = {0};
struct NearestFaceUserData data = {{0}};
const struct NearestFaceUserData_Hit *hit = NULL;
const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT;
BMesh *prev_select_bm = NULL;
data.mval_fl[0] = vc->mval[0];
data.mval_fl[1] = vc->mval[1];
data.use_select_bias = use_select_bias;
data.use_cycle = use_cycle;
static struct {
int index;
const BMFace *elem;
const BMesh *bm;
} prev_select = {0};
for (; base_index < bases_len; base_index++) {
Base *base_iter = bases[base_index];
ED_view3d_viewcontext_init_object(vc, base_iter->object);
if (use_cycle && prev_select.bm == vc->em->bm &&
prev_select.elem == BM_face_at_index_find_or_table(vc->em->bm, prev_select.index)) {
data.cycle_index_prev = prev_select.index;
/* No need to compare in the rest of the loop. */
use_cycle = false;
}
else {
data.cycle_index_prev = 0;
}
data.mval_fl[0] = vc->mval[0];
data.mval_fl[1] = vc->mval[1];
data.use_select_bias = use_select_bias;
data.use_cycle = use_cycle;
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);
hit = (data.use_cycle && data.hit_cycle.face) ? &data.hit_cycle : &data.hit;
if (hit->dist < *r_dist) {
if (r_base_index) {
*r_base_index = base_index;
}
*r_dist = hit->dist;
prev_select_bm = vc->em->bm;
}
for (; base_index < bases_len; base_index++) {
Base *base_iter = bases[base_index];
ED_view3d_viewcontext_init_object(vc, base_iter->object);
if (use_cycle && prev_select.bm == vc->em->bm &&
prev_select.elem == BM_face_at_index_find_or_table(vc->em->bm, prev_select.index)) {
data.cycle_index_prev = prev_select.index;
/* No need to compare in the rest of the loop. */
use_cycle = false;
}
else {
data.cycle_index_prev = 0;
}
if (hit == NULL) {
return NULL;
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);
hit = (data.use_cycle && data.hit_cycle.face) ? &data.hit_cycle : &data.hit;
if (hit->dist < *r_dist) {
if (r_base_index) {
*r_base_index = base_index;
}
*r_dist = hit->dist;
prev_select_bm = vc->em->bm;
}
if (r_dist_center) {
*r_dist_center = hit->dist;
}
prev_select.index = hit->index;
prev_select.elem = hit->face;
prev_select.bm = prev_select_bm;
return hit->face;
}
if (hit == NULL) {
return NULL;
}
if (r_dist_center) {
*r_dist_center = hit->dist;
}
prev_select.index = hit->index;
prev_select.elem = hit->face;
prev_select.bm = prev_select_bm;
return hit->face;
}
BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
@ -1353,9 +1347,7 @@ 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;
}
return OPERATOR_CANCELLED;
}
static int edbm_select_mode_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@ -1809,9 +1801,7 @@ 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;
}
return OPERATOR_CANCELLED;
}
void MESH_OT_loop_select(wmOperatorType *ot)
@ -2556,9 +2546,7 @@ bool EDBM_selectmode_disable(Scene *scene,
return true;
}
else {
return false;
}
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,9 +245,7 @@ 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");
}
gset_array[ob_index] = BLI_gset_ptr_new("Select similar face: facemap gset");
}
}
@ -1249,12 +1247,10 @@ 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);
}
return similar_face_select_exec(C, op);
}
static const EnumPropertyItem *select_similar_type_itemf(bContext *C,

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);
}
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,12 +5883,10 @@ 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);
}
return edbm_dissolve_faces_exec(C, op);
}
void MESH_OT_dissolve_mode(wmOperatorType *ot)
@ -6814,9 +6810,7 @@ static bool edbm_sort_elements_poll_property(const bContext *UNUSED(C),
if (action == SRT_RANDOMIZE) {
return true;
}
else {
return false;
}
return false;
}
/* Hide seed for reverse and randomize actions! */
@ -6824,9 +6818,7 @@ static bool edbm_sort_elements_poll_property(const bContext *UNUSED(C),
if (ELEM(action, SRT_RANDOMIZE, SRT_REVERSE)) {
return false;
}
else {
return true;
}
return true;
}
return true;
@ -7507,10 +7499,8 @@ 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);
}
EDBM_update_generic(obedit->data, true, true);
EDBM_selectmode_flush(em);
}
MEM_freeN(objects);
@ -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,20 +187,19 @@ 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");
}
if (em->emcopyusers <= 0) {
BKE_editmesh_free(em->emcopy);
MEM_freeN(em->emcopy);
em->emcopy = NULL;
}
return true;
em->emcopyusers--;
if (em->emcopyusers < 0) {
printf("warning: em->emcopyusers was less than zero.\n");
}
if (em->emcopyusers <= 0) {
BKE_editmesh_free(em->emcopy);
MEM_freeN(em->emcopy);
em->emcopy = NULL;
}
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,9 +370,7 @@ bool ED_mesh_uv_texture_remove_active(Mesh *me)
if (n != -1) {
return ED_mesh_uv_texture_remove_index(me, n);
}
else {
return false;
}
return false;
}
bool ED_mesh_uv_texture_remove_named(Mesh *me, const char *name)
{
@ -382,9 +380,7 @@ 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;
}
return false;
}
/* note: keep in sync with ED_mesh_uv_texture_add */
@ -479,9 +475,7 @@ bool ED_mesh_color_remove_active(Mesh *me)
if (n != -1) {
return ED_mesh_color_remove_index(me, n);
}
else {
return false;
}
return false;
}
bool ED_mesh_color_remove_named(Mesh *me, const char *name)
{
@ -490,9 +484,7 @@ 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;
}
return false;
}
/*********************** Sculpt Vertex colors operators ************************/
@ -590,9 +582,7 @@ bool ED_mesh_sculpt_color_remove_active(Mesh *me)
if (n != -1) {
return ED_mesh_sculpt_color_remove_index(me, n);
}
else {
return false;
}
return false;
}
bool ED_mesh_sculpt_color_remove_named(Mesh *me, const char *name)
{
@ -601,9 +591,7 @@ 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;
}
return false;
}
/*********************** UV texture operators ************************/
@ -817,9 +805,7 @@ static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int typ
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
/* Clear Mask */
@ -855,9 +841,7 @@ 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;
}
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,9 +166,7 @@ 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;
}
return false;
}
void ED_mesh_mirrtopo_init(BMEditMesh *em,
@ -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;
}
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,9 +892,7 @@ 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);
}
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,9 +961,7 @@ 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);
}
return editbmesh_get_x_mirror_vert_spatial(ob, em, co);
}
/**
@ -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,9 +1464,7 @@ 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;
}
return me->dvert + index;
}
MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
@ -1479,13 +1473,9 @@ 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;
return ED_mesh_active_dvert_get_ob(ob, NULL);
}
return NULL;
}
void EDBM_mesh_stats_multi(struct Object **objects,