diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-09 01:35:37 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-09 02:13:43 +0300 |
commit | 21462565632b876ac4eadf2bd30573f2fda70c76 (patch) | |
tree | 483da4fc20c4c8cc7198abd6edd5f3a53aa90b91 /source/blender/editors | |
parent | 626c844105afc3b2455f5a1b87ac8a7839a7e0bf (diff) |
Cleanup: use ELEM macro
Diffstat (limited to 'source/blender/editors')
7 files changed, 14 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f5fa710067b..2386b388a41 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3930,7 +3930,7 @@ static void ui_do_but_textedit( } #ifdef WITH_INPUT_IME - if (event->type == WM_IME_COMPOSITE_START || event->type == WM_IME_COMPOSITE_EVENT) { + if (ELEM(event->type, WM_IME_COMPOSITE_START, WM_IME_COMPOSITE_EVENT)) { changed = true; if (event->type == WM_IME_COMPOSITE_START && but->selend > but->selsta) { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index daa4b53803f..d47e67b9d27 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -3462,8 +3462,7 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) // files->entry->nr = totbl + 1; files->entry->poin = id; fake = id->flag & LIB_FAKEUSER; - if (idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || - idcode == ID_IM) { + if (ELEM(idcode, ID_MA, ID_TE, ID_LA, ID_WO, ID_IM)) { files->typeflag |= FILE_TYPE_IMAGE; } # if 0 diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 5ac4363e63d..bdad08fe20a 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -476,7 +476,7 @@ static void draw_seq_waveform_overlay(View2D *v2d, bool is_line_strip = (value_max - value_min < 0.05f); - if (was_line_strip != -1 && is_line_strip != was_line_strip) { + if (!ELEM(was_line_strip, -1, is_line_strip)) { /* If the previously added strip type isn't the same as the current one, * add transition areas so they transition smoothly between each other. */ if (is_line_strip) { diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 0e29c68cf23..d3fc3e9d352 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1108,7 +1108,7 @@ static void draw_documentation(const SpaceText *st, ARegion *region) if (*p == '\r' && *(++p) != '\n') { *(--p) = '\n'; /* Fix line endings */ } - if (*p == ' ' || *p == '\t') { + if (ELEM(*p, ' ', '\t')) { br = i; } else if (*p == '\n') { diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index b8530293d3e..d4b12142162 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1449,7 +1449,7 @@ static void VertsToTransData(TransInfo *t, td->ext = NULL; td->val = NULL; td->extra = eve; - if (t->mode == TFM_BWEIGHT || t->mode == TFM_VERT_CREASE) { + if (ELEM(t->mode, TFM_BWEIGHT, TFM_VERT_CREASE)) { td->val = bweight; td->ival = *bweight; } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 53b8a541dba..f19b32e3ad4 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2039,7 +2039,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) float *co1 = e->next->vert->co; float *co2 = e->next->next->vert->co; - if ((e->face != oldf1) && (e->face != oldf2)) { + if (!ELEM(e->face, oldf1, oldf2)) { float tetrav2[3], tetrav3[3]; /* tetrahedron volume = (1/3!)*|a.(b x c)| */ diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index 3bba618f682..938b798f4b6 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -438,7 +438,7 @@ void uvedit_edge_select_shared_vert(const Scene *scene, const bool do_history, const int cd_loop_uv_offset) { - BLI_assert((sticky_flag == SI_STICKY_LOC) || (sticky_flag == SI_STICKY_VERTEX)); + BLI_assert(ELEM(sticky_flag, SI_STICKY_LOC, SI_STICKY_VERTEX)); /* Set edge flags. Rely on this for face visibility checks */ uvedit_edge_select_set_noflush(scene, l, select, sticky_flag, cd_loop_uv_offset); @@ -647,7 +647,7 @@ void uvedit_uv_select_shared_vert(const Scene *scene, const bool do_history, const int cd_loop_uv_offset) { - BLI_assert((sticky_flag == SI_STICKY_LOC) || (sticky_flag == SI_STICKY_VERTEX)); + BLI_assert(ELEM(sticky_flag, SI_STICKY_LOC, SI_STICKY_VERTEX)); BMEdge *e_first, *e_iter; e_first = e_iter = l->e; @@ -2251,13 +2251,13 @@ static void uv_select_invert(const Scene *scene, BMEditMesh *em) } BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - if ((uv_selectmode == UV_SELECT_EDGE) || (uv_selectmode == UV_SELECT_FACE)) { + if (ELEM(uv_selectmode, UV_SELECT_EDGE, UV_SELECT_FACE)) { /* Use #MLOOPUV_EDGESEL to flag edges that must be selected. */ luv->flag ^= MLOOPUV_EDGESEL; luv->flag &= ~MLOOPUV_VERTSEL; } /* Use #MLOOPUV_VERTSEL to flag verts that must be selected. */ - else if ((uv_selectmode == UV_SELECT_VERTEX) || (uv_selectmode == UV_SELECT_ISLAND)) { + else if (ELEM(uv_selectmode, UV_SELECT_VERTEX, UV_SELECT_ISLAND)) { luv->flag ^= MLOOPUV_VERTSEL; luv->flag &= ~MLOOPUV_EDGESEL; } @@ -2265,10 +2265,10 @@ static void uv_select_invert(const Scene *scene, BMEditMesh *em) } /* Flush based on uv vert/edge flags and current UV select mode */ - if ((uv_selectmode == UV_SELECT_EDGE) || (uv_selectmode == UV_SELECT_FACE)) { + if (ELEM(uv_selectmode, UV_SELECT_EDGE, UV_SELECT_FACE)) { uv_select_flush_from_loop_edge_flag(scene, em); } - else if ((uv_selectmode == UV_SELECT_VERTEX) || (uv_selectmode == UV_SELECT_ISLAND)) { + else if (ELEM(uv_selectmode, UV_SELECT_VERTEX, UV_SELECT_ISLAND)) { uvedit_select_flush(scene, em); } } @@ -3221,7 +3221,7 @@ static void uv_select_flush_from_tag_face(const Scene *scene, Object *obedit, co const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && - ((ts->uv_sticky == SI_STICKY_VERTEX) || (ts->uv_sticky == SI_STICKY_LOC))) { + ELEM(ts->uv_sticky, SI_STICKY_VERTEX, SI_STICKY_LOC)) { struct UvVertMap *vmap; uint efa_index; @@ -3366,7 +3366,7 @@ static void uv_select_flush_from_loop_edge_flag(const Scene *scene, BMEditMesh * const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && - ((ts->uv_sticky == SI_STICKY_LOC) || (ts->uv_sticky == SI_STICKY_VERTEX))) { + ELEM(ts->uv_sticky, SI_STICKY_LOC, SI_STICKY_VERTEX)) { /* Use the #MLOOPUV_EDGESEL flag to identify which verts must to be selected */ struct UvVertMap *vmap; uint efa_index; |