Cleanup: use ELEM macro
This commit is contained in:
@@ -222,7 +222,7 @@ GHOST_XrSession::LifeExpectancy GHOST_XrSession::handleStateChangeEvent(
|
||||
m_oxr->session_state = lifecycle.state;
|
||||
|
||||
/* Runtime may send events for apparently destroyed session. Our handle should be NULL then. */
|
||||
assert((m_oxr->session == XR_NULL_HANDLE) || (m_oxr->session == lifecycle.session));
|
||||
assert(ELEM(m_oxr->session, XR_NULL_HANDLE, lifecycle.session));
|
||||
|
||||
switch (lifecycle.state) {
|
||||
case XR_SESSION_STATE_READY: {
|
||||
|
||||
@@ -736,7 +736,7 @@ CCGError ccgSubSurf_syncFace(
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ss->syncState == eSyncState_Vert || ss->syncState == eSyncState_Edge) {
|
||||
if (ELEM(ss->syncState, eSyncState_Vert, eSyncState_Edge)) {
|
||||
ss->syncState = eSyncState_Face;
|
||||
}
|
||||
else if (ss->syncState != eSyncState_Face) {
|
||||
|
||||
@@ -2190,7 +2190,7 @@ static void mesh_init_origspace(Mesh *mesh)
|
||||
for (i = 0; i < numpoly; i++, mp++) {
|
||||
OrigSpaceLoop *lof = lof_array + mp->loopstart;
|
||||
|
||||
if (mp->totloop == 3 || mp->totloop == 4) {
|
||||
if (ELEM(mp->totloop, 3, 4)) {
|
||||
for (j = 0; j < mp->totloop; j++, lof++) {
|
||||
copy_v2_v2(lof->uv, default_osf[j]);
|
||||
}
|
||||
|
||||
@@ -801,7 +801,7 @@ bool bone_autoside_name(
|
||||
while (changed) { /* remove extensions */
|
||||
changed = false;
|
||||
if (len > 2 && basename[len - 2] == '.') {
|
||||
if (basename[len - 1] == 'L' || basename[len - 1] == 'R') { /* L R */
|
||||
if (ELEM(basename[len - 1], 'L', 'R')) { /* L R */
|
||||
basename[len - 2] = '\0';
|
||||
len -= 2;
|
||||
changed = true;
|
||||
|
||||
@@ -2869,15 +2869,15 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
|
||||
|
||||
/* indicate with handlecodes double points */
|
||||
if (prevbezt->h1 == prevbezt->h2) {
|
||||
if (prevbezt->h1 == 0 || prevbezt->h1 == HD_VECT) {
|
||||
if (ELEM(prevbezt->h1, 0, HD_VECT)) {
|
||||
bevp->split_tag = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (prevbezt->h1 == 0 || prevbezt->h1 == HD_VECT) {
|
||||
if (ELEM(prevbezt->h1, 0, HD_VECT)) {
|
||||
bevp->split_tag = true;
|
||||
}
|
||||
else if (prevbezt->h2 == 0 || prevbezt->h2 == HD_VECT) {
|
||||
else if (ELEM(prevbezt->h2, 0, HD_VECT)) {
|
||||
bevp->split_tag = true;
|
||||
}
|
||||
}
|
||||
@@ -4961,7 +4961,7 @@ bool BKE_nurb_type_convert(Nurb *nu,
|
||||
}
|
||||
}
|
||||
else if (nu->type == CU_BEZIER) { /* Bezier */
|
||||
if (type == CU_POLY || type == CU_NURBS) {
|
||||
if (ELEM(type, CU_POLY, CU_NURBS)) {
|
||||
nr = use_handles ? (3 * nu->pntsu) : nu->pntsu;
|
||||
nu->bp = MEM_calloc_arrayN(nr, sizeof(BPoint), "setsplinetype");
|
||||
a = nu->pntsu;
|
||||
|
||||
@@ -269,11 +269,11 @@ uint BKE_curve_decimate_bezt_array(BezTriple *bezt_array,
|
||||
if (a == HD_VECT) { \
|
||||
a = HD_FREE; \
|
||||
} \
|
||||
else if (a == HD_AUTO || a == HD_AUTO_ANIM) { \
|
||||
else if (ELEM(a, HD_AUTO, HD_AUTO_ANIM)) { \
|
||||
a = HD_ALIGN; \
|
||||
} \
|
||||
/* opposite handle */ \
|
||||
if (b == HD_AUTO || b == HD_AUTO_ANIM) { \
|
||||
if (ELEM(b, HD_AUTO, HD_AUTO_ANIM)) { \
|
||||
b = HD_ALIGN; \
|
||||
} \
|
||||
} \
|
||||
|
||||
@@ -225,7 +225,7 @@ static bool calc_curve_deform(
|
||||
quat_apply_track(
|
||||
quat,
|
||||
axis,
|
||||
(axis == 0 || axis == 2) ? 1 : 0); /* up flag is a dummy, set so no rotation is done */
|
||||
(ELEM(axis, 0, 2)) ? 1 : 0); /* up flag is a dummy, set so no rotation is done */
|
||||
vec_apply_track(cent, axis);
|
||||
cent[index] = 0.0f;
|
||||
|
||||
|
||||
@@ -2509,7 +2509,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
|
||||
return &data->layers[CustomData_get_layer_index(data, type)];
|
||||
}
|
||||
|
||||
if ((alloctype == CD_ASSIGN) || (alloctype == CD_REFERENCE)) {
|
||||
if (ELEM(alloctype, CD_ASSIGN, CD_REFERENCE)) {
|
||||
newlayerdata = layerdata;
|
||||
}
|
||||
else if (totelem > 0 && typeInfo->size > 0) {
|
||||
|
||||
@@ -2700,7 +2700,7 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa
|
||||
|
||||
const int final_tri_index = tempPoints[final_index].tri_index;
|
||||
/* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */
|
||||
if (final_tri_index != target_tri && final_tri_index != -1) {
|
||||
if (!ELEM(final_tri_index, target_tri, -1)) {
|
||||
/* Check if it's close enough to likely touch the intended triangle. Any triangle
|
||||
* becomes thinner than a pixel at its vertices, so robustness requires some margin. */
|
||||
const float final_pt[2] = {((final_index % w) + 0.5f) / w, ((final_index / w) + 0.5f) / h};
|
||||
@@ -3034,7 +3034,7 @@ int dynamicPaint_createUVSurface(Scene *scene,
|
||||
n_pos++;
|
||||
}
|
||||
}
|
||||
else if (n_target == ON_MESH_EDGE || n_target == OUT_OF_TEXTURE) {
|
||||
else if (ELEM(n_target, ON_MESH_EDGE, OUT_OF_TEXTURE)) {
|
||||
ed->flags[final_index[index]] |= ADJ_ON_MESH_EDGE;
|
||||
}
|
||||
}
|
||||
@@ -3736,7 +3736,7 @@ static bool meshBrush_boundsIntersect(Bounds3D *b1,
|
||||
if (brush->collision == MOD_DPAINT_COL_VOLUME) {
|
||||
return boundsIntersect(b1, b2);
|
||||
}
|
||||
if (brush->collision == MOD_DPAINT_COL_DIST || brush->collision == MOD_DPAINT_COL_VOLDIST) {
|
||||
if (ELEM(brush->collision, MOD_DPAINT_COL_DIST, MOD_DPAINT_COL_VOLDIST)) {
|
||||
return boundsIntersectDist(b1, b2, brush_radius);
|
||||
}
|
||||
return true;
|
||||
@@ -4710,8 +4710,7 @@ static void dynamic_paint_paint_single_point_cb_ex(void *__restrict userdata,
|
||||
}
|
||||
|
||||
/* Smooth range or color ramp */
|
||||
if (brush->proximity_falloff == MOD_DPAINT_PRFALL_SMOOTH ||
|
||||
brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP) {
|
||||
if (ELEM(brush->proximity_falloff, MOD_DPAINT_PRFALL_SMOOTH, MOD_DPAINT_PRFALL_RAMP)) {
|
||||
strength = 1.0f - distance / brush_radius;
|
||||
CLAMP(strength, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
@@ -1260,7 +1260,7 @@ void calchandles_fcurve_ex(FCurve *fcu, eBezTriple_Flag handle_sel_flag)
|
||||
/* For automatic ease in and out. */
|
||||
if (BEZT_IS_AUTOH(bezt) && !cycle) {
|
||||
/* Only do this on first or last beztriple. */
|
||||
if ((a == 0) || (a == fcu->totvert - 1)) {
|
||||
if (ELEM(a, 0, fcu->totvert - 1)) {
|
||||
/* Set both handles to have same horizontal value as keyframe. */
|
||||
if (fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) {
|
||||
bezt->vec[0][1] = bezt->vec[2][1] = bezt->vec[1][1];
|
||||
|
||||
@@ -949,7 +949,7 @@ static bool vfont_to_curve(Object *ob,
|
||||
// CLOG_WARN(&LOG, "linewidth exceeded: %c%c%c...", mem[i], mem[i+1], mem[i+2]);
|
||||
for (j = i; j && (mem[j] != '\n') && (chartransdata[j].dobreak == 0); j--) {
|
||||
bool dobreak = false;
|
||||
if (mem[j] == ' ' || mem[j] == '-') {
|
||||
if (ELEM(mem[j], ' ', '-')) {
|
||||
ct -= (i - (j - 1));
|
||||
cnr -= (i - (j - 1));
|
||||
if (mem[j] == ' ') {
|
||||
|
||||
@@ -2670,7 +2670,7 @@ void BKE_gpencil_parent_matrix_get(const Depsgraph *depsgraph,
|
||||
return;
|
||||
}
|
||||
|
||||
if ((gpl->partype == PAROBJECT) || (gpl->partype == PARSKEL)) {
|
||||
if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) {
|
||||
mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
|
||||
add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
|
||||
return;
|
||||
@@ -2712,7 +2712,7 @@ void BKE_gpencil_update_layer_parent(const Depsgraph *depsgraph, Object *ob)
|
||||
if ((gpl->parent != NULL) && (gpl->actframe != NULL)) {
|
||||
Object *ob_parent = DEG_get_evaluated_object(depsgraph, gpl->parent);
|
||||
/* calculate new matrix */
|
||||
if ((gpl->partype == PAROBJECT) || (gpl->partype == PARSKEL)) {
|
||||
if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) {
|
||||
copy_m4_m4(cur_mat, ob_parent->obmat);
|
||||
}
|
||||
else if (gpl->partype == PARBONE) {
|
||||
|
||||
@@ -189,7 +189,7 @@ BoundBox *BKE_gpencil_boundbox_get(Object *ob)
|
||||
/* Update orig object's boundbox with re-computed evaluated values. This function can be
|
||||
* called with the evaluated object and need update the original object bound box data
|
||||
* to keep both values synchronized. */
|
||||
if ((ob_orig != NULL) && (ob != ob_orig)) {
|
||||
if (!ELEM(ob_orig, NULL, ob)) {
|
||||
if (ob_orig->runtime.bb == NULL) {
|
||||
ob_orig->runtime.bb = MEM_callocN(sizeof(BoundBox), "GPencil boundbox");
|
||||
}
|
||||
@@ -778,7 +778,7 @@ bool BKE_gpencil_stroke_smooth(bGPDstroke *gps, int i, float inf)
|
||||
/* Only affect endpoints by a fraction of the normal strength,
|
||||
* to prevent the stroke from shrinking too much
|
||||
*/
|
||||
if ((i == 0) || (i == gps->totpoints - 1)) {
|
||||
if (ELEM(i, 0, gps->totpoints - 1)) {
|
||||
inf *= 0.1f;
|
||||
}
|
||||
|
||||
@@ -838,7 +838,7 @@ bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float
|
||||
}
|
||||
/* Only affect endpoints by a fraction of the normal influence */
|
||||
float inf = influence;
|
||||
if ((point_index == 0) || (point_index == gps->totpoints - 1)) {
|
||||
if (ELEM(point_index, 0, gps->totpoints - 1)) {
|
||||
inf *= 0.01f;
|
||||
}
|
||||
/* Limit max influence to reduce pop effect. */
|
||||
@@ -902,7 +902,7 @@ bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float
|
||||
}
|
||||
/* Only affect endpoints by a fraction of the normal influence */
|
||||
float inf = influence;
|
||||
if ((point_index == 0) || (point_index == gps->totpoints - 1)) {
|
||||
if (ELEM(point_index, 0, gps->totpoints - 1)) {
|
||||
inf *= 0.01f;
|
||||
}
|
||||
/* Limit max influence to reduce pop effect. */
|
||||
@@ -1402,7 +1402,7 @@ bool BKE_gpencil_stroke_trim(bGPDstroke *gps)
|
||||
memcpy(dvert->dw, dvert_src->dw, sizeof(MDeformWeight));
|
||||
}
|
||||
}
|
||||
if (idx == start || idx == end) {
|
||||
if (ELEM(idx, start, end)) {
|
||||
copy_v3_v3(&pt_new->x, point);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,7 +668,7 @@ ImageTile *BKE_image_get_tile(Image *ima, int tile_number)
|
||||
|
||||
/* Tile number 0 is a special case and refers to the first tile, typically
|
||||
* coming from non-UDIM-aware code. */
|
||||
if (tile_number == 0 || tile_number == 1001) {
|
||||
if (ELEM(tile_number, 0, 1001)) {
|
||||
return ima->tiles.first;
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exist
|
||||
|
||||
/* first search an identical filepath */
|
||||
for (ima = bmain->images.first; ima; ima = ima->id.next) {
|
||||
if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) {
|
||||
if (!ELEM(ima->source, IMA_SRC_VIEWER, IMA_SRC_GENERATED)) {
|
||||
STRNCPY(strtest, ima->filepath);
|
||||
BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &ima->id));
|
||||
|
||||
@@ -1316,7 +1316,7 @@ int BKE_image_imtype_to_ftype(const char imtype, ImbFormatOptions *r_options)
|
||||
return IMB_FTYPE_TIF;
|
||||
}
|
||||
#endif
|
||||
if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) {
|
||||
if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
|
||||
return IMB_FTYPE_OPENEXR;
|
||||
}
|
||||
#ifdef WITH_CINEON
|
||||
@@ -1666,7 +1666,7 @@ static bool do_add_image_extension(char *string,
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_OPENEXR
|
||||
else if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) {
|
||||
else if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
|
||||
if (!BLI_path_extension_check(string, extension_test = ".exr")) {
|
||||
extension = extension_test;
|
||||
}
|
||||
|
||||
@@ -1616,7 +1616,7 @@ int BKE_keyblock_element_count_from_shape(const Key *key, const int shape_index)
|
||||
int result = 0;
|
||||
int index = 0;
|
||||
for (const KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
|
||||
if ((shape_index == -1) || (index == shape_index)) {
|
||||
if (ELEM(shape_index, -1, index)) {
|
||||
result += kb->totelem;
|
||||
}
|
||||
}
|
||||
@@ -1656,7 +1656,7 @@ void BKE_keyblock_data_get_from_shape(const Key *key, float (*arr)[3], const int
|
||||
uint8_t *elements = (uint8_t *)arr;
|
||||
int index = 0;
|
||||
for (const KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
|
||||
if ((shape_index == -1) || (index == shape_index)) {
|
||||
if (ELEM(shape_index, -1, index)) {
|
||||
const int block_elem_len = kb->totelem * key->elemsize;
|
||||
memcpy(elements, kb->data, block_elem_len);
|
||||
elements += block_elem_len;
|
||||
@@ -1686,7 +1686,7 @@ void BKE_keyblock_data_set_with_mat4(Key *key,
|
||||
|
||||
int index = 0;
|
||||
for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
|
||||
if ((shape_index == -1) || (index == shape_index)) {
|
||||
if (ELEM(shape_index, -1, index)) {
|
||||
const int block_elem_len = kb->totelem;
|
||||
float(*block_data)[3] = (float(*)[3])kb->data;
|
||||
for (int data_offset = 0; data_offset < block_elem_len; ++data_offset) {
|
||||
@@ -1710,7 +1710,7 @@ void BKE_keyblock_curve_data_set_with_mat4(
|
||||
|
||||
int index = 0;
|
||||
for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
|
||||
if ((shape_index == -1) || (index == shape_index)) {
|
||||
if (ELEM(shape_index, -1, index)) {
|
||||
const int block_elem_size = kb->totelem * key->elemsize;
|
||||
BKE_keyblock_curve_data_transform(nurb, mat, elements, kb->data);
|
||||
elements += block_elem_size;
|
||||
@@ -1726,7 +1726,7 @@ void BKE_keyblock_data_set(Key *key, const int shape_index, const void *data)
|
||||
const uint8_t *elements = data;
|
||||
int index = 0;
|
||||
for (KeyBlock *kb = key->block.first; kb; kb = kb->next, index++) {
|
||||
if ((shape_index == -1) || (index == shape_index)) {
|
||||
if (ELEM(shape_index, -1, index)) {
|
||||
const int block_elem_size = kb->totelem * key->elemsize;
|
||||
memcpy(kb->data, elements, block_elem_size);
|
||||
elements += block_elem_size;
|
||||
|
||||
@@ -1331,7 +1331,7 @@ void id_sort_by_name(ListBase *lb, ID *id, ID *id_sorting_hint)
|
||||
BLI_remlink(lb, id);
|
||||
|
||||
/* Check if we can actually insert id before or after id_sorting_hint, if given. */
|
||||
if (id_sorting_hint != NULL && id_sorting_hint != id) {
|
||||
if (!ELEM(id_sorting_hint, NULL, id)) {
|
||||
BLI_assert(BLI_findindex(lb, id_sorting_hint) >= 0);
|
||||
|
||||
ID *id_sorting_hint_next = id_sorting_hint->next;
|
||||
@@ -1569,7 +1569,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name, ID **r_id_sorting_
|
||||
char base_name_test[MAX_ID_NAME - 2];
|
||||
int number_test;
|
||||
if ((id != id_test) && !ID_IS_LINKED(id_test) && (name[0] == id_test->name[2]) &&
|
||||
(id_test->name[base_name_len + 2] == '.' || id_test->name[base_name_len + 2] == '\0') &&
|
||||
(ELEM(id_test->name[base_name_len + 2], '.', '\0')) &&
|
||||
STREQLEN(name, id_test->name + 2, base_name_len) &&
|
||||
(BLI_split_name_num(base_name_test, &number_test, id_test->name + 2, '.') ==
|
||||
base_name_len)) {
|
||||
|
||||
@@ -61,7 +61,7 @@ static int cddm_poly_compare(MLoop *mloop_array,
|
||||
|
||||
MLoop *mloop_source, *mloop_target;
|
||||
|
||||
BLI_assert(direct_reverse == 1 || direct_reverse == -1);
|
||||
BLI_assert(ELEM(direct_reverse, 1, -1));
|
||||
|
||||
i_loop_source = 0;
|
||||
mloop_source = mloop_array + mpoly_source->loopstart;
|
||||
|
||||
@@ -1165,7 +1165,7 @@ ParticleSystem *psys_get_target_system(Object *ob, ParticleTarget *pt)
|
||||
{
|
||||
ParticleSystem *psys = NULL;
|
||||
|
||||
if (pt->ob == NULL || pt->ob == ob) {
|
||||
if (ELEM(pt->ob, NULL, ob)) {
|
||||
psys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -738,8 +738,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
|
||||
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
|
||||
data_len = sizeof(PaintPoint);
|
||||
}
|
||||
else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
|
||||
surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
|
||||
else if (ELEM(surface->type, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_WEIGHT)) {
|
||||
data_len = sizeof(float);
|
||||
}
|
||||
else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
|
||||
|
||||
@@ -962,7 +962,7 @@ ARegion *BKE_area_find_region_xy(ScrArea *area, const int regiontype, int x, int
|
||||
if (area) {
|
||||
ARegion *region;
|
||||
for (region = area->regionbase.first; region; region = region->next) {
|
||||
if ((regiontype == RGN_TYPE_ANY) || (region->regiontype == regiontype)) {
|
||||
if (ELEM(regiontype, RGN_TYPE_ANY, region->regiontype)) {
|
||||
if (BLI_rcti_isect_pt(®ion->winrct, x, y)) {
|
||||
region_found = region;
|
||||
break;
|
||||
@@ -980,7 +980,7 @@ ARegion *BKE_screen_find_region_xy(bScreen *screen, const int regiontype, int x,
|
||||
{
|
||||
ARegion *region_found = NULL;
|
||||
LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
|
||||
if ((regiontype == RGN_TYPE_ANY) || (region->regiontype == regiontype)) {
|
||||
if (ELEM(regiontype, RGN_TYPE_ANY, region->regiontype)) {
|
||||
if (BLI_rcti_isect_pt(®ion->winrct, x, y)) {
|
||||
region_found = region;
|
||||
break;
|
||||
@@ -1017,7 +1017,7 @@ ScrArea *BKE_screen_find_big_area(bScreen *screen, const int spacetype, const sh
|
||||
int size, maxsize = 0;
|
||||
|
||||
for (area = screen->areabase.first; area; area = area->next) {
|
||||
if ((spacetype == SPACE_TYPE_ANY) || (area->spacetype == spacetype)) {
|
||||
if (ELEM(spacetype, SPACE_TYPE_ANY, area->spacetype)) {
|
||||
if (min <= area->winx && min <= area->winy) {
|
||||
size = area->winx * area->winy;
|
||||
if (size > maxsize) {
|
||||
@@ -1038,7 +1038,7 @@ ScrArea *BKE_screen_area_map_find_area_xy(const ScrAreaMap *areamap,
|
||||
{
|
||||
LISTBASE_FOREACH (ScrArea *, area, &areamap->areabase) {
|
||||
if (BLI_rcti_isect_pt(&area->totrct, x, y)) {
|
||||
if ((spacetype == SPACE_TYPE_ANY) || (area->spacetype == spacetype)) {
|
||||
if (ELEM(spacetype, SPACE_TYPE_ANY, area->spacetype)) {
|
||||
return area;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2032,7 +2032,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene,
|
||||
attached = 0;
|
||||
for (b = obp->nofsprings; b > 0; b--) {
|
||||
bs = sb->bspring + obp->springs[b - 1];
|
||||
if ((ilast - bb == bs->v2) || (ilast - bb == bs->v1)) {
|
||||
if (ELEM(ilast - bb, bs->v2, bs->v1)) {
|
||||
attached = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2335,7 +2335,7 @@ int txt_setcurr_tab_spaces(Text *text, int space)
|
||||
if (ch == ':') {
|
||||
is_indent = 1;
|
||||
}
|
||||
else if (ch != ' ' && ch != '\t') {
|
||||
else if (!ELEM(ch, ' ', '\t')) {
|
||||
is_indent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,7 +722,7 @@ static ImBuf *make_grayscale_ibuf_copy(ImBuf *ibuf)
|
||||
{
|
||||
ImBuf *grayscale = IMB_allocImBuf(ibuf->x, ibuf->y, 32, 0);
|
||||
|
||||
BLI_assert(ibuf->channels == 3 || ibuf->channels == 4);
|
||||
BLI_assert(ELEM(ibuf->channels, 3, 4));
|
||||
|
||||
/* TODO(sergey): Bummer, currently IMB API only allows to create 4 channels
|
||||
* float buffer, so we do it manually here.
|
||||
@@ -880,7 +880,7 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor,
|
||||
}
|
||||
/* Transform number of channels. */
|
||||
if (input_mode == LIBMV_IMAGE_MODE_RGBA) {
|
||||
BLI_assert(orig_ibuf->channels == 3 || orig_ibuf->channels == 4);
|
||||
BLI_assert(ELEM(orig_ibuf->channels, 3, 4));
|
||||
/* pass */
|
||||
}
|
||||
else /* if (input_mode == LIBMV_IMAGE_MODE_MONO) */ {
|
||||
|
||||
@@ -357,7 +357,7 @@ void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain)
|
||||
void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C)
|
||||
{
|
||||
const UndoType *ut = BKE_undosys_type_from_context(C);
|
||||
if ((ut != NULL) && (ut != BKE_UNDOSYS_TYPE_MEMFILE)) {
|
||||
if (!ELEM(ut, NULL, BKE_UNDOSYS_TYPE_MEMFILE)) {
|
||||
BKE_undosys_step_push_with_type(ustack, C, IFACE_("Original Mode"), ut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ static char *find_next_op(const char *str, char *remaining_str, int len_max)
|
||||
/* Make sure we don't look backwards before the start of the string. */
|
||||
if (remaining_str != str && i != 0) {
|
||||
/* Check for scientific notation. */
|
||||
if (remaining_str[i - 1] == 'e' || remaining_str[i - 1] == 'E') {
|
||||
if (ELEM(remaining_str[i - 1], 'e', 'E')) {
|
||||
scientific_notation = true;
|
||||
continue;
|
||||
}
|
||||
@@ -1178,7 +1178,7 @@ bool BKE_unit_replace_string(
|
||||
|
||||
/* Any operators after this? */
|
||||
for (ch = str_found + 1; *ch != '\0'; ch++) {
|
||||
if (*ch == ' ' || *ch == '\t') {
|
||||
if (ELEM(*ch, ' ', '\t')) {
|
||||
continue;
|
||||
}
|
||||
op_found = (ch_is_op(*ch) || ELEM(*ch, ',', ')'));
|
||||
|
||||
@@ -1313,7 +1313,7 @@ static BChunkList *bchunk_list_from_data_merge(const BArrayInfo *info,
|
||||
ASSERT_CHUNKLIST_DATA(chunk_list, data);
|
||||
|
||||
/* its likely that the next chunk in the list will be a match, so check it! */
|
||||
while ((cref_found->next != NULL) && (cref_found->next != chunk_list_reference_last)) {
|
||||
while (!ELEM(cref_found->next, NULL, chunk_list_reference_last)) {
|
||||
cref_found = cref_found->next;
|
||||
BChunk *chunk_found = cref_found->link;
|
||||
|
||||
|
||||
@@ -2008,7 +2008,7 @@ template<typename T> void dissolve_symedge(CDT_state<T> *cdt_state, SymEdge<T> *
|
||||
se = sym(se);
|
||||
symse = sym(se);
|
||||
}
|
||||
if (cdt->outer_face->symedge == se || cdt->outer_face->symedge == symse) {
|
||||
if (ELEM(cdt->outer_face->symedge, se, symse)) {
|
||||
/* Advancing by 2 to get past possible 'sym(se)'. */
|
||||
if (se->next->next == se) {
|
||||
cdt->outer_face->symedge = NULL;
|
||||
|
||||
@@ -470,7 +470,7 @@ void exactinit()
|
||||
}
|
||||
every_other = !every_other;
|
||||
check = 1.0 + epsilon;
|
||||
} while ((check != 1.0) && (check != lastcheck));
|
||||
} while (!ELEM(check, 1.0, lastcheck));
|
||||
splitter += 1.0;
|
||||
|
||||
/* Error bounds for orientation and #incircle tests. */
|
||||
|
||||
@@ -274,7 +274,7 @@ void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
|
||||
|
||||
void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4])
|
||||
{
|
||||
BLI_assert(R != A && R != B);
|
||||
BLI_assert(!ELEM(R, A, B));
|
||||
|
||||
/* matrix product: R[j][k] = A[j][i] . B[i][k] */
|
||||
#ifdef __SSE2__
|
||||
@@ -319,7 +319,7 @@ void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4])
|
||||
|
||||
void mul_m4_m4m4_db_uniq(double R[4][4], const double A[4][4], const double B[4][4])
|
||||
{
|
||||
BLI_assert(R != A && R != B);
|
||||
BLI_assert(!ELEM(R, A, B));
|
||||
|
||||
/* matrix product: R[j][k] = A[j][i] . B[i][k] */
|
||||
|
||||
@@ -347,7 +347,7 @@ void mul_m4_m4m4_db_uniq(double R[4][4], const double A[4][4], const double B[4]
|
||||
void mul_m4db_m4db_m4fl_uniq(double R[4][4], const double A[4][4], const float B[4][4])
|
||||
{
|
||||
/* Remove second check since types don't match. */
|
||||
BLI_assert(R != A /* && R != B */);
|
||||
BLI_assert(!ELEM(R, A /*, B */));
|
||||
|
||||
/* matrix product: R[j][k] = A[j][i] . B[i][k] */
|
||||
|
||||
@@ -419,7 +419,7 @@ void mul_m3_m3_post(float R[3][3], const float B[3][3])
|
||||
|
||||
void mul_m3_m3m3_uniq(float R[3][3], const float A[3][3], const float B[3][3])
|
||||
{
|
||||
BLI_assert(R != A && R != B);
|
||||
BLI_assert(!ELEM(R, A, B));
|
||||
|
||||
R[0][0] = B[0][0] * A[0][0] + B[0][1] * A[1][0] + B[0][2] * A[2][0];
|
||||
R[0][1] = B[0][0] * A[0][1] + B[0][1] * A[1][1] + B[0][2] * A[2][1];
|
||||
|
||||
@@ -2851,7 +2851,7 @@ static bool dissolve_leaves_valid_bmesh(FaceMergeState *fms,
|
||||
* saying which faces a vertex touches. */
|
||||
for (int a_v_index = 0; ok && a_v_index < alen; ++a_v_index) {
|
||||
const Vert *a_v = mf_left.vert[a_v_index];
|
||||
if (a_v != me.v1 && a_v != me.v2) {
|
||||
if (!ELEM(a_v, me.v1, me.v2)) {
|
||||
for (int b_v_index = 0; b_v_index < blen; ++b_v_index) {
|
||||
const Vert *b_v = mf_right.vert[b_v_index];
|
||||
if (a_v == b_v) {
|
||||
|
||||
@@ -2771,7 +2771,7 @@ static CDT_data calc_cluster_subdivided(const CoplanarClusterInfo &clinfo,
|
||||
std::pair<int, int> key = canon_int_pair(t, t_other);
|
||||
if (itt_map.contains(key)) {
|
||||
ITT_value itt = itt_map.lookup(key);
|
||||
if (itt.kind != INONE && itt.kind != ICOPLANAR) {
|
||||
if (!ELEM(itt.kind, INONE, ICOPLANAR)) {
|
||||
itts.append(itt);
|
||||
if (dbg_level > 0) {
|
||||
std::cout << " itt = " << itt << "\n";
|
||||
|
||||
@@ -157,14 +157,14 @@ static ScanFillEdge *edge_step(PolyInfo *poly_info,
|
||||
eed = (e_curr->next && e_curr != poly_info[poly_nr].edge_last) ? e_curr->next :
|
||||
poly_info[poly_nr].edge_first;
|
||||
if ((v_curr == eed->v1 || v_curr == eed->v2) == true &&
|
||||
(v_prev == eed->v1 || v_prev == eed->v2) == false) {
|
||||
(ELEM(v_prev, eed->v1, eed->v2)) == false) {
|
||||
return eed;
|
||||
}
|
||||
|
||||
eed = (e_curr->prev && e_curr != poly_info[poly_nr].edge_first) ? e_curr->prev :
|
||||
poly_info[poly_nr].edge_last;
|
||||
if ((v_curr == eed->v1 || v_curr == eed->v2) == true &&
|
||||
(v_prev == eed->v1 || v_prev == eed->v2) == false) {
|
||||
(ELEM(v_prev, eed->v1, eed->v2)) == false) {
|
||||
return eed;
|
||||
}
|
||||
|
||||
|
||||
@@ -2066,10 +2066,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
if (srl->freestyleConfig.mode == 0) {
|
||||
srl->freestyleConfig.mode = FREESTYLE_CONTROL_EDITOR_MODE;
|
||||
}
|
||||
if (srl->freestyleConfig.raycasting_algorithm ==
|
||||
FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE ||
|
||||
srl->freestyleConfig.raycasting_algorithm ==
|
||||
FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL) {
|
||||
if (ELEM(srl->freestyleConfig.raycasting_algorithm, FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE, FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL)) {
|
||||
srl->freestyleConfig.raycasting_algorithm = 0; /* deprecated */
|
||||
srl->freestyleConfig.flags |= FREESTYLE_CULLING;
|
||||
}
|
||||
|
||||
@@ -1197,7 +1197,7 @@ static void update_voronoi_node_square_distance(bNodeTree *ntree)
|
||||
NodeTexVoronoi *tex = (NodeTexVoronoi *)node->storage;
|
||||
bNodeSocket *sockDistance = nodeFindSocket(node, SOCK_OUT, "Distance");
|
||||
if (tex->distance == SHD_VORONOI_EUCLIDEAN &&
|
||||
(tex->feature == SHD_VORONOI_F1 || tex->feature == SHD_VORONOI_F2) &&
|
||||
(ELEM(tex->feature, SHD_VORONOI_F1, SHD_VORONOI_F2)) &&
|
||||
socket_is_used(sockDistance)) {
|
||||
bNode *multiplyNode = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
|
||||
multiplyNode->custom1 = NODE_MATH_MULTIPLY;
|
||||
@@ -1237,7 +1237,7 @@ static void update_noise_and_wave_distortion(bNodeTree *ntree)
|
||||
bool need_update = false;
|
||||
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node->type == SH_NODE_TEX_NOISE || node->type == SH_NODE_TEX_WAVE) {
|
||||
if (ELEM(node->type, SH_NODE_TEX_NOISE, SH_NODE_TEX_WAVE)) {
|
||||
|
||||
bNodeSocket *sockDistortion = nodeFindSocket(node, SOCK_IN, "Distortion");
|
||||
float *distortion = cycles_node_socket_float_value(sockDistortion);
|
||||
|
||||
@@ -1253,7 +1253,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
ed = sce->ed;
|
||||
if (ed) {
|
||||
SEQ_ALL_BEGIN (sce->ed, seq) {
|
||||
if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE) {
|
||||
if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE)) {
|
||||
seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ static void fill_locales(void)
|
||||
while (line) {
|
||||
int t;
|
||||
str = (char *)line->link;
|
||||
if (str[0] == '#' || str[0] == '\0') {
|
||||
if (ELEM(str[0], '#', '\0')) {
|
||||
line = line->next;
|
||||
continue; /* Comment or void... */
|
||||
}
|
||||
@@ -130,7 +130,7 @@ static void fill_locales(void)
|
||||
char *loc, *sep1, *sep2, *sep3;
|
||||
|
||||
str = (char *)line->link;
|
||||
if (str[0] == '#' || str[0] == '\0') {
|
||||
if (ELEM(str[0], '#', '\0')) {
|
||||
line = line->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ BMFace *BM_face_create_ngon_verts(BMesh *bm,
|
||||
/* we want to use the reverse winding to the existing order */
|
||||
BM_edge_ordered_verts(edge_arr[i], &test_v2, &test_v1);
|
||||
winding[(vert_arr[i_prev] == test_v2)]++;
|
||||
BLI_assert(vert_arr[i_prev] == test_v2 || vert_arr[i_prev] == test_v1);
|
||||
BLI_assert(ELEM(vert_arr[i_prev], test_v2, test_v1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -963,7 +963,7 @@ void BMO_slot_buffer_from_single(BMOperator *op, BMOpSlot *slot, BMHeader *ele)
|
||||
BMO_ASSERT_SLOT_IN_OP(slot, op);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
|
||||
BLI_assert(slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE);
|
||||
BLI_assert(slot->len == 0 || slot->len == 1);
|
||||
BLI_assert(ELEM(slot->len, 0, 1));
|
||||
|
||||
BLI_assert(slot->slot_subtype.elem & ele->htype);
|
||||
|
||||
@@ -979,7 +979,7 @@ void BMO_slot_buffer_from_array(BMOperator *op,
|
||||
{
|
||||
BMO_ASSERT_SLOT_IN_OP(slot, op);
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
|
||||
BLI_assert(slot->len == 0 || slot->len == ele_buffer_len);
|
||||
BLI_assert(ELEM(slot->len, 0, ele_buffer_len));
|
||||
|
||||
if (slot->data.buf == NULL) {
|
||||
slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(*slot->data.buf) * ele_buffer_len);
|
||||
@@ -993,7 +993,7 @@ void *BMO_slot_buffer_get_single(BMOpSlot *slot)
|
||||
{
|
||||
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
|
||||
BLI_assert(slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE);
|
||||
BLI_assert(slot->len == 0 || slot->len == 1);
|
||||
BLI_assert(ELEM(slot->len, 0, 1));
|
||||
|
||||
return slot->len ? (BMHeader *)slot->data.buf[0] : NULL;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ bool bmesh_radial_validate(int radlen, BMLoop *l)
|
||||
if (l_iter->e != l->e) {
|
||||
return false;
|
||||
}
|
||||
if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2) {
|
||||
if (!ELEM(l_iter->v, l->e->v1, l->e->v2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -983,7 +983,7 @@ static void *bmw_EdgeLoopWalker_step(BMWalker *walker)
|
||||
/* Typical loopiong over edges in the middle of a mesh */
|
||||
/* However, why use 2 here at all?
|
||||
* I guess for internal ngon loops it can be useful. Antony R. */
|
||||
if (vert_edge_tot == 4 || vert_edge_tot == 2) {
|
||||
if (ELEM(vert_edge_tot, 4, 2)) {
|
||||
int i_opposite = vert_edge_tot / 2;
|
||||
int i = 0;
|
||||
do {
|
||||
|
||||
@@ -1399,7 +1399,7 @@ static void offset_meet(BevelParams *bp,
|
||||
normalize_v3(norm_perp2);
|
||||
|
||||
float off1a[3], off1b[3], off2a[3], off2b[3];
|
||||
if (bp->offset_type == BEVEL_AMT_PERCENT || bp->offset_type == BEVEL_AMT_ABSOLUTE) {
|
||||
if (ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
|
||||
offset_meet_lines_percent_or_absolute(bp, e1, e2, v, off1a, off1b, off2a, off2b);
|
||||
}
|
||||
else {
|
||||
@@ -1556,7 +1556,7 @@ static bool offset_on_edge_between(BevelParams *bp,
|
||||
float meet1[3], meet2[3];
|
||||
bool ok1 = offset_meet_edge(e1, emid, v, meet1, &ang1);
|
||||
bool ok2 = offset_meet_edge(emid, e2, v, meet2, &ang2);
|
||||
if (bp->offset_type == BEVEL_AMT_PERCENT || bp->offset_type == BEVEL_AMT_ABSOLUTE) {
|
||||
if (ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
|
||||
BMVert *v2 = BM_edge_other_vert(emid->e, v);
|
||||
if (bp->offset_type == BEVEL_AMT_PERCENT) {
|
||||
interp_v3_v3v3(meetco, v->co, v2->co, bp->offset / 100.0f);
|
||||
@@ -2158,7 +2158,7 @@ static void snap_to_superellipsoid(float co[3], const float super_r, bool midlin
|
||||
float x = a;
|
||||
float y = b;
|
||||
float z = c;
|
||||
if (r == PRO_SQUARE_R || r == PRO_SQUARE_IN_R) {
|
||||
if (ELEM(r, PRO_SQUARE_R, PRO_SQUARE_IN_R)) {
|
||||
/* Will only be called for 2d profile. */
|
||||
BLI_assert(fabsf(z) < BEVEL_EPSILON);
|
||||
z = 0.0f;
|
||||
@@ -2441,7 +2441,7 @@ static void bevel_harden_normals(BevelParams *bp, BMesh *bm)
|
||||
BMFace *f;
|
||||
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
|
||||
FKind fkind = get_face_kind(bp, f);
|
||||
if (fkind == F_ORIG || fkind == F_RECON) {
|
||||
if (ELEM(fkind, F_ORIG, F_RECON)) {
|
||||
continue;
|
||||
}
|
||||
BMIter liter;
|
||||
@@ -4619,7 +4619,7 @@ static VMesh *pipe_adj_vmesh(BevelParams *bp, BevVert *bv, BoundVert *vpipe)
|
||||
if (bp->profile_type == BEVEL_PROFILE_CUSTOM) {
|
||||
/* Find both profile vertices that correspond to this point. */
|
||||
float *profile_point_pipe1, *profile_point_pipe2, f;
|
||||
if (i == ipipe1 || i == ipipe2) {
|
||||
if (ELEM(i, ipipe1, ipipe2)) {
|
||||
if (n_bndv == 3 && i == ipipe1) {
|
||||
/* This part of the vmesh is the triangular corner between the two pipe profiles. */
|
||||
int ring = max_ii(j, k);
|
||||
@@ -6229,7 +6229,7 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bp->offset_type != BEVEL_AMT_PERCENT && bp->offset_type != BEVEL_AMT_ABSOLUTE) {
|
||||
if (!ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
|
||||
e->offset_r_spec = e->offset_l_spec;
|
||||
}
|
||||
if (bp->use_weights) {
|
||||
@@ -6771,7 +6771,7 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
|
||||
BMIter iter;
|
||||
BMLoop *l;
|
||||
BM_ITER_ELEM (l, &iter, r_f, BM_LOOPS_OF_FACE) {
|
||||
if (l->v == verts[0] || l->v == verts[2]) {
|
||||
if (ELEM(l->v, verts[0], verts[2])) {
|
||||
BM_elem_flag_enable(l, BM_ELEM_LONG_TAG);
|
||||
}
|
||||
}
|
||||
@@ -7232,7 +7232,7 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
|
||||
EdgeHalf *ec;
|
||||
BMVert *vd;
|
||||
float kc;
|
||||
if (bp->offset_type == BEVEL_AMT_PERCENT || bp->offset_type == BEVEL_AMT_ABSOLUTE) {
|
||||
if (ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
|
||||
if (ea->is_bev && ebother != NULL && ebother->prev->is_bev) {
|
||||
if (bp->offset_type == BEVEL_AMT_PERCENT) {
|
||||
return 50.0f;
|
||||
|
||||
@@ -51,7 +51,7 @@ enum {
|
||||
*/
|
||||
static bool bm_edge_step_ok(BMEdge *e)
|
||||
{
|
||||
return BM_elem_flag_test(e, BM_ELEM_TAG) && ((e->l == NULL) || (e->l->radial_next == e->l));
|
||||
return BM_elem_flag_test(e, BM_ELEM_TAG) && (ELEM(e->l, NULL, e->l->radial_next));
|
||||
}
|
||||
|
||||
static int bm_edge_face(BMEdge *e)
|
||||
|
||||
@@ -63,7 +63,7 @@ NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter,
|
||||
converter.addLink(convertRGBToYCCOperation->getOutputSocket(0),
|
||||
separateOperation->getInputSocket(0));
|
||||
|
||||
if (channel == 0 || channel == 3) {
|
||||
if (ELEM(channel, 0, 3)) {
|
||||
converter.addLink(separateOperation->getOutputSocket(0),
|
||||
combineOperation->getInputSocket(channel));
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ bool WrapOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
newInput.ymin = input->ymin;
|
||||
newInput.ymax = input->ymax;
|
||||
|
||||
if (m_wrappingType == CMP_NODE_WRAP_X || m_wrappingType == CMP_NODE_WRAP_XY) {
|
||||
if (ELEM(m_wrappingType, CMP_NODE_WRAP_X, CMP_NODE_WRAP_XY)) {
|
||||
// wrap only on the x-axis if tile is wrapping
|
||||
newInput.xmin = getWrappedOriginalXPos(input->xmin);
|
||||
newInput.xmax = roundf(getWrappedOriginalXPos(input->xmax));
|
||||
@@ -98,7 +98,7 @@ bool WrapOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
newInput.xmax = this->getWidth();
|
||||
}
|
||||
}
|
||||
if (m_wrappingType == CMP_NODE_WRAP_Y || m_wrappingType == CMP_NODE_WRAP_XY) {
|
||||
if (ELEM(m_wrappingType, CMP_NODE_WRAP_Y, CMP_NODE_WRAP_XY)) {
|
||||
// wrap only on the y-axis if tile is wrapping
|
||||
newInput.ymin = getWrappedOriginalYPos(input->ymin);
|
||||
newInput.ymax = roundf(getWrappedOriginalYPos(input->ymax));
|
||||
|
||||
@@ -1200,7 +1200,7 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, bool is_object
|
||||
/* Keyed particle targets. */
|
||||
if (ELEM(part->phystype, PART_PHYS_KEYED, PART_PHYS_BOIDS)) {
|
||||
LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) {
|
||||
if (particle_target->ob == nullptr || particle_target->ob == object) {
|
||||
if (ELEM(particle_target->ob, nullptr, object)) {
|
||||
continue;
|
||||
}
|
||||
build_object(-1, particle_target->ob, DEG_ID_LINKED_INDIRECTLY, is_object_visible);
|
||||
|
||||
@@ -743,7 +743,7 @@ void DepsgraphRelationBuilder::build_object_proxy_from(Object *object)
|
||||
|
||||
void DepsgraphRelationBuilder::build_object_proxy_group(Object *object)
|
||||
{
|
||||
if (object->proxy_group == nullptr || object->proxy_group == object->proxy) {
|
||||
if (ELEM(object->proxy_group, nullptr, object->proxy)) {
|
||||
return;
|
||||
}
|
||||
/* Object is local here (local in .blend file, users interacts with it). */
|
||||
@@ -1854,7 +1854,7 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object)
|
||||
/* Keyed particle targets. */
|
||||
if (ELEM(part->phystype, PART_PHYS_KEYED, PART_PHYS_BOIDS)) {
|
||||
LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) {
|
||||
if (particle_target->ob == nullptr || particle_target->ob == object) {
|
||||
if (ELEM(particle_target->ob, nullptr, object)) {
|
||||
continue;
|
||||
}
|
||||
/* Make sure target object is pulled into the graph. */
|
||||
@@ -2814,8 +2814,7 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node)
|
||||
* to preserve that cache in copy-on-write, but for the time being
|
||||
* we allow flush to layer collections component which will ensure
|
||||
* that cached array of bases exists and is up-to-date. */
|
||||
if (comp_node->type == NodeType::PARAMETERS ||
|
||||
comp_node->type == NodeType::LAYER_COLLECTIONS) {
|
||||
if (ELEM(comp_node->type, NodeType::PARAMETERS, NodeType::LAYER_COLLECTIONS)) {
|
||||
rel_flag &= ~RELATION_FLAG_NO_FLUSH;
|
||||
}
|
||||
/* All entry operations of each component should wait for a proper
|
||||
|
||||
@@ -308,7 +308,7 @@ void depsgraph_tag_component(Depsgraph *graph,
|
||||
void deg_graph_id_tag_legacy_compat(
|
||||
Main *bmain, Depsgraph *depsgraph, ID *id, IDRecalcFlag tag, eUpdateSource update_source)
|
||||
{
|
||||
if (tag == ID_RECALC_GEOMETRY || tag == 0) {
|
||||
if (ELEM(tag, ID_RECALC_GEOMETRY, 0)) {
|
||||
switch (GS(id->name)) {
|
||||
case ID_OB: {
|
||||
Object *object = (Object *)id;
|
||||
|
||||
@@ -145,8 +145,7 @@ inline void flush_handle_component_node(IDNode *id_node,
|
||||
* special component where we don't want all operations to be tagged.
|
||||
*
|
||||
* TODO(sergey): Make this a more generic solution. */
|
||||
if (comp_node->type != NodeType::PARTICLE_SETTINGS &&
|
||||
comp_node->type != NodeType::PARTICLE_SYSTEM) {
|
||||
if (!ELEM(comp_node->type, NodeType::PARTICLE_SETTINGS, NodeType::PARTICLE_SYSTEM)) {
|
||||
for (OperationNode *op : comp_node->operations) {
|
||||
op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void IDNode::destroy()
|
||||
}
|
||||
|
||||
/* Free memory used by this CoW ID. */
|
||||
if (id_cow != id_orig && id_cow != nullptr) {
|
||||
if (!ELEM(id_cow, id_orig, nullptr)) {
|
||||
deg_free_copy_on_write_datablock(id_cow);
|
||||
MEM_freeN(id_cow);
|
||||
id_cow = nullptr;
|
||||
|
||||
@@ -401,7 +401,7 @@ static void eevee_id_world_update(void *vedata, World *wo)
|
||||
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
||||
LightCache *lcache = stl->g_data->light_cache;
|
||||
|
||||
if (lcache == NULL || lcache == stl->lookdev_lightcache) {
|
||||
if (ELEM(lcache, NULL, stl->lookdev_lightcache)) {
|
||||
/* Avoid Lookdev viewport clearing the update flag (see T67741). */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ static float light_shape_power_get(const Light *la, const EEVEE_Light *evli)
|
||||
power *= 4.0f / M_PI;
|
||||
}
|
||||
}
|
||||
else if (la->type == LA_SPOT || la->type == LA_LOCAL) {
|
||||
else if (ELEM(la->type, LA_SPOT, LA_LOCAL)) {
|
||||
power = 1.0f / (4.0f * evli->radius * evli->radius * M_PI * M_PI); /* 1/(4*r²*Pi²) */
|
||||
|
||||
/* for point lights (a.k.a radius == 0.0) */
|
||||
|
||||
@@ -521,8 +521,7 @@ void EEVEE_motion_blur_swap_data(EEVEE_Data *vedata)
|
||||
case EEVEE_MOTION_DATA_MESH:
|
||||
if (mb_geom->batch != NULL) {
|
||||
for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN; i++) {
|
||||
if (mb_geom->batch->verts[i] == mb_geom->vbo[MB_PREV] ||
|
||||
mb_geom->batch->verts[i] == mb_geom->vbo[MB_NEXT]) {
|
||||
if (ELEM(mb_geom->batch->verts[i], mb_geom->vbo[MB_PREV], mb_geom->vbo[MB_NEXT])) {
|
||||
/* Avoid double reference of the VBOs. */
|
||||
mb_geom->batch->verts[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ static float light_power_get(const Light *la)
|
||||
if (la->type == LA_AREA) {
|
||||
return 1.0f / (4.0f * M_PI);
|
||||
}
|
||||
if (la->type == LA_SPOT || la->type == LA_LOCAL) {
|
||||
if (ELEM(la->type, LA_SPOT, LA_LOCAL)) {
|
||||
return 1.0f / (4.0f * M_PI * M_PI);
|
||||
}
|
||||
|
||||
|
||||
@@ -2389,7 +2389,7 @@ GPUBatch *DRW_cache_bone_stick_get(void)
|
||||
/* Bone rectangle */
|
||||
pos[0] = 0.0f;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
pos[1] = (i == 0 || i == 3) ? 0.0f : ((i < 3) ? 1.0f : -1.0f);
|
||||
pos[1] = (ELEM(i, 0, 3)) ? 0.0f : ((i < 3) ? 1.0f : -1.0f);
|
||||
flag = ((i < 2 || i > 4) ? POS_HEAD : POS_TAIL) | ((i == 0 || i == 3) ? 0 : COL_WIRE) |
|
||||
COL_BONE | POS_BONE;
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, v, pos);
|
||||
|
||||
@@ -389,11 +389,11 @@ static GPUIndexBuf *lattice_batch_cache_get_edges(LatticeRenderData *rdata,
|
||||
#define LATT_INDEX(u, v, w) ((((w)*rdata->dims.v_len + (v)) * rdata->dims.u_len) + (u))
|
||||
|
||||
for (int w = 0; w < rdata->dims.w_len; w++) {
|
||||
int wxt = (w == 0 || w == rdata->dims.w_len - 1);
|
||||
int wxt = (ELEM(w, 0, rdata->dims.w_len - 1));
|
||||
for (int v = 0; v < rdata->dims.v_len; v++) {
|
||||
int vxt = (v == 0 || v == rdata->dims.v_len - 1);
|
||||
int vxt = (ELEM(v, 0, rdata->dims.v_len - 1));
|
||||
for (int u = 0; u < rdata->dims.u_len; u++) {
|
||||
int uxt = (u == 0 || u == rdata->dims.u_len - 1);
|
||||
int uxt = (ELEM(u, 0, rdata->dims.u_len - 1));
|
||||
|
||||
if (w && ((uxt || vxt) || !rdata->show_only_outside)) {
|
||||
GPU_indexbuf_add_line_verts(&elb, LATT_INDEX(u, v, w - 1), LATT_INDEX(u, v, w));
|
||||
|
||||
@@ -301,12 +301,12 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
|
||||
}
|
||||
ParticleData *particle = &psys->particles[parent_index];
|
||||
int num = particle->num_dmcache;
|
||||
if (num == DMCACHE_NOTFOUND || num == DMCACHE_ISCHILD) {
|
||||
if (ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) {
|
||||
if (particle->num < psmd->mesh_final->totface) {
|
||||
num = particle->num;
|
||||
}
|
||||
}
|
||||
if (num != DMCACHE_NOTFOUND && num != DMCACHE_ISCHILD) {
|
||||
if (!ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) {
|
||||
MFace *mface = &psmd->mesh_final->mface[num];
|
||||
for (int j = 0; j < num_uv_layers; j++) {
|
||||
psys_interpolate_uvs(mtfaces[j] + num, mface->v4, particle->fuv, r_uv[j]);
|
||||
@@ -330,12 +330,12 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys,
|
||||
}
|
||||
ParticleData *particle = &psys->particles[parent_index];
|
||||
int num = particle->num_dmcache;
|
||||
if (num == DMCACHE_NOTFOUND || num == DMCACHE_ISCHILD) {
|
||||
if (ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) {
|
||||
if (particle->num < psmd->mesh_final->totface) {
|
||||
num = particle->num;
|
||||
}
|
||||
}
|
||||
if (num != DMCACHE_NOTFOUND && num != DMCACHE_ISCHILD) {
|
||||
if (!ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) {
|
||||
MFace *mface = &psmd->mesh_final->mface[num];
|
||||
for (int j = 0; j < num_col_layers; j++) {
|
||||
/* CustomDataLayer CD_MCOL has 4 structs per face. */
|
||||
|
||||
@@ -1806,11 +1806,11 @@ static void select_similar_data_pchan(bContext *C, const size_t bytes_size, cons
|
||||
|
||||
static void is_ancestor(EditBone *bone, EditBone *ancestor)
|
||||
{
|
||||
if (bone->temp.ebone == ancestor || bone->temp.ebone == NULL) {
|
||||
if (ELEM(bone->temp.ebone, ancestor, NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bone->temp.ebone->temp.ebone != NULL && bone->temp.ebone->temp.ebone != ancestor) {
|
||||
if (!ELEM(bone->temp.ebone->temp.ebone, NULL, ancestor)) {
|
||||
is_ancestor(bone->temp.ebone, ancestor);
|
||||
}
|
||||
|
||||
|
||||
@@ -961,7 +961,7 @@ static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *p
|
||||
|
||||
/* initial apply for operator... */
|
||||
/* TODO: need to calculate percentage for initial round too... */
|
||||
if (pso->mode != POSESLIDE_PUSH_REST && pso->mode != POSESLIDE_RELAX_REST) {
|
||||
if (!ELEM(pso->mode, POSESLIDE_PUSH_REST, POSESLIDE_RELAX_REST)) {
|
||||
pose_slide_apply(C, pso);
|
||||
}
|
||||
else {
|
||||
@@ -1200,7 +1200,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
pose_slide_reset(pso);
|
||||
|
||||
/* apply... */
|
||||
if (pso->mode != POSESLIDE_PUSH_REST && pso->mode != POSESLIDE_RELAX_REST) {
|
||||
if (!ELEM(pso->mode, POSESLIDE_PUSH_REST, POSESLIDE_RELAX_REST)) {
|
||||
pose_slide_apply(C, pso);
|
||||
}
|
||||
else {
|
||||
@@ -1223,7 +1223,7 @@ static void pose_slide_cancel(bContext *UNUSED(C), wmOperator *op)
|
||||
static int pose_slide_exec_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
|
||||
{
|
||||
/* settings should have been set up ok for applying, so just apply! */
|
||||
if (pso->mode != POSESLIDE_PUSH_REST && pso->mode != POSESLIDE_RELAX_REST) {
|
||||
if (!ELEM(pso->mode, POSESLIDE_PUSH_REST, POSESLIDE_RELAX_REST)) {
|
||||
pose_slide_apply(C, pso);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -2055,7 +2055,7 @@ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const uint8_t flag)
|
||||
bp++;
|
||||
}
|
||||
|
||||
if (u == 0 || u == nu->pntsv - 1) { /* row in u-direction selected */
|
||||
if (ELEM(u, 0, nu->pntsv - 1)) { /* row in u-direction selected */
|
||||
ok = true;
|
||||
newbp = (BPoint *)MEM_mallocN(nu->pntsu * (nu->pntsv + 1) * sizeof(BPoint),
|
||||
"extrudeNurb1");
|
||||
@@ -2083,7 +2083,7 @@ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const uint8_t flag)
|
||||
nu->pntsv++;
|
||||
BKE_nurb_knot_calc_v(nu);
|
||||
}
|
||||
else if (v == 0 || v == nu->pntsu - 1) { /* column in v-direction selected */
|
||||
else if (ELEM(v, 0, nu->pntsu - 1)) { /* column in v-direction selected */
|
||||
ok = true;
|
||||
bpn = newbp = (BPoint *)MEM_mallocN((nu->pntsu + 1) * nu->pntsv * sizeof(BPoint),
|
||||
"extrudeNurb1");
|
||||
@@ -2309,7 +2309,7 @@ static void adduplicateflagNurb(
|
||||
newv = 0;
|
||||
for (a = 0; a < nu->pntsu; a++) {
|
||||
if (usel[a]) {
|
||||
if (newv == 0 || usel[a] == newv) {
|
||||
if (ELEM(newv, 0, usel[a])) {
|
||||
newv = usel[a];
|
||||
newu++;
|
||||
}
|
||||
@@ -3868,7 +3868,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
|
||||
const bool use_handles = RNA_boolean_get(op->ptr, "use_handles");
|
||||
const int type = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
if (type == CU_CARDINAL || type == CU_BSPLINE) {
|
||||
if (ELEM(type, CU_CARDINAL, CU_BSPLINE)) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Not yet implemented");
|
||||
continue;
|
||||
}
|
||||
@@ -4408,7 +4408,7 @@ static int merge_nurb(View3D *v3d, Object *obedit)
|
||||
|
||||
/* resolution match, to avoid uv rotations */
|
||||
if (nus1->nu->pntsv == 1) {
|
||||
if (nus1->nu->pntsu == nus2->nu->pntsu || nus1->nu->pntsu == nus2->nu->pntsv) {
|
||||
if (ELEM(nus1->nu->pntsu, nus2->nu->pntsu, nus2->nu->pntsv)) {
|
||||
/* pass */
|
||||
}
|
||||
else {
|
||||
@@ -4416,7 +4416,7 @@ static int merge_nurb(View3D *v3d, Object *obedit)
|
||||
}
|
||||
}
|
||||
else if (nus2->nu->pntsv == 1) {
|
||||
if (nus2->nu->pntsu == nus1->nu->pntsu || nus2->nu->pntsu == nus1->nu->pntsv) {
|
||||
if (ELEM(nus2->nu->pntsu, nus1->nu->pntsu, nus1->nu->pntsv)) {
|
||||
/* pass */
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -141,7 +141,7 @@ Nurb *ED_curve_add_nurbs_primitive(
|
||||
BKE_nurbList_flag_set(editnurb, SELECT, false);
|
||||
|
||||
/* these types call this function to return a Nurb */
|
||||
if (stype != CU_PRIM_TUBE && stype != CU_PRIM_DONUT) {
|
||||
if (!ELEM(stype, CU_PRIM_TUBE, CU_PRIM_DONUT)) {
|
||||
nu = (Nurb *)MEM_callocN(sizeof(Nurb), "addNurbprim");
|
||||
nu->type = cutype;
|
||||
nu->resolu = cu->resolu;
|
||||
|
||||
@@ -185,7 +185,7 @@ void ED_curve_nurb_vert_selected_find(
|
||||
a = nu1->pntsu;
|
||||
while (a--) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt1)) {
|
||||
if (*r_nu != NULL && *r_nu != nu1) {
|
||||
if (!ELEM(*r_nu, NULL, nu1)) {
|
||||
*r_nu = NULL;
|
||||
*r_bp = NULL;
|
||||
*r_bezt = NULL;
|
||||
@@ -209,7 +209,7 @@ void ED_curve_nurb_vert_selected_find(
|
||||
a = nu1->pntsu * nu1->pntsv;
|
||||
while (a--) {
|
||||
if (bp1->f1 & SELECT) {
|
||||
if (*r_nu != NULL && *r_nu != nu1) {
|
||||
if (!ELEM(*r_nu, NULL, nu1)) {
|
||||
*r_bp = NULL;
|
||||
*r_bezt = NULL;
|
||||
*r_nu = NULL;
|
||||
|
||||
@@ -1695,7 +1695,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
if (event_val && (ascii || event->utf8_buf[0])) {
|
||||
/* handle case like TAB (== 9) */
|
||||
if ((ascii > 31 && ascii < 254 && ascii != 127) || (ascii == 13) || (ascii == 10) ||
|
||||
if ((ascii > 31 && ascii < 254 && ascii != 127) || (ELEM(ascii, 13, 10)) ||
|
||||
(ascii == 8) || (event->utf8_buf[0])) {
|
||||
|
||||
if (accentcode) {
|
||||
|
||||
@@ -2041,7 +2041,7 @@ static void annotation_draw_apply(wmOperator *op, tGPsdata *p, Depsgraph *depsgr
|
||||
short ok = annotation_stroke_addpoint(p, p->mval, p->pressure, p->curtime);
|
||||
|
||||
/* handle errors while adding point */
|
||||
if ((ok == GP_STROKEADD_FULL) || (ok == GP_STROKEADD_OVERFLOW)) {
|
||||
if (ELEM(ok, GP_STROKEADD_FULL, GP_STROKEADD_OVERFLOW)) {
|
||||
/* finish off old stroke */
|
||||
annotation_paint_strokeend(p);
|
||||
/* And start a new one!!! Else, projection errors! */
|
||||
|
||||
@@ -1557,14 +1557,14 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
/* some stroke is already at front*/
|
||||
if ((direction == GP_STROKE_MOVE_TOP) || (direction == GP_STROKE_MOVE_UP)) {
|
||||
if (ELEM(direction, GP_STROKE_MOVE_TOP, GP_STROKE_MOVE_UP)) {
|
||||
if (gps == gpf->strokes.last) {
|
||||
gpf_lock = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* some stroke is already at botom */
|
||||
if ((direction == GP_STROKE_MOVE_BOTTOM) || (direction == GP_STROKE_MOVE_DOWN)) {
|
||||
if (ELEM(direction, GP_STROKE_MOVE_BOTTOM, GP_STROKE_MOVE_DOWN)) {
|
||||
if (gps == gpf->strokes.first) {
|
||||
gpf_lock = true;
|
||||
continue;
|
||||
@@ -3035,7 +3035,7 @@ static int gpencil_material_isolate_exec(bContext *C, wmOperator *op)
|
||||
for (short i = 0; i < *totcol; i++) {
|
||||
ma = BKE_gpencil_material(ob, i + 1);
|
||||
/* Skip if this is the active one */
|
||||
if ((ma == NULL) || (ma == active_ma)) {
|
||||
if (ELEM(ma, NULL, active_ma)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1042,7 +1042,7 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps)
|
||||
/* review points in the middle of stroke to create new strokes */
|
||||
for (int i = 0; i < gps->totpoints; i++) {
|
||||
/* skip first and last point */
|
||||
if ((i == 0) || (i == gps->totpoints - 1)) {
|
||||
if (ELEM(i, 0, gps->totpoints - 1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3221,13 +3221,13 @@ static int gpencil_stroke_caps_set_exec(bContext *C, wmOperator *op)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) || (type == GP_STROKE_CAPS_TOGGLE_START)) {
|
||||
if (ELEM(type, GP_STROKE_CAPS_TOGGLE_BOTH, GP_STROKE_CAPS_TOGGLE_START)) {
|
||||
++gps->caps[0];
|
||||
if (gps->caps[0] >= GP_STROKE_CAP_MAX) {
|
||||
gps->caps[0] = GP_STROKE_CAP_ROUND;
|
||||
}
|
||||
}
|
||||
if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) || (type == GP_STROKE_CAPS_TOGGLE_END)) {
|
||||
if (ELEM(type, GP_STROKE_CAPS_TOGGLE_BOTH, GP_STROKE_CAPS_TOGGLE_END)) {
|
||||
++gps->caps[1];
|
||||
if (gps->caps[1] >= GP_STROKE_CAP_MAX) {
|
||||
gps->caps[1] = GP_STROKE_CAP_ROUND;
|
||||
@@ -4389,7 +4389,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op)
|
||||
ob_dst->data = (bGPdata *)gpd_dst;
|
||||
|
||||
/* Loop old data-block and separate parts. */
|
||||
if ((mode == GP_SEPARATE_POINT) || (mode == GP_SEPARATE_STROKE)) {
|
||||
if (ELEM(mode, GP_SEPARATE_POINT, GP_SEPARATE_STROKE)) {
|
||||
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
|
||||
gpl_dst = NULL;
|
||||
bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
|
||||
|
||||
@@ -359,14 +359,12 @@ static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4])
|
||||
tgpw.custonion = true;
|
||||
|
||||
/* normal strokes */
|
||||
if ((tgpf->fill_draw_mode == GP_FILL_DMODE_STROKE) ||
|
||||
(tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) {
|
||||
if (ELEM(tgpf->fill_draw_mode, GP_FILL_DMODE_STROKE, GP_FILL_DMODE_BOTH)) {
|
||||
ED_gpencil_draw_fill(&tgpw);
|
||||
}
|
||||
|
||||
/* 3D Lines with basic shapes and invisible lines */
|
||||
if ((tgpf->fill_draw_mode == GP_FILL_DMODE_CONTROL) ||
|
||||
(tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) {
|
||||
if (ELEM(tgpf->fill_draw_mode, GP_FILL_DMODE_CONTROL, GP_FILL_DMODE_BOTH)) {
|
||||
gpencil_draw_basic_stroke(tgpf,
|
||||
gps,
|
||||
tgpw.diff_mat,
|
||||
|
||||
@@ -314,7 +314,7 @@ static int gpencil_insert_to_array(tGPencilPointCache *src_array,
|
||||
}
|
||||
src_elem = &src_array[idx];
|
||||
/* check if all points or only a stroke */
|
||||
if ((gps_filter != NULL) && (gps_filter != src_elem->gps)) {
|
||||
if (!ELEM(gps_filter, NULL, src_elem->gps)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1152,7 +1152,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
|
||||
/* invalidate any other point, to interpolate between
|
||||
* first and last contact in an imaginary line between them */
|
||||
for (i = 0; i < gpd->runtime.sbuffer_used; i++) {
|
||||
if ((i != first_valid) && (i != last_valid)) {
|
||||
if (!ELEM(i, first_valid, last_valid)) {
|
||||
depth_arr[i] = FLT_MAX;
|
||||
}
|
||||
}
|
||||
@@ -2719,7 +2719,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
|
||||
short ok = gpencil_stroke_addpoint(p, p->mval, p->pressure, p->curtime);
|
||||
|
||||
/* handle errors while adding point */
|
||||
if ((ok == GP_STROKEADD_FULL) || (ok == GP_STROKEADD_OVERFLOW)) {
|
||||
if (ELEM(ok, GP_STROKEADD_FULL, GP_STROKEADD_OVERFLOW)) {
|
||||
/* finish off old stroke */
|
||||
gpencil_paint_strokeend(p);
|
||||
/* And start a new one!!! Else, projection errors! */
|
||||
|
||||
@@ -849,7 +849,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
||||
/* invalidate any other point, to interpolate between
|
||||
* first and last contact in an imaginary line between them */
|
||||
for (i = 0; i < gps->totpoints; i++) {
|
||||
if ((i != first_valid) && (i != last_valid)) {
|
||||
if (!ELEM(i, first_valid, last_valid)) {
|
||||
depth_arr[i] = FLT_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ bool ED_gpencil_stroke_can_use_direct(const ScrArea *area, const bGPDstroke *gps
|
||||
/* filter stroke types by flags + spacetype */
|
||||
if (gps->flag & GP_STROKE_3DSPACE) {
|
||||
/* 3D strokes - only in 3D view */
|
||||
return ((area->spacetype == SPACE_VIEW3D) || (area->spacetype == SPACE_PROPERTIES));
|
||||
return (ELEM(area->spacetype, SPACE_VIEW3D, SPACE_PROPERTIES));
|
||||
}
|
||||
if (gps->flag & GP_STROKE_2DIMAGE) {
|
||||
/* Special "image" strokes - only in Image Editor */
|
||||
@@ -1429,7 +1429,7 @@ void ED_gpencil_reset_layers_parent(Depsgraph *depsgraph, Object *obact, bGPdata
|
||||
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
|
||||
if (gpl->parent != NULL) {
|
||||
/* calculate new matrix */
|
||||
if ((gpl->partype == PAROBJECT) || (gpl->partype == PARSKEL)) {
|
||||
if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) {
|
||||
invert_m4_m4(cur_mat, gpl->parent->obmat);
|
||||
copy_v3_v3(gpl_loc, obact->obmat[3]);
|
||||
}
|
||||
@@ -2289,7 +2289,7 @@ static void gpencil_insert_point(
|
||||
gpencil_copy_points(gps, pt, pt_final, i, i2);
|
||||
|
||||
/* create new point duplicating point and copy location */
|
||||
if ((i == a_idx) || (i == b_idx)) {
|
||||
if (ELEM(i, a_idx, b_idx)) {
|
||||
i2++;
|
||||
pt_final = &gps->points[i2];
|
||||
gpencil_copy_points(gps, pt, pt_final, i, i2);
|
||||
|
||||
@@ -502,13 +502,13 @@ static int gpencil_reset_transform_fill_exec(bContext *C, wmOperator *op)
|
||||
/* Loop all selected strokes and reset. */
|
||||
GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
|
||||
if (gps->flag & GP_STROKE_SELECT) {
|
||||
if ((mode == GP_UV_TRANSLATE) || (mode == GP_UV_ALL)) {
|
||||
if (ELEM(mode, GP_UV_TRANSLATE, GP_UV_ALL)) {
|
||||
zero_v2(gps->uv_translation);
|
||||
}
|
||||
if ((mode == GP_UV_ROTATE) || (mode == GP_UV_ALL)) {
|
||||
if (ELEM(mode, GP_UV_ROTATE, GP_UV_ALL)) {
|
||||
gps->uv_rotation = 0.0f;
|
||||
}
|
||||
if ((mode == GP_UV_SCALE) || (mode == GP_UV_ALL)) {
|
||||
if (ELEM(mode, GP_UV_SCALE, GP_UV_ALL)) {
|
||||
gps->uv_scale = 1.0f;
|
||||
}
|
||||
/* Calc geometry data. */
|
||||
|
||||
@@ -702,10 +702,10 @@ static bool ui_but_equals_old(const uiBut *but, const uiBut *oldbut)
|
||||
if (but->funcN != oldbut->funcN) {
|
||||
return false;
|
||||
}
|
||||
if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) {
|
||||
if (!ELEM(oldbut->func_arg1, oldbut, but->func_arg1)) {
|
||||
return false;
|
||||
}
|
||||
if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) {
|
||||
if (!ELEM(oldbut->func_arg2, oldbut, but->func_arg2)) {
|
||||
return false;
|
||||
}
|
||||
if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) ||
|
||||
|
||||
@@ -973,15 +973,15 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
|
||||
1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_a, res, is_line, pos);
|
||||
}
|
||||
else {
|
||||
if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_R) {
|
||||
if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_R)) {
|
||||
histogram_draw_one(
|
||||
1.0, 0.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_r, res, is_line, pos);
|
||||
}
|
||||
if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_G) {
|
||||
if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_G)) {
|
||||
histogram_draw_one(
|
||||
0.0, 1.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_g, res, is_line, pos);
|
||||
}
|
||||
if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B) {
|
||||
if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_B)) {
|
||||
histogram_draw_one(
|
||||
0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res, is_line, pos);
|
||||
}
|
||||
|
||||
@@ -1024,7 +1024,7 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
|
||||
}
|
||||
|
||||
ui_but_value_set(but, (double)value_toggle);
|
||||
if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == UI_BTYPE_ICON_TOGGLE_N) {
|
||||
if (ELEM(but->type, UI_BTYPE_ICON_TOGGLE, UI_BTYPE_ICON_TOGGLE_N)) {
|
||||
ui_but_update_edited(but);
|
||||
}
|
||||
|
||||
@@ -3564,7 +3564,7 @@ static void ui_do_but_textedit(
|
||||
|
||||
/* for double click: we do a press again for when you first click on button
|
||||
* (selects all text, no cursor pos) */
|
||||
if (event->val == KM_PRESS || event->val == KM_DBL_CLICK) {
|
||||
if (ELEM(event->val, KM_PRESS, KM_DBL_CLICK)) {
|
||||
float mx = event->x;
|
||||
float my = event->y;
|
||||
ui_window_to_block_fl(data->region, block, &mx, &my);
|
||||
@@ -4740,7 +4740,7 @@ static float ui_numedit_apply_snap(int temp,
|
||||
float softmax,
|
||||
const enum eSnapType snap)
|
||||
{
|
||||
if (temp == softmin || temp == softmax) {
|
||||
if (ELEM(temp, softmin, softmax)) {
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -5052,7 +5052,7 @@ static int ui_do_but_NUM(
|
||||
}
|
||||
}
|
||||
else if (data->state == BUTTON_STATE_NUM_EDITING) {
|
||||
if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
|
||||
if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
|
||||
if (event->val == KM_PRESS) {
|
||||
data->cancel = true;
|
||||
data->escapecancel = true;
|
||||
@@ -5244,13 +5244,13 @@ static bool ui_numedit_but_SLI(uiBut *but,
|
||||
temp = round_fl_to_int(tempf);
|
||||
|
||||
if (snap) {
|
||||
if (tempf == softmin || tempf == softmax) {
|
||||
if (ELEM(tempf, softmin, softmax)) {
|
||||
/* pass */
|
||||
}
|
||||
else if (ui_but_is_float(but)) {
|
||||
|
||||
if (shift) {
|
||||
if (tempf == softmin || tempf == softmax) {
|
||||
if (ELEM(tempf, softmin, softmax)) {
|
||||
}
|
||||
else if (softrange < 2.10f) {
|
||||
tempf = roundf(tempf * 100.0f) * 0.01f;
|
||||
@@ -5374,7 +5374,7 @@ static int ui_do_but_SLI(
|
||||
#endif
|
||||
}
|
||||
else if (data->state == BUTTON_STATE_NUM_EDITING) {
|
||||
if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
|
||||
if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
|
||||
if (event->val == KM_PRESS) {
|
||||
data->cancel = true;
|
||||
data->escapecancel = true;
|
||||
@@ -5997,7 +5997,7 @@ static int ui_do_but_UNITVEC(
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
|
||||
else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
|
||||
if (event->val == KM_PRESS) {
|
||||
data->cancel = true;
|
||||
data->escapecancel = true;
|
||||
@@ -6328,7 +6328,7 @@ static int ui_do_but_HSVCUBE(
|
||||
}
|
||||
}
|
||||
else if (data->state == BUTTON_STATE_NUM_EDITING) {
|
||||
if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
|
||||
if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
|
||||
if (event->val == KM_PRESS) {
|
||||
data->cancel = true;
|
||||
data->escapecancel = true;
|
||||
@@ -6602,7 +6602,7 @@ static int ui_do_but_HSVCIRCLE(
|
||||
}
|
||||
}
|
||||
else if (data->state == BUTTON_STATE_NUM_EDITING) {
|
||||
if (event->type == EVT_ESCKEY || event->type == RIGHTMOUSE) {
|
||||
if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
|
||||
if (event->val == KM_PRESS) {
|
||||
data->cancel = true;
|
||||
data->escapecancel = true;
|
||||
|
||||
@@ -1002,7 +1002,7 @@ static uiBut *ui_item_with_label(uiLayout *layout,
|
||||
const PropertySubType subtype = RNA_property_subtype(prop);
|
||||
|
||||
uiBut *but;
|
||||
if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
|
||||
if (ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH)) {
|
||||
UI_block_layout_set_current(block, uiLayoutRow(sub, true));
|
||||
but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, prop_but_width - UI_UNIT_X, h);
|
||||
|
||||
@@ -1886,7 +1886,7 @@ static void ui_item_rna_size(uiLayout *layout,
|
||||
else if (type == PROP_ENUM && !icon_only) {
|
||||
w += UI_UNIT_X / 4;
|
||||
}
|
||||
else if (type == PROP_FLOAT || type == PROP_INT) {
|
||||
else if (ELEM(type, PROP_FLOAT, PROP_INT)) {
|
||||
w += UI_UNIT_X * 3;
|
||||
}
|
||||
}
|
||||
@@ -5480,7 +5480,7 @@ uiLayout *UI_block_layout(uiBlock *block,
|
||||
layout->context = NULL;
|
||||
layout->emboss = UI_EMBOSS_UNDEFINED;
|
||||
|
||||
if (type == UI_LAYOUT_MENU || type == UI_LAYOUT_PIEMENU) {
|
||||
if (ELEM(type, UI_LAYOUT_MENU, UI_LAYOUT_PIEMENU)) {
|
||||
layout->space = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -4969,7 +4969,7 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAUp
|
||||
selection_y = &point->h2_loc[1];
|
||||
}
|
||||
}
|
||||
if (i == 0 || i == profile->path_len - 1) {
|
||||
if (ELEM(i, 0, profile->path_len - 1)) {
|
||||
point_last_or_first = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -917,7 +917,7 @@ static void shape_preset_init_trias_ex(uiWidgetTrias *tria,
|
||||
float centx, centy, sizex, sizey, minsize;
|
||||
int a, i1 = 0, i2 = 1;
|
||||
|
||||
if (where == 'r' || where == 'l') {
|
||||
if (ELEM(where, 'r', 'l')) {
|
||||
minsize = BLI_rcti_size_y(rect);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -293,7 +293,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
if (event->type == vpd->invoke_event || event->type == EVT_ESCKEY) {
|
||||
if (ELEM(event->type, vpd->invoke_event, EVT_ESCKEY)) {
|
||||
if (event->val == KM_RELEASE) {
|
||||
/* calculate overall delta mouse-movement for redo */
|
||||
RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
|
||||
@@ -1241,7 +1241,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
|
||||
vzd->zoom_to_mouse_pos = true;
|
||||
}
|
||||
|
||||
if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
|
||||
if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
|
||||
float dx, dy, fac;
|
||||
|
||||
vzd->lastx = event->prevx;
|
||||
@@ -1413,7 +1413,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
|
||||
/* apply zooming */
|
||||
view_zoomdrag_apply(C, op);
|
||||
}
|
||||
else if (event->type == vzd->invoke_event || event->type == EVT_ESCKEY) {
|
||||
else if (ELEM(event->type, vzd->invoke_event, EVT_ESCKEY)) {
|
||||
if (event->val == KM_RELEASE) {
|
||||
|
||||
/* for redo, store the overall deltas - need to respect zoom-locks here... */
|
||||
|
||||
@@ -202,7 +202,7 @@ static void finSelectedSplinePoint(MaskLayer *mask_layer,
|
||||
MaskSplinePoint *cur_point = &cur_spline->points[i];
|
||||
|
||||
if (MASKPOINT_ISSEL_ANY(cur_point)) {
|
||||
if (*spline != NULL && *spline != cur_spline) {
|
||||
if (!ELEM(*spline, NULL, cur_spline)) {
|
||||
*spline = NULL;
|
||||
*point = NULL;
|
||||
return;
|
||||
|
||||
@@ -111,7 +111,7 @@ static void draw_single_handle(const MaskLayer *mask_layer,
|
||||
const BezTriple *bezt = &point->bezt;
|
||||
char handle_type;
|
||||
|
||||
if (which_handle == MASK_WHICH_HANDLE_STICK || which_handle == MASK_WHICH_HANDLE_LEFT) {
|
||||
if (ELEM(which_handle, MASK_WHICH_HANDLE_STICK, MASK_WHICH_HANDLE_LEFT)) {
|
||||
handle_type = bezt->h1;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -110,7 +110,7 @@ static void edgering_find_order(BMEdge *eed_last, BMEdge *eed, BMVert *eve_last,
|
||||
|
||||
BMLoop *l_other = BM_loop_other_edge_loop(l, eed->v1);
|
||||
const bool rev = (l_other == l->prev);
|
||||
while (l_other->v != eed_last->v1 && l_other->v != eed_last->v2) {
|
||||
while (!ELEM(l_other->v, eed_last->v1, eed_last->v2)) {
|
||||
l_other = rev ? l_other->prev : l_other->next;
|
||||
}
|
||||
|
||||
|
||||
@@ -875,7 +875,7 @@ static void edbm_add_edge_face_exec__tricky_finalize_sel(BMesh *bm, BMElem *ele_
|
||||
}
|
||||
else {
|
||||
BMLoop *l = BM_face_edge_share_loop(f, (BMEdge *)ele_desel);
|
||||
BLI_assert(f->len == 4 || f->len == 3);
|
||||
BLI_assert(ELEM(f->len, 4, 3));
|
||||
|
||||
BM_edge_select_set(bm, (BMEdge *)ele_desel, false);
|
||||
if (f->len == 4) {
|
||||
@@ -4082,7 +4082,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
|
||||
isect = bm_edge_seg_isect(sco_a, sco_b, mouse_path, len, mode, &isected);
|
||||
|
||||
if (isect != 0.0f) {
|
||||
if (mode != KNIFE_MULTICUT && mode != KNIFE_MIDPOINT) {
|
||||
if (!ELEM(mode, KNIFE_MULTICUT, KNIFE_MIDPOINT)) {
|
||||
BMO_slot_map_float_insert(&bmop, slot_edge_percents, be, isect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
|
||||
me = (Mesh *)ob->data;
|
||||
key = me->key;
|
||||
|
||||
if (totvert == 0 || totvert == me->totvert) {
|
||||
if (ELEM(totvert, 0, me->totvert)) {
|
||||
BKE_report(op->reports, RPT_WARNING, "No mesh data to join");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@@ -2930,7 +2930,7 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
||||
/* Remove curves and meshes converted to Grease Pencil object. */
|
||||
if (gpencilConverted) {
|
||||
FOREACH_SCENE_OBJECT_BEGIN (scene, ob_delete) {
|
||||
if ((ob_delete->type == OB_CURVE) || (ob_delete->type == OB_MESH)) {
|
||||
if (ELEM(ob_delete->type, OB_CURVE, OB_MESH)) {
|
||||
if (ob_delete->flag & OB_DONE) {
|
||||
ED_object_base_free_and_unlink(bmain, scene, ob_delete);
|
||||
}
|
||||
|
||||
@@ -2219,7 +2219,7 @@ static const EnumPropertyItem *object_constraint_add_itemf(bContext *UNUSED(C),
|
||||
int totitem = 0;
|
||||
|
||||
while (item->identifier) {
|
||||
if ((item->value != CONSTRAINT_TYPE_KINEMATIC) && (item->value != CONSTRAINT_TYPE_SPLINEIK)) {
|
||||
if (!ELEM(item->value, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK)) {
|
||||
RNA_enum_item_add(&object_constraint_items, &totitem, item);
|
||||
}
|
||||
item++;
|
||||
|
||||
@@ -761,7 +761,7 @@ bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag
|
||||
|
||||
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_EDITMODE_LATTICE, scene);
|
||||
}
|
||||
else if (ob->type == OB_SURF || ob->type == OB_CURVE) {
|
||||
else if (ELEM(ob->type, OB_SURF, OB_CURVE)) {
|
||||
ok = 1;
|
||||
ED_curve_editnurb_make(ob);
|
||||
|
||||
|
||||
@@ -911,7 +911,7 @@ bool ED_object_parent_set(ReportList *reports,
|
||||
else if (partype == PAR_ARMATURE_NAME) {
|
||||
ED_gpencil_add_armature_weights(C, reports, ob, par, GP_PAR_ARMATURE_NAME);
|
||||
}
|
||||
else if ((partype == PAR_ARMATURE_AUTO) || (partype == PAR_ARMATURE_ENVELOPE)) {
|
||||
else if (ELEM(partype, PAR_ARMATURE_AUTO, PAR_ARMATURE_ENVELOPE)) {
|
||||
WM_cursor_wait(1);
|
||||
ED_gpencil_add_armature_weights(C, reports, ob, par, GP_PAR_ARMATURE_AUTO);
|
||||
WM_cursor_wait(0);
|
||||
|
||||
@@ -565,7 +565,7 @@ static void append_sorted_object_parent_hierarchy(Object *root_object,
|
||||
Object **sorted_objects,
|
||||
int *object_index)
|
||||
{
|
||||
if (object->parent != NULL && object->parent != root_object) {
|
||||
if (!ELEM(object->parent, NULL, root_object)) {
|
||||
append_sorted_object_parent_hierarchy(
|
||||
root_object, object->parent, sorted_objects, object_index);
|
||||
}
|
||||
@@ -1374,7 +1374,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
||||
if (centermode == ORIGIN_TO_CURSOR) {
|
||||
copy_v3_v3(gpcenter, cursor);
|
||||
}
|
||||
if ((centermode == ORIGIN_TO_GEOMETRY) || (centermode == ORIGIN_TO_CURSOR)) {
|
||||
if (ELEM(centermode, ORIGIN_TO_GEOMETRY, ORIGIN_TO_CURSOR)) {
|
||||
bGPDspoint *pt;
|
||||
float imat[3][3], bmat[3][3];
|
||||
float offset_global[3];
|
||||
|
||||
@@ -1385,7 +1385,7 @@ static void region_rect_recursive(
|
||||
region->winrct = *remainder;
|
||||
BLI_rcti_init(remainder, 0, 0, 0, 0);
|
||||
}
|
||||
else if (alignment == RGN_ALIGN_TOP || alignment == RGN_ALIGN_BOTTOM) {
|
||||
else if (ELEM(alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
|
||||
rcti *winrct = (region->overlap) ? overlap_remainder : remainder;
|
||||
|
||||
if ((prefsizey == 0) || (rct_fits(winrct, 'v', prefsizey) < 0)) {
|
||||
@@ -1437,7 +1437,7 @@ static void region_rect_recursive(
|
||||
BLI_rcti_sanitize(winrct);
|
||||
}
|
||||
}
|
||||
else if (alignment == RGN_ALIGN_VSPLIT || alignment == RGN_ALIGN_HSPLIT) {
|
||||
else if (ELEM(alignment, RGN_ALIGN_VSPLIT, RGN_ALIGN_HSPLIT)) {
|
||||
/* percentage subdiv*/
|
||||
region->winrct = *remainder;
|
||||
|
||||
@@ -3582,7 +3582,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);
|
||||
|
||||
@@ -203,7 +203,7 @@ static void draw_vertical_join_shape(ScrArea *area, char dir, uint pos)
|
||||
*/
|
||||
static void draw_join_shape(ScrArea *area, char dir, uint pos)
|
||||
{
|
||||
if (dir == 'u' || dir == 'd') {
|
||||
if (ELEM(dir, 'u', 'd')) {
|
||||
draw_vertical_join_shape(area, dir, pos);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -362,7 +362,7 @@ static void screen_areas_align(
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
if (dir == 0 || dir == 2) {
|
||||
if (ELEM(dir, 0, 2)) {
|
||||
/* horizontal join, use average for new top and bottom. */
|
||||
int top = (sa1->v2->vec.y + sa2->v2->vec.y) / 2;
|
||||
int bottom = (sa1->v4->vec.y + sa2->v4->vec.y) / 2;
|
||||
@@ -687,7 +687,7 @@ static void screen_cursor_set(wmWindow *win, const int xy[2])
|
||||
WM_cursor_set(win, WM_CURSOR_EDIT);
|
||||
}
|
||||
else if (az->type == AZONE_REGION) {
|
||||
if (az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT) {
|
||||
if (ELEM(az->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
|
||||
WM_cursor_set(win, WM_CURSOR_X_MOVE);
|
||||
}
|
||||
else {
|
||||
@@ -772,7 +772,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
|
||||
}
|
||||
}
|
||||
|
||||
if (region == region_prev || region == screen->active_region) {
|
||||
if (ELEM(region, region_prev, screen->active_region)) {
|
||||
do_draw = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ static bool screen_geom_vertices_scale_pass(const wmWindow *win,
|
||||
/* all selected vertices get the right offset */
|
||||
LISTBASE_FOREACH (ScrVert *, sv, &screen->vertbase) {
|
||||
/* if is a collapsed area */
|
||||
if (sv != area->v1 && sv != area->v4) {
|
||||
if (!ELEM(sv, area->v1, area->v4)) {
|
||||
if (sv->flag) {
|
||||
sv->vec.y = yval;
|
||||
/* Changed size of a area. Run another pass to ensure everything still fits. */
|
||||
@@ -228,7 +228,7 @@ static bool screen_geom_vertices_scale_pass(const wmWindow *win,
|
||||
/* all selected vertices get the right offset */
|
||||
LISTBASE_FOREACH (ScrVert *, sv, &screen->vertbase) {
|
||||
/* if is not a collapsed area */
|
||||
if (sv != area->v2 && sv != area->v3) {
|
||||
if (!ELEM(sv, area->v2, area->v3)) {
|
||||
if (sv->flag) {
|
||||
sv->vec.y = yval;
|
||||
/* Changed size of a area. Run another pass to ensure everything still fits. */
|
||||
|
||||
@@ -1617,7 +1617,7 @@ static int area_snap_calc_location(const bScreen *screen,
|
||||
switch (snap_type) {
|
||||
case SNAP_AREAGRID:
|
||||
m_cursor_final = m_cursor;
|
||||
if (delta != bigger && delta != -smaller) {
|
||||
if (!ELEM(delta, bigger, -smaller)) {
|
||||
m_cursor_final -= (m_cursor % AREAGRID);
|
||||
CLAMP(m_cursor_final, origval - smaller, origval + bigger);
|
||||
}
|
||||
@@ -2477,7 +2477,7 @@ static int area_max_regionsize(ScrArea *area, ARegion *scalear, AZEdge edge)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) {
|
||||
if (ELEM(edge, AE_RIGHT_TO_TOPLEFT, AE_LEFT_TO_TOPRIGHT)) {
|
||||
dist = BLI_rcti_size_x(&area->totrct);
|
||||
}
|
||||
else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
|
||||
@@ -2574,7 +2574,7 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event
|
||||
}
|
||||
|
||||
/* now copy to regionmovedata */
|
||||
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
|
||||
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
|
||||
rmd->origval = rmd->region->sizex;
|
||||
}
|
||||
else {
|
||||
@@ -2598,7 +2598,7 @@ static void region_scale_validate_size(RegionMoveData *rmd)
|
||||
if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) {
|
||||
short *size, maxsize = -1;
|
||||
|
||||
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
|
||||
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
|
||||
size = &rmd->region->sizex;
|
||||
}
|
||||
else {
|
||||
@@ -2648,7 +2648,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
const float aspect = BLI_rctf_size_x(&rmd->region->v2d.cur) /
|
||||
(BLI_rcti_size_x(&rmd->region->v2d.mask) + 1);
|
||||
const int snap_size_threshold = (U.widget_unit * 2) / aspect;
|
||||
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
|
||||
if (ELEM(rmd->edge, AE_LEFT_TO_TOPRIGHT, AE_RIGHT_TO_TOPLEFT)) {
|
||||
delta = event->x - rmd->origx;
|
||||
if (rmd->edge == AE_LEFT_TO_TOPRIGHT) {
|
||||
delta = -delta;
|
||||
|
||||
@@ -349,8 +349,7 @@ typedef struct PaintOperation {
|
||||
bool paint_use_opacity_masking(Brush *brush)
|
||||
{
|
||||
return ((brush->flag & BRUSH_AIRBRUSH) || (brush->flag & BRUSH_DRAG_DOT) ||
|
||||
(brush->flag & BRUSH_ANCHORED) || (brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
|
||||
(brush->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
|
||||
(brush->flag & BRUSH_ANCHORED) || (ELEM(brush->imagepaint_tool, PAINT_TOOL_SMEAR, PAINT_TOOL_SOFTEN)) ||
|
||||
(brush->imagepaint_tool == PAINT_TOOL_FILL) ||
|
||||
(brush->flag & BRUSH_USE_GRADIENT) ||
|
||||
(brush->mtex.tex && !ELEM(brush->mtex.brush_map_mode,
|
||||
|
||||
@@ -1789,7 +1789,7 @@ static float project_paint_uvpixel_mask(const ProjPaintState *ps,
|
||||
|
||||
static int project_paint_pixel_sizeof(const short tool)
|
||||
{
|
||||
if ((tool == PAINT_TOOL_CLONE) || (tool == PAINT_TOOL_SMEAR)) {
|
||||
if (ELEM(tool, PAINT_TOOL_CLONE, PAINT_TOOL_SMEAR)) {
|
||||
return sizeof(ProjPixelClone);
|
||||
}
|
||||
return sizeof(ProjPixel);
|
||||
|
||||
@@ -964,7 +964,7 @@ static void do_weight_paint_vertex_multi(
|
||||
if (me->editflag & ME_EDIT_VERTEX_GROUPS_X_SYMMETRY) {
|
||||
index_mirr = mesh_get_x_mirror_vert(ob, NULL, index, topology);
|
||||
|
||||
if (index_mirr != -1 && index_mirr != index) {
|
||||
if (!ELEM(index_mirr, -1, index)) {
|
||||
dv_mirr = &me->dvert[index_mirr];
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -675,7 +675,7 @@ void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieCl
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cur_sc->clip == old_clip || cur_sc->clip == NULL) {
|
||||
if (ELEM(cur_sc->clip, old_clip, NULL)) {
|
||||
cur_sc->clip = clip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ static int view_zoom_exec(bContext *C, wmOperator *op)
|
||||
|
||||
static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
|
||||
if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
|
||||
float delta, factor;
|
||||
|
||||
delta = event->prevx - event->x + event->prevy - event->y;
|
||||
|
||||
@@ -519,7 +519,7 @@ enum {
|
||||
|
||||
static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
|
||||
if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
|
||||
SpaceImage *sima = CTX_wm_space_image(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
float delta, factor, location[2];
|
||||
|
||||
@@ -108,7 +108,7 @@ static void compo_tag_output_nodes(bNodeTree *nodetree, int recalc_flags)
|
||||
node->flag |= NODE_DO_OUTPUT_RECALC;
|
||||
}
|
||||
}
|
||||
else if (node->type == CMP_NODE_VIEWER || node->type == CMP_NODE_SPLITVIEWER) {
|
||||
else if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
|
||||
if (recalc_flags & COM_RECALC_VIEWER) {
|
||||
node->flag |= NODE_DO_OUTPUT_RECALC;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user