Cleanup: use ELEM, STREQ macros
This commit is contained in:
parent
f9c0d7261a
commit
1241e91707
|
@ -172,7 +172,7 @@ class FairingContext {
|
|||
}
|
||||
|
||||
/* Early return, nothing to do. */
|
||||
if (num_affected_vertices == 0 || num_affected_vertices == totvert_) {
|
||||
if (ELEM(num_affected_vertices, 0, totvert_)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1706,7 +1706,7 @@ static bool gpencil_interpolate_reverse_poll(bContext *C)
|
|||
if (area == NULL) {
|
||||
return false;
|
||||
}
|
||||
if ((area->spacetype != SPACE_VIEW3D) && (area->spacetype != SPACE_ACTION)) {
|
||||
if (!ELEM(area->spacetype, SPACE_VIEW3D, SPACE_ACTION)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1340,7 +1340,7 @@ static void outliner_sort(ListBase *lb)
|
|||
tp->name = te->name;
|
||||
tp->idcode = te->idcode;
|
||||
|
||||
if ((tselem->type != TSE_SOME_ID) && tselem->type != TSE_DEFGROUP) {
|
||||
if (!ELEM(tselem->type, TSE_SOME_ID, TSE_DEFGROUP)) {
|
||||
tp->idcode = 0; /* Don't sort this. */
|
||||
}
|
||||
if (tselem->type == TSE_ID_BASE) {
|
||||
|
|
|
@ -189,7 +189,7 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const
|
|||
ofs_y += vertical_offset;
|
||||
}
|
||||
} /* Strip */
|
||||
else if (i == 1 || i == 2) {
|
||||
else if (ELEM(i, 1, 2)) {
|
||||
int len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]);
|
||||
if (metadata_is_valid(ibuf, temp_str, i + 1, len)) {
|
||||
BLF_position(fontid, xmin, ymax - vertical_offset - ofs_y, 0.0f);
|
||||
|
|
|
@ -209,8 +209,7 @@ static void updateDepsgraph(GpencilModifierData *md,
|
|||
}
|
||||
else {
|
||||
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (ctx->scene->master_collection, ob, mode) {
|
||||
if (ob->type == OB_MESH || ob->type == OB_MBALL || ob->type == OB_CURVE ||
|
||||
ob->type == OB_SURF || ob->type == OB_FONT) {
|
||||
if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVE, OB_SURF, OB_FONT)) {
|
||||
if (ob->lineart.usage != OBJECT_LRT_EXCLUDE) {
|
||||
DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art Modifier");
|
||||
DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");
|
||||
|
|
|
@ -1504,8 +1504,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
|
|||
return;
|
||||
}
|
||||
|
||||
if (ob->type == OB_MESH || ob->type == OB_MBALL || ob->type == OB_CURVE || ob->type == OB_SURF ||
|
||||
ob->type == OB_FONT) {
|
||||
if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVE, OB_SURF, OB_FONT)) {
|
||||
|
||||
if (ob->type == OB_MESH) {
|
||||
use_mesh = DEG_get_evaluated_object(dg, ob)->data;
|
||||
|
@ -1647,7 +1646,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
|
|||
if (usage == OBJECT_LRT_INTERSECTION_ONLY) {
|
||||
rt->flags |= LRT_TRIANGLE_INTERSECTION_ONLY;
|
||||
}
|
||||
else if (usage == OBJECT_LRT_NO_INTERSECTION || usage == OBJECT_LRT_OCCLUSION_ONLY) {
|
||||
else if (ELEM(usage, OBJECT_LRT_NO_INTERSECTION, OBJECT_LRT_OCCLUSION_ONLY)) {
|
||||
rt->flags |= LRT_TRIANGLE_NO_INTERSECTION;
|
||||
}
|
||||
|
||||
|
@ -1711,8 +1710,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
|
|||
LineartLineSegment *rls = lineart_mem_aquire(&rb->render_data_pool,
|
||||
sizeof(LineartLineSegment));
|
||||
BLI_addtail(&la_e->segments, rls);
|
||||
if (usage == OBJECT_LRT_INHERIT || usage == OBJECT_LRT_INCLUDE ||
|
||||
usage == OBJECT_LRT_NO_INTERSECTION) {
|
||||
if (ELEM(usage, OBJECT_LRT_INHERIT, OBJECT_LRT_INCLUDE, OBJECT_LRT_NO_INTERSECTION)) {
|
||||
lineart_add_edge_to_list(rb, la_e);
|
||||
}
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ static void modifier_panel_header(const bContext *C, Panel *panel)
|
|||
}
|
||||
}
|
||||
/* Collision and Surface are always enabled, hide buttons. */
|
||||
if ((md->type != eModifierType_Collision) && (md->type != eModifierType_Surface)) {
|
||||
if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) {
|
||||
if (mti->flags & eModifierTypeFlag_SupportsEditmode) {
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, (md->mode & eModifierMode_Realtime));
|
||||
|
|
|
@ -372,7 +372,7 @@ wmDragAsset *WM_drag_get_asset_data(const wmDrag *drag, int idcode)
|
|||
}
|
||||
|
||||
wmDragAsset *asset_drag = drag->poin;
|
||||
return (idcode == 0 || asset_drag->id_type == idcode) ? asset_drag : NULL;
|
||||
return (ELEM(idcode, 0, asset_drag->id_type)) ? asset_drag : NULL;
|
||||
}
|
||||
|
||||
static ID *wm_drag_asset_id_import(wmDragAsset *asset_drag)
|
||||
|
|
|
@ -580,7 +580,7 @@ void wm_event_do_notifiers(bContext *C)
|
|||
if ((note->category == NC_SPACE) && note->reference) {
|
||||
/* Filter out notifiers sent to other spaces. RNA sets the reference to the owning ID
|
||||
* though, the screen, so let notifiers through that reference the entire screen. */
|
||||
if ((note->reference != area->spacedata.first) && (note->reference != screen)) {
|
||||
if (!ELEM(note->reference, area->spacedata.first, screen)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -812,7 +812,7 @@ wmWindow *WM_window_open(bContext *C,
|
|||
LISTBASE_FOREACH (wmWindow *, win_iter, &wm->windows) {
|
||||
if (WM_window_is_temp_screen(win_iter)) {
|
||||
char *wintitle = GHOST_GetTitle(win_iter->ghostwin);
|
||||
if (strcmp(title, wintitle) == 0) {
|
||||
if (STREQ(title, wintitle)) {
|
||||
win = win_iter;
|
||||
}
|
||||
free(wintitle);
|
||||
|
|
Loading…
Reference in New Issue